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.28 by ayin, Wed Oct 31 09:55:23 2007 UTC vs.
Revision 1.32 by root, Sat Dec 26 10:24:04 2009 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."},
143// return: priority_of_a - priority_of_b 143// return: priority_of_a - priority_of_b
144static int 144static int
145compare_priority (keysym_t *a, keysym_t *b) 145compare_priority (keysym_t *a, keysym_t *b)
146{ 146{
147 // (the more '1's in state; the less range): the greater priority 147 // (the more '1's in state; the less range): the greater priority
148 int ca = popcount (a->state /* & OtherModMask */); 148 int ca = rxvt_popcount (a->state /* & OtherModMask */);
149 int cb = popcount (b->state /* & OtherModMask */); 149 int cb = rxvt_popcount (b->state /* & OtherModMask */);
150 150
151 if (ca != cb) 151 if (ca != cb)
152 return ca - cb; 152 return ca - cb;
153//else if (a->state != b->state) // this behavior is to be disscussed 153//else if (a->state != b->state) // this behavior is to be disscussed
154// return b->state - a->state; 154// return b->state - a->state;
426 ++hash_budget_counter [hashkey]; 426 ++hash_budget_counter [hashkey];
427 } 427 }
428 428
429 keymap.swap (sorted_keymap); 429 keymap.swap (sorted_keymap);
430 430
431#ifdef DEBUG_STRICT 431#ifndef NDEBUG
432 // check for invariants 432 // check for invariants
433 for (i = 0; i < KEYSYM_HASH_BUDGETS; ++i) 433 for (i = 0; i < KEYSYM_HASH_BUDGETS; ++i)
434 { 434 {
435 index = hash[i]; 435 index = hash[i];
436 for (int j = 0; j < hash_budget_size [i]; ++j) 436 for (int j = 0; j < hash_budget_size [i]; ++j)
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines