mirror of
https://github.com/swaywm/sway.git
synced 2024-11-29 11:21:28 +00:00
config/output: handle wildcard in get_output_config
In #3916, I overlooked that `get_output_config` does not handle wildcards unless the config is reloading, which is a remnant of older iterations of the output config handling that went unnoticed due to `output_find_config` handling it. With the current version of the output config handling, having `get_output_config` handle wildcard configs is actually preferable. This fixes having only a wildcard output config in the config file or when connecting/enabling a new output with only a wildcard config existing.
This commit is contained in:
parent
7b9ae42331
commit
0327c999d7
|
@ -493,20 +493,21 @@ static struct output_config *get_output_config(char *identifier,
|
||||||
free(result->name);
|
free(result->name);
|
||||||
result->name = strdup(identifier);
|
result->name = strdup(identifier);
|
||||||
merge_output_config(result, oc_id);
|
merge_output_config(result, oc_id);
|
||||||
} else if (config->reloading) {
|
} else {
|
||||||
// Neither config exists, but we need to reset the output so create a
|
|
||||||
// default config for the output and if a wildcard config exists, merge
|
|
||||||
// that on top
|
|
||||||
free(result->name);
|
|
||||||
result->name = strdup("*");
|
|
||||||
i = list_seq_find(config->output_configs, output_name_cmp, "*");
|
i = list_seq_find(config->output_configs, output_name_cmp, "*");
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
|
// No name or identifier config, but there is a wildcard config
|
||||||
|
free(result->name);
|
||||||
|
result->name = strdup("*");
|
||||||
merge_output_config(result, config->output_configs->items[i]);
|
merge_output_config(result, config->output_configs->items[i]);
|
||||||
}
|
} else if (!config->reloading) {
|
||||||
} else {
|
// No name, identifier, or wildcard config. Since we are not
|
||||||
|
// reloading with defaults, the output config will be empty, so
|
||||||
|
// just return NULL
|
||||||
free_output_config(result);
|
free_output_config(result);
|
||||||
result = NULL;
|
result = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free(id_on_name);
|
free(id_on_name);
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue