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

Juan Zhao juan.j.zhao at linux.intel.com
Wed Jan 11 07:34:51 PST 2012



On Tue, 2012-01-10 at 14:11 +0200, Pekka Paalanen wrote:
> 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. 
I would like to do it this way:
if(!es->output)
{
	/*assign an output by weston_surface_assign_output to assign*/
}
Is it OK?

> 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.
Yeah, good point. Should we add some interface for shell surface to
record the map status? Or there is already one?

Thanks, Juan
> 
> > +
> > +	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.
> 

> 




More information about the wayland-devel mailing list