summaryrefslogtreecommitdiff
path: root/src/gestures-tapping.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-09-10 13:08:22 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-09-10 14:06:10 +0200
commit2c07d7aa94c9f2f40d72875cf19a9c6a7b3a2c69 (patch)
treedee07e5ac6525ca4a6f35fef4632f6ce29409299 /src/gestures-tapping.c
parent9482738f738af43ca8932014f7953f2d2b3beef0 (diff)
Inhibit taps immediately after a finger is lifted
The intentional tap starts with a finger in the air. This patch treats the sequence up-down-up as unintentional, unless performed with a single finger. Fixes the problem with accidental taps during multi-finger gestures. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/gestures-tapping.c')
-rw-r--r--src/gestures-tapping.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gestures-tapping.c b/src/gestures-tapping.c
index 8727639..5474731 100644
--- a/src/gestures-tapping.c
+++ b/src/gestures-tapping.c
@@ -24,6 +24,7 @@
24#include <math.h> 24#include <math.h>
25 25
26static const int TAP_MIN_GAP_MS = 25; 26static const int TAP_MIN_GAP_MS = 25;
27static const int TAP_MIN_UP_MS = 200;
27 28
28static const int fm_mask = 0x07; 29static const int fm_mask = 0x07;
29 30
@@ -44,6 +45,9 @@ int gru_tapping(struct grail *ge,
44 struct gesture_recognizer *gru = ge->gru; 45 struct gesture_recognizer *gru = ge->gru;
45 struct tapping_model *state = &gru->tapping; 46 struct tapping_model *state = &gru->tapping;
46 struct move_model *move = &gru->move; 47 struct move_model *move = &gru->move;
48 grail_time_t up = move->time - state->end;
49 if (move->ntouch && move->ntouch < state->ntouch)
50 state->end = move->time;
47 if (move->ntouch > state->ntouch) { 51 if (move->ntouch > state->ntouch) {
48 if (state->active) { 52 if (state->active) {
49 gin_gid_discard(ge, state->gid); 53 gin_gid_discard(ge, state->gid);
@@ -67,7 +71,8 @@ int gru_tapping(struct grail *ge,
67 int x = state->prop[GRAIL_PROP_TAP_X]; 71 int x = state->prop[GRAIL_PROP_TAP_X];
68 int y = state->prop[GRAIL_PROP_TAP_Y]; 72 int y = state->prop[GRAIL_PROP_TAP_Y];
69 int t = move->time - state->start; 73 int t = move->time - state->start;
70 if (t < TAP_MIN_GAP_MS || t > move->fm[FM_X].bar_ms) { 74 if (t < TAP_MIN_GAP_MS || t > move->fm[FM_X].bar_ms ||
75 up < TAP_MIN_UP_MS) {
71 gin_gid_discard(ge, state->gid); 76 gin_gid_discard(ge, state->gid);
72 state->ntouch = move->ntouch; 77 state->ntouch = move->ntouch;
73 state->active = 0; 78 state->active = 0;