aboutsummaryrefslogtreecommitdiff
path: root/examples/pointer.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pointer.c')
-rw-r--r--examples/pointer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/pointer.c b/examples/pointer.c
index f0d9fb4b..cc58c223 100644
--- a/examples/pointer.c
+++ b/examples/pointer.c
@@ -304,8 +304,14 @@ void new_input_notify(struct wl_listener *listener, void *data) {
wlr_log(WLR_ERROR, "Failed to create XKB context");
exit(1);
}
- wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
- &rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
+ struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
+ if (!keymap) {
+ wlr_log(WLR_ERROR, "Failed to create XKB keymap");
+ exit(1);
+ }
+ wlr_keyboard_set_keymap(device->keyboard, keymap);
+ xkb_keymap_unref(keymap);
xkb_context_unref(context);
break;
default: