[PATCH 24/28] Input: Set last valuators in GetPointerEvents only

Daniel Stone daniel at fooishbar.org
Thu Jun 9 10:17:32 PDT 2011


Previously, various pieces of code, including acceleration, used to drop
the values into DeviceIntRec::last.valuators.  Remove all this and only
do it in GetPointerEvents after all transformation, acceleration and
clipping, so we're guaranteed to always have the correct values.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 dix/getevents.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dix/getevents.c b/dix/getevents.c
index 0ba992b..bbe54e0 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -720,7 +720,6 @@ moveAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
             continue;
         val = valuator_mask_get_double(mask, i);
         clipAxis(dev, i, &val);
-        dev->last.valuators[i] = val;
         valuator_mask_set_double(mask, i, val);
     }
 }
@@ -750,7 +749,6 @@ moveRelative(DeviceIntPtr dev, ValuatorMask *mask)
         if (valuator_get_mode(dev, i) == Absolute &&
             ((i != 0 && i != 1) || clip_xy))
             clipAxis(dev, i, &val);
-        dev->last.valuators[i] = val;
         valuator_mask_set_double(mask, i, val);
     }
 }
@@ -840,10 +838,6 @@ positionSprite(DeviceIntPtr dev, int mode, ScreenPtr scr, ValuatorMask *mask,
         master->last.valuators[1] = *screeny;
     }
 
-    /* dropy x/y (device coordinates) back into valuators for next event */
-    dev->last.valuators[0] = x;
-    dev->last.valuators[1] = y;
-
     if (valuator_mask_isset(mask, 0))
         valuator_mask_set_double(mask, 0, x);
     if (valuator_mask_isset(mask, 1))
@@ -1087,7 +1081,7 @@ QueuePointerEvents(DeviceIntPtr device, int type,
 int
 GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons,
                  int flags, const ValuatorMask *mask_in) {
-    int num_events = 1;
+    int num_events = 1, i;
     CARD32 ms;
     DeviceEvent *event;
     RawDeviceEvent    *raw;
@@ -1168,6 +1162,12 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons
 
     clipValuators(pDev, &mask);
 
+    for (i = 0; i < valuator_mask_size(&mask); i++)
+    {
+        if (valuator_mask_isset(&mask, i))
+            pDev->last.valuators[i] = valuator_mask_get_double(&mask, i);
+    }
+
     event = &events->device_event;
     init_event(pDev, event, ms);
 
-- 
1.7.5.3



More information about the xorg-devel mailing list