summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2011-01-18 20:08:09 +0000
committerDaniel Stone <daniel@fooishbar.org>2011-01-24 08:38:53 +1000
commita6469eecd5d3d6bf6e799653db785356e747868b (patch)
treec8092acd701739e4ae43d01f5bdab1ad8f6599cf
parent64237697994871adfcf4905b5784e75cd7281579 (diff)
Input: Pass co-ordinates by reference to transformAbsolute
With the upcoming XI 2.1 touch work, the co-ordinate values will need to be passed by reference, rather than modified in-place. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r--dix/getevents.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index 794df420b..775751216 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1058,23 +1058,14 @@ FreeEventList(EventListPtr list, int num_events)
}
static void
-transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
+transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask, int *x, int *y)
{
- struct pixman_f_vector p;
-
- /* p' = M * p in homogeneous coordinates */
- 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;
+ struct pixman_f_vector p = {.v = {*x, *y, 1}};
pixman_f_transform_point(&dev->transform, &p);
- 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]));
+ *x = lround(p.v[0]);
+ *y = lround(p.v[1]);
}
/**
@@ -1165,7 +1156,16 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
}
}
- transformAbsolute(pDev, &mask);
+ 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);
+
moveAbsolute(pDev, &x, &y, &mask);
} else {
if (flags & POINTER_ACCELERATE) {