summaryrefslogtreecommitdiff
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-10-10 11:28:22 +1000
commit5f015d210debc94471c0b088f8e12ae904a5b59e (patch)
treedeb6e23a8b18dc362a29310dedc4659017c6662c
parentcfc515b805712a10b3e8e115e8fc96f0e842de61 (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> (cherry picked from commit b75cdb5bf76303162e947173e8ee68253a861272)
-rw-r--r--dix/getevents.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index 90d5434ca..2056f856d 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1105,18 +1105,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);
}