[mutter/gnome-3-36] wayland/subsurface: Avoid placement ops for detached subsurfaces



commit 5bd625c33ff1d387938a5314b0bc22d0b38c52e2
Author: Robert Mader <robert mader posteo de>
Date:   Fri Apr 16 19:38:40 2021 +0200

    wayland/subsurface: Avoid placement ops for detached subsurfaces
    
    If a subsurface first gets reordered and afterwards detached from
    the parent before the parent surface got commited, we currently
    would end up reattaching the subsurface to its previous parent.
    
    While clients should avoid this behaviour, it's legit according
    to the spec.
    
    We already prevent similar cases where the subsurface is destroyed -
    extend that check to detaching, which includes the destroy case.
    
    
    (cherry picked from commit 6e00e5e6e7c7bab6c2ba408b528e1bdee8f17239)
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1838>

 src/wayland/meta-wayland-subsurface.c | 16 ++++++++--------
 src/wayland/meta-wayland-subsurface.h |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/wayland/meta-wayland-subsurface.c b/src/wayland/meta-wayland-subsurface.c
index 0027bb2104..d16172bda8 100644
--- a/src/wayland/meta-wayland-subsurface.c
+++ b/src/wayland/meta-wayland-subsurface.c
@@ -343,11 +343,11 @@ is_valid_sibling (MetaWaylandSurface *surface,
 }
 
 static void
-subsurface_handle_pending_surface_destroyed (struct wl_listener *listener,
-                                             void               *data)
+subsurface_handle_pending_subsurface_destroyed (struct wl_listener *listener,
+                                                void               *data)
 {
   MetaWaylandSubsurfacePlacementOp *op =
-    wl_container_of (listener, op, surface_destroy_listener);
+    wl_container_of (listener, op, subsurface_destroy_listener);
 
   op->surface = NULL;
 }
@@ -366,7 +366,7 @@ void
 meta_wayland_subsurface_placement_op_free (MetaWaylandSubsurfacePlacementOp *op)
 {
   if (op->surface)
-    wl_list_remove (&op->surface_destroy_listener.link);
+    wl_list_remove (&op->subsurface_destroy_listener.link);
   if (op->sibling)
     wl_list_remove (&op->sibling_destroy_listener.link);
   g_free (op);
@@ -384,12 +384,12 @@ queue_subsurface_placement (MetaWaylandSurface             *surface,
   op->placement = placement;
   op->surface = surface;
   op->sibling = sibling;
-  op->surface_destroy_listener.notify =
-    subsurface_handle_pending_surface_destroyed;
+  op->subsurface_destroy_listener.notify =
+    subsurface_handle_pending_subsurface_destroyed;
   op->sibling_destroy_listener.notify =
     subsurface_handle_pending_sibling_destroyed;
-  wl_resource_add_destroy_listener (surface->resource,
-                                    &op->surface_destroy_listener);
+  wl_resource_add_destroy_listener (surface->wl_subsurface,
+                                    &op->subsurface_destroy_listener);
   wl_resource_add_destroy_listener (sibling->resource,
                                     &op->sibling_destroy_listener);
 
diff --git a/src/wayland/meta-wayland-subsurface.h b/src/wayland/meta-wayland-subsurface.h
index 7ea6bc5ae1..45dbf86269 100644
--- a/src/wayland/meta-wayland-subsurface.h
+++ b/src/wayland/meta-wayland-subsurface.h
@@ -40,7 +40,7 @@ typedef struct
   MetaWaylandSubsurfacePlacement placement;
   MetaWaylandSurface *surface;
   MetaWaylandSurface *sibling;
-  struct wl_listener surface_destroy_listener;
+  struct wl_listener subsurface_destroy_listener;
   struct wl_listener sibling_destroy_listener;
 } MetaWaylandSubsurfacePlacementOp;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]