aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--river/Keyboard.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/river/Keyboard.zig b/river/Keyboard.zig
index 55efde8..4b5afce 100644
--- a/river/Keyboard.zig
+++ b/river/Keyboard.zig
@@ -85,7 +85,10 @@ fn handleKey(listener: *wl.Listener(*wlr.Keyboard.event.Key), event: *wlr.Keyboa
const modifiers = wlr_keyboard.getModifiers();
const released = event.state == .released;
- const xkb_state = wlr_keyboard.xkb_state orelse return;
+ // We must ref() the state here as a mapping could change the keyboard layout.
+ const xkb_state = (wlr_keyboard.xkb_state orelse return).ref();
+ defer xkb_state.unref();
+
const keysyms = xkb_state.keyGetSyms(keycode);
// Hide cursor when typing