diff options
Diffstat (limited to 'src/touch-engine.c')
| -rw-r--r-- | src/touch-engine.c | 42 |
1 files changed, 17 insertions, 25 deletions
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) | |||
| 34 | 34 | ||
| 35 | static void update_frame(struct touch_frame *frame, | 35 | static void update_frame(struct touch_frame *frame, |
| 36 | int slot, int active, | 36 | int slot, int active, |
| 37 | const touch_prop_mask_t *mask, | 37 | const grail_mask_t *mask, |
| 38 | const touch_prop_t *prop) | 38 | const touch_prop_t *prop) |
| 39 | { | 39 | { |
| 40 | struct touch *touch = &frame->touch[slot]; | 40 | struct touch *t = &frame->touch[slot]; |
| 41 | touch->active = active; | 41 | int i; |
| 42 | if (mask && prop) { | 42 | t->active = active; |
| 43 | int i; | 43 | grail_mask_modify(frame->touches, slot, active); |
| 44 | for (i = 0; i < DIM_TOUCH_PROP; i++) | 44 | if (mask && prop) |
| 45 | if (has_prop(mask, i)) | 45 | grail_mask_foreach(i, mask, DIM_TOUCH_PROP_BYTES) |
| 46 | touch->prop[i] = prop[i]; | 46 | t->prop[i] = prop[i]; |
| 47 | } | ||
| 48 | } | 47 | } |
| 49 | 48 | ||
| 50 | static void finalize_frame(struct touch_frame *frame, touch_time_t time) | 49 | static void finalize_frame(struct touch_frame *frame, touch_time_t time) |
| 51 | { | 50 | { |
| 52 | int i, last = -1; | 51 | int i, nslot = 0; |
| 53 | frame->ntouch = 0; | 52 | grail_mask_foreach(i, frame->touches, DIM_TOUCH_BYTES) |
| 54 | frame->slot = -1; | 53 | frame->active[nslot++] = &frame->touch[i]; |
| 55 | for (i = 0; i < DIM_TOUCH_PROP; i++) { | 54 | frame->nactive = nslot; |
| 56 | frame->touch[i].next = -1; | ||
| 57 | if (frame->touch[i].active) { | ||
| 58 | if (last < 0) | ||
| 59 | frame->slot = i; | ||
| 60 | else | ||
| 61 | frame->touch[last].next = i; | ||
| 62 | last = i; | ||
| 63 | frame->ntouch++; | ||
| 64 | } | ||
| 65 | } | ||
| 66 | frame->time = time; | 55 | frame->time = time; |
| 67 | } | 56 | } |
| 68 | 57 | ||
| 69 | static void tp_create(struct touch_dev *dev, int slot, | 58 | static void tp_create(struct touch_dev *dev, int slot, |
| 70 | const touch_prop_mask_t *mask, const touch_prop_t *prop) | 59 | const grail_mask_t *mask, const touch_prop_t *prop) |
| 71 | { | 60 | { |
| 72 | struct touch_engine *engine = dev->priv; | 61 | struct touch_engine *engine = dev->priv; |
| 73 | if (engine) { | 62 | if (engine) { |
| @@ -77,7 +66,7 @@ static void tp_create(struct touch_dev *dev, int slot, | |||
| 77 | } | 66 | } |
| 78 | 67 | ||
| 79 | static void tp_modify(struct touch_dev *dev, int slot, | 68 | static void tp_modify(struct touch_dev *dev, int slot, |
| 80 | const touch_prop_mask_t *mask, const touch_prop_t *prop) | 69 | const grail_mask_t *mask, const touch_prop_t *prop) |
| 81 | { | 70 | { |
| 82 | struct touch_engine *engine = dev->priv; | 71 | struct touch_engine *engine = dev->priv; |
| 83 | if (engine) { | 72 | if (engine) { |
| @@ -117,7 +106,10 @@ void touch_engine_init(struct touch_engine *engine, | |||
| 117 | const struct input_event *ev), | 106 | const struct input_event *ev), |
| 118 | void *priv) | 107 | void *priv) |
| 119 | { | 108 | { |
| 109 | int i; | ||
| 120 | memset(engine, 0, sizeof(*engine)); | 110 | memset(engine, 0, sizeof(*engine)); |
| 111 | for (i = 0; i < DIM_TOUCH; i++) | ||
| 112 | engine->frame.touch[i].slot = i; | ||
| 121 | engine->event = event; | 113 | engine->event = event; |
| 122 | engine->sync = sync; | 114 | engine->sync = sync; |
| 123 | engine->priv = priv; | 115 | engine->priv = priv; |
