From e79c9ceee50674a9e3892df6e0489f0ac6c672a5 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Fri, 4 Jul 2025 14:00:09 -0500 Subject: [PATCH] compositor: Move cache flush into weston_subsurface_set_synchronized Do a subsurface cache flush in weston_subsurface_set_effectively_synchronized instead of in the protocol handler. This is just so when I move some functions into another file later, I don't need to expose weston_subsurface_apply_from_cache(). Signed-off-by: Derek Foreman --- libweston/compositor.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index 2efecfd6b..c1f6ba9d9 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -5891,12 +5891,17 @@ weston_subsurface_update_effectively_synchronized(struct weston_subsurface *sub) static void weston_subsurface_set_synchronized(struct weston_subsurface *sub, bool sync) { + bool old_e_sync = sub->effectively_synchronized; if (sub->synchronized == sync) return; sub->synchronized = sync; weston_subsurface_update_effectively_synchronized(sub); + + /* If sub became effectively desynchronized, flush */ + if (old_e_sync && !sub->effectively_synchronized) + weston_subsurface_apply_from_cache(sub); } static void @@ -5918,13 +5923,7 @@ subsurface_set_desync(struct wl_client *client, struct wl_resource *resource) if (!sub) return; - if (sub->synchronized) { - weston_subsurface_set_synchronized(sub, false); - - /* If sub became effectively desynchronized, flush. */ - if (!sub->effectively_synchronized) - weston_subsurface_apply_from_cache(sub); - } + weston_subsurface_set_synchronized(sub, false); } static void