Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config-backend: fallback to normal [input] #2587

Merged
merged 2 commits into from
Feb 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions src/core/plugin.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#include "core-impl.hpp"
#include "wayfire/debug.hpp"
#include "wayfire/output.hpp"
#include "seat/input-manager.hpp"
#include "wayfire/signal-definitions.hpp"
#include <wayfire/nonstd/wlroots-full.hpp>
#include <wayfire/util/log.hpp>
#include <wayfire/config-backend.hpp>
#include <wayfire/plugin.hpp>
#include <libudev.h>

void wf::plugin_interface_t::fini()
Expand Down Expand Up @@ -82,18 +80,28 @@ std::shared_ptr<config::section_t> 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<std::string> wf::config_backend_t::get_xml_dirs() const
Expand Down