aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/libinput/events.c3
-rw-r--r--backend/libinput/tablet_tool.c12
-rw-r--r--include/backend/libinput.h1
3 files changed, 9 insertions, 7 deletions
diff --git a/backend/libinput/events.c b/backend/libinput/events.c
index d15de6bb..93664af2 100644
--- a/backend/libinput/events.c
+++ b/backend/libinput/events.c
@@ -186,9 +186,6 @@ 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++) {
diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c
index f02e045a..7cecb091 100644
--- a/backend/libinput/tablet_tool.c
+++ b/backend/libinput/tablet_tool.c
@@ -57,9 +57,9 @@ static void destroy_tool_tool(struct wlr_libinput_tablet_tool *tool) {
}
-void wlr_libinput_tablet_tool_destroy(struct wlr_input_device *wlr_dev) {
+static void libinput_tablet_tool_destroy(struct wlr_tablet_tool *tool) {
struct wlr_libinput_tablet *tablet =
- wl_container_of(wlr_dev->tablet_tool, tablet, wlr_tool);
+ wl_container_of(tool, tablet, wlr_tool);
struct tablet_tool_list_elem *pos;
struct tablet_tool_list_elem *tmp;
@@ -72,8 +72,14 @@ void wlr_libinput_tablet_tool_destroy(struct wlr_input_device *wlr_dev) {
destroy_tool_tool(tool);
}
}
+
+ free(tablet);
}
+static struct wlr_tablet_tool_impl tool_impl = {
+ .destroy = libinput_tablet_tool_destroy,
+};
+
struct wlr_tablet_tool *create_libinput_tablet_tool(
struct libinput_device *libinput_dev) {
assert(libinput_dev);
@@ -91,7 +97,7 @@ struct wlr_tablet_tool *create_libinput_tablet_tool(
wlr_tablet_tool->name = strdup(libinput_device_get_name(libinput_dev));
wl_list_init(&libinput_tablet_tool->tools);
- wlr_tablet_tool_init(wlr_tablet_tool, NULL);
+ wlr_tablet_tool_init(wlr_tablet_tool, &tool_impl);
return wlr_tablet_tool;
}
diff --git a/include/backend/libinput.h b/include/backend/libinput.h
index 6ecdf44f..f0928133 100644
--- a/include/backend/libinput.h
+++ b/include/backend/libinput.h
@@ -67,7 +67,6 @@ 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,