Extra pointer motion with current git xf86-input-synaptics
Magnus Kessler
Magnus.Kessler at gmx.net
Mon Sep 29 23:07:47 PDT 2008
On Monday 29 September 2008, Peter Hutterer wrote:
> On Sun, Sep 28, 2008 at 07:26:06PM +0200, Simon Thum wrote:
> >> The screen coords are used to move the cursor and the scaling is done
> >> based on the axis ranges. Hence the different acceleration when you
> >> change the axis range to 0,-1 (in which case the screen coords are
> >> used as axis ranges).
> >
> > To me, this case sounds like a rounding error piling up.
> >
> > What about:
> >
> > 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).
>
> 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;
Thanks, Peter. Your patch solves my original problem as well. No more
unwanted pointer movement seen on my machine. Can you please commit this to
the xserver?
Regards,
Magnus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.x.org/archives/xorg/attachments/20080930/597f0bb6/attachment.pgp>
More information about the xorg
mailing list