shell: Update a shsurf’s layer when its surface type changes

dev
Philip Withnall 11 years ago committed by Kristian Høgsberg
parent 07926d90d1
commit e1d75ae73f
  1. 47
      src/shell.c

@ -2083,6 +2083,25 @@ shell_surface_calculate_layer_link (struct shell_surface *shsurf)
return &ws->layer.view_list; return &ws->layer.view_list;
} }
/* Update the surface’s layer. Mark both the old and new views as having dirty
* geometry to ensure the changes are redrawn. */
static void
shell_surface_update_layer(struct shell_surface *shsurf)
{
struct wl_list *new_layer_link;
new_layer_link = shell_surface_calculate_layer_link(shsurf);
if (new_layer_link == &shsurf->view->layer_link)
return;
weston_view_geometry_dirty(shsurf->view);
wl_list_remove(&shsurf->view->layer_link);
wl_list_insert(new_layer_link, &shsurf->view->layer_link);
weston_view_geometry_dirty(shsurf->view);
weston_surface_damage(shsurf->surface);
}
static void static void
shell_surface_set_parent(struct shell_surface *shsurf, shell_surface_set_parent(struct shell_surface *shsurf,
struct weston_surface *parent) struct weston_surface *parent)
@ -2175,8 +2194,6 @@ set_fullscreen(struct shell_surface *shsurf,
static void static void
unset_fullscreen(struct shell_surface *shsurf) unset_fullscreen(struct shell_surface *shsurf)
{ {
struct workspace *ws;
/* Unset the fullscreen output, driver configuration and transforms. */ /* Unset the fullscreen output, driver configuration and transforms. */
if (shsurf->fullscreen.type == WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER && if (shsurf->fullscreen.type == WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER &&
shell_surface_is_top_fullscreen(shsurf)) { shell_surface_is_top_fullscreen(shsurf)) {
@ -2202,9 +2219,7 @@ unset_fullscreen(struct shell_surface *shsurf)
shsurf->saved_rotation_valid = false; shsurf->saved_rotation_valid = false;
} }
ws = get_current_workspace(shsurf->shell); /* Layer is updated in set_surface_type(). */
wl_list_remove(&shsurf->view->layer_link);
wl_list_insert(&ws->layer.view_list, &shsurf->view->layer_link);
} }
static void static void
@ -2286,8 +2301,6 @@ set_maximized(struct shell_surface *shsurf,
static void static void
unset_maximized(struct shell_surface *shsurf) unset_maximized(struct shell_surface *shsurf)
{ {
struct workspace *ws;
/* undo all maximized things here */ /* undo all maximized things here */
shsurf->output = get_default_output(shsurf->surface->compositor); shsurf->output = get_default_output(shsurf->surface->compositor);
weston_view_set_position(shsurf->view, weston_view_set_position(shsurf->view,
@ -2300,9 +2313,7 @@ unset_maximized(struct shell_surface *shsurf)
shsurf->saved_rotation_valid = false; shsurf->saved_rotation_valid = false;
} }
ws = get_current_workspace(shsurf->shell); /* Layer is updated in set_surface_type(). */
wl_list_remove(&shsurf->view->layer_link);
wl_list_insert(&ws->layer.view_list, &shsurf->view->layer_link);
} }
static void static void
@ -2321,6 +2332,8 @@ shell_surface_set_maximized(struct wl_client *client,
set_maximized(shsurf, output); set_maximized(shsurf, output);
} }
/* This is only ever called from set_surface_type(), so there’s no need to
* update layer_links here, since theyll be updated when we return. */
static int static int
reset_surface_type(struct shell_surface *surface) reset_surface_type(struct shell_surface *surface)
{ {
@ -2389,6 +2402,9 @@ set_surface_type(struct shell_surface *shsurf)
default: default:
break; break;
} }
/* Update the surface’s layer. */
shell_surface_update_layer(shsurf);
} }
static struct desktop_shell * static struct desktop_shell *
@ -4359,7 +4375,6 @@ map(struct desktop_shell *shell, struct shell_surface *shsurf,
struct weston_seat *seat; struct weston_seat *seat;
int panel_height = 0; int panel_height = 0;
int32_t surf_x, surf_y; int32_t surf_x, surf_y;
struct wl_list *new_layer_link;
shsurf->view->geometry.width = width; shsurf->view->geometry.width = width;
shsurf->view->geometry.height = height; shsurf->view->geometry.height = height;
@ -4397,14 +4412,8 @@ map(struct desktop_shell *shell, struct shell_surface *shsurf,
; ;
} }
/* Surface stacking order, see also activate(). /* Surface stacking order, see also activate(). */
* shell_surface_update_layer(shsurf);
* If any child surfaces exist and are mapped, ensure theyre in the
* same layer as this surface. */
new_layer_link = shell_surface_calculate_layer_link(shsurf);
wl_list_remove(&shsurf->view->layer_link);
wl_list_insert(new_layer_link,
&shsurf->view->layer_link);
if (shsurf->type != SHELL_SURFACE_NONE) { if (shsurf->type != SHELL_SURFACE_NONE) {
weston_view_update_transform(shsurf->view); weston_view_update_transform(shsurf->view);

Loading…
Cancel
Save