aboutsummaryrefslogtreecommitdiff
path: root/examples/multi-pointer.c
diff options
context:
space:
mode:
authorsghctoma <sghctoma@gmail.com>2018-09-07 15:45:20 +0200
committersghctoma <sghctoma@gmail.com>2018-09-07 15:45:20 +0200
commitbbeed1bd3179a082b5bfb04010e6c476e75e4320 (patch)
tree3042498f064af4c4517bf66798caa607ebbd759a /examples/multi-pointer.c
parentd948bffd3e7b283870dcbd7f1a5dd2aaea1950ec (diff)
parent085142ba346e0b8dd1a9b1a969a37156cf5656c1 (diff)
Merge remote-tracking branch 'upstream/master' into fix-freebsd-direct-session
Diffstat (limited to 'examples/multi-pointer.c')
-rw-r--r--examples/multi-pointer.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/examples/multi-pointer.c b/examples/multi-pointer.c
index 958e90f6..49670c39 100644
--- a/examples/multi-pointer.c
+++ b/examples/multi-pointer.c
@@ -239,15 +239,21 @@ 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;
case WLR_INPUT_DEVICE_POINTER:;
- struct sample_cursor *cursor = calloc(1, sizeof(struct sample_cursor));
+ struct sample_cursor *cursor = calloc(1, sizeof(struct sample_cursor));
struct sample_pointer *pointer = calloc(1, sizeof(struct sample_pointer));
pointer->device = device;
- cursor->sample = sample;
+ cursor->sample = sample;
cursor->device = device;
cursor->cursor = wlr_cursor_create();
@@ -324,6 +330,11 @@ int main(int argc, char *argv[]) {
cursor_destroy(cursor);
}
+ struct sample_pointer *pointer, *tmp_pointer;
+ wl_list_for_each_safe(pointer, tmp_pointer, &state.pointers, link) {
+ free(pointer);
+ }
+
wlr_xcursor_theme_destroy(theme);
wlr_output_layout_destroy(state.layout);
}