From 5b9373a7913d956b6e1aca8370b66d9d59a83351 Mon Sep 17 00:00:00 2001
From: Tony Crisci <tony@dubstepdish.com>
Date: Sat, 16 Sep 2017 20:07:19 -0400
Subject: xdg-toplevel-v6 set parent

---
 include/wlr/types/wlr_xdg_shell_v6.h | 1 +
 types/wlr_xdg_shell_v6.c             | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h
index 5183abd5..786bf4e6 100644
--- a/include/wlr/types/wlr_xdg_shell_v6.h
+++ b/include/wlr/types/wlr_xdg_shell_v6.h
@@ -53,6 +53,7 @@ struct wlr_xdg_toplevel_v6_state {
 struct wlr_xdg_toplevel_v6 {
 	struct wl_resource *resource;
 	struct wlr_xdg_surface_v6 *base;
+	struct wlr_xdg_surface_v6 *parent;
 	bool added;
 	struct wlr_xdg_toplevel_v6_state next; // client protocol requests
 	struct wlr_xdg_toplevel_v6_state pending; // user configure requests
diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c
index f09cba8f..9f503b1f 100644
--- a/types/wlr_xdg_shell_v6.c
+++ b/types/wlr_xdg_shell_v6.c
@@ -21,7 +21,14 @@ static void resource_destroy(struct wl_client *client,
 
 static void xdg_toplevel_protocol_set_parent(struct wl_client *client,
 		struct wl_resource *resource, struct wl_resource *parent_resource) {
-	wlr_log(L_DEBUG, "TODO: toplevel set parent");
+	struct wlr_xdg_surface_v6 *surface = wl_resource_get_user_data(resource);
+	struct wlr_xdg_surface_v6 *parent = NULL;
+
+	if (parent_resource != NULL) {
+		parent = wl_resource_get_user_data(parent_resource);
+	}
+
+	surface->toplevel_state->parent = parent;
 }
 
 static void xdg_toplevel_protocol_set_title(struct wl_client *client,
-- 
cgit v1.2.3