diff options
Diffstat (limited to 'src/grail-api.c')
| -rw-r--r-- | src/grail-api.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/grail-api.c b/src/grail-api.c index f7b664e..fbd0e83 100644 --- a/src/grail-api.c +++ b/src/grail-api.c | |||
| @@ -35,6 +35,7 @@ struct grail_impl { | |||
| 35 | struct touch_dev dev; | 35 | struct touch_dev dev; |
| 36 | struct touch_engine engine; | 36 | struct touch_engine engine; |
| 37 | struct evbuf evbuf; | 37 | struct evbuf evbuf; |
| 38 | int filter_abs; | ||
| 38 | }; | 39 | }; |
| 39 | 40 | ||
| 40 | static void tp_event(struct touch_engine *engine, | 41 | static void tp_event(struct touch_engine *engine, |
| @@ -51,19 +52,22 @@ static void tp_sync(struct touch_engine *engine, | |||
| 51 | struct input_event ev; | 52 | struct input_event ev; |
| 52 | struct grail *ge = engine->priv; | 53 | struct grail *ge = engine->priv; |
| 53 | struct grail_impl *x = ge->impl; | 54 | struct grail_impl *x = ge->impl; |
| 55 | struct gesture_recognizer *gru = ge->gru; | ||
| 54 | struct touch_frame *frame = &engine->frame; | 56 | struct touch_frame *frame = &engine->frame; |
| 55 | grail_mask_t filtered[DIM_EV_TYPE_BYTES]; | 57 | grail_mask_t filtered[DIM_EV_TYPE_BYTES]; |
| 56 | int nevent = 0; | 58 | int dofilt, nevent = 0; |
| 57 | gin_frame_begin(ge, frame); | 59 | gin_frame_begin(ge, frame); |
| 58 | gru_recognize(ge, frame); | 60 | gru_recognize(ge, frame); |
| 59 | gin_frame_end(ge, filtered, sizeof(filtered), frame); | 61 | gin_frame_end(ge, filtered, sizeof(filtered), frame); |
| 62 | dofilt = gru->move.multi || gru->move.single && x->filter_abs; | ||
| 63 | |||
| 60 | if (!ge->event) { | 64 | if (!ge->event) { |
| 61 | evbuf_clear(&x->evbuf); | 65 | evbuf_clear(&x->evbuf); |
| 62 | return; | 66 | return; |
| 63 | } | 67 | } |
| 64 | while (!evbuf_empty(&x->evbuf)) { | 68 | while (!evbuf_empty(&x->evbuf)) { |
| 65 | evbuf_get(&x->evbuf, &ev); | 69 | evbuf_get(&x->evbuf, &ev); |
| 66 | if (grail_mask_get(filtered, ev.type)) | 70 | if (dofilt && grail_mask_get(filtered, ev.type)) |
| 67 | continue; | 71 | continue; |
| 68 | ge->event(ge, &ev); | 72 | ge->event(ge, &ev); |
| 69 | nevent++; | 73 | nevent++; |
| @@ -72,6 +76,12 @@ static void tp_sync(struct touch_engine *engine, | |||
| 72 | ge->event(ge, syn); | 76 | ge->event(ge, syn); |
| 73 | } | 77 | } |
| 74 | 78 | ||
| 79 | void grail_filter_abs_events(struct grail *ge, int usage) | ||
| 80 | { | ||
| 81 | struct grail_impl *x = ge->impl; | ||
| 82 | x->filter_abs = usage; | ||
| 83 | } | ||
| 84 | |||
| 75 | int grail_open(struct grail *ge, int fd) | 85 | int grail_open(struct grail *ge, int fd) |
| 76 | { | 86 | { |
| 77 | struct grail_impl *x; | 87 | struct grail_impl *x; |
