summaryrefslogtreecommitdiff
path: root/src/wayland
diff options
context:
space:
mode:
authorRobert Mader <robert.mader@posteo.de>2020-10-14 18:50:05 +0200
committerRobert Mader <robert.mader@posteo.de>2020-10-14 18:55:21 +0200
commitae0d48b6fd3aed3e75a25ef1f749c4620e2e3e57 (patch)
treea2582928bd7ab8fb57e8b8f6482cd358c9b028f9 /src/wayland
parentdf65f05e276c145b87b6cdde1273a5793153bda4 (diff)
downloadmutter-ae0d48b6fd3aed3e75a25ef1f749c4620e2e3e57.tar.gz
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
Diffstat (limited to 'src/wayland')
-rw-r--r--src/wayland/meta-wayland-subsurface.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/wayland/meta-wayland-subsurface.c b/src/wayland/meta-wayland-subsurface.c
index bf14e0e3c..b4c503d20 100644
--- a/src/wayland/meta-wayland-subsurface.c
+++ b/src/wayland/meta-wayland-subsurface.c
@@ -67,6 +67,17 @@ transform_subsurface_position (MetaWaylandSurface *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
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_reactive (actor, TRUE);
- if (surface->buffer_ref->buffer)
+ if (should_show (surface))
clutter_actor_show (actor);
else
clutter_actor_hide (actor);