From 9482738f738af43ca8932014f7953f2d2b3beef0 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Fri, 10 Sep 2010 12:28:17 +0200 Subject: 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 --- src/grail-api.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/grail-api.c') 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, return nevent; } +static int pointer_active(const struct grail *ge) +{ + static const int fm_mask = 0x03; + const struct move_model *move = &ge->gru->move; + const struct tapping_model *tap = &ge->gru->tapping; + return move->single && ((move->active & fm_mask) || tap->active); +} + static void tp_sync(struct touch_dev *dev, const struct input_event *syn) { struct input_event ev; struct grail *ge = dev->priv; struct grail_impl *impl = ge->impl; - struct gesture_recognizer *gru = ge->gru; struct touch_frame *frame = &dev->frame; grail_mask_t filtered[DIM_EV_TYPE_BYTES]; int pointer, nevent = 0; gin_frame_begin(ge, frame); gru_recognize(ge, frame); gin_frame_end(ge, filtered, sizeof(filtered), frame); - pointer = gru->move.single && !grail_mask_get(filtered, EV_ABS); + pointer = pointer_active(ge) && !grail_mask_get(filtered, EV_ABS); if (!ge->event) { evbuf_clear(&impl->evbuf); -- cgit v1.2.3