aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/output.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-03-15 15:09:55 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-03-16 10:40:46 -0600
commit3106ef23a7b4f7f7efeb43d47e724f5b23c4fd78 (patch)
tree82335e0f8877d291a36e3c67f8cfefe07bbdde56 /sway/desktop/output.c
parentFlush stdout in swaymsg when in subscribe mode (diff)
downloadsway-3106ef23a7b4f7f7efeb43d47e724f5b23c4fd78.tar.gz
sway-3106ef23a7b4f7f7efeb43d47e724f5b23c4fd78.tar.zst
sway-3106ef23a7b4f7f7efeb43d47e724f5b23c4fd78.zip
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/desktop/output.c')
-rw-r--r--sway/desktop/output.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 1d9abbfd..9d0c0ef5 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -533,7 +533,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
533static void handle_mode(struct wl_listener *listener, void *data) { 533static void handle_mode(struct wl_listener *listener, void *data) {
534 struct sway_output *output = wl_container_of(listener, output, mode); 534 struct sway_output *output = wl_container_of(listener, output, mode);
535 if (!output->configured && !output->enabled) { 535 if (!output->configured && !output->enabled) {
536 struct output_config *oc = output_find_config(output); 536 struct output_config *oc = find_output_config(output);
537 if (output->wlr_output->current_mode != NULL && 537 if (output->wlr_output->current_mode != NULL &&
538 (!oc || oc->enabled)) { 538 (!oc || oc->enabled)) {
539 // We want to enable this output, but it didn't work last time, 539 // We want to enable this output, but it didn't work last time,
@@ -634,7 +634,7 @@ void handle_new_output(struct wl_listener *listener, void *data) {
634 output->damage_destroy.notify = damage_handle_destroy; 634 output->damage_destroy.notify = damage_handle_destroy;
635 wl_list_init(&output->swaybg_client_destroy.link); 635 wl_list_init(&output->swaybg_client_destroy.link);
636 636
637 struct output_config *oc = output_find_config(output); 637 struct output_config *oc = find_output_config(output);
638 if (!oc || oc->enabled) { 638 if (!oc || oc->enabled) {
639 output_enable(output, oc); 639 output_enable(output, oc);
640 } else { 640 } else {