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

Comparing rxvt-unicode/src/keyboard.C (file contents):
Revision 1.4 by root, Sun Jan 16 18:57:03 2005 UTC vs.
Revision 1.6 by root, Sun Jan 16 19:20:30 2005 UTC

57 *ch |= 0x80; 57 *ch |= 0x80;
58 } 58 }
59 else if (rt->meta_char == C0_ESC) /* escape prefix */ 59 else if (rt->meta_char == C0_ESC) /* escape prefix */
60#endif 60#endif
61 { 61 {
62 const unsigned char 62 const unsigned char ch = C0_ESC;
63 ch = C0_ESC;
64 rt->tt_write (&ch, 1); 63 rt->tt_write (&ch, 1);
65 } 64 }
66 } 65 }
67 66
68 rt->tt_write ((unsigned char *) buf, buflen); 67 rt->tt_write ((unsigned char *) buf, buflen);
73{ 72{
74 int len = snprintf (buf, bufsize, str + 1, keysym_offset + str [0]); 73 int len = snprintf (buf, bufsize, str + 1, keysym_offset + str [0]);
75 74
76 if (len >= bufsize) 75 if (len >= bufsize)
77 { 76 {
78 fprintf (stderr, "buffer overflowed!\n"); 77 rxvt_warn ("buffer overflowed!\n");
79 buf[bufsize - 1] = '\0'; 78 *buf = 0;
80 } 79 }
81 else if (len < 0) 80 else if (len < 0)
82 { 81 {
83 perror ("keyrange_translator()"); 82 rxvt_warn ("keyrange_translator(), snprintf error");
83 *buf = 0;
84 } 84 }
85 85
86 return len; 86 return len;
87} 87}
88 88
236bool 236bool
237keyboard_manager::dispatch (rxvt_term *term, KeySym keysym, unsigned int state) 237keyboard_manager::dispatch (rxvt_term *term, KeySym keysym, unsigned int state)
238{ 238{
239 assert (hash[0] == 0 && "register_done() need to be called"); 239 assert (hash[0] == 0 && "register_done() need to be called");
240 240
241 if (state & term->ModMetaMask) 241 if (state & term->ModMetaMask) state |= MetaMask;
242 state |= MetaMask;
243
244 if (state & term->ModNumLockMask) 242 if (state & term->ModNumLockMask) state |= NumLockMask;
245 state |= NumLockMask; 243 if (state & term->ModLevel3Mask) state |= Level3Mask;
246 244
247 if (!!(term->priv_modes & PrivMode_aplKP) != !!(state & ShiftMask)) 245 if (!!(term->priv_modes & PrivMode_aplKP) != !!(state & ShiftMask))
248 state |= AppKeypadMask; 246 state |= AppKeypadMask;
249 247
250 int index = find_keysym (keysym, state); 248 int index = find_keysym (keysym, state);
435 { 433 {
436 keysym_t *a = sorted_keymap[i]; 434 keysym_t *a = sorted_keymap[i];
437 for (int j = 0; j < a->range; ++j) 435 for (int j = 0; j < a->range; ++j)
438 { 436 {
439 int index = find_keysym (a->keysym + j, a->state & OtherModMask); 437 int index = find_keysym (a->keysym + j, a->state & OtherModMask);
438
440 assert (index >= 0); 439 assert (index >= 0);
441 keysym_t *b = keymap [index]; 440 keysym_t *b = keymap [index];
442 assert (i == (signed) index || // the normally expected result 441 assert (i == (signed) index || // the normally expected result
443 (a->keysym + j) >= b->keysym && (a->keysym + j) <= (b->keysym + b->range) && compare_priority (a, b) <= 0); // is effectively the same 442 (a->keysym + j) >= b->keysym && (a->keysym + j) <= (b->keysym + b->range) && compare_priority (a, b) <= 0); // is effectively the same
444 } 443 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines