From a6f7f55178c1fe4b421934703c1a42327a7970ff Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 20 Jun 2025 09:06:39 +1000 Subject: [PATCH] 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: --- src/libinput-plugin-system.h | 2 ++ src/libinput-plugin.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/libinput-plugin-system.h b/src/libinput-plugin-system.h index 13e22fc2..4734989a 100644 --- a/src/libinput-plugin-system.h +++ b/src/libinput-plugin-system.h @@ -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; }; diff --git a/src/libinput-plugin.c b/src/libinput-plugin.c index 68a1b166..904999a2 100644 --- a/src/libinput-plugin.c +++ b/src/libinput-plugin.c @@ -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);