aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rootston/keyboard.c1
-rw-r--r--types/wlr_keyboard.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/rootston/keyboard.c b/rootston/keyboard.c
index 758a49fb..16071c0c 100644
--- a/rootston/keyboard.c
+++ b/rootston/keyboard.c
@@ -364,6 +364,7 @@ struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
}
wlr_keyboard_set_keymap(device->keyboard, keymap);
+ xkb_keymap_unref(keymap);
xkb_context_unref(context);
int repeat_rate = (config->repeat_rate > 0) ? config->repeat_rate : 25;
diff --git a/types/wlr_keyboard.c b/types/wlr_keyboard.c
index 1c35825e..5ec8c043 100644
--- a/types/wlr_keyboard.c
+++ b/types/wlr_keyboard.c
@@ -118,7 +118,7 @@ void wlr_keyboard_destroy(struct wlr_keyboard *kb) {
wl_list_remove(&kb->events.key.listener_list);
}
xkb_state_unref(kb->xkb_state);
- xkb_map_unref(kb->keymap);
+ xkb_keymap_unref(kb->keymap);
close(kb->keymap_fd);
free(kb);
}
@@ -136,6 +136,11 @@ void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
}
xkb_keymap_ref(keymap);
kb->keymap = keymap;
+
+ if (kb->xkb_state) {
+ xkb_state_unref(kb->xkb_state);
+ }
+
kb->xkb_state = xkb_state_new(kb->keymap);
if (kb->xkb_state == NULL) {
wlr_log(L_ERROR, "Failed to create XKB state");