aboutsummaryrefslogtreecommitdiff
path: root/examples/pointer.c
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-08-28 10:29:53 -0400
committerTony Crisci <tony@dubstepdish.com>2017-08-28 10:29:53 -0400
commit5c845f14ed72bcdbd45a2e719223c441846f62ad (patch)
treeac07487864f4886d37bec799b77ee0a43a4fbf0b /examples/pointer.c
parentdf0ee7f25ff628360f38d87b8a74daaa2cc742a8 (diff)
handle input device destroy
Diffstat (limited to 'examples/pointer.c')
-rw-r--r--examples/pointer.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/examples/pointer.c b/examples/pointer.c
index 3863c0e8..8ad18442 100644
--- a/examples/pointer.c
+++ b/examples/pointer.c
@@ -188,6 +188,18 @@ static void handle_input_add(struct compositor_state *state, struct
}
}
+static void handle_input_remove(struct compositor_state *state, struct
+ wlr_input_device *device) {
+ struct sample_state *sample = state->data;
+ struct sample_input_device *s_device, *tmp = NULL;
+ wl_list_for_each_safe(s_device, tmp, &sample->devices, link) {
+ if (s_device->device == device) {
+ wl_list_remove(&s_device->link);
+ free(s_device);
+ }
+ }
+}
+
static void handle_cursor_motion(struct wl_listener *listener, void *data) {
struct sample_state *sample = wl_container_of(listener, sample, cursor_motion);
struct wlr_event_pointer_motion *event = data;
@@ -339,8 +351,7 @@ int main(int argc, char *argv[]) {
compositor.output_resolution_cb = handle_output_resolution;
compositor.output_frame_cb = handle_output_frame;
compositor.input_add_cb = handle_input_add;
- // TODO input_remove_cb
- //compositor.input_remove_cb = handle_input_add;
+ compositor.input_remove_cb = handle_input_remove;
state.compositor = &compositor;