[PATCH 25/27] Input: Set last valuators in GetPointerEvents only

Daniel Stone daniel at fooishbar.org
Fri Jun 3 08:00:01 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>
---
 dix/getevents.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dix/getevents.c b/dix/getevents.c
index 7a47c49..ad99cae 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -721,7 +721,6 @@ moveAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
         else
             val = dev->last.valuators[i];
         clipAxis(dev, i, &val);
-        dev->last.valuators[i] = val;
         valuator_mask_set_double(mask, i, val);
     }
 }
@@ -751,7 +750,6 @@ moveRelative(DeviceIntPtr dev, ValuatorMask *mask)
                 ((i != 0 && i != 1) || clip_xy))
                 clipAxis(dev, i, &val);
             valuator_mask_set_double(mask, i, val);
-            dev->last.valuators[i] = val;
         }
     }
 }
@@ -842,10 +840,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))
@@ -1074,7 +1068,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;
@@ -1155,6 +1149,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