[PATCH 2/4] shell: reset rotation for maximized surface

Kristian Høgsberg hoegsberg at gmail.com
Tue Mar 19 09:28:58 PDT 2013


On Mon, Mar 11, 2013 at 07:26:54PM +0100, Rafal Mielniczuk wrote:
> Surface will preserve its rotation transformation when maximizing, which
> will cause incosistiencies (eg. no window shadows drawn)
> 
> This patch removes rotation from maximized surface and restore it when
> unmaximizing (just like in fullscreen mode)

Very nice, thanks.  Splitting out the shell_unset_maximized logic is
also a nice cleanup.

Kristian

>  src/shell.c | 31 ++++++++++++++++++++++---------
>  1 file changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/src/shell.c b/src/shell.c
> index d8467bd..c0498e6 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -1473,6 +1473,27 @@ shell_unset_fullscreen(struct shell_surface *shsurf)
>  	wl_list_insert(&ws->layer.surface_list, &shsurf->surface->layer_link);
>  }
>  
> +static void
> +shell_unset_maximized(struct shell_surface *shsurf)
> +{
> +	struct workspace *ws;
> +	/* undo all maximized things here */
> +	shsurf->output = get_default_output(shsurf->surface->compositor);
> +	weston_surface_set_position(shsurf->surface,
> +					shsurf->saved_x,
> +					shsurf->saved_y);
> +
> +	if (shsurf->saved_rotation_valid) {
> +		wl_list_insert(&shsurf->surface->geometry.transformation_list,
> +						   &shsurf->rotation.transform.link);
> +		shsurf->saved_rotation_valid = false;
> +	}
> +
> +	ws = get_current_workspace(shsurf->shell);
> +	wl_list_remove(&shsurf->surface->layer_link);
> +	wl_list_insert(&ws->layer.surface_list, &shsurf->surface->layer_link);
> +}
> +
>  static int
>  reset_shell_surface_type(struct shell_surface *surface)
>  {
> @@ -1481,10 +1502,7 @@ reset_shell_surface_type(struct shell_surface *surface)
>  		shell_unset_fullscreen(surface);
>  		break;
>  	case SHELL_SURFACE_MAXIMIZED:
> -		surface->output = get_default_output(surface->surface->compositor);
> -		weston_surface_set_position(surface->surface,
> -					    surface->saved_x,
> -					    surface->saved_y);
> +		shell_unset_maximized(surface);
>  		break;
>  	case SHELL_SURFACE_NONE:
>  	case SHELL_SURFACE_TOPLEVEL:
> @@ -1518,11 +1536,6 @@ set_surface_type(struct shell_surface *shsurf)
>  		break;
>  
>  	case SHELL_SURFACE_MAXIMIZED:
> -		shsurf->saved_x = surface->geometry.x;
> -		shsurf->saved_y = surface->geometry.y;
> -		shsurf->saved_position_valid = true;
> -		break;
> -
>  	case SHELL_SURFACE_FULLSCREEN:
>  		shsurf->saved_x = surface->geometry.x;
>  		shsurf->saved_y = surface->geometry.y;
> -- 
> 1.8.1.5
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list