aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/events.c
diff options
context:
space:
mode:
authorSimon Zeni <simon@bl4ckb0ne.ca>2022-02-22 16:17:48 -0500
committerKirill Primak <vyivel@eclair.cafe>2022-03-02 18:18:05 +0000
commit9dd6e2b90521fd438c90837c646a1fb4092bfe1b (patch)
tree11c1405faf1a7371d7b12f3464793b96c122ef48 /backend/libinput/events.c
parent0a5a65cf4819ebffb74c410735ba676b288bb82d (diff)
backend/libinput: add devices wl_list
This commit prepares the ground for a wlr_libinput_input_device refactoring.
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;
}