… | |
… | |
24 | #include "../config.h" |
24 | #include "../config.h" |
25 | #include "rxvt.h" |
25 | #include "rxvt.h" |
26 | |
26 | |
27 | #ifdef KEYSYM_RESOURCE |
27 | #ifdef KEYSYM_RESOURCE |
28 | |
28 | |
29 | #include <cstring> |
29 | #include <string.h> |
30 | |
30 | |
31 | #include "rxvtperl.h" |
31 | #include "rxvtperl.h" |
32 | #include "keyboard.h" |
32 | #include "keyboard.h" |
33 | #include "command.h" |
|
|
34 | |
33 | |
35 | /* an intro to the data structure: |
34 | /* an intro to the data structure: |
36 | * |
35 | * |
37 | * vector keymap[] is grouped. |
36 | * vector keymap[] is grouped. |
38 | * |
37 | * |
… | |
… | |
112 | { |
111 | { |
113 | char *translation = rxvt_wcstoutf8 (ws); |
112 | char *translation = rxvt_wcstoutf8 (ws); |
114 | |
113 | |
115 | keysym_t *key = new keysym_t; |
114 | keysym_t *key = new keysym_t; |
116 | |
115 | |
117 | if (key && translation) |
|
|
118 | { |
|
|
119 | key->keysym = keysym; |
116 | key->keysym = keysym; |
120 | key->state = state; |
117 | key->state = state; |
121 | key->str = translation; |
118 | key->str = translation; |
122 | key->type = keysym_t::STRING; |
119 | key->type = keysym_t::STRING; |
123 | |
120 | |
124 | if (strncmp (translation, "builtin:", 8) == 0) |
121 | if (strncmp (translation, "builtin:", 8) == 0) |
125 | key->type = keysym_t::BUILTIN; |
122 | key->type = keysym_t::BUILTIN; |
126 | |
123 | |
127 | if (keymap.size () == keymap.capacity ()) |
124 | if (keymap.size () == keymap.capacity ()) |
128 | keymap.reserve (keymap.size () * 2); |
125 | keymap.reserve (keymap.size () * 2); |
129 | |
126 | |
130 | keymap.push_back (key); |
127 | keymap.push_back (key); |
131 | hash[0] = 3; |
128 | hash[0] = 3; |
132 | } |
|
|
133 | else |
|
|
134 | { |
|
|
135 | delete key; |
|
|
136 | free (translation); |
|
|
137 | rxvt_fatal ("memory allocation failure. aborting.\n"); |
|
|
138 | } |
|
|
139 | } |
129 | } |
140 | |
130 | |
141 | bool |
131 | bool |
142 | keyboard_manager::dispatch (rxvt_term *term, KeySym keysym, unsigned int state) |
132 | keyboard_manager::dispatch (rxvt_term *term, KeySym keysym, unsigned int state) |
143 | { |
133 | { |