diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-08-06 21:11:17 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-08-06 21:11:17 +0200 |
| commit | 7db9d8d76ff61c4802ac15559dcea6fa54ff567a (patch) | |
| tree | b67e040c0abeb0ab1fca72754a767dc9ab851461 /include/grail-touch.h | |
initial bzr repo at rev 27
Diffstat (limited to 'include/grail-touch.h')
| -rw-r--r-- | include/grail-touch.h | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/include/grail-touch.h b/include/grail-touch.h new file mode 100644 index 0000000..5c2fab0 --- /dev/null +++ b/include/grail-touch.h | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | /***************************************************************************** | ||
| 2 | * | ||
| 3 | * grail - Gesture Recognition And Instantiation Library | ||
| 4 | * | ||
| 5 | * Copyright (C) 2010 Canonical Ltd. | ||
| 6 | * | ||
| 7 | * This program is free software: you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation, either version 3 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, but | ||
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License along | ||
| 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | * Authors: | ||
| 21 | * Henrik Rydberg <rydberg@bitmath.org> | ||
| 22 | * | ||
| 23 | ****************************************************************************/ | ||
| 24 | |||
| 25 | #ifndef _GRAIL_TOUCH_H | ||
| 26 | #define _GRAIL_TOUCH_H | ||
| 27 | |||
| 28 | #include <grail-bits.h> | ||
| 29 | #include <mtdev.h> | ||
| 30 | |||
| 31 | #define DIM_TOUCH 32 | ||
| 32 | #define DIM_TOUCH_BYTES ((DIM_TOUCH + 7) >> 3) | ||
| 33 | |||
| 34 | typedef int touch_prop_t; | ||
| 35 | typedef __u64 touch_time_t; | ||
| 36 | |||
| 37 | enum touch_prop_list { | ||
| 38 | TP_POS_X, | ||
| 39 | TP_POS_Y, | ||
| 40 | TP_TOUCH_MAJOR, | ||
| 41 | TP_TOUCH_MINOR, | ||
| 42 | TP_WIDTH_MAJOR, | ||
| 43 | TP_WIDTH_MINOR, | ||
| 44 | TP_ORIENTATION, | ||
| 45 | TP_PRESSURE, | ||
| 46 | DIM_TOUCH_PROP | ||
| 47 | }; | ||
| 48 | |||
| 49 | #define DIM_TOUCH_PROP_BYTES ((DIM_TOUCH_PROP + 7) >> 3) | ||
| 50 | |||
| 51 | struct touch { | ||
| 52 | int active; | ||
| 53 | int slot; | ||
| 54 | touch_prop_t prop[DIM_TOUCH_PROP]; | ||
| 55 | }; | ||
| 56 | |||
| 57 | struct touch_frame { | ||
| 58 | int nactive; | ||
| 59 | int ncreate, nmodify, ndestroy; | ||
| 60 | touch_time_t time; | ||
| 61 | grail_mask_t touches[DIM_TOUCH_BYTES]; | ||
| 62 | struct touch *active[DIM_TOUCH]; | ||
| 63 | struct touch touch[DIM_TOUCH]; | ||
| 64 | }; | ||
| 65 | |||
| 66 | struct touch_dev_caps { | ||
| 67 | grail_mask_t mask[DIM_TOUCH_PROP_BYTES]; | ||
| 68 | struct input_absinfo info[DIM_TOUCH_PROP]; | ||
| 69 | }; | ||
| 70 | |||
| 71 | struct touch_dev { | ||
| 72 | void (*event)(struct touch_dev *dev, const struct input_event *ev); | ||
| 73 | void (*create)(struct touch_dev *dev, int slot, | ||
| 74 | const grail_mask_t *mask, const touch_prop_t *prop); | ||
| 75 | void (*modify)(struct touch_dev *dev, int slot, | ||
| 76 | const grail_mask_t *mask, const touch_prop_t *prop); | ||
| 77 | void (*destroy)(struct touch_dev *dev, int slot); | ||
| 78 | void (*sync)(struct touch_dev *dev, const struct input_event *syn); | ||
| 79 | struct touch_dev_caps caps; | ||
| 80 | struct touch_dev_impl *impl; | ||
| 81 | void *priv; | ||
| 82 | }; | ||
| 83 | |||
| 84 | struct touch_engine { | ||
| 85 | void (*event)(struct touch_engine *engine, | ||
| 86 | const struct input_event *ev); | ||
| 87 | void (*sync)(struct touch_engine *engine, | ||
| 88 | const struct input_event *syn); | ||
| 89 | struct touch_frame frame; | ||
| 90 | void *priv; | ||
| 91 | }; | ||
| 92 | |||
| 93 | int touch_dev_open(struct touch_dev *dev, int fd); | ||
| 94 | int touch_dev_idle(struct touch_dev *dev, int fd, int ms); | ||
| 95 | int touch_dev_pull(struct touch_dev *dev, int fd); | ||
| 96 | void touch_dev_close(struct touch_dev *dev, int fd); | ||
| 97 | |||
| 98 | void touch_engine_init(struct touch_engine *engine, | ||
| 99 | void (*event)(struct touch_engine *engine, | ||
| 100 | const struct input_event *ev), | ||
| 101 | void (*sync)(struct touch_engine *engine, | ||
| 102 | const struct input_event *ev), | ||
| 103 | void *priv); | ||
| 104 | void touch_engine_attach(struct touch_engine *engine, struct touch_dev *dev); | ||
| 105 | void touch_engine_detach(struct touch_engine *engine, struct touch_dev *dev); | ||
| 106 | |||
| 107 | #endif | ||
