backend/libinput: rework tablet interface

The wlr_libinput_device owns its wlr_tablet and its associated wlr_tablet_tools
This commit is contained in:
Simon Zeni 2022-02-24 11:00:11 -05:00 committed by Kirill Primak
parent 4f4dd95223
commit c8456086a1
4 changed files with 116 additions and 213 deletions

View File

@ -252,6 +252,9 @@ struct libinput_device *wlr_libinput_get_device_handle(
case WLR_INPUT_DEVICE_TOUCH: case WLR_INPUT_DEVICE_TOUCH:
dev = device_from_touch(wlr_dev->touch); dev = device_from_touch(wlr_dev->touch);
break; break;
case WLR_INPUT_DEVICE_TABLET_TOOL:
dev = device_from_tablet(wlr_dev->tablet);
break;
default: default:
dev = (struct wlr_libinput_input_device *)wlr_dev; dev = (struct wlr_libinput_input_device *)wlr_dev;
break; break;

View File

@ -49,6 +49,9 @@ void destroy_libinput_input_device(struct wlr_libinput_input_device *dev)
if (dev->touch.impl) { if (dev->touch.impl) {
wlr_touch_destroy(&dev->touch); wlr_touch_destroy(&dev->touch);
} }
if (dev->tablet.impl) {
wlr_tablet_destroy(&dev->tablet);
}
} }
libinput_device_unref(dev->handle); libinput_device_unref(dev->handle);
@ -162,6 +165,14 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
dev_used = true; dev_used = true;
} }
if (libinput_device_has_capability(libinput_dev,
LIBINPUT_DEVICE_CAP_TABLET_TOOL)) {
init_device_tablet(dev);
wlr_signal_emit_safe(&backend->backend.events.new_input,
&dev->tablet.base);
dev_used = true;
}
if (dev_used) { if (dev_used) {
wl_list_insert(&backend->devices, &dev->link); wl_list_insert(&backend->devices, &dev->link);
return; return;
@ -177,20 +188,6 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
} }
wl_list_init(wlr_devices); wl_list_init(wlr_devices);
if (libinput_device_has_capability(libinput_dev,
LIBINPUT_DEVICE_CAP_TABLET_TOOL)) {
struct wlr_input_device *wlr_dev = allocate_device(backend,
libinput_dev, wlr_devices, WLR_INPUT_DEVICE_TABLET_TOOL);
if (!wlr_dev) {
goto fail;
}
wlr_dev->tablet = create_libinput_tablet(libinput_dev);
if (!wlr_dev->tablet) {
free(wlr_dev);
goto fail;
}
wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev);
}
if (libinput_device_has_capability( if (libinput_device_has_capability(
libinput_dev, LIBINPUT_DEVICE_CAP_TABLET_PAD)) { libinput_dev, LIBINPUT_DEVICE_CAP_TABLET_PAD)) {
struct wlr_input_device *wlr_dev = allocate_device(backend, struct wlr_input_device *wlr_dev = allocate_device(backend,
@ -316,16 +313,16 @@ void handle_libinput_event(struct wlr_libinput_backend *backend,
handle_touch_frame(event, &dev->touch); handle_touch_frame(event, &dev->touch);
break; break;
case LIBINPUT_EVENT_TABLET_TOOL_AXIS: case LIBINPUT_EVENT_TABLET_TOOL_AXIS:
handle_tablet_tool_axis(event, libinput_dev); handle_tablet_tool_axis(event, &dev->tablet);
break; break;
case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY:
handle_tablet_tool_proximity(event, libinput_dev); handle_tablet_tool_proximity(event, &dev->tablet);
break; break;
case LIBINPUT_EVENT_TABLET_TOOL_TIP: case LIBINPUT_EVENT_TABLET_TOOL_TIP:
handle_tablet_tool_tip(event, libinput_dev); handle_tablet_tool_tip(event, &dev->tablet);
break; break;
case LIBINPUT_EVENT_TABLET_TOOL_BUTTON: case LIBINPUT_EVENT_TABLET_TOOL_BUTTON:
handle_tablet_tool_button(event, libinput_dev); handle_tablet_tool_button(event, &dev->tablet);
break; break;
case LIBINPUT_EVENT_TABLET_PAD_BUTTON: case LIBINPUT_EVENT_TABLET_PAD_BUTTON:
handle_tablet_pad_button(event, libinput_dev); handle_tablet_pad_button(event, libinput_dev);

View File

@ -1,92 +1,60 @@
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L #define _POSIX_C_SOURCE 200809L
#endif
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <libinput.h> #include <libinput.h>
#include <stdlib.h> #include <stdlib.h>
#include <wayland-util.h>
#include <wlr/backend/session.h>
#include <wlr/interfaces/wlr_tablet_tool.h> #include <wlr/interfaces/wlr_tablet_tool.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/libinput.h" #include "backend/libinput.h"
#include "util/array.h"
#include "util/signal.h" #include "util/signal.h"
static bool tablet_is_libinput(struct wlr_tablet *tablet) { struct tablet_tool {
return tablet->impl == &libinput_tablet_impl;
}
struct wlr_libinput_tablet_tool {
struct wlr_tablet_tool wlr_tool; struct wlr_tablet_tool wlr_tool;
struct libinput_tablet_tool *handle;
struct libinput_tablet_tool *libinput_tool; struct wl_list link; // wlr_libinput_input_device::tablet_tools
bool unique;
// Refcount for destroy + release
size_t pad_refs;
}; };
struct wlr_libinput_tablet { static void tool_destroy(struct tablet_tool *tool) {
struct wlr_tablet wlr_tablet;
struct wl_array tools; // struct wlr_libinput_tablet_tool *
};
static void destroy_tool(struct wlr_libinput_tablet_tool *tool) {
wlr_signal_emit_safe(&tool->wlr_tool.events.destroy, &tool->wlr_tool); wlr_signal_emit_safe(&tool->wlr_tool.events.destroy, &tool->wlr_tool);
libinput_tablet_tool_ref(tool->libinput_tool); libinput_tablet_tool_unref(tool->handle);
libinput_tablet_tool_set_user_data(tool->libinput_tool, NULL); libinput_tablet_tool_set_user_data(tool->handle, NULL);
wl_list_remove(&tool->link);
free(tool); free(tool);
} }
static void destroy_tablet(struct wlr_tablet *wlr_tablet) { static void tablet_destroy(struct wlr_tablet *wlr_tablet) {
assert(tablet_is_libinput(wlr_tablet)); struct wlr_libinput_input_device *dev = device_from_tablet(wlr_tablet);
struct wlr_libinput_tablet *tablet = struct tablet_tool *tool, *tmp;
wl_container_of(wlr_tablet, tablet, wlr_tablet); wl_list_for_each_safe(tool, tmp, &dev->tablet_tools, link) {
tool_destroy(tool);
struct wlr_libinput_tablet_tool **tool_ptr;
wl_array_for_each(tool_ptr, &tablet->tools) {
struct wlr_libinput_tablet_tool *tool = *tool_ptr;
if (--tool->pad_refs == 0) {
destroy_tool(tool);
}
} }
wl_array_release(&tablet->tools);
free(tablet);
} }
const struct wlr_tablet_impl libinput_tablet_impl = { const struct wlr_tablet_impl libinput_tablet_impl = {
.destroy = destroy_tablet, .destroy = tablet_destroy,
}; };
struct wlr_tablet *create_libinput_tablet( void init_device_tablet(struct wlr_libinput_input_device *dev) {
struct libinput_device *libinput_dev) { const char *name = libinput_device_get_name(dev->handle);
assert(libinput_dev); struct wlr_tablet *wlr_tablet = &dev->tablet;
struct wlr_libinput_tablet *libinput_tablet =
calloc(1, sizeof(struct wlr_libinput_tablet));
if (!libinput_tablet) {
wlr_log(WLR_ERROR, "Unable to allocate wlr_tablet_tool");
return NULL;
}
struct wlr_tablet *wlr_tablet = &libinput_tablet->wlr_tablet;
const char *name = libinput_device_get_name(libinput_dev);
wlr_tablet_init(wlr_tablet, &libinput_tablet_impl, name); wlr_tablet_init(wlr_tablet, &libinput_tablet_impl, name);
wlr_tablet->base.vendor = libinput_device_get_id_vendor(libinput_dev); wlr_tablet->base.vendor = libinput_device_get_id_vendor(dev->handle);
wlr_tablet->base.product = libinput_device_get_id_product(libinput_dev); wlr_tablet->base.product = libinput_device_get_id_product(dev->handle);
struct udev_device *udev = libinput_device_get_udev_device(libinput_dev); struct udev_device *udev = libinput_device_get_udev_device(dev->handle);
char **dst = wl_array_add(&wlr_tablet->paths, sizeof(char *)); char **dst = wl_array_add(&wlr_tablet->paths, sizeof(char *));
*dst = strdup(udev_device_get_syspath(udev)); *dst = strdup(udev_device_get_syspath(udev));
wlr_tablet->name = strdup(libinput_device_get_name(libinput_dev)); wl_list_init(&dev->tablet_tools);
}
wl_array_init(&libinput_tablet->tools); struct wlr_libinput_input_device *device_from_tablet(
struct wlr_tablet *wlr_tablet) {
assert(wlr_tablet->impl == &libinput_tablet_impl);
return wlr_tablet; struct wlr_libinput_input_device *dev =
wl_container_of(wlr_tablet, dev, tablet);
return dev;
} }
static enum wlr_tablet_tool_type wlr_type_from_libinput_type( static enum wlr_tablet_tool_type wlr_type_from_libinput_type(
@ -112,87 +80,55 @@ static enum wlr_tablet_tool_type wlr_type_from_libinput_type(
abort(); // unreachable abort(); // unreachable
} }
static struct wlr_libinput_tablet_tool *get_wlr_tablet_tool( static struct tablet_tool *get_tablet_tool(
struct libinput_tablet_tool *tool) { struct wlr_libinput_input_device *dev,
struct wlr_libinput_tablet_tool *ret = struct libinput_tablet_tool *libinput_tool) {
libinput_tablet_tool_get_user_data(tool); struct tablet_tool *tool =
libinput_tablet_tool_get_user_data(libinput_tool);
if (ret) { if (tool) {
return ret; return tool;
} }
ret = calloc(1, sizeof(struct wlr_libinput_tablet_tool)); tool = calloc(1, sizeof(struct tablet_tool));
if (!ret) { if (tool == NULL) {
wlr_log_errno(WLR_ERROR, "failed to allocate wlr_libinput_tablet_tool");
return NULL; return NULL;
} }
ret->libinput_tool = libinput_tablet_tool_ref(tool); tool->wlr_tool.type = wlr_type_from_libinput_type(
ret->wlr_tool.pressure = libinput_tablet_tool_has_pressure(tool); libinput_tablet_tool_get_type(libinput_tool));
ret->wlr_tool.distance = libinput_tablet_tool_has_distance(tool); tool->wlr_tool.hardware_serial =
ret->wlr_tool.tilt = libinput_tablet_tool_has_tilt(tool); libinput_tablet_tool_get_serial(libinput_tool);
ret->wlr_tool.rotation = libinput_tablet_tool_has_rotation(tool); tool->wlr_tool.hardware_wacom =
ret->wlr_tool.slider = libinput_tablet_tool_has_slider(tool); libinput_tablet_tool_get_tool_id(libinput_tool);
ret->wlr_tool.wheel = libinput_tablet_tool_has_wheel(tool);
ret->wlr_tool.hardware_serial = libinput_tablet_tool_get_serial(tool); tool->wlr_tool.pressure = libinput_tablet_tool_has_pressure(libinput_tool);
ret->wlr_tool.hardware_wacom = libinput_tablet_tool_get_tool_id(tool); tool->wlr_tool.distance = libinput_tablet_tool_has_distance(libinput_tool);
ret->wlr_tool.type = wlr_type_from_libinput_type( tool->wlr_tool.tilt = libinput_tablet_tool_has_tilt(libinput_tool);
libinput_tablet_tool_get_type(tool)); tool->wlr_tool.rotation = libinput_tablet_tool_has_rotation(libinput_tool);
tool->wlr_tool.slider = libinput_tablet_tool_has_slider(libinput_tool);
tool->wlr_tool.wheel = libinput_tablet_tool_has_wheel(libinput_tool);
ret->unique = libinput_tablet_tool_is_unique(tool); wl_signal_init(&tool->wlr_tool.events.destroy);
wl_signal_init(&ret->wlr_tool.events.destroy); tool->handle = libinput_tablet_tool_ref(libinput_tool);
libinput_tablet_tool_set_user_data(libinput_tool, tool);
libinput_tablet_tool_set_user_data(tool, ret); wl_list_insert(&dev->tablet_tools, &tool->link);
return ret; return tool;
}
static void ensure_tool_reference(struct wlr_libinput_tablet_tool *tool,
struct wlr_tablet *wlr_dev) {
assert(tablet_is_libinput(wlr_dev));
struct wlr_libinput_tablet *tablet =
wl_container_of(wlr_dev, tablet, wlr_tablet);
struct wlr_libinput_tablet_tool **tool_ptr;
wl_array_for_each(tool_ptr, &tablet->tools) {
if (*tool_ptr == tool) { // We already have a ref
// XXX: We *could* optimize the tool to the front of
// the list here, since we will probably get the next
// couple of events from the same tool.
// BUT the list should always be rather short (probably
// single digit amount of tools) so it might be more
// work than it saves
return;
}
}
struct wlr_libinput_tablet_tool **dst =
wl_array_add(&tablet->tools, sizeof(tool));
if (!dst) {
wlr_log(WLR_ERROR, "Failed to allocate memory for tracking tablet tool");
return;
}
*dst = tool;
++tool->pad_refs;
} }
void handle_tablet_tool_axis(struct libinput_event *event, void handle_tablet_tool_axis(struct libinput_event *event,
struct libinput_device *libinput_dev) { struct wlr_tablet *wlr_tablet) {
struct wlr_input_device *wlr_dev =
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_TOOL, libinput_dev);
if (!wlr_dev) {
wlr_log(WLR_DEBUG,
"Got a tablet tool event for a device with no tablet tools?");
return;
}
struct libinput_event_tablet_tool *tevent = struct libinput_event_tablet_tool *tevent =
libinput_event_get_tablet_tool_event(event); libinput_event_get_tablet_tool_event(event);
struct wlr_event_tablet_tool_axis wlr_event = { 0 }; struct wlr_libinput_input_device *dev = device_from_tablet(wlr_tablet);
struct wlr_libinput_tablet_tool *tool = get_wlr_tablet_tool( struct tablet_tool *tool =
libinput_event_tablet_tool_get_tool(tevent)); get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
ensure_tool_reference(tool, wlr_dev->tablet);
wlr_event.device = wlr_dev; struct wlr_event_tablet_tool_axis wlr_event = { 0 };
wlr_event.device = &wlr_tablet->base;
wlr_event.tool = &tool->wlr_tool; wlr_event.tool = &tool->wlr_tool;
wlr_event.time_msec = wlr_event.time_msec =
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)); usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
@ -234,27 +170,20 @@ void handle_tablet_tool_axis(struct libinput_event *event,
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_WHEEL; wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_WHEEL;
wlr_event.wheel_delta = libinput_event_tablet_tool_get_wheel_delta(tevent); wlr_event.wheel_delta = libinput_event_tablet_tool_get_wheel_delta(tevent);
} }
wlr_signal_emit_safe(&wlr_dev->tablet->events.axis, &wlr_event); wlr_signal_emit_safe(&wlr_tablet->events.axis, &wlr_event);
} }
void handle_tablet_tool_proximity(struct libinput_event *event, void handle_tablet_tool_proximity(struct libinput_event *event,
struct libinput_device *libinput_dev) { struct wlr_tablet *wlr_tablet) {
struct wlr_input_device *wlr_dev =
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_TOOL, libinput_dev);
if (!wlr_dev) {
wlr_log(WLR_DEBUG,
"Got a tablet tool event for a device with no tablet tools?");
return;
}
struct libinput_event_tablet_tool *tevent = struct libinput_event_tablet_tool *tevent =
libinput_event_get_tablet_tool_event(event); libinput_event_get_tablet_tool_event(event);
struct wlr_event_tablet_tool_proximity wlr_event = { 0 }; struct wlr_libinput_input_device *dev = device_from_tablet(wlr_tablet);
struct wlr_libinput_tablet_tool *tool = get_wlr_tablet_tool( struct tablet_tool *tool =
libinput_event_tablet_tool_get_tool(tevent)); get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
ensure_tool_reference(tool, wlr_dev->tablet);
struct wlr_event_tablet_tool_proximity wlr_event = { 0 };
wlr_event.tool = &tool->wlr_tool; wlr_event.tool = &tool->wlr_tool;
wlr_event.device = wlr_dev; wlr_event.device = &wlr_tablet->base;
wlr_event.time_msec = wlr_event.time_msec =
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)); usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
wlr_event.x = libinput_event_tablet_tool_get_x_transformed(tevent, 1); wlr_event.x = libinput_event_tablet_tool_get_x_transformed(tevent, 1);
@ -268,56 +197,34 @@ void handle_tablet_tool_proximity(struct libinput_event *event,
wlr_event.state = WLR_TABLET_TOOL_PROXIMITY_IN; wlr_event.state = WLR_TABLET_TOOL_PROXIMITY_IN;
break; break;
} }
wlr_signal_emit_safe(&wlr_dev->tablet->events.proximity, &wlr_event); wlr_signal_emit_safe(&wlr_tablet->events.proximity, &wlr_event);
if (libinput_event_tablet_tool_get_proximity_state(tevent) == if (libinput_event_tablet_tool_get_proximity_state(tevent) ==
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN) { LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN) {
handle_tablet_tool_axis(event, libinput_dev); handle_tablet_tool_axis(event, wlr_tablet);
} }
// If the tool is not unique, libinput will not find it again after the // If the tool is not unique, libinput will not find it again after the
// proximity out, so we should destroy it // proximity out, so we should destroy it
if (!tool->unique && if (!libinput_tablet_tool_is_unique(tool->handle)
libinput_event_tablet_tool_get_proximity_state(tevent) == && libinput_event_tablet_tool_get_proximity_state(tevent) ==
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT) { LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT) {
// The tool isn't unique, it can't be on multiple tablets // The tool isn't unique, it can't be on multiple tablets
assert(tool->pad_refs == 1); tool_destroy(tool);
assert(tablet_is_libinput(wlr_dev->tablet));
struct wlr_libinput_tablet *tablet =
wl_container_of(wlr_dev->tablet, tablet, wlr_tablet);
size_t i = 0;
struct wlr_libinput_tablet_tool **tool_ptr;
wl_array_for_each(tool_ptr, &tablet->tools) {
if (*tool_ptr == tool) {
array_remove_at(&tablet->tools, i * sizeof(tool), sizeof(tool));
break;
}
i++;
}
destroy_tool(tool);
} }
} }
void handle_tablet_tool_tip(struct libinput_event *event, void handle_tablet_tool_tip(struct libinput_event *event,
struct libinput_device *libinput_dev) { struct wlr_tablet *wlr_tablet) {
struct wlr_input_device *wlr_dev = handle_tablet_tool_axis(event, wlr_tablet);
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_TOOL, libinput_dev);
if (!wlr_dev) {
wlr_log(WLR_DEBUG,
"Got a tablet tool event for a device with no tablet tools?");
return;
}
handle_tablet_tool_axis(event, libinput_dev);
struct libinput_event_tablet_tool *tevent = struct libinput_event_tablet_tool *tevent =
libinput_event_get_tablet_tool_event(event); libinput_event_get_tablet_tool_event(event);
struct wlr_event_tablet_tool_tip wlr_event = { 0 }; struct wlr_libinput_input_device *dev = device_from_tablet(wlr_tablet);
struct wlr_libinput_tablet_tool *tool = get_wlr_tablet_tool( struct tablet_tool *tool =
libinput_event_tablet_tool_get_tool(tevent)); get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
ensure_tool_reference(tool, wlr_dev->tablet);
wlr_event.device = wlr_dev; struct wlr_event_tablet_tool_tip wlr_event = { 0 };
wlr_event.device = &wlr_tablet->base;
wlr_event.tool = &tool->wlr_tool; wlr_event.tool = &tool->wlr_tool;
wlr_event.time_msec = wlr_event.time_msec =
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)); usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
@ -332,27 +239,20 @@ void handle_tablet_tool_tip(struct libinput_event *event,
wlr_event.state = WLR_TABLET_TOOL_TIP_DOWN; wlr_event.state = WLR_TABLET_TOOL_TIP_DOWN;
break; break;
} }
wlr_signal_emit_safe(&wlr_dev->tablet->events.tip, &wlr_event); wlr_signal_emit_safe(&wlr_tablet->events.tip, &wlr_event);
} }
void handle_tablet_tool_button(struct libinput_event *event, void handle_tablet_tool_button(struct libinput_event *event,
struct libinput_device *libinput_dev) { struct wlr_tablet *wlr_tablet) {
struct wlr_input_device *wlr_dev = handle_tablet_tool_axis(event, wlr_tablet);
get_appropriate_device(WLR_INPUT_DEVICE_TABLET_TOOL, libinput_dev);
if (!wlr_dev) {
wlr_log(WLR_DEBUG,
"Got a tablet tool event for a device with no tablet tools?");
return;
}
handle_tablet_tool_axis(event, libinput_dev);
struct libinput_event_tablet_tool *tevent = struct libinput_event_tablet_tool *tevent =
libinput_event_get_tablet_tool_event(event); libinput_event_get_tablet_tool_event(event);
struct wlr_event_tablet_tool_button wlr_event = { 0 }; struct wlr_libinput_input_device *dev = device_from_tablet(wlr_tablet);
struct wlr_libinput_tablet_tool *tool = get_wlr_tablet_tool( struct tablet_tool *tool =
libinput_event_tablet_tool_get_tool(tevent)); get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
ensure_tool_reference(tool, wlr_dev->tablet);
wlr_event.device = wlr_dev; struct wlr_event_tablet_tool_button wlr_event = { 0 };
wlr_event.device = &wlr_tablet->base;
wlr_event.tool = &tool->wlr_tool; wlr_event.tool = &tool->wlr_tool;
wlr_event.time_msec = wlr_event.time_msec =
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)); usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
@ -365,5 +265,5 @@ void handle_tablet_tool_button(struct libinput_event *event,
wlr_event.state = WLR_BUTTON_PRESSED; wlr_event.state = WLR_BUTTON_PRESSED;
break; break;
} }
wlr_signal_emit_safe(&wlr_dev->tablet->events.button, &wlr_event); wlr_signal_emit_safe(&wlr_tablet->events.button, &wlr_event);
} }

View File

@ -38,6 +38,8 @@ struct wlr_libinput_input_device {
struct wlr_pointer pointer; struct wlr_pointer pointer;
struct wlr_switch switch_device; struct wlr_switch switch_device;
struct wlr_touch touch; struct wlr_touch touch;
struct wlr_tablet tablet;
struct wl_list tablet_tools; // see backend/libinput/tablet_tool.c
struct wl_list link; struct wl_list link;
}; };
@ -111,16 +113,17 @@ void handle_touch_cancel(struct libinput_event *event,
void handle_touch_frame(struct libinput_event *event, void handle_touch_frame(struct libinput_event *event,
struct wlr_touch *touch); struct wlr_touch *touch);
struct wlr_tablet *create_libinput_tablet( void init_device_tablet(struct wlr_libinput_input_device *dev);
struct libinput_device *device); struct wlr_libinput_input_device *device_from_tablet(
struct wlr_tablet *tablet);
void handle_tablet_tool_axis(struct libinput_event *event, void handle_tablet_tool_axis(struct libinput_event *event,
struct libinput_device *device); struct wlr_tablet *tablet);
void handle_tablet_tool_proximity(struct libinput_event *event, void handle_tablet_tool_proximity(struct libinput_event *event,
struct libinput_device *device); struct wlr_tablet *tablet);
void handle_tablet_tool_tip(struct libinput_event *event, void handle_tablet_tool_tip(struct libinput_event *event,
struct libinput_device *device); struct wlr_tablet *tablet);
void handle_tablet_tool_button(struct libinput_event *event, void handle_tablet_tool_button(struct libinput_event *event,
struct libinput_device *device); struct wlr_tablet *tablet);
struct wlr_tablet_pad *create_libinput_tablet_pad( struct wlr_tablet_pad *create_libinput_tablet_pad(
struct libinput_device *device); struct libinput_device *device);