diff options
author | Dominique Martinet <asmadeus@codewreck.org> | 2017-08-11 22:46:50 +0200 |
---|---|---|
committer | Dominique Martinet <asmadeus@codewreck.org> | 2017-08-12 00:11:18 +0200 |
commit | be3a0ad065a946c8dfe753368757f3d5744059e6 (patch) | |
tree | 6b7468f55780a5bc0155e141297a5731d1dfe75a /backend/libinput | |
parent | 65a899924221c3104800a8676852b34b0cd7223d (diff) |
libinput backend: fill in handle_device_removed
And fix input_remove_notify accordingly
Diffstat (limited to 'backend/libinput')
-rw-r--r-- | backend/libinput/events.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/backend/libinput/events.c b/backend/libinput/events.c index 0cdf26ec..9afdab21 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -111,8 +111,21 @@ static void handle_device_added(struct wlr_backend_state *state, static void handle_device_removed(struct wlr_backend_state *state, struct libinput_device *device) { - wlr_log(L_DEBUG, "libinput device removed"); - // TODO + list_t *devices = libinput_device_get_user_data(device); + for (size_t i = 0; i < devices->length; i++) { + struct wlr_input_device *wlr_device = devices->items[i]; + wlr_log(L_DEBUG, "Removing %s [%d:%d]", wlr_device->name, + wlr_device->vendor, wlr_device->product); + wl_signal_emit(&state->backend->events.input_remove, wlr_device); + wlr_input_device_destroy(wlr_device); + } + for (size_t i = 0; i < state->devices->length; i++) { + if (state->devices->items[i] == devices) { + list_del(state->devices, i); + break; + } + } + list_free(devices); } void wlr_libinput_event(struct wlr_backend_state *state, |