From d4de4cbe57dedbe07b0ea8a14aea31eb07a41c3f Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 15 Nov 2023 18:07:25 +0100 Subject: [PATCH] config/output: avoid no-op enabled output change Ensure that allow_reconfiguration is always set even if we skip the enabled change. --- sway/config/output.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sway/config/output.c b/sway/config/output.c index eefde22b..36028ad3 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -392,14 +392,18 @@ static void queue_output_config(struct output_config *oc, struct wlr_output *wlr_output = output->wlr_output; - if (oc && (!oc->enabled || oc->power == 0)) { - sway_log(SWAY_DEBUG, "Turning off output %s", wlr_output->name); - wlr_output_state_set_enabled(pending, false); - return; + pending->allow_reconfiguration = true; + + bool enabled = !oc || (oc->enabled != 0 && oc->power != 0); + if (wlr_output->enabled != enabled) { + sway_log(SWAY_DEBUG, "Turning %s output %s", + enabled ? "on" : "off", wlr_output->name); + wlr_output_state_set_enabled(pending, enabled); } - sway_log(SWAY_DEBUG, "Turning on output %s", wlr_output->name); - wlr_output_state_set_enabled(pending, true); + if (!enabled) { + return; + } if (oc && oc->drm_mode.type != 0 && oc->drm_mode.type != (uint32_t) -1) { sway_log(SWAY_DEBUG, "Set %s modeline",