ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.48 by pcg, Sat Feb 21 21:15:03 2004 UTC vs.
Revision 1.49 by pcg, Sat Feb 21 22:14:00 2004 UTC

25 * - extensive modifications 25 * - extensive modifications
26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> 26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org>
27 * Copyright (c) 2001 Marius Gedminas 27 * Copyright (c) 2001 Marius Gedminas
28 * - Ctrl/Mod4+Tab works like Meta+Tab (options) 28 * - Ctrl/Mod4+Tab works like Meta+Tab (options)
29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> 29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org>
30 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com>
30 * 31 *
31 * This program is free software; you can redistribute it and/or modify 32 * This program is free software; you can redistribute it and/or modify
32 * it under the terms of the GNU General Public License as published by 33 * it under the terms of the GNU General Public License as published by
33 * the Free Software Foundation; either version 2 of the License, or 34 * the Free Software Foundation; either version 2 of the License, or
34 * (at your option) any later version. 35 * (at your option) any later version.
55 56
56/*{{{ Convert the keypress event into a string */ 57/*{{{ Convert the keypress event into a string */
57void 58void
58rxvt_term::lookup_key (XKeyEvent &ev) 59rxvt_term::lookup_key (XKeyEvent &ev)
59{ 60{
60 int ctrl, meta, shft, len; 61 int ctrl, meta, shft, len;
61 unsigned int newlen; 62 unsigned int newlen;
62 KeySym keysym; 63 KeySym keysym;
63#ifdef DEBUG_CMD 64#ifdef DEBUG_CMD
64 static int debug_key = 1; /* accessible by a debugger only */ 65 static int debug_key = 1; /* accessible by a debugger only */
65#endif 66#endif
66 int valid_keysym; 67 int valid_keysym;
67 unsigned char kbuf[KBUFSZ]; 68 unsigned char kbuf[KBUFSZ];
68 69
69 /* 70 /*
70 * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an 71 * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an
71 * escape sequence to toggle the Keypad. 72 * escape sequence to toggle the Keypad.
93 if (enc_utf8 && 0) // currently disabled, doesn't seem to work, nor is useful 94 if (enc_utf8 && 0) // currently disabled, doesn't seem to work, nor is useful
94 len = Xutf8LookupString (Input_Context, &ev, (char *)kbuf, 95 len = Xutf8LookupString (Input_Context, &ev, (char *)kbuf,
95 KBUFSZ, &keysym, &status_return); 96 KBUFSZ, &keysym, &status_return);
96 else 97 else
97#endif 98#endif
98
99 { 99 {
100 wchar_t wkbuf[KBUFSZ + 1]; 100 wchar_t wkbuf[KBUFSZ + 1];
101 101
102 // the XOpenIM manpage lies about hardcoding the locale 102 // the XOpenIM manpage lies about hardcoding the locale
103 // at the point of XOpenIM, so temporarily switch locales 103 // at the point of XOpenIM, so temporarily switch locales
108 KBUFSZ, &keysym, &status_return); 108 KBUFSZ, &keysym, &status_return);
109 if (rs[Rs_imLocale]) 109 if (rs[Rs_imLocale])
110 SET_LOCALE (locale); 110 SET_LOCALE (locale);
111 111
112 if (status_return == XLookupChars 112 if (status_return == XLookupChars
113 || status_return == XLookupBoth) 113 || status_return == XLookupBoth)
114 { 114 {
115 wkbuf[len] = 0; 115 wkbuf[len] = 0;
116 len = wcstombs ((char *)kbuf, wkbuf, KBUFSZ); 116 len = wcstombs ((char *)kbuf, wkbuf, KBUFSZ);
117 if (len < 0) 117 if (len < 0)
118 len = 0; 118 len = 0;
120 else 120 else
121 len = 0; 121 len = 0;
122 } 122 }
123 123
124 valid_keysym = status_return == XLookupKeySym 124 valid_keysym = status_return == XLookupKeySym
125 || status_return == XLookupBoth; 125 || status_return == XLookupBoth;
126 } 126 }
127 else 127 else
128#endif 128#endif
129
130 { 129 {
131 len = XLookupString (&ev, (char *)kbuf, KBUFSZ, &keysym, &compose); 130 len = XLookupString (&ev, (char *)kbuf, KBUFSZ, &keysym, &compose);
132 valid_keysym = !len; 131 valid_keysym = keysym != NoSymbol;
133 } 132 }
134 133
135 if (valid_keysym) 134 if (valid_keysym)
136 { 135 {
137 /* for some backwards compatibility */ 136 /* for some backwards compatibility */
162 { 161 {
163#else 162#else
164 if (IS_SCROLL_MOD) 163 if (IS_SCROLL_MOD)
165 { 164 {
166#endif 165#endif
167 int lnsppg; 166 int lnsppg;
168 167
169#ifdef PAGING_CONTEXT_LINES 168#ifdef PAGING_CONTEXT_LINES
170 lnsppg = TermWin.nrow - PAGING_CONTEXT_LINES; 169 lnsppg = TermWin.nrow - PAGING_CONTEXT_LINES;
171#else 170#else
172 lnsppg = TermWin.nrow * 4 / 5; 171 lnsppg = TermWin.nrow * 4 / 5;
210 scr_move_to (1, 0); 209 scr_move_to (1, 0);
211 return; 210 return;
212 } 211 }
213 } 212 }
214#endif 213#endif
215
216 } 214 }
217 215
218 if (shft) 216 if (shft)
219 { 217 {
220 /* Shift + F1 - F10 generates F11 - F20 */ 218 /* Shift + F1 - F10 generates F11 - F20 */
286 tt_write (kbuf0, l); 284 tt_write (kbuf0, l);
287 return; 285 return;
288 } 286 }
289 else 287 else
290#endif 288#endif
291
292 { 289 {
293 newlen = 1; 290 newlen = 1;
294 switch (keysym) 291 switch (keysym)
295 { 292 {
296#ifndef NO_BACKSPACE_KEY 293#ifndef NO_BACKSPACE_KEY
348 meta = 1; 345 meta = 1;
349#endif 346#endif
350 newlen = 0; 347 newlen = 0;
351 } 348 }
352 break; 349 break;
353
354 350
355#ifdef XK_KP_Left 351#ifdef XK_KP_Left
356 case XK_KP_Up: /* \033Ox or standard */ 352 case XK_KP_Up: /* \033Ox or standard */
357 case XK_KP_Down: /* \033Or or standard */ 353 case XK_KP_Down: /* \033Or or standard */
358 case XK_KP_Right: /* \033Ov or standard */ 354 case XK_KP_Right: /* \033Ov or standard */
482 STRCPY (kbuf, "\033OP"); 478 STRCPY (kbuf, "\033OP");
483 kbuf[2] += (keysym - XK_KP_F1); 479 kbuf[2] += (keysym - XK_KP_F1);
484 break; 480 break;
485 481
486 case XK_KP_Multiply: /* "\033Oj" : "*" */ 482 case XK_KP_Multiply: /* "\033Oj" : "*" */
487 case XK_KP_Add: /* "\033Ok" : "+" */ 483 case XK_KP_Add: /* "\033Ok" : "+" */
488 case XK_KP_Separator: /* "\033Ol" : "," */ 484 case XK_KP_Separator: /* "\033Ol" : "," */
489 case XK_KP_Subtract: /* "\033Om" : "-" */ 485 case XK_KP_Subtract: /* "\033Om" : "-" */
490 case XK_KP_Decimal: /* "\033On" : "." */ 486 case XK_KP_Decimal: /* "\033On" : "." */
491 case XK_KP_Divide: /* "\033Oo" : "/" */ 487 case XK_KP_Divide: /* "\033Oo" : "/" */
492 case XK_KP_0: /* "\033Op" : "0" */ 488 case XK_KP_0: /* "\033Op" : "0" */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines