From bc56db0776d50eb5b6ff0208b706751abef9d770 Mon Sep 17 00:00:00 2001 From: David Maciejak Date: Sun, 26 Feb 2023 08:51:35 +0800 Subject: [PATCH] WPrefs: use W_KeycodeToKeysym instead of XkbKeycodeToKeysym This patch replaces XKeycodeToKeysym and XkbKeycodeToKeysym in WPrefs by our own function W_KeycodeToKeysym. --- WPrefs.app/KeyboardShortcuts.c | 7 ++----- WPrefs.app/MouseSettings.c | 5 +---- WPrefs.app/WPrefs.h | 2 +- WPrefs.app/main.c | 4 ---- WPrefs.app/xmodifier.c | 5 +---- 5 files changed, 5 insertions(+), 18 deletions(-) diff --git a/WPrefs.app/KeyboardShortcuts.c b/WPrefs.app/KeyboardShortcuts.c index 29419ff0..107f0e82 100644 --- a/WPrefs.app/KeyboardShortcuts.c +++ b/WPrefs.app/KeyboardShortcuts.c @@ -317,11 +317,8 @@ char *capture_shortcut(Display *dpy, Bool *capturing, Bool convert_case) if (ev.type == KeyPress && ev.xkey.keycode != 0) { numlock_mask = NumLockMask(dpy); - if (xext_xkb_supported) - /* conditional mask check to get numeric keypad keys */ - ksym = XkbKeycodeToKeysym(dpy, ev.xkey.keycode, 0, ev.xkey.state & numlock_mask?1:0); - else - ksym = XKeycodeToKeysym(dpy, ev.xkey.keycode, ev.xkey.state & numlock_mask?1:0); + /* conditional mask check to get numeric keypad keys */ + ksym = W_KeycodeToKeysym(dpy, ev.xkey.keycode, ev.xkey.state & numlock_mask?1:0); if (!IsModifierKey(ksym)) { if (convert_case) { diff --git a/WPrefs.app/MouseSettings.c b/WPrefs.app/MouseSettings.c index 497005dd..9dc1328c 100644 --- a/WPrefs.app/MouseSettings.c +++ b/WPrefs.app/MouseSettings.c @@ -381,10 +381,7 @@ static void fillModifierPopUp(WMPopUpButton * pop) if (mapping->modifiermap[idx] != 0) { int l; for (l = 0; l < 4; l++) { - if (xext_xkb_supported) - ksym = XkbKeycodeToKeysym(dpy, mapping->modifiermap[idx], 0, l); - else - ksym = XKeycodeToKeysym(dpy, mapping->modifiermap[idx], l); + ksym = W_KeycodeToKeysym(dpy, mapping->modifiermap[idx], l); if (ksym != NoSymbol) break; } diff --git a/WPrefs.app/WPrefs.h b/WPrefs.app/WPrefs.h index 0373414c..99592971 100644 --- a/WPrefs.app/WPrefs.h +++ b/WPrefs.app/WPrefs.h @@ -33,6 +33,7 @@ #include #include +#include /* Needed for HAVE_LIBINTL_H and EXTENDED_WINDOWSHORTCUT */ #include "../src/wconfig.h" @@ -54,7 +55,6 @@ /****/ extern char *NOptionValueChanged; -extern Bool xext_xkb_supported; typedef struct _Panel Panel; diff --git a/WPrefs.app/main.c b/WPrefs.app/main.c index d2dd77d9..2a76a203 100644 --- a/WPrefs.app/main.c +++ b/WPrefs.app/main.c @@ -35,8 +35,6 @@ #endif char *NOptionValueChanged = "NOptionValueChanged"; -Bool xext_xkb_supported = False; - #define MAX_DEATHS 64 @@ -157,8 +155,6 @@ int main(int argc, char **argv) exit(0); } - xext_xkb_supported = XkbQueryExtension(dpy, NULL, NULL, NULL, NULL, NULL); - WMPLSetCaseSensitive(False); Initialize(scr); diff --git a/WPrefs.app/xmodifier.c b/WPrefs.app/xmodifier.c index f1a3bc2b..d3746ebc 100644 --- a/WPrefs.app/xmodifier.c +++ b/WPrefs.app/xmodifier.c @@ -171,10 +171,7 @@ static void x_reset_modifier_mapping(Display * display) KeySym sym; if (code) { - if (xext_xkb_supported) - sym = XkbKeycodeToKeysym(display, code, 0, column); - else - sym = XKeycodeToKeysym(display, code, column); + sym = W_KeycodeToKeysym(display, code, column); } else { sym = NoSymbol; }