]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src/output.c: restore flicker free resize when running nested
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Tue, 27 Feb 2024 22:25:45 +0000 (23:25 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 4 Mar 2024 21:24:17 +0000 (21:24 +0000)
PR #1301 did partly revert the first variant because
`lab_wlr_scene_output_commit()` (which uses the `output->pending`
state in contrast to `wlr_scene_output_commit()`) was deemd to
cause 'frozen' frames during video playback (#1273).

We are now back at using `lab_wlr_scene_output_commit()` for
unrelated reasons and the cause of the original issue #1273 was
likely that `wlr_scene_output_send_frame_done()` was only sent
on a successful commit. This was changed to always be sent.

So lets restore the flicker free nested resize as well.

src/output.c

index e1c615e79fdb71787f5a14082d9bc0fd12f34b34..16eee4b81d85b495f59ac0fc7717551391fe9824 100644 (file)
@@ -150,6 +150,32 @@ output_request_state_notify(struct wl_listener *listener, void *data)
        struct output *output = wl_container_of(listener, output, request_state);
        const struct wlr_output_event_request_state *event = data;
 
+       /*
+        * If wlroots ever requests other state changes here we could
+        * restore more of ddc9047a67cd53b2948f71fde1bbe9118000dd3f.
+        */
+       if (event->state->committed == WLR_OUTPUT_STATE_MODE) {
+               /* Only the mode has changed */
+               switch (event->state->mode_type) {
+               case WLR_OUTPUT_STATE_MODE_FIXED:
+                       wlr_output_set_mode(output->wlr_output, event->state->mode);
+                       break;
+               case WLR_OUTPUT_STATE_MODE_CUSTOM:
+                       wlr_output_set_custom_mode(output->wlr_output,
+                               event->state->custom_mode.width,
+                               event->state->custom_mode.height,
+                               event->state->custom_mode.refresh);
+                       break;
+               }
+               wlr_output_schedule_frame(output->wlr_output);
+               return;
+       }
+
+       /*
+        * Fallback path for everything that we didn't handle above.
+        * The commit will cause a black frame injection so this
+        * path causes flickering during resize of nested outputs.
+        */
        if (!wlr_output_commit_state(output->wlr_output, event->state)) {
                wlr_log(WLR_ERROR, "Backend requested a new state that could not be applied");
        }