summaryrefslogtreecommitdiff
path: root/src/grail-api.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-09-10 12:28:17 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-09-10 12:28:17 +0200
commit9482738f738af43ca8932014f7953f2d2b3beef0 (patch)
treefab157631e3464911b6c76f6763d824f25565cba /src/grail-api.c
parentbe45e7cc1e71a358a35add1cd62280e8224b53f1 (diff)
Only emit abs events when motion is active
This bug was hidden behind the motion inhibit during tapping, but resurfaced when tapping from resting finger was introduced. With this patch, pointer movement is inhibited also when lifting fingers from the surface. Ideally, tapping should be treated as a transient event, which would allow zero pointer event also _before_ the tap, but presently unity seems to depend on the initial pointer movement as a touch-down event. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/grail-api.c')
-rw-r--r--src/grail-api.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/grail-api.c b/src/grail-api.c
index 1a60a21..d0712b3 100644
--- a/src/grail-api.c
+++ b/src/grail-api.c
@@ -92,20 +92,27 @@ static int handle_abs_events(struct grail *ge,
92 return nevent; 92 return nevent;
93} 93}
94 94
95static int pointer_active(const struct grail *ge)
96{
97 static const int fm_mask = 0x03;
98 const struct move_model *move = &ge->gru->move;
99 const struct tapping_model *tap = &ge->gru->tapping;
100 return move->single && ((move->active & fm_mask) || tap->active);
101}
102
95static void tp_sync(struct touch_dev *dev, 103static void tp_sync(struct touch_dev *dev,
96 const struct input_event *syn) 104 const struct input_event *syn)
97{ 105{
98 struct input_event ev; 106 struct input_event ev;
99 struct grail *ge = dev->priv; 107 struct grail *ge = dev->priv;
100 struct grail_impl *impl = ge->impl; 108 struct grail_impl *impl = ge->impl;
101 struct gesture_recognizer *gru = ge->gru;
102 struct touch_frame *frame = &dev->frame; 109 struct touch_frame *frame = &dev->frame;
103 grail_mask_t filtered[DIM_EV_TYPE_BYTES]; 110 grail_mask_t filtered[DIM_EV_TYPE_BYTES];
104 int pointer, nevent = 0; 111 int pointer, nevent = 0;
105 gin_frame_begin(ge, frame); 112 gin_frame_begin(ge, frame);
106 gru_recognize(ge, frame); 113 gru_recognize(ge, frame);
107 gin_frame_end(ge, filtered, sizeof(filtered), frame); 114 gin_frame_end(ge, filtered, sizeof(filtered), frame);
108 pointer = gru->move.single && !grail_mask_get(filtered, EV_ABS); 115 pointer = pointer_active(ge) && !grail_mask_get(filtered, EV_ABS);
109 116
110 if (!ge->event) { 117 if (!ge->event) {
111 evbuf_clear(&impl->evbuf); 118 evbuf_clear(&impl->evbuf);