[PATCH 4/8] shell: Move shell_surface_set_parent to wl_shell calls.

Rafael Antognolli rafael.antognolli at intel.com
Tue Dec 3 09:35:44 PST 2013


The parent update on set_maximized and set_fullscreen is a behavior of
wl_shell.

That does not happen on xdg-shell, so it can't be in the set_fullscreen
and set_maximized common code, but rather in the wl_shell_surface
interfaces.
---
 src/shell.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/shell.c b/src/shell.c
index d346b4c..6483e69 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -2252,8 +2252,6 @@ surface_clear_next_states(struct shell_surface *shsurf)
 static void
 set_toplevel(struct shell_surface *shsurf)
 {
-	shell_surface_set_parent(shsurf, NULL);
-
 	shsurf->next_type = SHELL_SURFACE_TOPLEVEL;
 
 	/* The layer_link is updated in set_surface_type(),
@@ -2266,6 +2264,8 @@ shell_surface_set_toplevel(struct wl_client *client,
 {
 	struct shell_surface *surface = wl_resource_get_user_data(resource);
 
+	shell_surface_set_parent(surface, NULL);
+
 	surface_clear_next_states(surface);
 	set_toplevel(surface);
 }
@@ -2280,8 +2280,6 @@ set_transient(struct shell_surface *shsurf,
 	shsurf->transient.y = y;
 	shsurf->transient.flags = flags;
 
-	shell_surface_set_parent(shsurf, parent);
-
 	shsurf->next_state.relative = true;
 
 	/* The layer_link is updated in set_surface_type(),
@@ -2298,6 +2296,8 @@ shell_surface_set_transient(struct wl_client *client,
 	struct weston_surface *parent =
 		wl_resource_get_user_data(parent_resource);
 
+	shell_surface_set_parent(shsurf, parent);
+
 	surface_clear_next_states(shsurf);
 	set_transient(shsurf, parent, x, y, flags);
 }
@@ -2314,8 +2314,6 @@ set_fullscreen(struct shell_surface *shsurf,
 	shsurf->fullscreen.type = method;
 	shsurf->fullscreen.framerate = framerate;
 
-	shell_surface_set_parent(shsurf, NULL);
-
 	shsurf->next_type = shsurf->type;
 
 	shsurf->client->send_configure(shsurf->surface, 0,
@@ -2372,6 +2370,8 @@ shell_surface_set_fullscreen(struct wl_client *client,
 	else
 		output = NULL;
 
+	shell_surface_set_parent(shsurf, NULL);
+
 	surface_clear_next_states(shsurf);
 	shsurf->next_state.fullscreen = true;
 	shsurf->state_changed = true;
@@ -2393,8 +2393,6 @@ set_popup(struct shell_surface *shsurf,
 	shsurf->popup.x = x;
 	shsurf->popup.y = y;
 
-	shell_surface_set_parent(shsurf, parent);
-
 	shsurf->next_type = SHELL_SURFACE_POPUP;
 }
 
@@ -2407,10 +2405,14 @@ shell_surface_set_popup(struct wl_client *client,
 			int32_t x, int32_t y, uint32_t flags)
 {
 	struct shell_surface *shsurf = wl_resource_get_user_data(resource);
+	struct weston_surface *parent =
+		wl_resource_get_user_data(parent_resource);
+
+	shell_surface_set_parent(shsurf, parent);
 
 	surface_clear_next_states(shsurf);
 	set_popup(shsurf,
-	          wl_resource_get_user_data(parent_resource),
+	          parent,
 	          wl_resource_get_user_data(seat_resource),
 	          serial, x, y);
 }
@@ -2432,8 +2434,6 @@ set_maximized(struct shell_surface *shsurf,
 	                               shsurf->output->width,
 	                               shsurf->output->height - panel_height);
 
-	shell_surface_set_parent(shsurf, NULL);
-
 	shsurf->next_type = shsurf->type;
 }
 
@@ -2468,6 +2468,8 @@ shell_surface_set_maximized(struct wl_client *client,
 	else
 		output = NULL;
 
+	shell_surface_set_parent(shsurf, NULL);
+
 	surface_clear_next_states(shsurf);
 	shsurf->next_state.maximized = true;
 	shsurf->state_changed = true;
-- 
1.8.3.1



More information about the wayland-devel mailing list