summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gestures-tapping.c7
-rw-r--r--src/grail-gestures.h2
2 files changed, 7 insertions, 2 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;
diff --git a/src/grail-gestures.h b/src/grail-gestures.h
index 5a242d9..247acf9 100644
--- a/src/grail-gestures.h
+++ b/src/grail-gestures.h
@@ -97,7 +97,7 @@ int gru_winrotate(struct grail *ge,
97 const struct touch_frame *frame); 97 const struct touch_frame *frame);
98 98
99struct tapping_model { 99struct tapping_model {
100 grail_time_t start; 100 grail_time_t start, end;
101 int ntouch; 101 int ntouch;
102 int active, gid; 102 int active, gid;
103 int nprop; 103 int nprop;