[PATCH weston] Use wl_fixed_to_int() in weston_output_update_zoom().

Ander Conselvan de Oliveira conselvan2 at gmail.com
Wed May 16 01:21:40 PDT 2012


On 05/16/2012 02:18 AM, Scott Moreau wrote:
> This way, we don't have to use wl_fixed_to_int() for
> each call to weston_output_update_zoom(). The instance
> in notify_motion() was missed, which broke zoom.
> ---
>   src/compositor.c |    3 +++
>   src/shell.c      |    4 +---
>   2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/compositor.c b/src/compositor.c
> index 788b1de..e5d89b5 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -2363,6 +2363,9 @@ weston_output_update_zoom(struct weston_output *output, int x, int y)

You should also change the function prototype to make it clear it takes 
wl_fixed_t.

>   	if (output->zoom.level<= 0)
>   		return;
>
> +	x = wl_fixed_to_int(x);
> +	y = wl_fixed_to_int(y);
> +
>   	output->zoom.magnification = 1 / output->zoom.level;
>   	ratio = 1 - (1 / output->zoom.magnification);
>
> diff --git a/src/shell.c b/src/shell.c
> index a44074d..364c07d 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -1642,9 +1642,7 @@ zoom_binding(struct wl_input_device *device, uint32_t time,
>   			if (output->zoom.level<  output->zoom.increment)
>   				output->zoom.level = output->zoom.increment;
>
> -			weston_output_update_zoom(output,
> -			                          wl_fixed_to_int(device->x),
> -						  wl_fixed_to_int(device->y));
> +			weston_output_update_zoom(output, device->x, device->y);
>   		}
>   	}
>   }



More information about the wayland-devel mailing list