[PATCH 09/27] Input: Prepare moveAbsolute for conversion to double

Daniel Stone daniel at fooishbar.org
Fri Jun 3 07:59:45 PDT 2011


Shuffle some code around to make moving to double easier later.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 dix/getevents.c |   34 ++++++++++++----------------------
 1 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/dix/getevents.c b/dix/getevents.c
index 453ddd9..473a784 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -703,40 +703,30 @@ UpdateFromMaster(InternalEvent* events, DeviceIntPtr dev, int type, int *num_eve
 /**
  * Move the device's pointer to the position given in the valuators.
  *
- * @param dev The device which's pointer is to be moved.
+ * @param dev The device whose pointer is to be moved.
  * @param x Returns the x position of the pointer after the move.
  * @param y Returns the y position of the pointer after the move.
- * @param mask Bit mask of valid valuators.
- * @param valuators Valuator data for each axis between @first and
- *        @first+ at num.
+ * @param mask Valuator data for this event.
  */
 static void
-moveAbsolute(DeviceIntPtr dev, int *x, int *y, ValuatorMask *mask)
+moveAbsolute(DeviceIntPtr dev, int *x_out, int *y_out, ValuatorMask *mask)
 {
     int i;
+    int x, y;
 
-    if (valuator_mask_isset(mask, 0))
-        *x = valuator_mask_get(mask, 0);
-    else
-        *x = dev->last.valuators[0];
-
-    if (valuator_mask_isset(mask, 1))
-        *y = valuator_mask_get(mask, 1);
-    else
-        *y = dev->last.valuators[1];
-
-    clipAxis(dev, 0, x);
-    clipAxis(dev, 1, y);
-
-    for (i = 2; i < valuator_mask_size(mask); i++)
+    for (i = 0; i < valuator_mask_size(mask); i++)
     {
         if (valuator_mask_isset(mask, i))
         {
-            dev->last.valuators[i] = valuator_mask_get(mask, i);
-            clipAxis(dev, i, &dev->last.valuators[i]);
-            valuator_mask_set(mask, i, dev->last.valuators[i]);
+            int val = valuator_mask_get(mask, i);
+            clipAxis(dev, i, &val);
+            dev->last.valuators[i] = val;
+            valuator_mask_set(mask, i, val);
         }
     }
+
+    *x_out = dev->last.valuators[0];
+    *y_out = dev->last.valuators[1];
 }
 
 /**
-- 
1.7.5.3



More information about the xorg-devel mailing list