Sebastian Reuße
2017-03-08 18:25:53 UTC
When running on Wayland or when using the Xorg libinput driver (which is the
default on some distributions), a call to XkbGetKeyboard always returns NULL
(causing xsetwacom to segfault) and is apparently not supported anymore (cf.
[1,2] and others). Instead, we are supposed to use XkbGetMap now.
[1] <https://bugs.freedesktop.org/show_bug.cgi?id=89240>
[2] <https://github.com/glfw/glfw/issues/389>
Signed-off-by: Sebastian Reuße <***@wirrsal.net>
---
tools/xsetwacom.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
index bbc92f1..b0f21e4 100644
--- a/tools/xsetwacom.c
+++ b/tools/xsetwacom.c
@@ -1173,9 +1173,10 @@ static int keysym_to_keycode(Display *dpy, KeySym sym)
XkbStateRec state;
int kc = 0;
-
- if (!xkb)
- xkb = XkbGetKeyboard(dpy, XkbAllComponentsMask, XkbUseCoreKbd);
+ if (!xkb && !(xkb = XkbGetMap(dpy, XkbAllComponentsMask, XkbUseCoreKbd))) {
+ fprintf(stderr, "Warning: failed to query keyboard map\n");
+ goto out;
+ }
XkbGetState(dpy, XkbUseCoreKbd, &state);
for (kc = xkb->min_key_code; kc <= xkb->max_key_code; kc++)
default on some distributions), a call to XkbGetKeyboard always returns NULL
(causing xsetwacom to segfault) and is apparently not supported anymore (cf.
[1,2] and others). Instead, we are supposed to use XkbGetMap now.
[1] <https://bugs.freedesktop.org/show_bug.cgi?id=89240>
[2] <https://github.com/glfw/glfw/issues/389>
Signed-off-by: Sebastian Reuße <***@wirrsal.net>
---
tools/xsetwacom.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
index bbc92f1..b0f21e4 100644
--- a/tools/xsetwacom.c
+++ b/tools/xsetwacom.c
@@ -1173,9 +1173,10 @@ static int keysym_to_keycode(Display *dpy, KeySym sym)
XkbStateRec state;
int kc = 0;
-
- if (!xkb)
- xkb = XkbGetKeyboard(dpy, XkbAllComponentsMask, XkbUseCoreKbd);
+ if (!xkb && !(xkb = XkbGetMap(dpy, XkbAllComponentsMask, XkbUseCoreKbd))) {
+ fprintf(stderr, "Warning: failed to query keyboard map\n");
+ goto out;
+ }
XkbGetState(dpy, XkbUseCoreKbd, &state);
for (kc = xkb->min_key_code; kc <= xkb->max_key_code; kc++)
--
2.12.0
2.12.0