summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2011-03-02 13:19:00 +0000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-09-29 12:23:51 +1000
commit80fdf9ca33a8f50f98a4b1a3279e66b040353b80 (patch)
treeb29286dfac5662db51431b188aaf4dffc16e369d
parent6a6b4eb05c7822860e2362fa9b8441fc67055e27 (diff)
Input: Prepare moveAbsolute for conversion to double
Shuffle some code around to make moving to double easier later. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--dix/getevents.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index d9c5c0df5..bcac6aa9f 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -690,40 +690,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+@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];
}
/**