[PATCH 14/17] shell: Factor out common code to create fullscreen black surfaces
Pekka Paalanen
ppaalanen at gmail.com
Tue Nov 26 06:39:18 PST 2013
On Mon, 25 Nov 2013 18:01:43 +0000
Philip Withnall <philip at tecnocode.co.uk> wrote:
> From: Philip Withnall <philip.withnall at collabora.co.uk>
>
> ---
> src/shell.c | 66 ++++++++++++++++++++++---------------------------------------
> 1 file changed, 24 insertions(+), 42 deletions(-)
>
> diff --git a/src/shell.c b/src/shell.c
> index 96bfea0..a505bf5 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -2446,6 +2446,29 @@ create_black_surface(struct weston_compositor *ec,
> return view;
> }
>
> +static void
> +shell_ensure_fullscreen_black_view(struct shell_surface *shsurf)
> +{
> + struct weston_output *output = shsurf->fullscreen_output;
> +
> + assert(shsurf->type == SHELL_SURFACE_FULLSCREEN);
> +
> + 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);
> +
> + weston_view_geometry_dirty(shsurf->fullscreen.black_view);
> + wl_list_remove(&shsurf->fullscreen.black_view->layer_link);
> + wl_list_insert(&shsurf->view->layer_link,
> + &shsurf->fullscreen.black_view->layer_link);
> + weston_view_geometry_dirty(shsurf->fullscreen.black_view);
> + weston_surface_damage(shsurf->surface);
Dirtying the same thing twice seems a little strange, am I missing
something?
Thanks,
pq
> +}
> +
> /* Create black surface and append it to the associated fullscreen surface.
> * Handle size dismatch and positioning according to the method. */
> static void
> @@ -2460,19 +2483,7 @@ shell_configure_fullscreen(struct shell_surface *shsurf)
> if (shsurf->fullscreen.type != WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER)
> restore_output_mode(output);
>
> - if (!shsurf->fullscreen.black_view)
> - shsurf->fullscreen.black_view =
> - create_black_surface(surface->compositor,
> - 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);
> - shsurf->fullscreen.black_view->surface->output = output;
> - shsurf->fullscreen.black_view->output = output;
> + shell_ensure_fullscreen_black_view(shsurf);
>
> surface_subsurfaces_boundingbox(shsurf->surface, &surf_x, &surf_y,
> &surf_width, &surf_height);
> @@ -2548,36 +2559,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
> shell_map_fullscreen(struct shell_surface *shsurf)
> {
> - shell_stack_fullscreen(shsurf);
> shell_configure_fullscreen(shsurf);
> }
>
> @@ -3935,7 +3919,6 @@ activate(struct desktop_shell *shell, struct weston_surface *es,
> switch (get_shell_surface_type(main_surface)) {
> case SHELL_SURFACE_FULLSCREEN:
> /* should on top of panels */
> - shell_stack_fullscreen(get_shell_surface(main_surface));
> shell_configure_fullscreen(get_shell_surface(main_surface));
> return;
> case SHELL_SURFACE_TOPLEVEL:
> @@ -4490,7 +4473,6 @@ configure(struct desktop_shell *shell, struct weston_surface *surface,
>
> switch (surface_type) {
> case SHELL_SURFACE_FULLSCREEN:
> - shell_stack_fullscreen(shsurf);
> shell_configure_fullscreen(shsurf);
> break;
> case SHELL_SURFACE_MAXIMIZED:
More information about the wayland-devel
mailing list