diff options
author | Mikkel Oscar Lyderik <mikkeloscar@gmail.com> | 2016-02-12 13:22:20 +0100 |
---|---|---|
committer | Mikkel Oscar Lyderik <mikkeloscar@gmail.com> | 2016-02-12 13:45:47 +0100 |
commit | 016a77424aae401cd25b49eb9c681cbab4e12908 (patch) | |
tree | 2aa4320dd448b0ea2c1e0294246c00f0c9e69765 /sway/container.c | |
parent | 91d6113d4ad15e38308a795313da92b0ec249bcf (diff) |
Prefer named output config over wildcard config.
This makes sure that a named output config is applied before the
general wildcard config when a new output is created. This ensures that
the config:
output * ...
output NAME ...
behaves the same way as:
output NAME ...
output * ...
Diffstat (limited to 'sway/container.c')
-rw-r--r-- | sway/container.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sway/container.c b/sway/container.c index 444f85fd..6e6b20b2 100644 --- a/sway/container.c +++ b/sway/container.c @@ -90,22 +90,28 @@ swayc_t *new_output(wlc_handle handle) { sway_log(L_DEBUG, "New output %lu:%s", handle, name); - struct output_config *oc = NULL; + struct output_config *oc = NULL, *all = NULL; int i; for (i = 0; i < config->output_configs->length; ++i) { struct output_config *cur = config->output_configs->items[i]; if (strcasecmp(name, cur->name) == 0) { sway_log(L_DEBUG, "Matched output config for %s", name); oc = cur; - break; } if (strcasecmp("*", cur->name) == 0) { sway_log(L_DEBUG, "Matched wildcard output config for %s", name); - oc = cur; + all = cur; + } + + if (oc && all) { break; } } + if (!oc) { + oc = all; + } + if (oc && !oc->enabled) { return NULL; } |