[PATCH 1/2] Treat all touch event valuators as absolute

Peter Hutterer peter.hutterer at who-t.net
Thu Jan 19 20:28:01 PST 2012


On Wed, Jan 18, 2012 at 07:09:20PM -0800, Chase Douglas wrote:
> An indirect touch device, such as a multitouch touchpad, has relative X
> and Y axes internally. These axes are in screen coordinates. However,
> the cooresponding axes for touch events are in absolute device
> coordinates.
> 
> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
> ---
>  dix/getevents.c |   12 +++++++++---
>  1 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/dix/getevents.c b/dix/getevents.c
> index 1547059..3e37910 100644
> --- a/dix/getevents.c
> +++ b/dix/getevents.c
> @@ -222,17 +222,23 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, ValuatorMask *mask)
>      int i;
>  
>      /* Set the data to the previous value for unset absolute axes. The values
> -     * may be used when sent as part of an XI 1.x valuator event. */
> +     * may be used when sent as part of an XI 1.x valuator event.
> +     *
> +     * All touch event valuators are absolute, even if the corresponding pointer
> +     * valuator is relative. This is the case for indirect touch devices for the
> +     * X and Y axes. */
>      for (i = 0; i < valuator_mask_size(mask); i++)
>      {
>          if (valuator_mask_isset(mask, i))
>          {
>              SetBit(event->valuators.mask, i);
> -            if (valuator_get_mode(dev, i) == Absolute)
> +            if (IsTouchEvent((InternalEvent *)event) ||
> +                valuator_get_mode(dev, i) == Absolute)
>                  SetBit(event->valuators.mode, i);
>              event->valuators.data[i] = valuator_mask_get_double(mask, i);
>          }
> -        else if (valuator_get_mode(dev, i) == Absolute)
> +        else if (IsTouchEvent((InternalEvent *)event) ||
> +                 valuator_get_mode(dev, i) == Absolute)
>              event->valuators.data[i] = dev->valuator->axisVal[i];
>      }
>  }
> -- 
> 1.7.8.3

can we reshape this to pass in what the mode is for the valuators
instead of guessing based on the event type?
 
Cheers,
  Peter


More information about the xorg-devel mailing list