[PATCH weston] compositor: raise errors when bad scale or transform values are used
Pekka Paalanen
ppaalanen at gmail.com
Tue Jun 3 00:08:37 PDT 2014
On Fri, 30 May 2014 12:07:15 +0200
Jonny Lamb <jonny.lamb at collabora.co.uk> wrote:
> ---
> src/compositor.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/src/compositor.c b/src/compositor.c
> index 574db2d..3c5c8e3 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -2138,6 +2138,16 @@ surface_set_buffer_transform(struct wl_client *client,
> {
> struct weston_surface *surface = wl_resource_get_user_data(resource);
>
> + /* if wl_output.transform grows more members this will need to be updated. */
If we wanted to automatically catch new members, we could use a switch
without the default case here. But it seems unlikely, so this is ok.
> + if (transform < 0 ||
> + transform > WL_OUTPUT_TRANSFORM_FLIPPED_270) {
> + wl_resource_post_error(resource,
> + WL_SURFACE_ERROR_INVALID_TRANSFORM,
> + "buffer transform must be a valid transform "
> + "('%d' specified)", transform);
> + return;
> + }
> +
> surface->pending.buffer_viewport.buffer.transform = transform;
> }
>
> @@ -2148,6 +2158,14 @@ surface_set_buffer_scale(struct wl_client *client,
> {
> struct weston_surface *surface = wl_resource_get_user_data(resource);
>
> + if (scale < 1) {
> + wl_resource_post_error(resource,
> + WL_SURFACE_ERROR_INVALID_SCALE,
> + "buffer scale must be at least one "
> + "('%d' specified)", scale);
> + return;
> + }
> +
> surface->pending.buffer_viewport.buffer.scale = scale;
> }
>
Looks good, I'll push this right after I have pushed the
corresponding Wayland patch. This means that Weston will depend on
Wayland master until the next release.
Thanks,
pq
More information about the wayland-devel
mailing list