From d07c43f9f19dc0ee38aaf44947cfc396f437490e Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Tue, 3 Aug 2010 15:01:50 +0200 Subject: Introduce zoom, rotate and combo gestures Introduce grail_mask bit functions, and add new gestures as separate functions, referring to the same move model. Signed-off-by: Henrik Rydberg --- src/touch-engine.c | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) (limited to 'src/touch-engine.c') diff --git a/src/touch-engine.c b/src/touch-engine.c index 28b68da..3e6870e 100644 --- a/src/touch-engine.c +++ b/src/touch-engine.c @@ -34,40 +34,29 @@ static void tp_event(struct touch_dev *dev, const struct input_event *ev) static void update_frame(struct touch_frame *frame, int slot, int active, - const touch_prop_mask_t *mask, + const grail_mask_t *mask, const touch_prop_t *prop) { - struct touch *touch = &frame->touch[slot]; - touch->active = active; - if (mask && prop) { - int i; - for (i = 0; i < DIM_TOUCH_PROP; i++) - if (has_prop(mask, i)) - touch->prop[i] = prop[i]; - } + struct touch *t = &frame->touch[slot]; + int i; + t->active = active; + grail_mask_modify(frame->touches, slot, active); + if (mask && prop) + grail_mask_foreach(i, mask, DIM_TOUCH_PROP_BYTES) + t->prop[i] = prop[i]; } static void finalize_frame(struct touch_frame *frame, touch_time_t time) { - int i, last = -1; - frame->ntouch = 0; - frame->slot = -1; - for (i = 0; i < DIM_TOUCH_PROP; i++) { - frame->touch[i].next = -1; - if (frame->touch[i].active) { - if (last < 0) - frame->slot = i; - else - frame->touch[last].next = i; - last = i; - frame->ntouch++; - } - } + int i, nslot = 0; + grail_mask_foreach(i, frame->touches, DIM_TOUCH_BYTES) + frame->active[nslot++] = &frame->touch[i]; + frame->nactive = nslot; frame->time = time; } static void tp_create(struct touch_dev *dev, int slot, - const touch_prop_mask_t *mask, const touch_prop_t *prop) + const grail_mask_t *mask, const touch_prop_t *prop) { struct touch_engine *engine = dev->priv; if (engine) { @@ -77,7 +66,7 @@ static void tp_create(struct touch_dev *dev, int slot, } static void tp_modify(struct touch_dev *dev, int slot, - const touch_prop_mask_t *mask, const touch_prop_t *prop) + const grail_mask_t *mask, const touch_prop_t *prop) { struct touch_engine *engine = dev->priv; if (engine) { @@ -117,7 +106,10 @@ void touch_engine_init(struct touch_engine *engine, const struct input_event *ev), void *priv) { + int i; memset(engine, 0, sizeof(*engine)); + for (i = 0; i < DIM_TOUCH; i++) + engine->frame.touch[i].slot = i; engine->event = event; engine->sync = sync; engine->priv = priv; -- cgit v1.2.3