diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-02-20 10:21:01 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-02-20 10:21:01 +0100 |
commit | c79f2d289004d419d8bb76cf8bf731980d40da5d (patch) | |
tree | 9258dcab08b1c2c4b66c457d31e61bf6ff04d9ac /nx-X11/programs/Xserver | |
parent | 73ec915bcb1c6bde73168ad1ee1cccbec3455569 (diff) | |
parent | 38ac74d6fb5a34cf755bcc97829ea36b48cd4378 (diff) | |
download | nx-libs-c79f2d289004d419d8bb76cf8bf731980d40da5d.tar.gz nx-libs-c79f2d289004d419d8bb76cf8bf731980d40da5d.tar.bz2 nx-libs-c79f2d289004d419d8bb76cf8bf731980d40da5d.zip |
Merge branch 'sunweaver-pr/use-xgetkeyboardMapping-instead-of-deprecated-xkeycodetokeysym' into 3.6.x
Attributes GH PR #335: https://github.com/ArcticaProject/nx-libs/pull/335
Reviewed by: Ulrich Sibiller <uli42@gmx.de> -- Fri, 17 Feb 2017 06:49:03 -0800
Diffstat (limited to 'nx-X11/programs/Xserver')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Events.c | 21 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 27 |
2 files changed, 37 insertions, 11 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 371780a92..efe745718 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -934,7 +934,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) { enum HandleEventResult result; - KeySym keysym; + XlibKeySym *keysym; #ifdef TEST fprintf(stderr, "nxagentDispatchEvents: Going to handle new KeyPress event.\n"); @@ -1101,12 +1101,17 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) * sive delay. */ - keysym = XKeycodeToKeysym(nxagentDisplay, X.xkey.keycode, 0); + int keysyms_per_keycode_return; + keysym = XGetKeyboardMapping(nxagentDisplay, + X.xkey.keycode, + 1, + &keysyms_per_keycode_return); - if (nxagentMonitoredDuplicate(keysym) == 1) + if (nxagentMonitoredDuplicate(keysym[0]) == 1) { nxagentRemoveDuplicatedKeys(&X); } + free(keysym); if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow) == 1 && result == doNothing) { @@ -4638,8 +4643,16 @@ void nxagentDumpInputDevicesState(void) { if (val & (mask << k)) { + int keysyms_per_keycode_return; + XlibKeySym *keysym = XGetKeyboardMapping(nxagentDisplay, + i * 8 + k, + 1, + &keysyms_per_keycode_return); + + fprintf(stderr, "\n\t[%d] [%s]", i * 8 + k, - XKeysymToString(XKeycodeToKeysym(nxagentDisplay, i * 8 + k, 0))); + XKeysymToString(keysym[0])); + free(keysym); } } } 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. |