diff options
Diffstat (limited to 'backend/libinput')
-rw-r--r-- | backend/libinput/events.c | 3 | ||||
-rw-r--r-- | backend/libinput/tablet_tool.c | 12 |
2 files changed, 9 insertions, 6 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; } |