summaryrefslogtreecommitdiff
path: root/include/grail-touch.h
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-08-06 21:11:17 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-08-06 21:11:17 +0200
commit7db9d8d76ff61c4802ac15559dcea6fa54ff567a (patch)
treeb67e040c0abeb0ab1fca72754a767dc9ab851461 /include/grail-touch.h
initial bzr repo at rev 27
Diffstat (limited to 'include/grail-touch.h')
-rw-r--r--include/grail-touch.h107
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
34typedef int touch_prop_t;
35typedef __u64 touch_time_t;
36
37enum 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
51struct touch {
52 int active;
53 int slot;
54 touch_prop_t prop[DIM_TOUCH_PROP];
55};
56
57struct 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
66struct touch_dev_caps {
67 grail_mask_t mask[DIM_TOUCH_PROP_BYTES];
68 struct input_absinfo info[DIM_TOUCH_PROP];
69};
70
71struct 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
84struct 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
93int touch_dev_open(struct touch_dev *dev, int fd);
94int touch_dev_idle(struct touch_dev *dev, int fd, int ms);
95int touch_dev_pull(struct touch_dev *dev, int fd);
96void touch_dev_close(struct touch_dev *dev, int fd);
97
98void 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);
104void touch_engine_attach(struct touch_engine *engine, struct touch_dev *dev);
105void touch_engine_detach(struct touch_engine *engine, struct touch_dev *dev);
106
107#endif