From 293c6123865c2ec6106949226b790ac54f0eaef6 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Thu, 9 Sep 2010 10:14:26 +0200 Subject: Make sure contact area is always defined Some devices do not always send touch_minor after touch_major has been set. According to the MT protocol, this case should be treated as if minor is equal to major. This patch makes sure touch_minor is never zero when touch_major is set. Signed-off-by: Henrik Rydberg --- src/touch-dev.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/touch-dev.c') diff --git a/src/touch-dev.c b/src/touch-dev.c index 287076a..17082ed 100644 --- a/src/touch-dev.c +++ b/src/touch-dev.c @@ -25,6 +25,9 @@ #include #include +/* see mtdev-mapping.h */ +#define MTDEV_TOUCH_MINOR 1 + #define SET_PROP(name, value) \ if (t->name != value) { \ t->name = value; \ @@ -34,6 +37,9 @@ static void finish_touch(struct touch_dev *dev, struct touch_frame *frame) { struct touch *t = &frame->touch[dev->slot]; + if (t->touch_major && !t->touch_minor || + !dev->mtdev.caps.has_abs[MTDEV_TOUCH_MINOR]) + SET_PROP(touch_minor, t->touch_major); if (dev->state > 0) { t->active = 1; grail_mask_set(frame->touches, dev->slot); -- cgit v1.2.3