aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/events.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/libinput/events.c')
-rw-r--r--backend/libinput/events.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/backend/libinput/events.c b/backend/libinput/events.c
index e8d99f25..39b3fc00 100644
--- a/backend/libinput/events.c
+++ b/backend/libinput/events.c
@@ -224,6 +224,16 @@ static void handle_device_removed(struct wlr_libinput_backend *backend,
int product = libinput_device_get_id_product(libinput_dev);
const char *name = libinput_device_get_name(libinput_dev);
wlr_log(WLR_DEBUG, "Removing %s [%d:%d]", name, vendor, product);
+
+ if (!wl_list_empty(&backend->devices)) {
+ struct wlr_libinput_input_device *dev, *tmp_dev;
+ wl_list_for_each_safe(dev, tmp_dev, &backend->devices, link) {
+ if (dev->handle == libinput_dev) {
+ destroy_libinput_input_device(dev);
+ }
+ }
+ }
+
if (!wlr_devices) {
return;
}