backend/libinput: expose libinput_tablet_tool

Exposing libinput_tablet_tool from libinput allows compositors
to set tool specific configuration options like pressure range
and eraser button behavior.

See 'libinput_tablet_tool_*()' functions which require a
'libinput_tablet_tool' handle:
https://wayland.freedesktop.org/libinput/doc/1.30.0/api/group__config.html
(libinput 1.30.0, latest at the time of writing).
This commit is contained in:
Jens Peters 2026-01-19 20:42:42 +01:00
parent b7312b4f95
commit 3eb07b1fdb
2 changed files with 16 additions and 0 deletions

View file

@ -18,6 +18,16 @@ const struct wlr_tablet_impl libinput_tablet_impl = {
.name = "libinput-tablet-tool", .name = "libinput-tablet-tool",
}; };
struct libinput_tablet_tool *wlr_libinput_get_tablet_tool_handle(
struct wlr_tablet_tool *wlr_tablet_tool) {
struct tablet_tool *tool =
wl_container_of(wlr_tablet_tool, tool, wlr_tool);
assert(tool);
return tool->handle;
}
void init_device_tablet(struct wlr_libinput_input_device *dev) { void init_device_tablet(struct wlr_libinput_input_device *dev) {
const char *name = get_libinput_device_name(dev->handle); const char *name = get_libinput_device_name(dev->handle);
struct wlr_tablet *wlr_tablet = &dev->tablet; struct wlr_tablet *wlr_tablet = &dev->tablet;

View file

@ -15,6 +15,7 @@
#include <wlr/backend/session.h> #include <wlr/backend/session.h>
struct wlr_input_device; struct wlr_input_device;
struct wlr_tablet_tool;
struct wlr_backend *wlr_libinput_backend_create(struct wlr_session *session); struct wlr_backend *wlr_libinput_backend_create(struct wlr_session *session);
/** /**
@ -22,6 +23,11 @@ struct wlr_backend *wlr_libinput_backend_create(struct wlr_session *session);
*/ */
struct libinput_device *wlr_libinput_get_device_handle( struct libinput_device *wlr_libinput_get_device_handle(
struct wlr_input_device *dev); struct wlr_input_device *dev);
/**
* Gets the underlying struct libinput_tablet_tool handle for the given tablet tool.
*/
struct libinput_tablet_tool *wlr_libinput_get_tablet_tool_handle(
struct wlr_tablet_tool *wlr_tablet_tool);
bool wlr_backend_is_libinput(struct wlr_backend *backend); bool wlr_backend_is_libinput(struct wlr_backend *backend);
bool wlr_input_device_is_libinput(struct wlr_input_device *device); bool wlr_input_device_is_libinput(struct wlr_input_device *device);