… | |
… | |
61 | * where hashkey of keymap[i]->keysym = keymap[i]->keysym & KEYSYM_HASH_MASK |
61 | * where hashkey of keymap[i]->keysym = keymap[i]->keysym & KEYSYM_HASH_MASK |
62 | * n(the number of groups) = the number of non-zero member of hash_bucket_size[]; |
62 | * n(the number of groups) = the number of non-zero member of hash_bucket_size[]; |
63 | * Ni(the size of group i) = hash_bucket_size[Ii]. |
63 | * Ni(the size of group i) = hash_bucket_size[Ii]. |
64 | */ |
64 | */ |
65 | |
65 | |
66 | static void |
|
|
67 | output_string (rxvt_term *term, const char *str) |
|
|
68 | { |
|
|
69 | if (strncmp (str, "command:", 8) == 0) |
|
|
70 | term->cmdbuf_append (str + 8, strlen (str) - 8); |
|
|
71 | else if (strncmp (str, "perl:", 5) == 0) |
|
|
72 | HOOK_INVOKE((term, HOOK_USER_COMMAND, DT_STR, str + 5, DT_END)); |
|
|
73 | else |
|
|
74 | term->tt_write (str, strlen (str)); |
|
|
75 | } |
|
|
76 | |
|
|
77 | // return: priority_of_a - priority_of_b |
66 | // return: priority_of_a - priority_of_b |
78 | static int |
67 | static int |
79 | compare_priority (keysym_t *a, keysym_t *b) |
68 | compare_priority (keysym_t *a, keysym_t *b) |
80 | { |
69 | { |
81 | // (the more '1's in state; the less range): the greater priority |
70 | // (the more '1's in state; the less range): the greater priority |
… | |
… | |
148 | wchar_t *ws = rxvt_utf8towcs (key->str); |
137 | wchar_t *ws = rxvt_utf8towcs (key->str); |
149 | char *str = rxvt_wcstombs (ws); |
138 | char *str = rxvt_wcstombs (ws); |
150 | // TODO: do (some) translations, unescaping etc, here (allow \u escape etc.) |
139 | // TODO: do (some) translations, unescaping etc, here (allow \u escape etc.) |
151 | free (ws); |
140 | free (ws); |
152 | |
141 | |
153 | output_string (term, str); |
142 | if (char *colon = strchr (str, ':')) |
|
|
143 | { |
|
|
144 | if (strncmp (str, "command:", 8) == 0) |
|
|
145 | term->cmdbuf_append (str + 8, strlen (str) - 8); |
|
|
146 | else if (strncmp (str, "perl:", 8) == 0) |
|
|
147 | HOOK_INVOKE ((term, HOOK_USER_COMMAND, DT_STR, colon + 1, DT_END)); |
|
|
148 | else if (HOOK_INVOKE ((term, HOOK_KEYBOARD_DISPATCH, DT_STR_LEN, str, colon - str, DT_STR, colon + 1, DT_END))) |
|
|
149 | /* done */; |
|
|
150 | else |
|
|
151 | term->tt_write (str, strlen (str)); |
|
|
152 | } |
154 | |
153 | |
155 | free (str); |
154 | free (str); |
156 | |
155 | |
157 | return true; |
156 | return true; |
158 | } |
157 | } |