plugin: only load the plugin system once

This got lost during one of the many rebases, see
https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1217#note_2961314

It is required even without public-facing plugins so we don't end up
with duplicated plugins for every device added with
libinput_path_add_device().

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1229>
This commit is contained in:
Peter Hutterer 2025-06-20 09:06:39 +10:00 committed by Marge Bot
parent b3cbc6053f
commit a6f7f55178
2 changed files with 8 additions and 0 deletions

View file

@ -40,6 +40,8 @@ struct libinput_plugin;
struct libinput_plugin_system {
char **directories; /* NULL once loaded == true */
bool loaded;
struct list plugins;
struct list removed_plugins;
};

View file

@ -355,6 +355,7 @@ libinput_plugin_system_drop_unregistered_plugins(struct libinput_plugin_system *
void
libinput_plugin_system_init(struct libinput_plugin_system *system)
{
system->loaded = false;
list_init(&system->plugins);
list_init(&system->removed_plugins);
}
@ -363,6 +364,11 @@ void
libinput_plugin_system_load_internal_plugins(struct libinput *libinput,
struct libinput_plugin_system *system)
{
if (system->loaded)
return;
system->loaded = true;
/* FIXME: this should really be one of the first in the sequence
* so plugins don't have to take care of this? */
libinput_tablet_plugin_forced_tool(libinput);