From 9dd6e2b90521fd438c90837c646a1fb4092bfe1b Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Tue, 22 Feb 2022 16:17:48 -0500 Subject: backend/libinput: add devices wl_list This commit prepares the ground for a wlr_libinput_input_device refactoring. --- backend/libinput/events.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'backend/libinput/events.c') 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; } -- cgit v1.2.3