aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-02-17 12:43:06 +0000
committerMihai Moldovan <ionic@ionic.de>2017-03-01 15:19:16 +0100
commitefc0dae0519aa0ef1fabea6a64919475fd916347 (patch)
tree217c9be4c9cc9de2bc7065ed08da43863ee80416
parente70448087a05c123f916ff82f468e6d5fc57d714 (diff)
downloadnx-libs-efc0dae0519aa0ef1fabea6a64919475fd916347.tar.gz
nx-libs-efc0dae0519aa0ef1fabea6a64919475fd916347.tar.bz2
nx-libs-efc0dae0519aa0ef1fabea6a64919475fd916347.zip
Switch from using libNX_X11's deprecated XKeycodeToKeysym() function to using XGetKeyboardMapping().
Fixes ArcticaProject/nx-libs#229.
-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.