plugin: add internal api to notify plugins of tool configuration

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1218>
This commit is contained in:
Peter Hutterer 2025-06-03 14:07:40 +10:00
parent 4ef14e14e4
commit 42c0bff29b
4 changed files with 28 additions and 0 deletions

View file

@ -1193,6 +1193,10 @@ apply_pressure_range_configuration(struct tablet_dispatch *tablet,
tool->pressure.range.min = tool->pressure.wanted_range.min; tool->pressure.range.min = tool->pressure.wanted_range.min;
tool->pressure.range.max = tool->pressure.wanted_range.max; 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 static inline void

View file

@ -82,6 +82,10 @@ void
libinput_plugin_system_notify_device_ignored(struct libinput_plugin_system *system, libinput_plugin_system_notify_device_ignored(struct libinput_plugin_system *system,
struct libinput_device *device); struct libinput_device *device);
void
libinput_plugin_system_notify_tablet_tool_configured(struct libinput_plugin_system *system,
struct libinput_tablet_tool *tool);
void void
libinput_plugin_system_notify_evdev_frame(struct libinput_plugin_system *system, libinput_plugin_system_notify_evdev_frame(struct libinput_plugin_system *system,
struct libinput_device *device, struct libinput_device *device,

View file

@ -433,6 +433,18 @@ libinput_plugin_system_notify_device_ignored(struct libinput_plugin_system *syst
libinput_plugin_system_drop_unregistered_plugins(system); 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 static void
libinput_plugin_process_frame(struct libinput_plugin *plugin, libinput_plugin_process_frame(struct libinput_plugin *plugin,
struct libinput_device *device, struct libinput_device *device,

View file

@ -35,6 +35,7 @@
struct evdev_frame; struct evdev_frame;
struct libinput; struct libinput;
struct libinput_device; struct libinput_device;
struct libinput_tablet_tool;
struct libinput_plugin; struct libinput_plugin;
enum libinput_log_priority; enum libinput_log_priority;
@ -98,6 +99,13 @@ struct libinput_plugin_interface {
void (*evdev_frame)(struct libinput_plugin *plugin, void (*evdev_frame)(struct libinput_plugin *plugin,
struct libinput_device *device, struct libinput_device *device,
struct evdev_frame *frame); 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);
}; };
/** /**