| 18 | |
| 19 | |
| 20 | static KeySym KeycodeToKeysym(Display *dpy, KeyCode keycode, int index) |
| 21 | { |
| 22 | KeySym ks = NoSymbol, *keysyms; int n = 0; |
| 23 | |
| 24 | keysyms = XGetKeyboardMapping(dpy, keycode, 1, &n); |
| 25 | if(keysyms) |
| 26 | { |
| 27 | if(n >= 1 && index >= 0 && index < n) |
| 28 | ks = keysyms[index]; |
| 29 | XFree(keysyms); |
| 30 | } |
| 31 | |
| 32 | return ks; |
| 33 | } |
| 34 | |
| 35 | #endif |