diff options
-rw-r--r-- | include/sway/output.h | 2 | ||||
-rw-r--r-- | sway/config/output.c | 12 | ||||
-rw-r--r-- | sway/tree/output.c | 11 |
3 files changed, 7 insertions, 18 deletions
diff --git a/include/sway/output.h b/include/sway/output.h index b1c74258..53e77420 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); void output_sort_workspaces(struct sway_output *output); -bool output_enable(struct sway_output *output, struct output_config *oc); +void output_enable(struct sway_output *output); void output_disable(struct sway_output *output); diff --git a/sway/config/output.c b/sway/config/output.c index e1925c93..73d62aff 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -343,14 +343,6 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { } wlr_output_enable(wlr_output, false); return wlr_output_commit(wlr_output); - } else if (!output->enabled) { - // Output is not enabled. Enable it, output_enable will call us again. - if (!oc || oc->dpms_state != DPMS_OFF) { - sway_log(SWAY_DEBUG, "Enabling output %s", oc->name); - wlr_output_enable(wlr_output, true); - wlr_output_commit(wlr_output); - } - return output_enable(output, oc); } if (!oc || oc->dpms_state != DPMS_OFF) { @@ -440,6 +432,10 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { output->width = output_box->width; output->height = output_box->height; + if ((!oc || oc->enabled) && !output->enabled) { + output_enable(output); + } + if (oc && oc->dpms_state == DPMS_OFF) { sway_log(SWAY_DEBUG, "Turning off output %s", oc->name); wlr_output_enable(wlr_output, false); diff --git a/sway/tree/output.c b/sway/tree/output.c index d2ede1f2..6f4146cd 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c @@ -105,9 +105,9 @@ struct sway_output *output_create(struct wlr_output *wlr_output) { return output; } -bool output_enable(struct sway_output *output, struct output_config *oc) { +void output_enable(struct sway_output *output) { if (!sway_assert(!output->enabled, "output is already enabled")) { - return false; + return; } struct wlr_output *wlr_output = output->wlr_output; size_t len = sizeof(output->layers) / sizeof(output->layers[0]); @@ -116,11 +116,6 @@ bool output_enable(struct sway_output *output, struct output_config *oc) { } output->enabled = true; - if (!apply_output_config(oc, output)) { - output->enabled = false; - return false; - } - output->configured = true; list_add(root->outputs, output); @@ -156,8 +151,6 @@ bool output_enable(struct sway_output *output, struct output_config *oc) { arrange_layers(output); arrange_root(); - - return true; } static void evacuate_sticky(struct sway_workspace *old_ws, |