]> git.mdlowis.com Git - proto/labwc.git/commitdiff
output: early return on wlopm if requested state is already set
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Thu, 13 Feb 2025 15:28:17 +0000 (16:28 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Thu, 13 Feb 2025 20:45:18 +0000 (20:45 +0000)
This prevents a unnecessary output commit without buffer,
showing up as black flash when repeatedly calling wlopm --on.

src/output.c

index 8a5b5825619be4de63ab3ad2091f3c70c9fb8740..2d805b10a446216dbcf5ccb420827e41a63c1767 100644 (file)
@@ -1068,10 +1068,16 @@ handle_output_power_manager_set_mode(struct wl_listener *listener, void *data)
 
        switch (event->mode) {
        case ZWLR_OUTPUT_POWER_V1_MODE_OFF:
+               if (!event->output->enabled) {
+                       return;
+               }
                wlr_output_state_set_enabled(&output->pending, false);
                output_state_commit(output);
                break;
        case ZWLR_OUTPUT_POWER_V1_MODE_ON:
+               if (event->output->enabled) {
+                       return;
+               }
                wlr_output_state_set_enabled(&output->pending, true);
                if (!event->output->current_mode) {
                        /*