[PATCH weston 08/10] xdg-shell: Add a simple destructor request

Pekka Paalanen ppaalanen at gmail.com
Fri Feb 27 00:26:59 PST 2015


On Fri, 13 Feb 2015 14:02:00 +0800
Jonas Ã…dahl <jadahl at gmail.com> wrote:

> From: "Jasper St. Pierre" <jstpierre at mecheye.net>
> 
> ---
>  desktop-shell/shell.c  | 10 +++++++++-
>  protocol/xdg-shell.xml |  5 +++++
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index 57f7335..0ae2ad3 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -3985,6 +3985,13 @@ static const struct weston_shell_client xdg_client = {
>  };
>  
>  static void
> +xdg_shell_destroy(struct wl_client *client,
> +		  struct wl_resource *resource)
> +{
> +	wl_resource_destroy(resource);
> +}
> +
> +static void
>  xdg_use_unstable_version(struct wl_client *client,
>  			 struct wl_resource *resource,
>  			 int32_t version)
> @@ -4194,6 +4201,7 @@ shell_surface_is_xdg_popup(struct shell_surface *shsurf)
>  }
>  
>  static const struct xdg_shell_interface xdg_implementation = {
> +	xdg_shell_destroy,
>  	xdg_use_unstable_version,
>  	xdg_get_xdg_surface,
>  	xdg_get_xdg_popup,
> @@ -4209,7 +4217,7 @@ xdg_shell_unversioned_dispatch(const void *implementation,
>  	struct wl_resource *resource = _target;
>  	struct shell_client *sc = wl_resource_get_user_data(resource);
>  
> -	if (opcode != 0) {
> +	if (opcode != 1 /* XDG_SHELL_USE_UNSTABLE_VERSION */) {
>  		wl_resource_post_error(resource,
>  				       WL_DISPLAY_ERROR_INVALID_OBJECT,
>  				       "must call use_unstable_version first");
> diff --git a/protocol/xdg-shell.xml b/protocol/xdg-shell.xml
> index 14165dc..0181901 100644
> --- a/protocol/xdg-shell.xml
> +++ b/protocol/xdg-shell.xml
> @@ -52,6 +52,11 @@
>        <entry name="role" value="0" summary="given wl_surface has another role"/>
>      </enum>
>  
> +    <request name="destroy" type="destructor">
> +      <description summary="destroy xdg_shell">
> +      </description>
> +    </request>
> +
>      <request name="use_unstable_version">
>        <description summary="enable use of this unstable version">
>  	Negotiate the unstable version of the interface.  This

Hmm, changing the opcode of use_unstable_version seems fragile.

If we have a client using the old xdg-shell interface, it will send
use_unstable_version with opcode 0, which will cause an error in the
server due to mismatching message size (I hope) instead of a mismatch
in versions error.

Normally I would ask you to keep the use_unstable_version opcode
intact, but since this has already been merged in Gtk and mutter
(right?), fixing this would only cause more confusion when people mix
different versions. Therefore:

Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>


Thanks,
pq


More information about the wayland-devel mailing list