shell: Move shell_surface_set_parent to wl_shell calls.

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.
This commit is contained in:
Rafael Antognolli 2013-12-03 15:35:44 -02:00 committed by Kristian Høgsberg
parent ed207b4bd5
commit 4b99a40bcb

View File

@ -2252,8 +2252,6 @@ surface_clear_next_states(struct shell_surface *shsurf)
static void static void
set_toplevel(struct shell_surface *shsurf) set_toplevel(struct shell_surface *shsurf)
{ {
shell_surface_set_parent(shsurf, NULL);
shsurf->next_type = SHELL_SURFACE_TOPLEVEL; shsurf->next_type = SHELL_SURFACE_TOPLEVEL;
/* The layer_link is updated in set_surface_type(), /* 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); struct shell_surface *surface = wl_resource_get_user_data(resource);
shell_surface_set_parent(surface, NULL);
surface_clear_next_states(surface); surface_clear_next_states(surface);
set_toplevel(surface); set_toplevel(surface);
} }
@ -2280,8 +2280,6 @@ set_transient(struct shell_surface *shsurf,
shsurf->transient.y = y; shsurf->transient.y = y;
shsurf->transient.flags = flags; shsurf->transient.flags = flags;
shell_surface_set_parent(shsurf, parent);
shsurf->next_state.relative = true; shsurf->next_state.relative = true;
/* The layer_link is updated in set_surface_type(), /* 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 = struct weston_surface *parent =
wl_resource_get_user_data(parent_resource); wl_resource_get_user_data(parent_resource);
shell_surface_set_parent(shsurf, parent);
surface_clear_next_states(shsurf); surface_clear_next_states(shsurf);
set_transient(shsurf, parent, x, y, flags); set_transient(shsurf, parent, x, y, flags);
} }
@ -2314,8 +2314,6 @@ set_fullscreen(struct shell_surface *shsurf,
shsurf->fullscreen.type = method; shsurf->fullscreen.type = method;
shsurf->fullscreen.framerate = framerate; shsurf->fullscreen.framerate = framerate;
shell_surface_set_parent(shsurf, NULL);
shsurf->next_type = shsurf->type; shsurf->next_type = shsurf->type;
shsurf->client->send_configure(shsurf->surface, 0, shsurf->client->send_configure(shsurf->surface, 0,
@ -2372,6 +2370,8 @@ shell_surface_set_fullscreen(struct wl_client *client,
else else
output = NULL; output = NULL;
shell_surface_set_parent(shsurf, NULL);
surface_clear_next_states(shsurf); surface_clear_next_states(shsurf);
shsurf->next_state.fullscreen = true; shsurf->next_state.fullscreen = true;
shsurf->state_changed = true; shsurf->state_changed = true;
@ -2393,8 +2393,6 @@ set_popup(struct shell_surface *shsurf,
shsurf->popup.x = x; shsurf->popup.x = x;
shsurf->popup.y = y; shsurf->popup.y = y;
shell_surface_set_parent(shsurf, parent);
shsurf->next_type = SHELL_SURFACE_POPUP; 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) int32_t x, int32_t y, uint32_t flags)
{ {
struct shell_surface *shsurf = wl_resource_get_user_data(resource); 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); surface_clear_next_states(shsurf);
set_popup(shsurf, set_popup(shsurf,
wl_resource_get_user_data(parent_resource), parent,
wl_resource_get_user_data(seat_resource), wl_resource_get_user_data(seat_resource),
serial, x, y); serial, x, y);
} }
@ -2432,8 +2434,6 @@ set_maximized(struct shell_surface *shsurf,
shsurf->output->width, shsurf->output->width,
shsurf->output->height - panel_height); shsurf->output->height - panel_height);
shell_surface_set_parent(shsurf, NULL);
shsurf->next_type = shsurf->type; shsurf->next_type = shsurf->type;
} }
@ -2468,6 +2468,8 @@ shell_surface_set_maximized(struct wl_client *client,
else else
output = NULL; output = NULL;
shell_surface_set_parent(shsurf, NULL);
surface_clear_next_states(shsurf); surface_clear_next_states(shsurf);
shsurf->next_state.maximized = true; shsurf->next_state.maximized = true;
shsurf->state_changed = true; shsurf->state_changed = true;