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 <s...@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


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to