| 365 | } |
| 366 | |
| 367 | int read_key_code(string s) |
| 368 | { |
| 369 | if (s.empty()) |
| 370 | return 0; |
| 371 | |
| 372 | // try human-readable variants |
| 373 | int key = _name_to_keycode(s); |
| 374 | if (key != CK_NO_KEY) |
| 375 | return key; |
| 376 | |
| 377 | int base = 10; |
| 378 | if (s[0] == 'x') |
| 379 | { |
| 380 | s = s.substr(1); |
| 381 | base = 16; |
| 382 | } |
| 383 | |
| 384 | char *tail; |
| 385 | return strtol(s.c_str(), &tail, base); |
| 386 | } |
| 387 | |
| 388 | /* |
| 389 | * Takes as argument a string, and returns a sequence of keys described |
no test coverage detected