[PATCH weston 03/10] xdg-shell: Take a xdg_surface as the parent surface

Jonas Ã…dahl jadahl at gmail.com
Thu Feb 12 22:01:55 PST 2015


From: "Jasper St. Pierre" <jstpierre at mecheye.net>

There is no other valid surface that we should be using here.
---
 clients/window.c       | 14 +++++++-------
 desktop-shell/shell.c  | 12 ++++++------
 protocol/xdg-shell.xml |  2 +-
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index c5082ba..7b12227 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -253,7 +253,7 @@ struct window {
 	struct xdg_popup *xdg_popup;
 
 	struct window *parent;
-	struct wl_surface *last_parent_surface;
+	struct window *last_parent;
 
 	struct ivi_surface *ivi_surface;
 
@@ -4031,21 +4031,21 @@ static const struct xdg_surface_listener xdg_surface_listener = {
 static void
 window_sync_parent(struct window *window)
 {
-	struct wl_surface *parent_surface;
+	struct xdg_surface *parent_surface;
 
 	if (!window->xdg_surface)
 		return;
 
+	if (window->parent == window->last_parent)
+		return;
+
 	if (window->parent)
-		parent_surface = window->parent->main_surface->surface;
+		parent_surface = window->parent->xdg_surface;
 	else
 		parent_surface = NULL;
 
-	if (parent_surface == window->last_parent_surface)
-		return;
-
 	xdg_surface_set_parent(window->xdg_surface, parent_surface);
-	window->last_parent_surface = parent_surface;
+	window->last_parent = window->parent;
 }
 
 static void
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 1242f93..076b454 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -3717,14 +3717,14 @@ xdg_surface_set_parent(struct wl_client *client,
 		       struct wl_resource *parent_resource)
 {
 	struct shell_surface *shsurf = wl_resource_get_user_data(resource);
-	struct weston_surface *parent;
+	struct shell_surface *parent;
 
-	if (parent_resource)
+	if (parent_resource) {
 		parent = wl_resource_get_user_data(parent_resource);
-	else
-		parent = NULL;
-
-	shell_surface_set_parent(shsurf, parent);
+		shell_surface_set_parent(shsurf, parent->surface);
+	} else {
+		shell_surface_set_parent(shsurf, NULL);
+	}
 }
 
 static void
diff --git a/protocol/xdg-shell.xml b/protocol/xdg-shell.xml
index 776438b..6abfabd 100644
--- a/protocol/xdg-shell.xml
+++ b/protocol/xdg-shell.xml
@@ -152,7 +152,7 @@
 	unmapped if the parent is unmapped too. They should not appear
 	on task bars and alt+tab.
       </description>
-      <arg name="parent" type="object" interface="wl_surface" allow-null="true"/>
+      <arg name="parent" type="object" interface="xdg_surface" allow-null="true"/>
     </request>
 
     <request name="set_title">
-- 
2.1.0



More information about the wayland-devel mailing list