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.13 by pcg, Fri Dec 5 04:27:20 2003 UTC vs.
Revision 1.14 by pcg, Mon Dec 8 23:14:40 2003 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: command.c 2 * File: command.c
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * $Id: command.C,v 1.13 2003/12/05 04:27:20 pcg Exp $ 4 * $Id: command.C,v 1.14 2003/12/08 23:14:40 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>
61 unsigned int newlen; 61 unsigned int newlen;
62 KeySym keysym; 62 KeySym keysym;
63#ifdef DEBUG_CMD 63#ifdef DEBUG_CMD
64 static int debug_key = 1; /* accessible by a debugger only */ 64 static int debug_key = 1; /* accessible by a debugger only */
65#endif 65#endif
66#ifdef USE_XIM
67 int valid_keysym; 66 int valid_keysym;
68#endif
69 unsigned char *kbuf = R->kbuf; 67 unsigned char *kbuf = R->kbuf;
70 68
71/* 69/*
72 * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an 70 * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an
73 * escape sequence to toggle the Keypad. 71 * escape sequence to toggle the Keypad.
75 * Always permit `shift' to override the current setting 73 * Always permit `shift' to override the current setting
76 */ 74 */
77 shft = (ev->state & ShiftMask); 75 shft = (ev->state & ShiftMask);
78 ctrl = (ev->state & ControlMask); 76 ctrl = (ev->state & ControlMask);
79 meta = (ev->state & R->ModMetaMask); 77 meta = (ev->state & R->ModMetaMask);
78
80 if (R->numlock_state || (ev->state & R->ModNumLockMask)) { 79 if (R->numlock_state || (ev->state & R->ModNumLockMask))
80 {
81 R->numlock_state = (ev->state & R->ModNumLockMask); 81 R->numlock_state = (ev->state & R->ModNumLockMask);
82 PrivMode((!R->numlock_state), PrivMode_aplKP); 82 PrivMode((!R->numlock_state), PrivMode_aplKP);
83 } 83 }
84
85 kbuf[0] = 0;
86
84#ifdef USE_XIM 87#ifdef USE_XIM
85 if (R->Input_Context != NULL) { 88 if (R->Input_Context)
89 {
86 Status status_return; 90 Status status_return;
87 91
88 kbuf[0] = '\0';
89#ifdef X_HAVE_UTF8_STRING 92#ifdef X_HAVE_UTF8_STRING
90 len = Xutf8LookupString(R->Input_Context, ev, (char *)kbuf, 93 len = Xutf8LookupString(R->Input_Context, ev, (char *)kbuf,
91 KBUFSZ, &keysym, &status_return); 94 KBUFSZ, &keysym, &status_return);
92#else 95#else
93 len = XmbLookupString(R->Input_Context, ev, (char *)kbuf, 96 len = XmbLookupString(R->Input_Context, ev, (char *)kbuf,
94 KBUFSZ, &keysym, &status_return); 97 KBUFSZ, &keysym, &status_return);
95#endif 98#endif
96 valid_keysym = ((status_return == XLookupKeySym) 99 valid_keysym = ((status_return == XLookupKeySym)
97 || (status_return == XLookupBoth)); 100 || (status_return == XLookupBoth));
101 }
98 } else { 102 else
103#endif
104 {
99 len = XLookupString(ev, (char *)kbuf, KBUFSZ, &keysym, 105 len = XLookupString(ev, (char *)kbuf, KBUFSZ, &keysym, &R->compose);
100 &R->compose);
101 valid_keysym = 1; 106 valid_keysym = !len;
102 } 107 }
103#else /* USE_XIM */
104 len = XLookupString(ev, (char *)kbuf, KBUFSZ, &keysym,
105 &R->compose);
106/*
107 * map unmapped Latin[2-4]/Katakana/Arabic/Cyrillic/Greek entries -> Latin1
108 * good for installations with correct fonts, but without XLOCALE
109 */
110 if (!len) {
111 if ((keysym >= 0x0100) && (keysym < 0x0800)) {
112 kbuf[0] = (keysym & 0xFF);
113 kbuf[1] = '\0';
114 len = 1;
115 } else
116 kbuf[0] = '\0';
117 }
118#endif /* USE_XIM */
119 108
120#ifdef USE_XIM
121 if (valid_keysym) 109 if (valid_keysym)
122#endif
123 { 110 {
124/* for some backwards compatibility */ 111/* for some backwards compatibility */
125#if defined(HOTKEY_CTRL) || defined(HOTKEY_META) 112#if defined(HOTKEY_CTRL) || defined(HOTKEY_META)
126# ifdef HOTKEY_CTRL 113# ifdef HOTKEY_CTRL
127 if (ctrl) { 114 if (ctrl)
128# else 115# else
129 if (meta) { 116 if (meta)
130# endif 117# endif
118 {
131 if (keysym == R->ks_bigfont) { 119 if (keysym == R->ks_bigfont)
120 {
132 rxvt_change_font(aR_ 0, FONT_UP); 121 rxvt_change_font(aR_ 0, FONT_UP);
133 return; 122 return;
123 }
134 } else if (keysym == R->ks_smallfont) { 124 else if (keysym == R->ks_smallfont)
125 {
135 rxvt_change_font(aR_ 0, FONT_DN); 126 rxvt_change_font(aR_ 0, FONT_DN);
136 return; 127 return;
137 } 128 }
138 } 129 }
139#endif 130#endif
140 131
141 if (R->TermWin.saveLines) { 132 if (R->TermWin.saveLines) {
142#ifdef UNSHIFTED_SCROLLKEYS 133#ifdef UNSHIFTED_SCROLLKEYS
143 if (!ctrl && !meta) { 134 if (!ctrl && !meta) {
237 /* escape prefix */ 228 /* escape prefix */
238 if (meta) 229 if (meta)
239# ifdef META8_OPTION 230# ifdef META8_OPTION
240 if (R->meta_char == C0_ESC) 231 if (R->meta_char == C0_ESC)
241# endif 232# endif
242 R->tt_write(&ch, 1); 233 R->tt_write (&ch, 1);
243 R->tt_write(kbuf0, l); 234 R->tt_write (kbuf0, l);
244 return; 235 return;
245 } else 236 } else
246#endif 237#endif
247 { 238 {
248 newlen = 1; 239 newlen = 1;
572 if (R->greek_mode) 563 if (R->greek_mode)
573 len = greek_xlat(kbuf, len); 564 len = greek_xlat(kbuf, len);
574#endif 565#endif
575 /* nil */ ; 566 /* nil */ ;
576 } 567 }
577 } 568 }
578 569
579 if (len <= 0) 570 if (len <= 0)
580 return; /* not mapped */ 571 return; /* not mapped */
581 572
582 if (R->Options & Opt_scrollTtyKeypress) 573 if (R->Options & Opt_scrollTtyKeypress)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines