[PATCH v2 2/2] shell: Add set_maximised for wl_shell_surface interface.

Pekka Paalanen ppaalanen at gmail.com
Tue Jan 10 04:11:03 PST 2012


On Mon,  9 Jan 2012 22:54:20 +0800
juan.j.zhao at linux.intel.com wrote:

> From: Alex Wu <zhiwen.wu at linux.intel.com>
> 
> mainly send a configure event to the client
> 
> Signed-off-by: Juan Zhao <juan.j.zhao at linux.intel.com>
> Signed-off-by: Alex Wu <zhiwen.wu at linux.intel.com>
> 
> ---
>  src/shell.c |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 48 insertions(+), 0 deletions(-)
> 
> diff --git a/src/shell.c b/src/shell.c
> index d12bc1a..b93bfa3 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -408,6 +408,53 @@ get_default_output(struct weston_compositor *compositor)
>  }
>  
>  static void
> +shell_surface_set_maximised(struct wl_client *client,
> +			     struct wl_resource *resource)
> +{
> +	struct shell_surface *shsurf = resource->data;
> +	struct weston_surface *es = shsurf->surface;
> +	struct weston_surface *es_temp = NULL;
> +	struct weston_output *output;
> +	uint32_t edges = 0, panel_width = 0, panel_height = 0;
> +	struct shell_surface *priv;
> +
> +	if (reset_shell_surface_type(shsurf))
> +		return;
> +
> +	/* FIXME: set maximised on first output */
> +	/* FIXME: Handle output going away */
> +	output = get_default_output(es->compositor);
> +	es->output = output;

I seem to recall that there was code in compositor.c to find the output
the surface is currently in. Another question is, how do we determine
the output for a surface that has never been mapped before?

Should probably check for the non-mapped case and defer to mapping time
in that case.

> +
> +	shsurf->saved_x = es->x;
> +	shsurf->saved_y = es->y;
> +
> +
> +	/*FIXME: get the panel width and height of the first panel*/
> +	struct weston_compositor *ec = output->compositor;
> +	wl_list_for_each(es_temp, &ec->surface_list, link) {
> +		if((es_temp->type == WESTON_SURFACE_TYPE_PANEL) &&
> +		   ((panel_width < es_temp->width) ||
> +		    (panel_height < es_temp->height))){
> +			panel_width = es_temp->width;
> +			panel_height = es_temp->height;
> +			break;
> +		}
> +	}

struct wl_shell has a list of panels. You could iterate that and find
the panel for the selected output, if it exists.

> +
> +	/*FIXME: the pannel is on the top-left*/
> +	es->x = 0;
> +	es->y = panel_height;
> +	edges = WL_SHELL_SURFACE_RESIZE_TOP|WL_SHELL_SURFACE_RESIZE_LEFT;
> +	wl_resource_post_event(&shsurf->resource,
> +			       WL_SHELL_SURFACE_CONFIGURE,
> +			       weston_compositor_get_time(), edges,
> +			       output->current->width, output->current->height-panel_height);
> +}
> +
> +
> +
> +static void
>  shell_surface_set_fullscreen(struct wl_client *client,
>  			     struct wl_resource *resource, uint32_t framerate,
>  			     uint32_t flags)
> @@ -574,6 +621,7 @@ static const struct wl_shell_surface_interface shell_surface_implementation = {
>  	shell_surface_set_toplevel,
>  	shell_surface_set_transient,
>  	shell_surface_set_fullscreen,
> +	shell_surface_set_maximised,
>  	shell_surface_set_popup
>  };
>  



More information about the wayland-devel mailing list