mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
wayland/subsurface: Only show subsurface if parent is mapped
The spec states: ``` A sub-surface becomes mapped, when a non-NULL wl_buffer is applied and the parent surface is mapped. The order of which one happens first is irrelevant. A sub-surface is hidden if the parent becomes hidden, or if a NULL wl_buffer is applied. These rules apply recursively through the tree of surfaces. ``` In the past we relied on Clutter actor behaviour to realize the recursive part - which then broke in https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/664 when we changed the actor hierachy in regards to subsurfaces. Explicitly encode the desired behaviour in `MetaWaylandSubsurface`, fixing the issue and making it future proof. Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1384
This commit is contained in:
parent
df65f05e27
commit
ae0d48b6fd
@ -67,6 +67,17 @@ transform_subsurface_position (MetaWaylandSurface *surface,
|
|||||||
while (surface);
|
while (surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
should_show (MetaWaylandSurface *surface)
|
||||||
|
{
|
||||||
|
if (!surface->buffer_ref->buffer)
|
||||||
|
return FALSE;
|
||||||
|
else if (surface->sub.parent)
|
||||||
|
return should_show (surface->sub.parent);
|
||||||
|
else
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sync_actor_subsurface_state (MetaWaylandSurface *surface)
|
sync_actor_subsurface_state (MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
@ -87,7 +98,7 @@ sync_actor_subsurface_state (MetaWaylandSurface *surface)
|
|||||||
clutter_actor_set_position (actor, x, y);
|
clutter_actor_set_position (actor, x, y);
|
||||||
clutter_actor_set_reactive (actor, TRUE);
|
clutter_actor_set_reactive (actor, TRUE);
|
||||||
|
|
||||||
if (surface->buffer_ref->buffer)
|
if (should_show (surface))
|
||||||
clutter_actor_show (actor);
|
clutter_actor_show (actor);
|
||||||
else
|
else
|
||||||
clutter_actor_hide (actor);
|
clutter_actor_hide (actor);
|
||||||
|
Loading…
Reference in New Issue
Block a user