[PATCH weston 7/8] protocol, compositor: split wl_viewport setters

Bill Spitzak spitzak at gmail.com
Fri Mar 14 11:54:27 PDT 2014


Pekka Paalanen wrote:

> +    <request name="set_source" since="2">
> +      <description summary="set the source rectangle for cropping">
> +	Set the source rectangle of the associated wl_surface. See
> +	wl_viewport for the description, and relation to the wl_buffer
> +	size.
> +
> +	If width and/or height are negative, the source rectangle is unset
> +	instead.
> +
> +    <request name="set_destination" since="2">
> +      <description summary="set the surface size for scaling">
> +	Set the destination size of the associated wl_surface. See
> +	wl_viewport for the description, and relation to the wl_buffer
> +	size.
> +
> +	If width and/or height are negative or zero, the destination size
> +	is unset instead.

I think you may have the <=0 and <0 reversed here. A zero-sized source 
cannot be used (unless the destination is zero-sized) so that should not 
be considered valid. But a zero-sized destination does make physical 
sense (the image is scaled to invisibly tiny).

However the result of a zero-sized destination (or a zero-sized source 
when the destination is unset) can be achieved by the client hiding the 
surface instead, so I think there is no reason to support it. Therefore 
I think it would be best if both rectangles used zero to mean unset. 
This is easier for software to test for with readable code, too.

You may also want to reserve negative numbers for future use. They could 
conceivably do reflections. Not sure if that is useful but it might be 
best if such negative numbers were errors rather than meaning unset.


More information about the wayland-devel mailing list