Extra pointer motion with current git xf86-input-synaptics

Peter Hutterer peter.hutterer at who-t.net
Sun Sep 28 23:32:36 PDT 2008


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;
 
-- 
1.5.4.3



More information about the xorg mailing list