Extra pointer motion with current git xf86-input-synaptics

Simon Thum simon.thum at gmx.de
Mon Sep 29 03:21:39 PDT 2008


Peter Hutterer wrote:
> On Sun, Sep 28, 2008 at 07:26:06PM +0200, Simon Thum wrote:
>> rescaleValuatorAxis(int coord, AxisInfoPtr from, AxisInfoPtr to,
>>                     int defmax)
>> {
>>     [...]
>>     return (int)(((float)(coord - fmin) + 0.5f) * (tmax - tmin + 1) /
>>                  (fmax - fmin + 1)) + tmin;
> 
> 
> The patch below should fix another issue, the scaling from device -> core ->
> device. With the patch below, x/y is now used as it is reported by the device
> (unless a screen cross happens).
Great, that's fixing what my patch merely conceals. However, I'm in 
favor of applying both. With translation in place, rounding to nearest 
is simply avoiding errors.

Cheers,

Simon


> diff --git a/dix/getevents.c b/dix/getevents.c
> index 166ab4e..f2086e8 100644
> --- a/dix/getevents.c
> +++ b/dix/getevents.c
> @@ -919,17 +919,22 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
>          master->last.valuators[1] = pDev->last.valuators[1];
>      }
>  
> +    /* Crossed screen? Scale back to device coordiantes */
>      if(cx != pDev->last.valuators[0])
> +    {
> +        scr = miPointerGetScreen(pDev);
> +        x = rescaleValuatorAxis(pDev->last.valuators[0], NULL,
> +                                pDev->valuator->axes + 0, scr->width);
>          cx = pDev->last.valuators[0];
> +    }
>      if(cy != pDev->last.valuators[1])
> +    {
> +        scr = miPointerGetScreen(pDev);
>          cy = pDev->last.valuators[1];
> +        y = rescaleValuatorAxis(pDev->last.valuators[1], NULL,
> +                                pDev->valuator->axes + 1, scr->height);
> +    }
>  
> -    /* scale x/y back to device coordinates */
> -    scr = miPointerGetScreen(pDev);
> -    x = rescaleValuatorAxis(pDev->last.valuators[0], NULL,
> -                        pDev->valuator->axes + 0, scr->width);
> -    y = rescaleValuatorAxis(pDev->last.valuators[1], NULL,
> -                        pDev->valuator->axes + 1, scr->height);
>  
>      updateMotionHistory(pDev, ms, first_valuator, num_valuators,
>              &pDev->last.valuators[first_valuator]);
> @@ -938,7 +943,6 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
>                  &pDev->last.valuators[first_valuator]);
>  
>      /* Update the valuators with the true value sent to the client*/
> -    /* FIXME: we lose subpixel precision here. */
>      if(v0) *v0 = x;
>      if(v1) *v1 = y;
>  




More information about the xorg mailing list