Use tablet_tool impl in libinput backend

This commit is contained in:
Markus Ongyerth 2018-05-15 15:49:55 +02:00
parent 31cec36b74
commit adba68a3c1
3 changed files with 9 additions and 7 deletions

View file

@ -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++) {

View file

@ -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;
}

View file

@ -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,