From c38c595083426e64891a3255d92f9b6e1b90895c Mon Sep 17 00:00:00 2001 From: Ilia Bozhinov Date: Mon, 24 Feb 2025 19:35:48 +0100 Subject: [PATCH] config-backend: fallback to normal [input] --- src/core/plugin.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/core/plugin.cpp b/src/core/plugin.cpp index 614e11217..f187bc6cb 100644 --- a/src/core/plugin.cpp +++ b/src/core/plugin.cpp @@ -1,8 +1,5 @@ -#include "core-impl.hpp" #include "wayfire/debug.hpp" -#include "wayfire/output.hpp" -#include "seat/input-manager.hpp" -#include "wayfire/signal-definitions.hpp" +#include #include #include #include @@ -82,18 +79,28 @@ std::shared_ptr wf::config_backend_t::get_input_device_sectio std::string name = nonull(device->name); name = prefix + ":" + name; LOGC(INPUT_DEVICES, "Checking for config section [", name, "]"); - section = config.get_section(name); - if (section) + + if (!config.get_section(name)) + { + // For input-device:(*) section, we always use per-device sections. + // For input:(*) sections, we fall back to the common [input] section. + if (prefix == "input") + { + LOGC(INPUT_DEVICES, "Using default config section [", prefix, "]"); + section = config.get_section(prefix); + } else + { + LOGC(INPUT_DEVICES, "Creating config section [", name, "]"); + section = config.get_section(prefix)->clone_with_name(name); + config.merge_section(section); + } + } else { LOGC(INPUT_DEVICES, "Using config section [", name, "]"); - return section; + section = config.get_section(name); } - config.merge_section( - config.get_section(prefix)->clone_with_name(name)); - - LOGC(INPUT_DEVICES, "Using config section [", name, "]"); - return config.get_section(name); + return section; } std::vector wf::config_backend_t::get_xml_dirs() const