[PATCH xf86-input-evdev 2/2 v2] Add support for masked valuators

Peter Hutterer peter.hutterer at who-t.net
Sun Jan 23 16:11:52 PST 2011


On Sat, Jan 22, 2011 at 04:26:35PM -0500, Chase Douglas wrote:
> >> +        for (i = 0; i <= 1; i++) {
> >> +            int val;
> >>  
> >> -        if (pEvdev->flags & EVDEV_CALIBRATED)
> >> -        {
> >> -            v[0] = xf86ScaleAxis(v[0],
> >> -                    pEvdev->absinfo[ABS_X].maximum,
> >> -                    pEvdev->absinfo[ABS_X].minimum,
> >> -                    pEvdev->calibration.max_x, pEvdev->calibration.min_x);
> >> -            v[1] = xf86ScaleAxis(v[1],
> >> -                    pEvdev->absinfo[ABS_Y].maximum,
> >> -                    pEvdev->absinfo[ABS_Y].minimum,
> >> -                    pEvdev->calibration.max_y, pEvdev->calibration.min_y);
> >> -        }
> >> +            if (!valuator_mask_isset(pEvdev->mask, i))
> >> +                continue;
> >>  
> >> -        if (pEvdev->invert_x)
> >> -            v[0] = (pEvdev->absinfo[ABS_X].maximum - v[0] +
> >> -                    pEvdev->absinfo[ABS_X].minimum);
> >> -        if (pEvdev->invert_y)
> >> -            v[1] = (pEvdev->absinfo[ABS_Y].maximum - v[1] +
> >> -                    pEvdev->absinfo[ABS_Y].minimum);
> >> +            val = valuator_mask_get(pEvdev->mask, i);
> > 
> > val here has the same value as unswapped_x/y, so you can skip those two and
> > just work with val.
> 
> val is retrieved during the loop. The first time through the loop this
> would work. But then the x value will change for the second loop. Thus,
> I use val as a temporary variable.

Ah, sorry. I misread the ternary conditions, sorry.

Cheers,
  Peter


More information about the xorg-devel mailing list