From: Christophe CURIS <[email protected]>

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 <[email protected]>
---
 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 4324b03..84da1d0 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 d0b1a22..226652e 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;
-- 
1.7.10.4


-- 
To unsubscribe, send mail to [email protected].

Reply via email to