[mutter/wayland] wayland-surface: Fix transient_for



commit a37a8c64972f392013b6101bcd6205a6ceb6a14f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Nov 21 13:09:13 2013 -0500

    wayland-surface: Fix transient_for
    
    It takes a wl_surface resource, not an xdg_shell_surface resource,
    and the argument is allowed to be NULL.

 src/wayland/meta-wayland-surface.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 3a28584..71e3512 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -524,14 +524,19 @@ xdg_surface_destroy (struct wl_client *client,
 static void
 xdg_surface_set_transient_for (struct wl_client *client,
                                struct wl_resource *resource,
-                               struct wl_resource *parent)
+                               struct wl_resource *parent_resource)
 {
   MetaWaylandSurfaceExtension *xdg_surface = wl_resource_get_user_data (resource);
   MetaWaylandSurface *surface = wl_container_of (xdg_surface, surface, xdg_surface);
-  MetaWaylandSurfaceExtension *parent_xdg_surface = wl_resource_get_user_data (parent);
-  MetaWaylandSurface *parent_surface = wl_container_of (parent_xdg_surface, surface, xdg_surface);
+  MetaWindow *transient_for = NULL;
 
-  meta_window_set_transient_for (surface->window, parent_surface->window);
+  if (parent_resource)
+    {
+      MetaWaylandSurface *parent_surface = wl_resource_get_user_data (parent_resource);
+      transient_for = parent_surface->window;
+    }
+
+  meta_window_set_transient_for (surface->window, transient_for);
 }
 
 static void


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