diff options
Diffstat (limited to 'src/mtstate.c')
| -rw-r--r-- | src/mtstate.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/mtstate.c b/src/mtstate.c index a8541dc..c3bcc78 100644 --- a/src/mtstate.c +++ b/src/mtstate.c | |||
| @@ -39,6 +39,14 @@ static int touching_finger(const struct FingerData *hw, | |||
| 39 | return 1; | 39 | return 1; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | static int set_finger(struct MTFinger *f, | ||
| 43 | const struct FingerState *fs, | ||
| 44 | const struct Capabilities *caps) | ||
| 45 | { | ||
| 46 | f->hw = fs->hw; | ||
| 47 | f->id = fs->id; | ||
| 48 | } | ||
| 49 | |||
| 42 | void extract_mtstate(struct MTState *s, | 50 | void extract_mtstate(struct MTState *s, |
| 43 | const struct HWState *hs, | 51 | const struct HWState *hs, |
| 44 | const struct Capabilities *caps) | 52 | const struct Capabilities *caps) |
| @@ -46,15 +54,18 @@ void extract_mtstate(struct MTState *s, | |||
| 46 | int i; | 54 | int i; |
| 47 | 55 | ||
| 48 | s->nfinger = 0; | 56 | s->nfinger = 0; |
| 49 | for (i = 0; i < hs->nfinger; i++) | 57 | for (i = 0; i < hs->nfinger; i++) { |
| 50 | if (touching_finger(&hs->finger[i].hw, caps)) | 58 | if (!touching_finger(&hs->finger[i].hw, caps)) |
| 51 | s->finger[s->nfinger++] = hs->finger[i]; | 59 | continue; |
| 60 | set_finger(&s->finger[s->nfinger], &hs->finger[i], caps); | ||
| 61 | s->nfinger++; | ||
| 62 | } | ||
| 52 | 63 | ||
| 53 | s->button = hs->button; | 64 | s->button = hs->button; |
| 54 | s->evtime = hs->evtime; | 65 | s->evtime = hs->evtime; |
| 55 | } | 66 | } |
| 56 | 67 | ||
| 57 | const struct FingerState *find_finger(const struct MTState *s, int id) | 68 | const struct MTFinger *find_finger(const struct MTState *s, int id) |
| 58 | { | 69 | { |
| 59 | int i; | 70 | int i; |
| 60 | 71 | ||
