diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-06-15 20:24:14 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-06-16 02:28:08 +0200 |
| commit | 78085b21f2dc7b1d49a0c54ab56b567fc195d440 (patch) | |
| tree | 3ae649c25b380114ce2eaa5463350fb9b29ee78c /src/memory.c | |
| parent | 4583da1ad81b59b2a8cd2ae51c32b1bc8d32f1c4 (diff) | |
refactor: Simplify capabilities
Use the generated abs2mt mapping to simplify the MT device
capabilities.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/memory.c')
| -rw-r--r-- | src/memory.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/memory.c b/src/memory.c index 9084502..39621da 100644 --- a/src/memory.c +++ b/src/memory.c | |||
| @@ -21,6 +21,9 @@ | |||
| 21 | 21 | ||
| 22 | #include "memory.h" | 22 | #include "memory.h" |
| 23 | 23 | ||
| 24 | /* click area definition */ | ||
| 25 | #define CLICK_AREA(c) ((c->has_ibt ? 0.20 : 0.00) * get_cap_ysize(c)) | ||
| 26 | |||
| 24 | /* fraction of max movement threshold */ | 27 | /* fraction of max movement threshold */ |
| 25 | #define DELTA_CUT(x) (0.5 * (x)) | 28 | #define DELTA_CUT(x) (0.5 * (x)) |
| 26 | 29 | ||
| @@ -88,11 +91,12 @@ static void update_pointers(struct Memory *m, | |||
| 88 | const struct Capabilities *caps) | 91 | const struct Capabilities *caps) |
| 89 | { | 92 | { |
| 90 | const struct MTFinger *f = state->finger; | 93 | const struct MTFinger *f = state->finger; |
| 94 | int yclick = caps->abs[BIT_POSITION_Y].maximum - CLICK_AREA(caps); | ||
| 91 | int i; | 95 | int i; |
| 92 | 96 | ||
| 93 | if (state->nfinger < 2) { | 97 | if (state->nfinger < 2) { |
| 94 | m->pointing = m->fingers; | 98 | m->pointing = m->fingers; |
| 95 | m->ybar = caps->abs_position_y.maximum; | 99 | m->ybar = caps->abs[BIT_POSITION_Y].maximum; |
| 96 | return; | 100 | return; |
| 97 | } | 101 | } |
| 98 | 102 | ||
| @@ -107,9 +111,9 @@ static void update_pointers(struct Memory *m, | |||
| 107 | } | 111 | } |
| 108 | 112 | ||
| 109 | m->pointing = 0; | 113 | m->pointing = 0; |
| 110 | m->ybar = caps->yclick; | 114 | m->ybar = yclick; |
| 111 | foreach_bit(i, m->fingers) { | 115 | foreach_bit(i, m->fingers) { |
| 112 | if (f[i].hw.position_y > caps->yclick) | 116 | if (f[i].hw.position_y > yclick) |
| 113 | continue; | 117 | continue; |
| 114 | if (!m->pointing || f[i].hw.position_y > m->ybar) | 118 | if (!m->pointing || f[i].hw.position_y > m->ybar) |
| 115 | m->ybar = f[i].hw.position_y; | 119 | m->ybar = f[i].hw.position_y; |
