[xserver PATCH 2/3] Fix transformAbsolute
Chase Douglas
chase.douglas at canonical.com
Mon Nov 15 08:42:12 PST 2010
From: Chase Douglas <chase.douglas at ubuntu.com>
transformAbsolute must use old values if valuator mask doesn't have new
ones, and it must only set new values if there was a change.
Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
dix/getevents.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/dix/getevents.c b/dix/getevents.c
index d2f1025..8ebd63b 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1065,14 +1065,18 @@ transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
struct pixman_f_vector p;
/* p' = M * p in homogeneous coordinates */
- p.v[0] = valuator_mask_get(mask, 0);
- p.v[1] = valuator_mask_get(mask, 1);
+ p.v[0] = (valuator_mask_isset(mask, 0) ? valuator_mask_get(mask, 0) :
+ dev->last.valuators[0]);
+ p.v[1] = (valuator_mask_isset(mask, 1) ? valuator_mask_get(mask, 1) :
+ dev->last.valuators[1]);
p.v[2] = 1.0;
pixman_f_transform_point(&dev->transform, &p);
- valuator_mask_set(mask, 0, lround(p.v[0]));
- valuator_mask_set(mask, 1, lround(p.v[1]));
+ if (lround(p.v[0]) != dev->last.valuators[0])
+ valuator_mask_set(mask, 0, lround(p.v[0]));
+ if (lround(p.v[1]) != dev->last.valuators[1])
+ valuator_mask_set(mask, 1, lround(p.v[1]));
}
/**
--
1.7.1
More information about the xorg-devel
mailing list