From 39ecbc10848d2efaf929b354bb61721852a2e706 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sat, 15 Jun 2013 14:38:44 +0200 Subject: [PATCH] WPrefs: Added XKeycodeToKeysym work-around to all other usage places To ensure proper behaviour with X servers that do not support the Xkb extension, implemented call to the fall-back legacy function to the other places where it is being used, to ensure proper behaviour in any case. Signed-off-by: Christophe CURIS --- WPrefs.app/KeyboardShortcuts.c | 5 ++++- WPrefs.app/xmodifier.c | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/WPrefs.app/KeyboardShortcuts.c b/WPrefs.app/KeyboardShortcuts.c index 4324b03b..84da1d0c 100644 --- a/WPrefs.app/KeyboardShortcuts.c +++ b/WPrefs.app/KeyboardShortcuts.c @@ -273,7 +273,10 @@ char *capture_shortcut(Display *dpy, Bool *capturing, Bool convert_case) XAllowEvents(dpy, AsyncKeyboard, CurrentTime); WMNextEvent(dpy, &ev); if (ev.type == KeyPress && ev.xkey.keycode != 0) { - ksym = XkbKeycodeToKeysym(dpy, ev.xkey.keycode, 0, 0); + if (xext_xkb_supported) + ksym = XkbKeycodeToKeysym(dpy, ev.xkey.keycode, 0, 0); + else + ksym = XKeycodeToKeysym(dpy, ev.xkey.keycode, 0); if (!IsModifierKey(ksym)) { if (convert_case) { XConvertCase(ksym, &lksym, &uksym); diff --git a/WPrefs.app/xmodifier.c b/WPrefs.app/xmodifier.c index d0b1a229..226652e5 100644 --- a/WPrefs.app/xmodifier.c +++ b/WPrefs.app/xmodifier.c @@ -162,7 +162,17 @@ static void x_reset_modifier_mapping(Display * display) for (column = 0; column < 4; column += 2) { KeyCode code = x_modifier_keymap->modifiermap[modifier_index * mkpm + modifier_key]; - KeySym sym = (code ? XkbKeycodeToKeysym(display, code, 0, column) : 0); + KeySym sym; + + if (code) { + if (xext_xkb_supported) + sym = XkbKeycodeToKeysym(display, code, 0, column); + else + sym = XKeycodeToKeysym(display, code, column); + } else { + sym = NoSymbol; + } + if (sym == last_sym) continue; last_sym = sym;