diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-02-17 12:43:06 +0000 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-02-20 10:19:47 +0100 |
commit | 38ac74d6fb5a34cf755bcc97829ea36b48cd4378 (patch) | |
tree | 9258dcab08b1c2c4b66c457d31e61bf6ff04d9ac /nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | |
parent | 73ec915bcb1c6bde73168ad1ee1cccbec3455569 (diff) | |
download | nx-libs-38ac74d6fb5a34cf755bcc97829ea36b48cd4378.tar.gz nx-libs-38ac74d6fb5a34cf755bcc97829ea36b48cd4378.tar.bz2 nx-libs-38ac74d6fb5a34cf755bcc97829ea36b48cd4378.zip |
Switch from using libNX_X11's deprecated XKeycodeToKeysym() function to using XGetKeyboardMapping().
Fixes ArcticaProject/nx-libs#229.
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Keystroke.c')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index 8dc1a0b85..6237b9dac 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -406,7 +406,13 @@ free(filename); static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X) { - KeySym keysym = XKeycodeToKeysym(nxagentDisplay, X->keycode, 0); + int keysyms_per_keycode_return; + XlibKeySym *keysym = XGetKeyboardMapping(nxagentDisplay, + X->keycode, + 1, + &keysyms_per_keycode_return); + + struct nxagentSpecialKeystrokeMap *cur = map; if (! nxagentKeystrokeFileParsed) @@ -418,19 +424,20 @@ static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X) enum nxagentSpecialKeystroke ret = KEYSTROKE_NOTHING; while (cur->stroke != KEYSTROKE_END_MARKER) { - if (cur->keysym == keysym && modifier_matches(cur->modifierMask, cur->modifierAltMeta, X->state)) { + if (cur->keysym == keysym[0] && modifier_matches(cur->modifierMask, cur->modifierAltMeta, X->state)) { + + free(keysym); return cur->stroke; } cur++; } + free(keysym); return ret; } int nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result) { - KeySym sym; - int index = 0; enum nxagentSpecialKeystroke stroke = find_keystroke(X); *result = doNothing; @@ -440,17 +447,23 @@ int nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result) * Do we need a cache ? */ - sym = XKeycodeToKeysym(nxagentDisplay, X -> keycode, index); + int keysyms_per_keycode_return; + XlibKeySym *sym = XGetKeyboardMapping(nxagentDisplay, + X->keycode, + 1, + &keysyms_per_keycode_return); - if (sym == XK_VoidSymbol || sym == NoSymbol) + if (sym[0] == XK_VoidSymbol || sym[0] == NoSymbol) { + free(sym); return 0; } #ifdef TEST fprintf(stderr, "nxagentCheckSpecialKeystroke: got code %x - state %x - sym %lx\n", - X -> keycode, X -> state, sym); + X -> keycode, X -> state, sym[0]); #endif + free(sym); /* * Check special keys. |