[PATCH weston v2] libweston-desktop/xdg_shell_v6: Raise errors on not-yet-possible requests

Jonas Ådahl jadahl at gmail.com
Mon Sep 12 13:33:56 UTC 2016


On Sun, Sep 11, 2016 at 11:38:52AM +0200, Quentin Glidic wrote:
> From: Quentin Glidic <sardemff7+git at sardemff7.net>
> 
> These requests need a mapped surface, which can only happen after the
> initial configure event.
> 
> Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>

1 and v2 of 2 are
Reviewed-by: Jonas Ådahl <jadahl at gmail.com>

> ---
> Sorry for the noise, last minute rename.
> 
>  libweston-desktop/xdg-shell-v6.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/libweston-desktop/xdg-shell-v6.c b/libweston-desktop/xdg-shell-v6.c
> index fbf3e69..d4d0112 100644
> --- a/libweston-desktop/xdg-shell-v6.c
> +++ b/libweston-desktop/xdg-shell-v6.c
> @@ -349,6 +349,13 @@ weston_desktop_xdg_toplevel_protocol_show_window_menu(struct wl_client *wl_clien
>  	struct weston_desktop_xdg_toplevel *toplevel =
>  		weston_desktop_surface_get_implementation_data(dsurface);
>  
> +	if (!toplevel->base.configured) {
> +		wl_resource_post_error(toplevel->resource,
> +				       ZXDG_SURFACE_V6_ERROR_NOT_CONSTRUCTED,
> +				       "Surface has not been configured yet");
> +		return;
> +	}
> +
>  	weston_desktop_api_show_window_menu(toplevel->base.desktop,
>  					    dsurface, seat, x, y);
>  }
> @@ -366,6 +373,13 @@ weston_desktop_xdg_toplevel_protocol_move(struct wl_client *wl_client,
>  	struct weston_desktop_xdg_toplevel *toplevel =
>  		weston_desktop_surface_get_implementation_data(dsurface);
>  
> +	if (!toplevel->base.configured) {
> +		wl_resource_post_error(toplevel->resource,
> +				       ZXDG_SURFACE_V6_ERROR_NOT_CONSTRUCTED,
> +				       "Surface has not been configured yet");
> +		return;
> +	}
> +
>  	weston_desktop_api_move(toplevel->base.desktop, dsurface, seat, serial);
>  }
>  
> @@ -383,6 +397,13 @@ weston_desktop_xdg_toplevel_protocol_resize(struct wl_client *wl_client,
>  	struct weston_desktop_xdg_toplevel *toplevel =
>  		weston_desktop_surface_get_implementation_data(dsurface);
>  
> +	if (!toplevel->base.configured) {
> +		wl_resource_post_error(toplevel->resource,
> +				       ZXDG_SURFACE_V6_ERROR_NOT_CONSTRUCTED,
> +				       "Surface has not been configured yet");
> +		return;
> +	}
> +
>  	weston_desktop_api_resize(toplevel->base.desktop,
>  				  dsurface, seat, serial, edges);
>  }
> -- 
> 2.10.0
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list