[mutter/wayland] window: Delay the showing of XWayland clients until set_window_id



commit 59c8b949ad1b8712be7f1e90f8aaddac897da463
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat Feb 1 19:16:25 2014 -0500

    window: Delay the showing of XWayland clients until set_window_id
    
    Use our new "surface_mapped" field to delay the showing of XWayland clients
    until we have associated together the window's XID and the Wayland surface ID.
    
    This ensures that when we show this window to the compositor, it will properly
    use the Wayland surface for rendering, rather than trying to use COMPOSITE and
    crash.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720631

 src/core/window.c           |   12 +++++++++---
 src/wayland/meta-xwayland.c |    2 ++
 2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 83ca163..22a8c67 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -833,7 +833,6 @@ meta_window_new_shared (MetaDisplay         *display,
                         MetaWindowClientType client_type,
                         MetaWaylandSurface  *surface,
                         Window               xwindow,
-                        gboolean             surface_mapped,
                         gulong               existing_wm_state,
                         MetaCompEffect       effect,
                         XWindowAttributes   *attrs)
@@ -863,7 +862,7 @@ meta_window_new_shared (MetaDisplay         *display,
   window->client_type = client_type;
   window->surface = surface;
   window->xwindow = xwindow;
-  window->surface_mapped = surface_mapped;
+  window->surface_mapped = FALSE;
 
   /* this is in window->screen->display, but that's too annoying to
    * type
@@ -1413,7 +1412,6 @@ meta_window_new_for_wayland (MetaDisplay        *display,
                                    META_WINDOW_CLIENT_TYPE_WAYLAND,
                                    surface,
                                    None,
-                                   FALSE,
                                    WithdrawnState,
                                    META_COMP_EFFECT_CREATE,
                                    &attrs);
@@ -1585,6 +1583,14 @@ meta_window_new (MetaDisplay       *display,
                                    effect,
                                    &attrs);
 
+  /* When running as an X compositor, we can simply show the window now.
+   *
+   * When running as a Wayland compositor, we need to wait until we see
+   * the Wayland surface appear. We will later call meta_window_set_surface_mapped()
+   * to show the window in our in our set_surface_id implementation */
+  if (!meta_is_wayland_compositor ())
+    meta_window_set_surface_mapped (window, TRUE);
+
   meta_error_trap_pop (display); /* pop the XSync()-reducing trap */
 
   return window;
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 33b3b8d..e15e308 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -49,6 +49,8 @@ xserver_set_window_id (struct wl_client *client,
 
   surface->window = window;
   window->surface = surface;
+
+  meta_window_set_surface_mapped (window, TRUE);
 }
 
 static const struct xserver_interface xserver_implementation = {


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