diff --git a/include/sway/config.h b/include/sway/config.h index d9f561571..17b7a5735 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -710,6 +710,14 @@ void sort_output_configs_by_priority(struct matched_output_config *configs, */ 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); void free_output_config(struct output_config *oc); diff --git a/sway/config/output.c b/sway/config/output.c index aa8504ed2..61148ab85 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -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) { bool merged = false; bool wildcard = strcmp(oc->name, "*") == 0;