diff options
author | Markus Ongyerth <ongy@ongy.net> | 2018-05-15 15:49:55 +0200 |
---|---|---|
committer | Markus Ongyerth <ongy@ongy.net> | 2018-07-14 09:43:16 +0200 |
commit | adba68a3c1fb51771342512f570c552a7404cc93 (patch) | |
tree | e974973b32f8dff2c1b906ce4d71820fe71c09a1 /backend | |
parent | 31cec36b741d3c645c18c4e7e8dedbd6c6e3ece5 (diff) |
Use tablet_tool impl in libinput backend
Diffstat (limited to 'backend')
-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; } |