mirror of
https://github.com/swaywm/sway.git
synced 2026-04-18 06:46:56 -04:00
config/output: Support storing temporary output configs
When an output configuration is stored, it is merged into existing configurations in ways that make the change impractical to undo. In order to let a caller test a configuration with the full handling of precedence, add support for temporarily stored configuration that can be removed after a test.
This commit is contained in:
parent
fdeb5a5890
commit
639162dad3
2 changed files with 21 additions and 0 deletions
|
|
@ -710,6 +710,14 @@ void sort_output_configs_by_priority(struct matched_output_config *configs,
|
||||||
*/
|
*/
|
||||||
void store_output_config(struct output_config *oc);
|
void store_output_config(struct output_config *oc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a temporary output config that will not be merged for testing
|
||||||
|
* purposes. This must be removed again after test, before any calls to
|
||||||
|
* store_output_config that could result in merge with the temporary config.
|
||||||
|
*/
|
||||||
|
void store_temp_output_config(struct output_config *oc);
|
||||||
|
void remove_temp_output_config(struct output_config *oc);
|
||||||
|
|
||||||
struct output_config *find_output_config(struct sway_output *output);
|
struct output_config *find_output_config(struct sway_output *output);
|
||||||
|
|
||||||
void free_output_config(struct output_config *oc);
|
void free_output_config(struct output_config *oc);
|
||||||
|
|
|
||||||
|
|
@ -218,6 +218,19 @@ static void merge_output_config(struct output_config *dst, struct output_config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void remove_temp_output_config(struct output_config *oc) {
|
||||||
|
size_t idx = list_find(config->output_configs, oc);
|
||||||
|
if (idx) {
|
||||||
|
list_del(config->output_configs, idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void store_temp_output_config(struct output_config *oc) {
|
||||||
|
// Add it directly so the config can be removed later
|
||||||
|
list_add(config->output_configs, oc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void store_output_config(struct output_config *oc) {
|
void store_output_config(struct output_config *oc) {
|
||||||
bool merged = false;
|
bool merged = false;
|
||||||
bool wildcard = strcmp(oc->name, "*") == 0;
|
bool wildcard = strcmp(oc->name, "*") == 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue