[mutter] wayland/subsurface: Only show subsurface if parent is mapped
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland/subsurface: Only show subsurface if parent is mapped
- Date: Wed, 14 Oct 2020 17:25:51 +0000 (UTC)
commit ae0d48b6fd3aed3e75a25ef1f749c4620e2e3e57
Author: Robert Mader <robert mader posteo de>
Date: Wed Oct 14 18:50:05 2020 +0200
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
src/wayland/meta-wayland-subsurface.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/src/wayland/meta-wayland-subsurface.c b/src/wayland/meta-wayland-subsurface.c
index bf14e0e3c9..b4c503d201 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]