summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-05-31 10:51:19 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-06-03 14:43:05 +1000
commitb75cdb5bf76303162e947173e8ee68253a861272 (patch)
treef883f5291b29e4c8a2968c5a642cc4b5da160530 /dix
parentfe4b818700453b76d9f46749dac5d12540b91e63 (diff)
dix: drop x/y back into the right valuators after transformation.
If the matrix is used for rotation, the coordinates affected may change. e.g. a valuator mask of (x, nil) becomes [x, lasty] and is rotated to [lasty, x]. Since the second value was unset, we would not drop x back into the mask, resulting in a loss of movement. Thus, drop any value that changed after applying the matrix into the valuators. Thus, the example above becomes (x, nil) → [x, lasty] → [lasty, x] → (lasty, x) Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Simon Thum <simon.thum@gmx.de>
Diffstat (limited to 'dix')
-rw-r--r--dix/getevents.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index 6dcee3e97..1352a81e5 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1069,18 +1069,19 @@ transform(struct pixman_f_transform *m, int *x, int *y)
static void
transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
{
- int x, y;
+ int x, y, ox, oy;
- 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];
+ ox = x = valuator_mask_isset(mask, 0) ? valuator_mask_get(mask, 0) :
+ dev->last.valuators[0];
+ oy = 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))
+ if (valuator_mask_isset(mask, 0) || ox != x)
valuator_mask_set(mask, 0, x);
- if (valuator_mask_isset(mask, 1))
+
+ if (valuator_mask_isset(mask, 1) || oy != y)
valuator_mask_set(mask, 1, y);
}