From 3eb07b1fdb869c3fd264a1ddbf0b6f341db57883 Mon Sep 17 00:00:00 2001 From: Jens Peters Date: Mon, 19 Jan 2026 20:42:42 +0100 Subject: [PATCH] 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). --- backend/libinput/tablet_tool.c | 10 ++++++++++ include/wlr/backend/libinput.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c index d43c6cd0a..b2430a445 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -18,6 +18,16 @@ const struct wlr_tablet_impl libinput_tablet_impl = { .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) { const char *name = get_libinput_device_name(dev->handle); struct wlr_tablet *wlr_tablet = &dev->tablet; diff --git a/include/wlr/backend/libinput.h b/include/wlr/backend/libinput.h index 663f71acd..2a4e1996e 100644 --- a/include/wlr/backend/libinput.h +++ b/include/wlr/backend/libinput.h @@ -15,6 +15,7 @@ #include struct wlr_input_device; +struct wlr_tablet_tool; 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 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_input_device_is_libinput(struct wlr_input_device *device);