[PATCH 03/16] shell: Change set_maximized to receive internal structures.

Kristian Høgsberg hoegsberg at gmail.com
Fri Nov 29 15:02:30 PST 2013


On Wed, Nov 27, 2013 at 03:50:19PM -0200, Rafael Antognolli wrote:
> Change the parameters of set_maximized from wl_resource and wl_client to
> shell_surface and weston_output. This will allow it to be used with
> xdg-shell too.
> ---
>  src/shell.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/src/shell.c b/src/shell.c
> index cf89a84..507d46f 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -2204,19 +2204,17 @@ get_output_panel_height(struct desktop_shell *shell,
>  }
>  
>  static void
> -set_maximized(struct wl_client *client,
> -	      struct wl_resource *resource,
> -	      struct wl_resource *output_resource)
> +set_maximized(struct shell_surface *shsurf,
> +	      struct weston_output *output)
>  {
> -	struct shell_surface *shsurf = wl_resource_get_user_data(resource);
>  	struct weston_surface *es = shsurf->surface;
>  	struct desktop_shell *shell = NULL;
>  	uint32_t edges = 0, panel_height = 0;
>  
>  	/* get the default output, if the client set it as NULL
>  	   check whether the ouput is available */
> -	if (output_resource)
> -		shsurf->output = wl_resource_get_user_data(output_resource);
> +	if (output)
> +		shsurf->output = output;
>  	else if (es->output)
>  		shsurf->output = es->output;
>  	else
> @@ -2239,10 +2237,17 @@ shell_surface_set_maximized(struct wl_client *client,
>  			    struct wl_resource *output_resource)
>  {
>  	struct shell_surface *shsurf = wl_resource_get_user_data(resource);
> +	struct weston_output *output;
> +
>  	surface_clear_next_states(shsurf);
> -	set_maximized(client, resource, output_resource);
>  	shsurf->next.maximized = true;
>  	shsurf->state_changed = true;

I was going to say that these details should be in set_maximized(),
but resetting the state is part of wl_shell semantics and should stay
here.  This patch is good to go, but depends on previous patch.

> +
> +	if (output_resource)
> +		output = wl_resource_get_user_data(output_resource);
> +	else
> +		output = NULL;
> +	set_maximized(shsurf, output);
>  }
>  
>  static void
> -- 
> 1.8.3.1
> 
> _______________________________________________
> 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