diff options
-rw-r--r-- | include/sway/output.h | 2 | ||||
-rw-r--r-- | sway/config/output.c | 8 | ||||
-rw-r--r-- | sway/tree/output.c | 15 |
3 files changed, 14 insertions, 11 deletions
diff --git a/include/sway/output.h b/include/sway/output.h index 53e77420..01c32e0b 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -101,7 +101,7 @@ struct sway_output *all_output_by_name_or_id(const char *name_or_id); | |||
101 | 101 | ||
102 | void output_sort_workspaces(struct sway_output *output); | 102 | void output_sort_workspaces(struct sway_output *output); |
103 | 103 | ||
104 | void output_enable(struct sway_output *output); | 104 | void output_configure(struct sway_output *output); |
105 | 105 | ||
106 | void output_disable(struct sway_output *output); | 106 | void output_disable(struct sway_output *output); |
107 | 107 | ||
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 | ||
108 | void output_enable(struct sway_output *output) { | 113 | void 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 | ||