diff options
author | Simon Ser <contact@emersion.fr> | 2021-11-22 22:30:40 +0100 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-11-23 14:14:18 +0000 |
commit | 1d9c1bcea6a223379af63b4d779d53663eaffcf8 (patch) | |
tree | ddab71bb63061a9bb0868fdce1496b52b4fea5a5 /backend/libinput | |
parent | c9ba9e82b6a829d6e6d5acc65753b3ade46cefb9 (diff) |
input-device: remove wlr_input_device.link
This field's ownership is unclear: it's in wlr_input_device, but
it's not managed by the common code, it's up to each individual
backend to use it and clean it up.
Since this is a backend implementation detail, move it to the
backend-specific structs.
Diffstat (limited to 'backend/libinput')
-rw-r--r-- | backend/libinput/backend.c | 6 | ||||
-rw-r--r-- | backend/libinput/events.c | 16 |
2 files changed, 11 insertions, 11 deletions
diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 00145e41..4191f350 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -143,9 +143,9 @@ static void backend_destroy(struct wlr_backend *wlr_backend) { struct wl_list **wlr_devices_ptr; wl_array_for_each(wlr_devices_ptr, &backend->wlr_device_lists) { - struct wlr_input_device *wlr_dev, *next; - wl_list_for_each_safe(wlr_dev, next, *wlr_devices_ptr, link) { - wlr_input_device_destroy(wlr_dev); + struct wlr_libinput_input_device *dev, *tmp; + wl_list_for_each_safe(dev, tmp, *wlr_devices_ptr, link) { + wlr_input_device_destroy(&dev->wlr_input_device); } free(*wlr_devices_ptr); } diff --git a/backend/libinput/events.c b/backend/libinput/events.c index 82883779..67598998 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -23,10 +23,10 @@ struct wlr_input_device *get_appropriate_device( if (!wlr_devices) { return NULL; } - struct wlr_input_device *dev; + struct wlr_libinput_input_device *dev; wl_list_for_each(dev, wlr_devices, link) { - if (dev->type == desired_type) { - return dev; + if (dev->wlr_input_device.type == desired_type) { + return &dev->wlr_input_device; } } return NULL; @@ -36,7 +36,7 @@ static void input_device_destroy(struct wlr_input_device *wlr_dev) { struct wlr_libinput_input_device *dev = get_libinput_device_from_device(wlr_dev); libinput_device_unref(dev->handle); - wl_list_remove(&dev->wlr_input_device.link); + wl_list_remove(&dev->link); free(dev); } @@ -63,7 +63,7 @@ static struct wlr_input_device *allocate_device( if (output_name != NULL) { wlr_dev->output_name = strdup(output_name); } - wl_list_insert(wlr_devices, &wlr_dev->link); + wl_list_insert(wlr_devices, &dev->link); dev->handle = libinput_dev; libinput_device_ref(libinput_dev); wlr_input_device_init(wlr_dev, type, &input_device_impl, @@ -198,7 +198,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, fail: wlr_log(WLR_ERROR, "Could not allocate new device"); - struct wlr_input_device *dev, *tmp_dev; + struct wlr_libinput_input_device *dev, *tmp_dev; wl_list_for_each_safe(dev, tmp_dev, wlr_devices, link) { free(dev); } @@ -215,9 +215,9 @@ static void handle_device_removed(struct wlr_libinput_backend *backend, if (!wlr_devices) { return; } - struct wlr_input_device *dev, *tmp_dev; + struct wlr_libinput_input_device *dev, *tmp_dev; wl_list_for_each_safe(dev, tmp_dev, wlr_devices, link) { - wlr_input_device_destroy(dev); + wlr_input_device_destroy(&dev->wlr_input_device); } size_t i = 0; struct wl_list **ptr; |