[PATCH] shell: Use desired output when sending configure events when maximised

Kristian Høgsberg hoegsberg at gmail.com
Mon Jul 2 12:19:54 PDT 2012


On Mon, Jul 02, 2012 at 07:00:19PM +0100, Rob Bradford wrote:
> From: Rob Bradford <rob at linux.intel.com>
> 
> With shell_surface.set_maximised the caller can provide an output to maximise
> to or the default output will be used. With the corresponding configure we
> should use the dimensions from the chosen output not the output the surface
> was currently on.
> 
> Similarly when calculating the position for the window in the map() function
> we should use the desired output again.

That looks good.  I think we'll chage the is_mapped condition to "is
it in a layer", or in other words !wl_list_empty(surface->layer_link).
Then we are free to assign surface->output before it's mapped and can
drop shsurf->output.  But let's go with this for now and make sure we
don't break it when we change the is_mapped condition.

Kristian

> There is no need to assign shsurf->output to es->output since that happens in
> the map() function later.
> ---
>  src/shell.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/shell.c b/src/shell.c
> index 4d09c5b..a0d2088 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -1358,12 +1358,12 @@ shell_surface_set_maximized(struct wl_client *client,
>  		shsurf->output = get_default_output(es->compositor);
>  
>  	shell = shell_surface_get_shell(shsurf);
> -	panel_height = get_output_panel_height(shell, es->output);
> +	panel_height = get_output_panel_height(shell, shsurf->output);
>  	edges = WL_SHELL_SURFACE_RESIZE_TOP|WL_SHELL_SURFACE_RESIZE_LEFT;
>  
>  	shsurf->client->send_configure(shsurf->surface, edges,
> -				       es->output->current->width,
> -				       es->output->current->height - panel_height);
> +				       shsurf->output->current->width,
> +				       shsurf->output->current->height - panel_height);
>  
>  	shsurf->next_type = SHELL_SURFACE_MAXIMIZED;
>  }
> @@ -2548,8 +2548,8 @@ map(struct desktop_shell *shell, struct weston_surface *surface,
>  	case SHELL_SURFACE_MAXIMIZED:
>  		/* use surface configure to set the geometry */
>  		panel_height = get_output_panel_height(shell,surface->output);
> -		weston_surface_set_position(surface, surface->output->x,
> -					    surface->output->y + panel_height);
> +		weston_surface_set_position(surface, shsurf->output->x,
> +					    shsurf->output->y + panel_height);
>  		break;
>  	case SHELL_SURFACE_POPUP:
>  		shell_map_popup(shsurf);
> -- 
> 1.7.10.2
> 
> _______________________________________________
> 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