1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: command.c |
2 | * File: command.c |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * $Id: command.C,v 1.15 2003/12/16 23:04:13 pcg Exp $ |
4 | * $Id: command.C,v 1.17 2003/12/18 00:29:29 pcg Exp $ |
5 | * |
5 | * |
6 | * All portions of code are copyright by their respective author/s. |
6 | * All portions of code are copyright by their respective author/s. |
7 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
7 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
8 | * - original version |
8 | * - original version |
9 | * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> |
9 | * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> |
… | |
… | |
88 | if (R->Input_Context) |
88 | if (R->Input_Context) |
89 | { |
89 | { |
90 | Status status_return; |
90 | Status status_return; |
91 | |
91 | |
92 | #ifdef X_HAVE_UTF8_STRING |
92 | #ifdef X_HAVE_UTF8_STRING |
93 | len = Xutf8LookupString(R->Input_Context, ev, (char *)kbuf, |
93 | len = Xutf8LookupString (R->Input_Context, ev, (char *)kbuf, |
94 | KBUFSZ, &keysym, &status_return); |
94 | KBUFSZ, &keysym, &status_return); |
95 | #else |
95 | #else |
|
|
96 | wchar_t wkbuf[KBUFSZ + 1]; |
|
|
97 | |
|
|
98 | // assume wchar_t == unicode or better |
96 | len = XmbLookupString(R->Input_Context, ev, (char *)kbuf, |
99 | len = XwcLookupString (R->Input_Context, ev, wkbuf, |
97 | KBUFSZ, &keysym, &status_return); |
100 | KBUFSZ, &keysym, &status_return); |
|
|
101 | |
|
|
102 | if (status_return == XLookupChars |
|
|
103 | || status_return == XLookupBoth) |
|
|
104 | { |
|
|
105 | wkbuf[len] = 0; |
|
|
106 | len = wcstombs ((char *)kbuf, wkbuf, KBUFSZ); |
|
|
107 | } |
|
|
108 | else |
|
|
109 | len = 0; |
98 | #endif |
110 | #endif |
99 | valid_keysym = ((status_return == XLookupKeySym) |
111 | valid_keysym = status_return == XLookupKeySym |
100 | || (status_return == XLookupBoth)); |
112 | || status_return == XLookupBoth; |
101 | } |
113 | } |
102 | else |
114 | else |
103 | #endif |
115 | #endif |
104 | { |
116 | { |
105 | len = XLookupString(ev, (char *)kbuf, KBUFSZ, &keysym, &R->compose); |
117 | len = XLookupString (ev, (char *)kbuf, KBUFSZ, &keysym, &R->compose); |
106 | valid_keysym = !len; |
118 | valid_keysym = !len; |
107 | } |
119 | } |
108 | |
120 | |
109 | if (valid_keysym) |
121 | if (valid_keysym) |
110 | { |
122 | { |
… | |
… | |
2582 | |
2594 | |
2583 | case CSI_SD: /* 8.3.114: (1) SCROLL DOWN */ |
2595 | case CSI_SD: /* 8.3.114: (1) SCROLL DOWN */ |
2584 | arg[0] = -arg[0]; |
2596 | arg[0] = -arg[0]; |
2585 | /* FALLTHROUGH */ |
2597 | /* FALLTHROUGH */ |
2586 | case CSI_SU: /* 8.3.148: (1) SCROLL UP */ |
2598 | case CSI_SU: /* 8.3.148: (1) SCROLL UP */ |
2587 | rxvt_scroll_text(aR_ R->screen.tscroll, R->screen.bscroll, arg[0], 0); |
2599 | R->scr_scroll_text (R->screen.tscroll, R->screen.bscroll, arg[0], 0); |
2588 | break; |
2600 | break; |
2589 | |
2601 | |
2590 | case CSI_DA: /* 8.3.24: (0) DEVICE ATTRIBUTES */ |
2602 | case CSI_DA: /* 8.3.24: (0) DEVICE ATTRIBUTES */ |
2591 | R->tt_write((const unsigned char *)VT100_ANS, |
2603 | R->tt_write((const unsigned char *)VT100_ANS, |
2592 | (unsigned int)(sizeof(VT100_ANS) - 1)); |
2604 | (unsigned int)(sizeof(VT100_ANS) - 1)); |