diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-03-15 15:09:55 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-03-16 10:40:46 -0600 |
commit | 3106ef23a7b4f7f7efeb43d47e724f5b23c4fd78 (patch) | |
tree | 82335e0f8877d291a36e3c67f8cfefe07bbdde56 /sway/tree | |
parent | 2578669de76c6d4b2038a648d1cfcd3c7e9e320a (diff) |
Fix output config retrieval for new outputs
This removes `output_find_config`, which would take the first matching
output config it found. This is fine if only a name output config,
identifier output config, or even just wildcard exist, but if there is
a name output config and identifier output config, they are not merged.
Instead, this introduces find_output_config, which is just a wrapper
for `get_output_config`. This ensures that both the name and identifier
output configs are respected.
This fixes the following case:
- For simplicity in this example, remove all output configs from config
- Run `swaymsg output <name> bg #ff0000 solid_color`
- Run `swaymsg output <identifier> scale 2`
- Disconnect and reconnect output
Without this, the output will have the background, but not the scale.
With this, the output will have both the background and scale
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/output.c | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/sway/tree/output.c b/sway/tree/output.c index 227d487c..1202ba3c 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c @@ -267,36 +267,6 @@ void output_begin_destroy(struct sway_output *output) { output->wlr_output = NULL; } -struct output_config *output_find_config(struct sway_output *output) { - const char *name = output->wlr_output->name; - char identifier[128]; - output_get_identifier(identifier, sizeof(identifier), output); - - struct output_config *oc = NULL, *all = NULL; - for (int i = 0; i < config->output_configs->length; ++i) { - struct output_config *cur = config->output_configs->items[i]; - - if (strcasecmp(name, cur->name) == 0 || - strcasecmp(identifier, cur->name) == 0) { - sway_log(SWAY_DEBUG, "Matched output config for %s", name); - oc = cur; - } - if (strcasecmp("*", cur->name) == 0) { - sway_log(SWAY_DEBUG, "Matched wildcard output config for %s", name); - all = cur; - } - - if (oc && all) { - break; - } - } - if (!oc) { - oc = all; - } - - return oc; -} - struct sway_output *output_from_wlr_output(struct wlr_output *output) { return output->data; } |