[mutter/wip/carlosg/issue-361] wayland: Check whether Xwayland window had a prior surface in generic code



commit a9a145cb620f21fa8332dd184c3d356f0b121dfd
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Feb 6 23:04:13 2019 +0100

    wayland: Check whether Xwayland window had a prior surface in generic code
    
    Since commit 8df2a1452cf (As pointed out by Robert Mader) we just happened
    do this check when doing the first lookup for a Wayland surface for a
    XWayland window, when we are later notifying upon surface creation we just
    set the relation with no further checks.
    
    The cases pointed out in the comment (eg. window changing decoration) might
    presumably happen in a quick enough sequence that we have two scheduled
    associations on the fly, so move this check to the more generic
    meta_xwayland_associate_window_with_surface() which is called on both
    immediate and delayed paths.
    
    https://gitlab.gnome.org/GNOME/mutter/issues/361

 src/wayland/meta-xwayland.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index f0b95351d..f21b16de6 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -67,6 +67,16 @@ meta_xwayland_associate_window_with_surface (MetaWindow          *window,
 {
   MetaDisplay *display = window->display;
 
+  /* If the window has an existing surface, like if we're
+   * undecorating or decorating the window, then we need
+   * to detach the window from its old surface.
+   */
+  if (window->surface)
+    {
+      meta_wayland_surface_set_window (window->surface, NULL);
+      window->surface = NULL;
+    }
+
   if (!meta_wayland_surface_assign_role (surface,
                                          META_TYPE_WAYLAND_SURFACE_ROLE_XWAYLAND,
                                          NULL))
@@ -97,16 +107,6 @@ associate_window_with_surface_id (MetaXWaylandManager *manager,
 {
   struct wl_resource *resource;
 
-  /* If the window has an existing surface, like if we're
-   * undecorating or decorating the window, then we need
-   * to detach the window from its old surface.
-   */
-  if (window->surface)
-    {
-      meta_wayland_surface_set_window (window->surface, NULL);
-      window->surface = NULL;
-    }
-
   resource = wl_client_get_object (manager->client, surface_id);
   if (resource)
     {


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