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>
This commit is contained in:
Peter Hutterer 2011-05-31 10:51:19 +10:00
parent fe4b818700
commit b75cdb5bf7

View File

@ -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);
}