Make use of xkb_state_update_mask.

Fixes mod keys in Wayland it seems.
This commit is contained in:
Hans-Kristian Arntzen 2016-12-17 20:42:48 +01:00
parent b2059dcb79
commit 313ac63c33
2 changed files with 13 additions and 1 deletions

View File

@ -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,

View File

@ -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)