summaryrefslogtreecommitdiff
path: root/src/grail-gestures.c
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2011-04-12 18:11:46 +0200
committerHenrik Rydberg <rydberg@euromail.se>2011-04-12 18:16:16 +0200
commit6b56d222dde782fb618b1886c5ed8279271a80b8 (patch)
tree711182c73fb1d21a8ee0afa23ff01a08ffa1c16d /src/grail-gestures.c
parent1fb331ca738e92e5815fe8b7ce503c187f52fecc (diff)
Remove the obsoleted transformation filter
Remove the additional filtering performed in the gestural transforms. This used to serve a purpose during development against devices without per-contact filtering. Since then, all devices are filtered, rendering the extra filtering obsolete. This patch also fixes a problem with rotation events. Currently, if you rotate very fast, the rotation angle will be close to the true angle. However, if you rotate very slow, the rotation angle will be much less than the true rotation angle. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/grail-gestures.c')
-rw-r--r--src/grail-gestures.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/src/grail-gestures.c b/src/grail-gestures.c
index c4ae0dc..b461dc3 100644
--- a/src/grail-gestures.c
+++ b/src/grail-gestures.c
@@ -87,18 +87,6 @@ static float compute_rotation(float x, float y, float r,
87 return da; 87 return da;
88} 88}
89 89
90/* Response-augmented EWMA filter, courtesy of Vojtech Pavlik */
91static float move_filter(const struct filter_model *m, float val)
92{
93 if (val > m->value - m->fuzz / 2 && val < m->value + m->fuzz / 2)
94 return m->value;
95 if (val > m->value - m->fuzz && val < m->value + m->fuzz)
96 return (m->value * 3 + val) / 4;
97 if (val > m->value - m->fuzz * 2 && val < m->value + m->fuzz * 2)
98 return (m->value + val) / 2;
99 return val;
100}
101
102static void move_reset(struct move_model *m, int i, float x, grail_time_t t) 90static void move_reset(struct move_model *m, int i, float x, grail_time_t t)
103{ 91{
104 struct filter_model *fm = &m->fm[i]; 92 struct filter_model *fm = &m->fm[i];
@@ -192,15 +180,10 @@ void gru_motion(struct grail *ge,
192 m->single = 1; 180 m->single = 1;
193 m->multi = 0; 181 m->multi = 0;
194 } else { 182 } else {
195 x = move_filter(&m->fm[FM_X], x);
196 y = move_filter(&m->fm[FM_Y], y);
197 r = compute_radius(x, y, frame); 183 r = compute_radius(x, y, frame);
198 r = move_filter(&m->fm[FM_R], r);
199 a = m->fm[FM_A].value; 184 a = m->fm[FM_A].value;
200 if (!s->is_semi_mt) { 185 if (!s->is_semi_mt)
201 a += compute_rotation(x, y, r, frame); 186 a += compute_rotation(x, y, r, frame);
202 a = move_filter(&m->fm[FM_A], a);
203 }
204 move_update(m, FM_X, x, t); 187 move_update(m, FM_X, x, t);
205 move_update(m, FM_Y, y, t); 188 move_update(m, FM_Y, y, t);
206 move_update(m, FM_R, r, t); 189 move_update(m, FM_R, r, t);