aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/output.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2020-02-16 01:47:59 -0500
committerLibravatar Simon Ser <contact@emersion.fr>2020-02-16 09:42:22 +0100
commit8b593677d262b9018d2bcb9093f03fbccb38c43b (patch)
tree8e13a78ca12ba442b6b8963ef67840088643d3d0 /sway/tree/output.c
parentFix crash: use wlr_output->name instead of possibly missing oc->name (diff)
downloadsway-8b593677d262b9018d2bcb9093f03fbccb38c43b.tar.gz
sway-8b593677d262b9018d2bcb9093f03fbccb38c43b.tar.zst
sway-8b593677d262b9018d2bcb9093f03fbccb38c43b.zip
output: fix updating output manager config
The output manager config is created when the output is created. It is updated when the mode, transform, scale, or layout for the output changes, as well as, when the output is destroyed. Since the output->enabled property was not being set before calling apply_output_config, the output event handlers were early returning and never updating the output manager config when the output state was committed. This fixes the issue by setting output->enabled in apply_output_config below the output disabling section. There are also a few other minor changes that are required to function. Additionally, this renames output_enable to output_configure to better describe the recent changes.
Diffstat (limited to 'sway/tree/output.c')
-rw-r--r--sway/tree/output.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sway/tree/output.c b/sway/tree/output.c
index 6f4146cd..c96c3187 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -102,20 +102,19 @@ struct sway_output *output_create(struct wlr_output *wlr_output) {
102 output->workspaces = create_list(); 102 output->workspaces = create_list();
103 output->current.workspaces = create_list(); 103 output->current.workspaces = create_list();
104 104
105 size_t len = sizeof(output->layers) / sizeof(output->layers[0]);
106 for (size_t i = 0; i < len; ++i) {
107 wl_list_init(&output->layers[i]);
108 }
109
105 return output; 110 return output;
106} 111}
107 112
108void output_enable(struct sway_output *output) { 113void output_configure(struct sway_output *output) {
109 if (!sway_assert(!output->enabled, "output is already enabled")) { 114 if (!sway_assert(!output->configured, "output is already configured")) {
110 return; 115 return;
111 } 116 }
112 struct wlr_output *wlr_output = output->wlr_output; 117 struct wlr_output *wlr_output = output->wlr_output;
113 size_t len = sizeof(output->layers) / sizeof(output->layers[0]);
114 for (size_t i = 0; i < len; ++i) {
115 wl_list_init(&output->layers[i]);
116 }
117
118 output->enabled = true;
119 output->configured = true; 118 output->configured = true;
120 list_add(root->outputs, output); 119 list_add(root->outputs, output);
121 120