[PATCH 2/3] dix: drop x/y back into the right valuators after transformation.

Simon Thum simon.thum at gmx.de
Thu Jun 2 03:54:58 PDT 2011


On 05/31/2011 05:57 AM, Peter Hutterer wrote:
> If the matrix is used for rotation, the coordinates affected may change.
> e.g. a valuator mask of (x, nil) becomes [x, lasty] and is rotated to
> [lasty, x]. Since the second value was unset, we would not drop x back into
> the mask, resulting in a loss of movement.
> 
> Thus, drop any value that changed after applying the matrix into the
> valuators. Thus, the example above becomes
> (x, nil) → [x, lasty] → [lasty, x] → (lasty, x)
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  dix/getevents.c |   15 ++++++++-------
>  1 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/dix/getevents.c b/dix/getevents.c
> index 6dcee3e..1352a81 100644
> --- a/dix/getevents.c
> +++ b/dix/getevents.c
> @@ -1069,18 +1069,19 @@ transform(struct pixman_f_transform *m, int *x, int *y)
>  static void
>  transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
>  {
> -    int x, y;
> +    int x, y, ox, oy;
>  
> -    x = valuator_mask_isset(mask, 0) ? valuator_mask_get(mask, 0) :
> -                                       dev->last.valuators[0];
> -    y = valuator_mask_isset(mask, 1) ? valuator_mask_get(mask, 1) :
> -                                       dev->last.valuators[1];
> +    ox = x = valuator_mask_isset(mask, 0) ? valuator_mask_get(mask, 0) :
> +                                            dev->last.valuators[0];
> +    oy = y = valuator_mask_isset(mask, 1) ? valuator_mask_get(mask, 1) :
> +                                            dev->last.valuators[1];
>  
>      transform(&dev->transform, &x, &y);
>  
> -    if (valuator_mask_isset(mask, 0))
> +    if (valuator_mask_isset(mask, 0) || ox != x)
>          valuator_mask_set(mask, 0, x);
> -    if (valuator_mask_isset(mask, 1))
> +
> +    if (valuator_mask_isset(mask, 1) || oy != y)
>          valuator_mask_set(mask, 1, y);
>  }
>  
Reviewed-by: Simon Thum <simon.thum at gmx.de>




More information about the xorg-devel mailing list