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);