[PATCH 17/27] Input: Remove x and y from moveAbsolute/moveRelative

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


Both these functions modify the mask and
pDev->last.{valuators,remainder} in-place now, so there's no need to
pass in pointers to local x and y values.

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

diff --git a/dix/getevents.c b/dix/getevents.c
index 2f8e137..eff277b 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -715,15 +715,12 @@ 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 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 Valuator data for this event.
  */
 static void
-moveAbsolute(DeviceIntPtr dev, int *x_out, int *y_out, ValuatorMask *mask)
+moveAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
 {
     int i;
-    double x = dev->last.valuators[0], y = dev->last.valuators[1];
 
     for (i = 0; i < valuator_mask_size(mask); i++)
     {
@@ -737,21 +734,16 @@ moveAbsolute(DeviceIntPtr dev, int *x_out, int *y_out, ValuatorMask *mask)
         dev->last.remainder[i] = val - floor(val);
         valuator_mask_set_double(mask, i, val);
     }
-
-    *x_out = dev->last.valuators[0];
-    *y_out = dev->last.valuators[1];
 }
 
 /**
  * Move the device's pointer by the values given in @valuators.
  *
  * @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 Valuator data for this event.
  */
 static void
-moveRelative(DeviceIntPtr dev, int *x_out, int *y_out, ValuatorMask *mask)
+moveRelative(DeviceIntPtr dev, ValuatorMask *mask)
 {
     int i;
     Bool clip_xy = IsMaster(dev) || !IsFloating(dev);
@@ -773,9 +765,6 @@ moveRelative(DeviceIntPtr dev, int *x_out, int *y_out, ValuatorMask *mask)
             dev->last.remainder[i] = val - round_towards_zero(val);
         }
     }
-
-    *x_out = dev->last.valuators[0];
-    *y_out = dev->last.valuators[1];
 }
 
 /**
@@ -1185,24 +1174,17 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons
         }
 
         transformAbsolute(pDev, &mask);
-        /* x and y are only set, but not used, by moveAbsolute */
-        moveAbsolute(pDev, &x, &y, &mask);
+        moveAbsolute(pDev, &mask);
     } else {
         if (flags & POINTER_ACCELERATE)
             accelPointer(pDev, &mask, ms);
-        moveRelative(pDev, &x, &y, &mask);
+        moveRelative(pDev, &mask);
     }
 
-    if (valuator_mask_isset(&mask, 0))
-    {
-        x_frac = valuator_mask_get_double(&mask, 0);
-        x_frac -= round_towards_zero(x_frac);
-    }
-    if (valuator_mask_isset(&mask, 1))
-    {
-        y_frac = valuator_mask_get_double(&mask, 1);
-        y_frac -= round_towards_zero(y_frac);
-    }
+    x = pDev->last.valuators[0];
+    x_frac = pDev->last.remainder[0];
+    y = pDev->last.valuators[1];
+    y_frac = pDev->last.remainder[1];
 
     set_raw_valuators(raw, &mask, raw->valuators.data,
                       raw->valuators.data_frac);
-- 
1.7.5.3



More information about the xorg-devel mailing list