From 3f9a16448403f57bb7a562ed351f26a0e4206b77 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 3 Jan 2026 23:16:56 +0100 Subject: [PATCH] scene: keep last preferred configuration when leaving last output Before this patch, when a surface became occluded on all outputs, we'd reconfigure it with a base configuration (scale set to 1, transform set to NORMAL, image description set to gamma 2.2/sRGB). As a result, when quickly hiding a toplevel and showing it again, the client would render to switch to the base configuration, then render again to switch to the output configuration. Avoi this needless back-and-forth by retaining the last sent preferred configuration when a surface leaves all outputs. --- types/scene/surface.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/scene/surface.c b/types/scene/surface.c index 0c24208cb..dadbf8303 100644 --- a/types/scene/surface.c +++ b/types/scene/surface.c @@ -96,6 +96,12 @@ static void handle_scene_buffer_outputs_update( surface->frame_pacing_output = get_surface_frame_pacing_output(surface->surface); + // If the surface is no longer visible on any output, keep the last sent + // preferred configuration to avoid unnecessary redraws + if (wl_list_empty(&surface->surface->current_outputs)) { + return; + } + double scale = get_surface_preferred_buffer_scale(surface->surface); wlr_fractional_scale_v1_notify_scale(surface->surface, scale); wlr_surface_set_preferred_buffer_scale(surface->surface, ceil(scale));