From 313ac63c335f77c80e7d5e2f6a76352d98451d1c Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Sat, 17 Dec 2016 20:42:48 +0100 Subject: [PATCH] Make use of xkb_state_update_mask. Fixes mod keys in Wayland it seems. --- gfx/drivers_context/wayland_ctx.c | 7 ++++++- input/drivers_keyboard/keyboard_event_xkb.c | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index 307dca0d6f..046e8fd187 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -107,6 +107,7 @@ static enum gfx_ctx_api wl_api = GFX_CTX_NONE; /* FIXME: Move this into a header? */ int init_xkb(int fd, size_t size); int handle_xkb(int code, int value); +void handle_xkb_state_mask(uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group); void free_xkb(void); #endif @@ -176,7 +177,7 @@ static void keyboard_handle_key(void *data, } #ifdef HAVE_XKBCOMMON - if (handle_xkb(key, state) == 0) + if (handle_xkb(key, value) == 0) return; #endif input_keyboard_event(value, @@ -195,10 +196,14 @@ static void keyboard_handle_modifiers(void *data, (void)data; (void)keyboard; (void)serial; +#ifdef HAVE_XKBCOMMON + handle_xkb_state_mask(modsDepressed, modsLatched, modsLocked, group); +#else (void)modsDepressed; (void)modsLatched; (void)modsLocked; (void)group; +#endif } static void keyboard_handle_repeat_info(void *data, diff --git a/input/drivers_keyboard/keyboard_event_xkb.c b/input/drivers_keyboard/keyboard_event_xkb.c index 3cbe45490e..a422e3d9e3 100644 --- a/input/drivers_keyboard/keyboard_event_xkb.c +++ b/input/drivers_keyboard/keyboard_event_xkb.c @@ -136,6 +136,13 @@ error: return -1; } +void handle_xkb_state_mask(uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group) +{ + if (!xkb_state) + return; + xkb_state_update_mask(xkb_state, depressed, latched, locked, 0, 0, group); +} + /* FIXME: Don't handle composed and dead-keys properly. * Waiting for support in libxkbcommon ... */ int handle_xkb(int code, int value)