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.27 by ayin, Sun Jul 29 09:37:01 2007 UTC vs.
Revision 1.30 by ayin, Thu Jan 10 11:30:45 2008 UTC

68//////////////////////////////////////////////////////////////////////////////// 68////////////////////////////////////////////////////////////////////////////////
69// default keycode translation map and keyevent handlers 69// default keycode translation map and keyevent handlers
70 70
71keysym_t keyboard_manager::stock_keymap[] = { 71keysym_t keyboard_manager::stock_keymap[] = {
72 /* examples */ 72 /* examples */
73 /* keysym, state, range, handler, str */ 73 /* keysym, state, range, type, str */
74//{XK_ISO_Left_Tab, 0, 1, keysym_t::STRING, "\033[Z"}, 74//{XK_ISO_Left_Tab, 0, 1, keysym_t::STRING, "\033[Z"},
75//{ 'a', 0, 26, keysym_t::RANGE_META8, "a" "%c"}, 75//{ 'a', 0, 26, keysym_t::RANGE_META8, "a" "%c"},
76//{ 'a', ControlMask, 26, keysym_t::RANGE_META8, "" "%c"}, 76//{ 'a', ControlMask, 26, keysym_t::RANGE_META8, "" "%c"},
77//{ XK_Left, 0, 4, keysym_t::LIST, ".\033[.DACB."}, 77//{ XK_Left, 0, 4, keysym_t::LIST, ".\033[.DACB."},
78//{ XK_Left, ShiftMask, 4, keysym_t::LIST, ".\033[.dacb."}, 78//{ XK_Left, ShiftMask, 4, keysym_t::LIST, ".\033[.dacb."},
213 213
214 if (strncmp (translation, "list", 4) == 0 && translation [4]) 214 if (strncmp (translation, "list", 4) == 0 && translation [4])
215 { 215 {
216 char *middle = strchr (translation + 5, translation [4]); 216 char *middle = strchr (translation + 5, translation [4]);
217 char *suffix = strrchr (translation + 5, translation [4]); 217 char *suffix = strrchr (translation + 5, translation [4]);
218 218
219 if (suffix && middle && suffix > middle + 1) 219 if (suffix && middle && suffix > middle + 1)
220 { 220 {
221 key->type = keysym_t::LIST; 221 key->type = keysym_t::LIST;
222 key->range = suffix - middle - 1; 222 key->range = suffix - middle - 1;
223 223
452 { 452 {
453 int index = find_keysym (a->keysym + j, a->state); 453 int index = find_keysym (a->keysym + j, a->state);
454 454
455 assert (index >= 0); 455 assert (index >= 0);
456 keysym_t *b = keymap [index]; 456 keysym_t *b = keymap [index];
457 assert (i == (signed) index || // the normally expected result 457 assert (i == index // the normally expected result
458 (a->keysym + j) >= b->keysym && (a->keysym + j) <= (b->keysym + b->range) && compare_priority (a, b) <= 0); // is effectively the same or a closer match 458 || IN_RANGE_INC (a->keysym + j, b->keysym, b->keysym + b->range)
459 && compare_priority (a, b) <= 0); // is effectively the same or a closer match
459 } 460 }
460 } 461 }
461#endif 462#endif
462} 463}
463 464
465keyboard_manager::find_keysym (KeySym keysym, unsigned int state) 466keyboard_manager::find_keysym (KeySym keysym, unsigned int state)
466{ 467{
467 int hashkey = keysym & KEYSYM_HASH_MASK; 468 int hashkey = keysym & KEYSYM_HASH_MASK;
468 unsigned int index = hash [hashkey]; 469 unsigned int index = hash [hashkey];
469 unsigned int end = hashkey < KEYSYM_HASH_BUDGETS - 1 470 unsigned int end = hashkey < KEYSYM_HASH_BUDGETS - 1
470 ? hash [hashkey + 1] 471 ? hash [hashkey + 1]
471 : keymap.size (); 472 : keymap.size ();
472 473
473 for (; index < end; ++index) 474 for (; index < end; ++index)
474 { 475 {
475 keysym_t *key = keymap [index]; 476 keysym_t *key = keymap [index];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines