diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-09-09 10:14:26 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-09-09 10:14:26 +0200 |
| commit | 293c6123865c2ec6106949226b790ac54f0eaef6 (patch) | |
| tree | ce996d12dec885b8d53d5b3140c7f4d0b0df3a11 /src/touch-dev.c | |
| parent | c704f3ea261cc682c6b3dc7ac98b81a66180b26a (diff) | |
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 <rydberg@euromail.se>
Diffstat (limited to 'src/touch-dev.c')
| -rw-r--r-- | src/touch-dev.c | 6 |
1 files changed, 6 insertions, 0 deletions
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 @@ | |||
| 25 | #include <string.h> | 25 | #include <string.h> |
| 26 | #include <errno.h> | 26 | #include <errno.h> |
| 27 | 27 | ||
| 28 | /* see mtdev-mapping.h */ | ||
| 29 | #define MTDEV_TOUCH_MINOR 1 | ||
| 30 | |||
| 28 | #define SET_PROP(name, value) \ | 31 | #define SET_PROP(name, value) \ |
| 29 | if (t->name != value) { \ | 32 | if (t->name != value) { \ |
| 30 | t->name = value; \ | 33 | t->name = value; \ |
| @@ -34,6 +37,9 @@ | |||
| 34 | static void finish_touch(struct touch_dev *dev, struct touch_frame *frame) | 37 | static void finish_touch(struct touch_dev *dev, struct touch_frame *frame) |
| 35 | { | 38 | { |
| 36 | struct touch *t = &frame->touch[dev->slot]; | 39 | struct touch *t = &frame->touch[dev->slot]; |
| 40 | if (t->touch_major && !t->touch_minor || | ||
| 41 | !dev->mtdev.caps.has_abs[MTDEV_TOUCH_MINOR]) | ||
| 42 | SET_PROP(touch_minor, t->touch_major); | ||
| 37 | if (dev->state > 0) { | 43 | if (dev->state > 0) { |
| 38 | t->active = 1; | 44 | t->active = 1; |
| 39 | grail_mask_set(frame->touches, dev->slot); | 45 | grail_mask_set(frame->touches, dev->slot); |
