wayland/subsurface: Ensure cached state recursivly gets applied on set_desync()

Subsurfaces can be effectively synced indirectly via their ancestors.
Right now such indirectly synced surfaces don't apply their cached
state when their ancestor effectively becomes desync as by the time
we call `parent_state_applied()` on them, they are considered as
desync.

Thus sligthly reoder things so when the ancestors becomes desync
and applies its state, those surfaces still count as synced and
will thus apply their cached state as well.

While on it, add a check to prevent `set_desync()` to have side
effects when the target surface is not currently synced.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2232>
This commit is contained in:
Robert Mader 2022-01-10 20:11:47 +01:00 committed by Marge Bot
parent 68b6507429
commit 03434e566a

View File

@ -468,14 +468,18 @@ wl_subsurface_set_desync (struct wl_client *client,
struct wl_resource *resource)
{
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
gboolean was_effectively_synchronized;
gboolean is_parent_effectively_synchronized;
was_effectively_synchronized = is_surface_effectively_synchronized (surface);
surface->sub.synchronous = FALSE;
if (!surface->sub.synchronous)
return;
if (was_effectively_synchronized &&
!is_surface_effectively_synchronized (surface))
is_parent_effectively_synchronized =
is_surface_effectively_synchronized (surface->sub.parent);
if (!is_parent_effectively_synchronized)
meta_wayland_surface_apply_cached_state (surface);
surface->sub.synchronous = FALSE;
}
static const struct wl_subsurface_interface meta_wayland_wl_subsurface_interface = {