diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-05-31 10:23:57 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-10-10 11:28:22 +1000 |
commit | cfc515b805712a10b3e8e115e8fc96f0e842de61 (patch) | |
tree | 5f4f5559d6d2cfcf1b3222eddf7b4b063a44e53a | |
parent | a85c6f5ab3b51515e890a88b4e49ec8bafa5aec6 (diff) |
dix: don't pass x/y to transformAbsolute
We passed in the mask, but didn't do anything with it. Move the logic to
take the axes out of the valuator masks into transformAbsolute.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
(cherry picked from commit fe4b818700453b76d9f46749dac5d12540b91e63)
-rw-r--r-- | dix/getevents.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index d0c963e18..90d5434ca 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -1088,17 +1088,38 @@ FreeEventList(EventListPtr list, int num_events) free(list); } +/** + * Transform vector x/y according to matrix m and drop the rounded coords + * back into x/y. + */ static void -transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask, int *x, int *y) +transform(struct pixman_f_transform *m, int *x, int *y) { struct pixman_f_vector p = {.v = {*x, *y, 1}}; - - pixman_f_transform_point(&dev->transform, &p); + pixman_f_transform_point(m, &p); *x = lround(p.v[0]); *y = lround(p.v[1]); } +static void +transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask) +{ + int x, y; + + x = valuator_mask_isset(mask, 0) ? valuator_mask_get(mask, 0) : + dev->last.valuators[0]; + y = valuator_mask_isset(mask, 1) ? valuator_mask_get(mask, 1) : + dev->last.valuators[1]; + + transform(&dev->transform, &x, &y); + + if (valuator_mask_isset(mask, 0)) + valuator_mask_set(mask, 0, x); + if (valuator_mask_isset(mask, 1)) + valuator_mask_set(mask, 1, y); +} + /** * Generate a series of InternalEvents (filled into the EventList) * representing pointer motion, or button presses. @@ -1200,16 +1221,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, } } - x = (valuator_mask_isset(&mask, 0) ? valuator_mask_get(&mask, 0) : - pDev->last.valuators[0]); - y = (valuator_mask_isset(&mask, 1) ? valuator_mask_get(&mask, 1) : - pDev->last.valuators[1]); - transformAbsolute(pDev, &mask, &x, &y); - if (valuator_mask_isset(&mask, 0)) - valuator_mask_set(&mask, 0, x); - if (valuator_mask_isset(&mask, 1)) - valuator_mask_set(&mask, 1, y); - + transformAbsolute(pDev, &mask); moveAbsolute(pDev, &x, &y, &mask); } else { if (flags & POINTER_ACCELERATE) { |