shell: Factor out code to set a shsurf’s parent

This is in preparation for unifying how surface layering works. It
introduces the small functional change that fullscreen, maximized and
top-level surfaces now explicitly have no parent surface. Only popup and
transient surfaces have a non-NULL parent.
diff --git a/src/shell.c b/src/shell.c
index 6464a47..e9d733c 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -2041,6 +2041,13 @@
 }
 
 static void
+shell_surface_set_parent(struct shell_surface *shsurf,
+                         struct weston_surface *parent)
+{
+	shsurf->parent = parent;
+}
+
+static void
 shell_surface_set_output(struct shell_surface *shsurf,
                          struct weston_output *output)
 {
@@ -2059,6 +2066,8 @@
 static void
 set_toplevel(struct shell_surface *shsurf)
 {
+	shell_surface_set_parent(shsurf, NULL);
+
 	shsurf->next_type = SHELL_SURFACE_TOPLEVEL;
 }
 
@@ -2075,11 +2084,14 @@
 set_transient(struct shell_surface *shsurf,
 	      struct weston_surface *parent, int x, int y, uint32_t flags)
 {
-	/* assign to parents output */
-	shsurf->parent = parent;
+	assert(parent != NULL);
+
 	shsurf->transient.x = x;
 	shsurf->transient.y = y;
 	shsurf->transient.flags = flags;
+
+	shell_surface_set_parent(shsurf, parent);
+
 	shsurf->next_type = SHELL_SURFACE_TRANSIENT;
 }
 
@@ -2107,6 +2119,9 @@
 	shsurf->fullscreen_output = shsurf->output;
 	shsurf->fullscreen.type = method;
 	shsurf->fullscreen.framerate = framerate;
+
+	shell_surface_set_parent(shsurf, NULL);
+
 	shsurf->next_type = SHELL_SURFACE_FULLSCREEN;
 
 	shsurf->client->send_configure(shsurf->surface, 0,
@@ -2175,12 +2190,15 @@
           int32_t x,
           int32_t y)
 {
+	assert(parent != NULL);
+
 	shsurf->type = SHELL_SURFACE_POPUP;
-	shsurf->parent = parent;
 	shsurf->popup.shseat = get_shell_seat(seat);
 	shsurf->popup.serial = serial;
 	shsurf->popup.x = x;
 	shsurf->popup.y = y;
+
+	shell_surface_set_parent(shsurf, parent);
 }
 
 static void
@@ -2216,6 +2234,8 @@
 	                               shsurf->output->width,
 	                               shsurf->output->height - panel_height);
 
+	shell_surface_set_parent(shsurf, NULL);
+
 	shsurf->next_type = SHELL_SURFACE_MAXIMIZED;
 }
 
@@ -2513,6 +2533,9 @@
 	shsurf->transient.x = x;
 	shsurf->transient.y = y;
 	shsurf->transient.flags = flags;
+
+	shell_surface_set_parent(shsurf, NULL);
+
 	shsurf->next_type = SHELL_SURFACE_XWAYLAND;
 }