diff options
author | Daniel Stone <daniel@fooishbar.org> | 2011-03-02 13:19:00 +0000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-10-10 11:28:23 +1000 |
commit | bd0365d9bca62bc29948bddb4d65f3302ede9339 (patch) | |
tree | 5b917837e8f4b4ef59b065d9b9bcb33eaa94fd40 | |
parent | a8879a93096cab2e5e8551e56f139d8735f3abab (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>
(cherry picked from commit 80fdf9ca33a8f50f98a4b1a3279e66b040353b80)
-rw-r--r-- | dix/getevents.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index ad0fe4304..329940d9a 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -709,40 +709,30 @@ UpdateFromMaster(EventListPtr events, DeviceIntPtr dev, int type, int *num_event /** * 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]; } /** |