From 1267e47de913d2cda2644ad89bba4e9c55842cd3 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Sat, 16 Mar 2024 17:55:20 +0100 Subject: config/output: Refactor handling of tiered configs Output configuration can be applied to a particular output in three ways: As a wildcard, by connector name and by identifier. This in turn means that three different configurations must be handled at any given time. In the current model, this is managed by merging new configuration into every other matching configuration. At the same time, an additional synthetic configuration is made which matchehes both identifier and name at the same time, further complicating logic. Instead, manage and store each configuration independently and merge them in order when retrieving configuration for an output. When changes are made to a less specific configuration, clear these fields from more specific configurations to allow the change to take effect regardless of precedence. Fixes: https://github.com/swaywm/sway/issues/8048 --- include/sway/config.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/sway/config.h b/include/sway/config.h index 40710199..0be1cd22 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -693,7 +693,14 @@ bool apply_output_configs(struct matched_output_config *configs, void apply_all_output_configs(void); -struct output_config *store_output_config(struct output_config *oc); +/** + * store_output_config stores a new output config. An output may be matched by + * three different config types, in order of precedence: Identifier, name and + * wildcard. When storing a config type of lower precedence, assume that the + * user wants the config to take immediate effect by superseding (clearing) the + * same values from higher presedence configuration. + */ +void store_output_config(struct output_config *oc); struct output_config *find_output_config(struct sway_output *output); -- cgit v1.2.3