shell: Factor out common code to create fullscreen black surfaces

dev
Philip Withnall 11 years ago committed by Kristian Høgsberg
parent 83ffd9d17b
commit ed8f1a9e4b
  1. 66
      src/shell.c

@ -2451,33 +2451,44 @@ create_black_surface(struct weston_compositor *ec,
return view; return view;
} }
/* Create black surface and append it to the associated fullscreen surface.
* Handle size dismatch and positioning according to the method. */
static void static void
shell_configure_fullscreen(struct shell_surface *shsurf) shell_ensure_fullscreen_black_view(struct shell_surface *shsurf)
{ {
struct weston_output *output = shsurf->fullscreen_output; struct weston_output *output = shsurf->fullscreen_output;
struct weston_surface *surface = shsurf->surface;
struct weston_matrix *matrix;
float scale, output_aspect, surface_aspect, x, y;
int32_t surf_x, surf_y, surf_width, surf_height;
if (shsurf->fullscreen.type != WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER) assert(shsurf->type == SHELL_SURFACE_FULLSCREEN);
restore_output_mode(output);
if (!shsurf->fullscreen.black_view) if (!shsurf->fullscreen.black_view)
shsurf->fullscreen.black_view = shsurf->fullscreen.black_view =
create_black_surface(surface->compositor, create_black_surface(shsurf->surface->compositor,
surface, shsurf->surface,
output->x, output->y, output->x, output->y,
output->width, output->width,
output->height); output->height);
weston_view_geometry_dirty(shsurf->fullscreen.black_view);
wl_list_remove(&shsurf->fullscreen.black_view->layer_link); wl_list_remove(&shsurf->fullscreen.black_view->layer_link);
wl_list_insert(&shsurf->view->layer_link, wl_list_insert(&shsurf->view->layer_link,
&shsurf->fullscreen.black_view->layer_link); &shsurf->fullscreen.black_view->layer_link);
shsurf->fullscreen.black_view->surface->output = output; weston_view_geometry_dirty(shsurf->fullscreen.black_view);
shsurf->fullscreen.black_view->output = output; weston_surface_damage(shsurf->surface);
}
/* Create black surface and append it to the associated fullscreen surface.
* Handle size dismatch and positioning according to the method. */
static void
shell_configure_fullscreen(struct shell_surface *shsurf)
{
struct weston_output *output = shsurf->fullscreen_output;
struct weston_surface *surface = shsurf->surface;
struct weston_matrix *matrix;
float scale, output_aspect, surface_aspect, x, y;
int32_t surf_x, surf_y, surf_width, surf_height;
if (shsurf->fullscreen.type != WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER)
restore_output_mode(output);
shell_ensure_fullscreen_black_view(shsurf);
surface_subsurfaces_boundingbox(shsurf->surface, &surf_x, &surf_y, surface_subsurfaces_boundingbox(shsurf->surface, &surf_x, &surf_y,
&surf_width, &surf_height); &surf_width, &surf_height);
@ -2553,36 +2564,9 @@ shell_configure_fullscreen(struct shell_surface *shsurf)
} }
} }
/* make the fullscreen and black surface at the top */
static void
shell_stack_fullscreen(struct shell_surface *shsurf)
{
struct weston_output *output = shsurf->fullscreen_output;
struct desktop_shell *shell = shell_surface_get_shell(shsurf);
wl_list_remove(&shsurf->view->layer_link);
wl_list_insert(&shell->fullscreen_layer.view_list,
&shsurf->view->layer_link);
weston_surface_damage(shsurf->surface);
if (!shsurf->fullscreen.black_view)
shsurf->fullscreen.black_view =
create_black_surface(shsurf->surface->compositor,
shsurf->surface,
output->x, output->y,
output->width,
output->height);
wl_list_remove(&shsurf->fullscreen.black_view->layer_link);
wl_list_insert(&shsurf->view->layer_link,
&shsurf->fullscreen.black_view->layer_link);
weston_surface_damage(shsurf->fullscreen.black_view->surface);
}
static void static void
shell_map_fullscreen(struct shell_surface *shsurf) shell_map_fullscreen(struct shell_surface *shsurf)
{ {
shell_stack_fullscreen(shsurf);
shell_configure_fullscreen(shsurf); shell_configure_fullscreen(shsurf);
} }
@ -3940,7 +3924,6 @@ activate(struct desktop_shell *shell, struct weston_surface *es,
switch (get_shell_surface_type(main_surface)) { switch (get_shell_surface_type(main_surface)) {
case SHELL_SURFACE_FULLSCREEN: case SHELL_SURFACE_FULLSCREEN:
/* should on top of panels */ /* should on top of panels */
shell_stack_fullscreen(get_shell_surface(main_surface));
shell_configure_fullscreen(get_shell_surface(main_surface)); shell_configure_fullscreen(get_shell_surface(main_surface));
return; return;
case SHELL_SURFACE_TOPLEVEL: case SHELL_SURFACE_TOPLEVEL:
@ -4495,7 +4478,6 @@ configure(struct desktop_shell *shell, struct weston_surface *surface,
switch (surface_type) { switch (surface_type) {
case SHELL_SURFACE_FULLSCREEN: case SHELL_SURFACE_FULLSCREEN:
shell_stack_fullscreen(shsurf);
shell_configure_fullscreen(shsurf); shell_configure_fullscreen(shsurf);
break; break;
case SHELL_SURFACE_MAXIMIZED: case SHELL_SURFACE_MAXIMIZED:

Loading…
Cancel
Save