[PATCH (v5) evdev 1/4] Add support for masked valuators

Peter Hutterer peter.hutterer at who-t.net
Thu Jan 20 21:00:10 PST 2011


On Wed, Jan 19, 2011 at 11:11:54PM +0000, Daniel Stone wrote:
> From: Chase Douglas <chase.douglas at canonical.com>
> 
> With the X server now supporting masked valuators for XI2, enable
> support in X evdev.
> 
> This kills backwards compatibility with X Input ABI < 12
> 
> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
> ---
> 
> v5: No changes other than fixing conflicts.

this needs an 
#if GET_ABI_MAJOR < 12
#error you lose

and all free(mask) should be replaced with valuator_mask_free(&mask);
(the patch for that has been sitting in the pull request)

also, I've been meaning to bump the minor abi once the evdev conversion to
valuator masks is done. if you think we need to add another valuator mask
call, we need to get it in now.

[...]

> @@ -444,46 +432,43 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v,
>       * just works.
>       */
>      else if (pEvdev->abs_queued && pEvdev->in_proximity) {
> -        memcpy(v, pEvdev->vals, sizeof(int) * pEvdev->num_vals);
> +        int unswapped_x = valuator_mask_get(pEvdev->mask, 0);
> +        int unswapped_y = valuator_mask_get(pEvdev->mask, 1);
> +        int i;
>  
> -        if (pEvdev->swap_axes) {
> -            int tmp = v[0];
> -            v[0] = xf86ScaleAxis(v[1],
> -                    pEvdev->absinfo[ABS_X].maximum,
> -                    pEvdev->absinfo[ABS_X].minimum,
> -                    pEvdev->absinfo[ABS_Y].maximum,
> -                    pEvdev->absinfo[ABS_Y].minimum);
> -            v[1] = xf86ScaleAxis(tmp,
> -                    pEvdev->absinfo[ABS_Y].maximum,
> -                    pEvdev->absinfo[ABS_Y].minimum,
> -                    pEvdev->absinfo[ABS_X].maximum,
> -                    pEvdev->absinfo[ABS_X].minimum);
> -        }
> +        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);
>  
> -        *num_v = pEvdev->num_vals;
> -        *first_v = 0;
> +            if (pEvdev->swap_axes)
> +                val = xf86ScaleAxis((i == 0 ? unswapped_y : unswapped_x),

i've pointed this out in the last time: there's no need for unswapped_x or
unswapped_y here. you can just use valuator_mask_get(mask, i);

Cheers,
  Peter


More information about the xorg-devel mailing list