aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-02-17 12:43:06 +0000
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-02-20 10:19:47 +0100
commit38ac74d6fb5a34cf755bcc97829ea36b48cd4378 (patch)
tree9258dcab08b1c2c4b66c457d31e61bf6ff04d9ac /nx-X11/programs/Xserver/hw
parent73ec915bcb1c6bde73168ad1ee1cccbec3455569 (diff)
downloadnx-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')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c21
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keystroke.c27
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.