[PATCH weston] toytoolkit: Take into account transform when sending output allocation.

Kristian Høgsberg hoegsberg at gmail.com
Wed Oct 10 10:06:08 PDT 2012


On Sat, Sep 29, 2012 at 02:03:11AM -0600, Scott Moreau wrote:
> ---
> 
> It seems only wscreensaver and tablet-shell use output_get_allocation(). This
> fixes a problem when screensaver gets the wrong size for transformed outputs
> where width and height are swapped.

Looks good, thanks.

Kristian

>  clients/window.c | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/clients/window.c b/clients/window.c
> index 41f9d2c..0a66e65 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -237,6 +237,7 @@ struct output {
>  	struct wl_output *output;
>  	struct rectangle allocation;
>  	struct wl_list link;
> +	int transform;
>  
>  	display_output_handler_t destroy_handler;
>  	void *user_data;
> @@ -3441,6 +3442,7 @@ display_handle_geometry(void *data,
>  
>  	output->allocation.x = x;
>  	output->allocation.y = y;
> +	output->transform = transform;
>  }
>  
>  static void
> @@ -3533,9 +3535,22 @@ output_set_destroy_handler(struct output *output,
>  }
>  
>  void
> -output_get_allocation(struct output *output, struct rectangle *allocation)
> +output_get_allocation(struct output *output, struct rectangle *base)
>  {
> -	*allocation = output->allocation;
> +	struct rectangle allocation = output->allocation;
> +
> +	switch (output->transform) {
> +	case WL_OUTPUT_TRANSFORM_90:
> +	case WL_OUTPUT_TRANSFORM_270:
> +	case WL_OUTPUT_TRANSFORM_FLIPPED_90:
> +	case WL_OUTPUT_TRANSFORM_FLIPPED_270:
> +	        /* Swap width and height */
> +	        allocation.width = output->allocation.height;
> +	        allocation.height = output->allocation.width;
> +	        break;
> +	}
> +
> +	*base = allocation;
>  }
>  
>  struct wl_output *
> -- 
> 1.7.11.4
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list