Revision 9d537c90
b/input.c | ||
---|---|---|
186 | 186 |
|
187 | 187 |
int index_from_key(const char *key) |
188 | 188 |
{ |
189 |
int i, keycode; |
|
190 |
char *endp; |
|
189 |
int i; |
|
191 | 190 |
|
192 | 191 |
for (i = 0; QKeyCode_lookup[i] != NULL; i++) { |
193 | 192 |
if (!strcmp(key, QKeyCode_lookup[i])) { |
... | ... | |
195 | 194 |
} |
196 | 195 |
} |
197 | 196 |
|
198 |
if (strstart(key, "0x", NULL)) { |
|
199 |
keycode = strtoul(key, &endp, 0); |
|
200 |
if (*endp == '\0' && keycode >= 0x01 && keycode <= 0xff) { |
|
201 |
for (i = 0; i < Q_KEY_CODE_MAX; i++) { |
|
202 |
if (keycode == key_defs[i]) { |
|
203 |
break; |
|
204 |
} |
|
205 |
} |
|
206 |
} |
|
207 |
} |
|
208 |
|
|
209 | 197 |
/* Return Q_KEY_CODE_MAX if the key is invalid */ |
210 | 198 |
return i; |
211 | 199 |
} |
Also available in: Unified diff