From f6e65676026fa9f3f2664100b68ba2c6da376a24 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sat, 7 Aug 2010 19:16:00 +0200 Subject: Add configurable pointer gesture In some applications, it is desirable to treat pointer movements as a gesture. This patch adds a gru configuration parameter which, then true, makes grail emit pointer gesture events. Signed-off-by: Henrik Rydberg --- src/gestures-pan.c | 8 ++++---- src/grail-recognizer.c | 5 +++++ src/grail-recognizer.h | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gestures-pan.c b/src/gestures-pan.c index a023122..b8e1751 100644 --- a/src/gestures-pan.c +++ b/src/gestures-pan.c @@ -25,8 +25,8 @@ #include static const int getype[DIM_TOUCH + 1] = { - 0, - 0, + -1, + GRAIL_TYPE_POINTER, GRAIL_TYPE_PAN, GRAIL_TYPE_SWIPE, GRAIL_TYPE_BRUSH, @@ -43,7 +43,7 @@ int gru_pan(struct grail *ge, struct move_model *move = &gru->move; grail_prop_t prop[DIM_GRAIL_PROP]; int mask = state->active ? (move->active & fm_mask) : fm_mask; - if (!move->multi) { + if (!move->multi && (!gru->pointer_gesture || !move->single)) { if (state->active) { gru_end(ge, state->gid, move); state->active = 0; @@ -54,7 +54,7 @@ int gru_pan(struct grail *ge, return 0; if (!state->active) { int type = getype[move->ntouch]; - if (!type) + if (type < 0) return 0; state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame); state->active = 1; diff --git a/src/grail-recognizer.c b/src/grail-recognizer.c index c4c6812..bcfbc2c 100644 --- a/src/grail-recognizer.c +++ b/src/grail-recognizer.c @@ -54,3 +54,8 @@ void gru_recognize(struct grail *ge, const struct touch_frame *frame) gru_tapping(ge, frame); ge->gru->frame = *frame; } + +int gru_use_pointer_gesture(struct grail *ge, int usage) +{ + ge->gru->pointer_gesture = usage; +} diff --git a/src/grail-recognizer.h b/src/grail-recognizer.h index 212ac7d..11b44ce 100644 --- a/src/grail-recognizer.h +++ b/src/grail-recognizer.h @@ -33,6 +33,7 @@ struct gesture_recognizer { struct combo_model rotate; struct combo_model combo; struct tapping_model tapping; + int pointer_gesture; }; int gru_init(struct grail *ge); -- cgit v1.2.3