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.
This commit is contained in:
Markus Ongyerth 2018-04-17 19:09:42 +02:00
parent bf8751d632
commit 000b305ecc
4 changed files with 222 additions and 1 deletions

View file

@ -67,6 +67,7 @@ void handle_touch_cancel(struct libinput_event *event,
struct wlr_tablet_tool *create_libinput_tablet_tool(
struct libinput_device *device);
void wlr_libinput_tablet_tool_destroy(struct wlr_input_device *device);
void handle_tablet_tool_axis(struct libinput_event *event,
struct libinput_device *device);
void handle_tablet_tool_proximity(struct libinput_event *event,