diff --git a/clients/window.c b/clients/window.c
index c5082bae..7b12227c 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 1242f93c..076b4549 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 776438be..6abfabd2 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.
-
+