From 42c0bff29b652c3dc8e92dbb41324e19050b86d1 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 3 Jun 2025 14:07:40 +1000 Subject: [PATCH] plugin: add internal api to notify plugins of tool configuration Part-of: --- src/evdev-tablet.c | 4 ++++ src/libinput-plugin-system.h | 4 ++++ src/libinput-plugin.c | 12 ++++++++++++ src/libinput-plugin.h | 8 ++++++++ 4 files changed, 28 insertions(+) diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index b3049f1e..f66003d4 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -1193,6 +1193,10 @@ apply_pressure_range_configuration(struct tablet_dispatch *tablet, tool->pressure.range.min = tool->pressure.wanted_range.min; tool->pressure.range.max = tool->pressure.wanted_range.max; + + struct libinput *libinput = tablet_libinput_context(tablet); + libinput_plugin_system_notify_tablet_tool_configured(&libinput->plugin_system, + tool); } static inline void diff --git a/src/libinput-plugin-system.h b/src/libinput-plugin-system.h index 5927240e..13e22fc2 100644 --- a/src/libinput-plugin-system.h +++ b/src/libinput-plugin-system.h @@ -82,6 +82,10 @@ void libinput_plugin_system_notify_device_ignored(struct libinput_plugin_system *system, struct libinput_device *device); +void +libinput_plugin_system_notify_tablet_tool_configured(struct libinput_plugin_system *system, + struct libinput_tablet_tool *tool); + void libinput_plugin_system_notify_evdev_frame(struct libinput_plugin_system *system, struct libinput_device *device, diff --git a/src/libinput-plugin.c b/src/libinput-plugin.c index 709a35e1..0001b067 100644 --- a/src/libinput-plugin.c +++ b/src/libinput-plugin.c @@ -433,6 +433,18 @@ libinput_plugin_system_notify_device_ignored(struct libinput_plugin_system *syst libinput_plugin_system_drop_unregistered_plugins(system); } +void +libinput_plugin_system_notify_tablet_tool_configured(struct libinput_plugin_system *system, + struct libinput_tablet_tool *tool) +{ + struct libinput_plugin *plugin; + list_for_each_safe(plugin, &system->plugins, link) { + if (plugin->interface->tool_configured) + plugin->interface->tool_configured(plugin, tool); + } + libinput_plugin_system_drop_unregistered_plugins(system); +} + static void libinput_plugin_process_frame(struct libinput_plugin *plugin, struct libinput_device *device, diff --git a/src/libinput-plugin.h b/src/libinput-plugin.h index fc2defb2..c2af29ae 100644 --- a/src/libinput-plugin.h +++ b/src/libinput-plugin.h @@ -35,6 +35,7 @@ struct evdev_frame; struct libinput; struct libinput_device; +struct libinput_tablet_tool; struct libinput_plugin; enum libinput_log_priority; @@ -98,6 +99,13 @@ struct libinput_plugin_interface { void (*evdev_frame)(struct libinput_plugin *plugin, struct libinput_device *device, struct evdev_frame *frame); + + /** + * Notification that a configuration option on a tool + * was modified. + */ + void (*tool_configured)(struct libinput_plugin *plugin, + struct libinput_tablet_tool *tool); }; /**