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 <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2025-07-04 14:00:09 -05:00
parent b76e6ebd82
commit e79c9ceee5

View file

@ -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