aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-10-11 22:45:23 -0400
committerDrew DeVault <sir@cmpwn.com>2017-10-11 22:45:39 -0400
commit2272f3d47cdcb5ffa42dcd20ad87253f78a2e9d0 (patch)
tree19868f3a19aefac4487976880ed6bf89201ec6b2
parentf73cb2aa1fbaf6c7cd937376edaa0128974228f3 (diff)
Don't segfault wlr_keyboard when no xkb state
-rw-r--r--types/wlr_keyboard.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/types/wlr_keyboard.c b/types/wlr_keyboard.c
index f37895b0..c27264ef 100644
--- a/types/wlr_keyboard.c
+++ b/types/wlr_keyboard.c
@@ -48,6 +48,9 @@ static void keyboard_modifier_update(struct wlr_keyboard *keyboard) {
void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
uint32_t group) {
+ if (!keyboard->xkb_state) {
+ return;
+ }
xkb_state_update_mask(keyboard->xkb_state, mods_depressed, mods_latched,
mods_locked, 0, 0, group);
keyboard_modifier_update(keyboard);
@@ -55,6 +58,9 @@ void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
struct wlr_event_keyboard_key *event) {
+ if (!keyboard->xkb_state) {
+ return;
+ }
if (event->update_state) {
uint32_t keycode = event->keycode + 8;
xkb_state_update_key(keyboard->xkb_state, keycode,