shell: Move shell_surface_set_parent to wl_shell calls.
authorRafael Antognolli <rafael.antognolli@intel.com>
Tue, 3 Dec 2013 17:35:44 +0000 (15:35 -0200)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 3 Dec 2013 19:35:25 +0000 (11:35 -0800)
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

index d346b4c..6483e69 100644 (file)
@@ -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;