aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/output.c
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2020-07-10 18:04:45 +0200
committerLibravatar Simon Ser <contact@emersion.fr>2020-07-15 19:27:12 +0200
commitd5f5885c941d9f74f131734b253133108c759e20 (patch)
tree59b5e3e01b63e7a8a8d5c794f776dc24913565b5 /sway/tree/output.c
parentReload command now matches i3's implementation (diff)
downloadsway-d5f5885c941d9f74f131734b253133108c759e20.tar.gz
sway-d5f5885c941d9f74f131734b253133108c759e20.tar.zst
sway-d5f5885c941d9f74f131734b253133108c759e20.zip
config/output: don't change output state before commit
Previously, we called output_disable prior to wlr_output_commit. This mutates Sway's output state before the output commit actually succeeds. This results in Sway's state getting out-of-sync with wlroots'. An alternative fix [1] was to revert the changes made by output_disable in case of failure. This is a little complicated. Instead, this patch makes it so Sway's internal state is never changed before a successful wlr_output commit. We had two output flags: enabled and configured. However enabled was set prior to the output becoming enabled, and was used to prevent the output event handlers (specifically, the mode handler) from calling apply_output_config again (infinite loop). Rename enabled to enabling and use it exclusively for this purpose. Rename configure to enabled, because that's what it really means. [1]: https://github.com/swaywm/sway/pull/5521 Closes: https://github.com/swaywm/sway/issues/5483 (cherry picked from commit 5432f00adfdd8375fb422ad9033253d17f04efc7)
Diffstat (limited to 'sway/tree/output.c')
-rw-r--r--sway/tree/output.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sway/tree/output.c b/sway/tree/output.c
index 9a10c6a8..ae3c3abf 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -110,12 +110,12 @@ struct sway_output *output_create(struct wlr_output *wlr_output) {
110 return output; 110 return output;
111} 111}
112 112
113void output_configure(struct sway_output *output) { 113void output_enable(struct sway_output *output) {
114 if (!sway_assert(!output->configured, "output is already configured")) { 114 if (!sway_assert(!output->enabled, "output is already enabled")) {
115 return; 115 return;
116 } 116 }
117 struct wlr_output *wlr_output = output->wlr_output; 117 struct wlr_output *wlr_output = output->wlr_output;
118 output->configured = true; 118 output->enabled = true;
119 list_add(root->outputs, output); 119 list_add(root->outputs, output);
120 120
121 restore_workspaces(output); 121 restore_workspaces(output);
@@ -262,7 +262,6 @@ void output_disable(struct sway_output *output) {
262 list_del(root->outputs, index); 262 list_del(root->outputs, index);
263 263
264 output->enabled = false; 264 output->enabled = false;
265 output->configured = false;
266 output->current_mode = NULL; 265 output->current_mode = NULL;
267 266
268 arrange_root(); 267 arrange_root();