[PATCH weston 07/10] xdg-shell: Add invalid_parent error to xdg_popup

Jonas Ådahl jadahl at gmail.com
Fri Feb 27 02:23:26 PST 2015


On Fri, Feb 27, 2015 at 10:18:46AM +0200, Pekka Paalanen wrote:
> On Fri, 13 Feb 2015 14:01:59 +0800
> Jonas Ådahl <jadahl at gmail.com> wrote:
> 
> > Send an invalid_parent error when the client tries to create a popup
> > with a paren that is neither a xdg_surface nor a xdg_popup.
> > 
> > Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> > ---
> >  desktop-shell/shell.c  | 11 ++++++++++-
> >  protocol/xdg-shell.xml |  3 ++-
> >  2 files changed, 12 insertions(+), 2 deletions(-)
> > 
> > diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> > index 6697222..57f7335 100644
> > --- a/desktop-shell/shell.c
> > +++ b/desktop-shell/shell.c
> > @@ -4092,12 +4092,21 @@ create_xdg_popup(struct shell_client *owner, void *shell,
> >  		 uint32_t serial,
> >  		 int32_t x, int32_t y)
> >  {
> > -	struct shell_surface *shsurf;
> > +	struct shell_surface *shsurf, *parent_shsurf;
> >  
> >  	/* Verify that we are creating the top most popup when mapping,
> >  	 * as its not until then we know whether it was mapped as most
> >  	 * top level or not. */
> >  
> > +	parent_shsurf = get_shell_surface(parent);
> > +	if (!shell_surface_is_xdg_popup(parent_shsurf) &&
> > +	    !shell_surface_is_xdg_surface(parent_shsurf)) {
> > +		wl_resource_post_error(owner->resource,
> > +				       XDG_POPUP_ERROR_INVALID_PARENT,
> > +				       "xdg_popup parent was invalid");
> > +		return NULL;
> > +	}
> > +
> >  	shsurf = create_common_surface(owner, shell, surface, client);
> >  	if (!shsurf)
> >  		return NULL;
> > diff --git a/protocol/xdg-shell.xml b/protocol/xdg-shell.xml
> > index 360179d..14165dc 100644
> > --- a/protocol/xdg-shell.xml
> > +++ b/protocol/xdg-shell.xml
> > @@ -402,7 +402,8 @@
> >        <description summary="xdg_popup error values">
> >  	These errors can be emitted in response to xdg_popup requests.
> >        </description>
> > -      <entry name="not_the_topmost_popup" value="0" summary="The client tried to destroy a non-toplevel popup"/>
> > +      <entry name="not_the_topmost_popup" value="0" summary="The client tried to map or destroy a non-toplevel popup"/>
> 
> The same typo as in the previous patch: toplevel should be topmost.

This change really shouldn't be in this patch anyway, so I'll move the
change to the right patch, and resend the affected ones.

> 
> > +      <entry name="invalid_parent" value="1" summary="The client specified an invalid parent surface"/>
> >      </enum>
> >  
> >      <request name="destroy" type="destructor">
> 
> Other than the typo,
> Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>


Jonas


More information about the wayland-devel mailing list