summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gestures-tapping.c3
-rw-r--r--src/grail-gestures.c6
-rw-r--r--src/grail-gestures.h4
3 files changed, 9 insertions, 4 deletions
diff --git a/src/gestures-tapping.c b/src/gestures-tapping.c
index d8a580f..0deacf8 100644
--- a/src/gestures-tapping.c
+++ b/src/gestures-tapping.c
@@ -28,7 +28,6 @@ static const int TAP_END = 1;
28static const int TAP_CANCEL = 2; 28static const int TAP_CANCEL = 2;
29 29
30static const int TAP_MIN_GAP_MS = 25; 30static const int TAP_MIN_GAP_MS = 25;
31static const int TAP_MAX_GAP_MS = 300;
32 31
33static const int fm_mask = 0x03; 32static const int fm_mask = 0x03;
34 33
@@ -66,7 +65,7 @@ int gru_tapping(struct grail *ge,
66 } 65 }
67 if (state->ntouch < 1 || state->ntouch > 5) 66 if (state->ntouch < 1 || state->ntouch > 5)
68 state->status = TAP_CANCEL; 67 state->status = TAP_CANCEL;
69 if (move->time - state->start > TAP_MAX_GAP_MS) 68 if (move->time - state->start > move->fm[FM_X].bar_ms)
70 state->status = TAP_CANCEL; 69 state->status = TAP_CANCEL;
71 if (state->status == TAP_END && 70 if (state->status == TAP_END &&
72 move->time - state->start < TAP_MIN_GAP_MS) 71 move->time - state->start < TAP_MIN_GAP_MS)
diff --git a/src/grail-gestures.c b/src/grail-gestures.c
index c743544..1d49765 100644
--- a/src/grail-gestures.c
+++ b/src/grail-gestures.c
@@ -25,6 +25,7 @@
25 25
26static const float FM_SN[DIM_FM] = { 1000, 1000, 200, 1000 }; 26static const float FM_SN[DIM_FM] = { 1000, 1000, 200, 1000 };
27static const float FM_BAR[DIM_FM] = { 50, 50, 30, 50 }; 27static const float FM_BAR[DIM_FM] = { 50, 50, 30, 50 };
28static const grail_time_t FM_BAR_MS[DIM_FM] = { 300, 300, 10000, 10000 };
28static const grail_time_t SAMPLE_MS = 10; 29static const grail_time_t SAMPLE_MS = 10;
29static const float EPS = 1e-5; 30static const float EPS = 1e-5;
30 31
@@ -105,6 +106,7 @@ static void move_reset(struct move_model *m, int i, float x, grail_time_t t)
105 fm->velocity = 0; 106 fm->velocity = 0;
106 fm->value = x; 107 fm->value = x;
107 fm->original = x; 108 fm->original = x;
109 fm->original_ms = t;
108 fm->sample = x; 110 fm->sample = x;
109 fm->sample_ms = t; 111 fm->sample_ms = t;
110 m->tickle &= ~(1 << i); 112 m->tickle &= ~(1 << i);
@@ -130,7 +132,8 @@ static void move_update(struct move_model *m, int i, float x, grail_time_t t)
130 if (m->active & (1 << i)) 132 if (m->active & (1 << i))
131 return; 133 return;
132 fm->action_delta = x - fm->original; 134 fm->action_delta = x - fm->original;
133 if (fabs(fm->action_delta) > fm->bar) 135 if (fabs(fm->action_delta) > fm->bar ||
136 t - fm->original_ms > fm->bar_ms)
134 m->active |= (1 << i); 137 m->active |= (1 << i);
135 else 138 else
136 fm->action_delta = 0; 139 fm->action_delta = 0;
@@ -151,6 +154,7 @@ void gru_init_motion(struct grail *ge)
151 for (i = 0; i < DIM_FM; i++) { 154 for (i = 0; i < DIM_FM; i++) {
152 m->fm[i].fuzz = D[i] / FM_SN[i]; 155 m->fm[i].fuzz = D[i] / FM_SN[i];
153 m->fm[i].bar = D[i] / FM_BAR[i]; 156 m->fm[i].bar = D[i] / FM_BAR[i];
157 m->fm[i].bar_ms = FM_BAR_MS[i];
154 } 158 }
155} 159}
156 160
diff --git a/src/grail-gestures.h b/src/grail-gestures.h
index 658b548..5b8f7d7 100644
--- a/src/grail-gestures.h
+++ b/src/grail-gestures.h
@@ -42,10 +42,12 @@ struct filter_model {
42 float velocity; 42 float velocity;
43 float value; 43 float value;
44 float original; 44 float original;
45 float sample;
45 float fuzz; 46 float fuzz;
46 float bar; 47 float bar;
47 float sample; 48 grail_time_t original_ms;
48 grail_time_t sample_ms; 49 grail_time_t sample_ms;
50 grail_time_t bar_ms;
49}; 51};
50 52
51struct move_model { 53struct move_model {