Commit 651d5e5e authored by Ulrich Sibiller's avatar Ulrich Sibiller

Revert "Switch from using libNX_X11's deprecated XKeycodeToKeysym() function to…

Revert "Switch from using libNX_X11's deprecated XKeycodeToKeysym() function to using XGetKeyboardMapping()." This reverts commit efc0dae0. Recent test revealed keyboard hangs on high latency connections. These hangs are not happening in 3.5.0 releases if the nx-libs. The commit above is responsible for them so we take that back. Interestingly nxcomp has special treatment for XGetKeyboardMapping() so it should normally speed up things but it results in the opposite for us. Needs further examination. This fixes ArcticaProject/nx-libs#450
parent 60d7c02e
...@@ -934,7 +934,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -934,7 +934,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
{ {
enum HandleEventResult result; enum HandleEventResult result;
XlibKeySym *keysym; KeySym keysym;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentDispatchEvents: Going to handle new KeyPress event.\n"); fprintf(stderr, "nxagentDispatchEvents: Going to handle new KeyPress event.\n");
...@@ -1101,17 +1101,12 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -1101,17 +1101,12 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
* sive delay. * sive delay.
*/ */
int keysyms_per_keycode_return; keysym = XKeycodeToKeysym(nxagentDisplay, X.xkey.keycode, 0);
keysym = XGetKeyboardMapping(nxagentDisplay,
X.xkey.keycode,
1,
&keysyms_per_keycode_return);
if (nxagentMonitoredDuplicate(keysym[0]) == 1) if (nxagentMonitoredDuplicate(keysym) == 1)
{ {
nxagentRemoveDuplicatedKeys(&X); nxagentRemoveDuplicatedKeys(&X);
} }
free(keysym);
if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow) == 1 && result == doNothing) if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow) == 1 && result == doNothing)
{ {
...@@ -4657,16 +4652,8 @@ void nxagentDumpInputDevicesState(void) ...@@ -4657,16 +4652,8 @@ void nxagentDumpInputDevicesState(void)
{ {
if (val & (mask << k)) 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, fprintf(stderr, "\n\t[%d] [%s]", i * 8 + k,
XKeysymToString(keysym[0])); XKeysymToString(XKeycodeToKeysym(nxagentDisplay, i * 8 + k, 0)));
free(keysym);
} }
} }
} }
......
...@@ -480,30 +480,25 @@ void nxagentDumpKeystrokes(void) ...@@ -480,30 +480,25 @@ void nxagentDumpKeystrokes(void)
static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X) static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X)
{ {
enum nxagentSpecialKeystroke ret = KEYSTROKE_NOTHING; enum nxagentSpecialKeystroke ret = KEYSTROKE_NOTHING;
int keysyms_per_keycode_return;
XlibKeySym *keysym = XGetKeyboardMapping(nxagentDisplay, KeySym keysym = XKeycodeToKeysym(nxagentDisplay, X->keycode, 0);
X->keycode,
1,
&keysyms_per_keycode_return);
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: got keysym '%c' (%d)\n", __func__, keysym[0], keysym[0]); fprintf(stderr, "%s: got keysym '%c' (%d)\n", __func__, keysym, keysym);
#endif #endif
for (struct nxagentSpecialKeystrokeMap *cur = map; cur->stroke != KEYSTROKE_END_MARKER; cur++) { for (struct nxagentSpecialKeystrokeMap *cur = map; cur->stroke != KEYSTROKE_END_MARKER; cur++) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: checking keysym '%c' (%d)\n", __func__, cur->keysym, cur->keysym); fprintf(stderr, "%s: checking keysym '%c' (%d)\n", __func__, cur->keysym, cur->keysym);
#endif #endif
if (cur->keysym == keysym[0] && modifier_matches(cur->modifierMask, cur->modifierAltMeta, X->state)) { if (cur->keysym == keysym && modifier_matches(cur->modifierMask, cur->modifierAltMeta, X->state)) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "%s: match including modifiers for keysym '%c' (%d), stroke %d (%s)\n", __func__, cur->keysym, cur->keysym, cur->stroke, nxagentSpecialKeystrokeNames[cur->stroke]); fprintf(stderr, "%s: match including modifiers for keysym '%c' (%d), stroke %d (%s)\n", __func__, cur->keysym, cur->keysym, cur->stroke, nxagentSpecialKeystrokeNames[cur->stroke]);
#endif #endif
free(keysym);
return cur->stroke; return cur->stroke;
} }
} }
free(keysym);
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment