aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
Diffstat (limited to 'sway')
-rw-r--r--sway/config/output.c8
-rw-r--r--sway/tree/output.c15
2 files changed, 13 insertions, 10 deletions
diff --git a/sway/config/output.c b/sway/config/output.c
index de566869..40f86b6e 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -345,6 +345,9 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
345 return wlr_output_commit(wlr_output); 345 return wlr_output_commit(wlr_output);
346 } 346 }
347 347
348 bool was_enabled = output->enabled;
349 output->enabled = true;
350
348 if (!oc || oc->dpms_state != DPMS_OFF) { 351 if (!oc || oc->dpms_state != DPMS_OFF) {
349 sway_log(SWAY_DEBUG, "Turning on output %s", wlr_output->name); 352 sway_log(SWAY_DEBUG, "Turning on output %s", wlr_output->name);
350 wlr_output_enable(wlr_output, true); 353 wlr_output_enable(wlr_output, true);
@@ -393,6 +396,7 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
393 // output disabled for now and try again when the output gets the mode 396 // output disabled for now and try again when the output gets the mode
394 // we asked for. 397 // we asked for.
395 sway_log(SWAY_ERROR, "Failed to modeset output %s", wlr_output->name); 398 sway_log(SWAY_ERROR, "Failed to modeset output %s", wlr_output->name);
399 output->enabled = was_enabled;
396 return false; 400 return false;
397 } 401 }
398 402
@@ -432,8 +436,8 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
432 output->width = output_box->width; 436 output->width = output_box->width;
433 output->height = output_box->height; 437 output->height = output_box->height;
434 438
435 if ((!oc || oc->enabled) && !output->enabled) { 439 if ((!oc || oc->enabled) && !output->configured) {
436 output_enable(output); 440 output_configure(output);
437 } 441 }
438 442
439 if (oc && oc->dpms_state == DPMS_OFF) { 443 if (oc && oc->dpms_state == DPMS_OFF) {
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