aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/events.c
diff options
context:
space:
mode:
authorMarkus Ongyerth <ongy@ongy.net>2018-04-17 19:09:42 +0200
committerMarkus Ongyerth <ongy@ongy.net>2018-07-14 09:40:39 +0200
commit000b305eccb8d732aa2bde5f4b2f126c23e574cf (patch)
tree836f48065a8f2254d1bbb68fc8eb54ffe2bfbb0d /backend/libinput/events.c
parentbf8751d632c32d5d564bd8cae163199b4db54869 (diff)
backend/libinput: Manage tablet tool livetimes
This adds the management code to manage tablet tools lifetimes from libinput. It follows the suggestion made in the tablet-unstable-v2.xml to destroy tablet_tools once all tablets that it got into contact with were removed from the system. This is implemented via a refcount. If a tool is *not* unique, it will be destroyed on proximity out. This is libinput specific and mentioned in libinput docs that tools will not be found again, so we shouldn't keep a reference to them. Also they can't be on other tablets as well, because they cannot be tracked. The naming in this commit is a bit off (to not break things). The wlr names stay the same, tablet_tool is the libinput_device with capaiblity LIBINPUT_DEVICE_CAP_TABLET_TOOL which is more akin to "tablet" in the tablet-unstable-v2 protocol. The struct that corresponds to the tablet_tool in tablet-unstable-v2 is called tablet_tool_tool, a rename should be done at some point in the future.
Diffstat (limited to 'backend/libinput/events.c')
-rw-r--r--backend/libinput/events.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/backend/libinput/events.c b/backend/libinput/events.c
index 93664af2..d15de6bb 100644
--- a/backend/libinput/events.c
+++ b/backend/libinput/events.c
@@ -186,6 +186,9 @@ static void handle_device_removed(struct wlr_libinput_backend *backend,
}
struct wlr_input_device *dev, *tmp_dev;
wl_list_for_each_safe(dev, tmp_dev, wlr_devices, link) {
+ if (dev->type == WLR_INPUT_DEVICE_TABLET_TOOL) {
+ wlr_libinput_tablet_tool_destroy(dev);
+ }
wlr_input_device_destroy(dev);
}
for (size_t i = 0; i < backend->wlr_device_lists.length; i++) {