summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/gestures.h1
-rw-r--r--include/hwdata.h75
-rw-r--r--include/hwstate.h33
-rw-r--r--include/mtdev-caps.h1
-rw-r--r--include/mtouch.h11
-rw-r--r--include/mtstate.h16
6 files changed, 32 insertions, 105 deletions
diff --git a/include/gestures.h b/include/gestures.h
index 2bd4a55..1d70a25 100644
--- a/include/gestures.h
+++ b/include/gestures.h
@@ -39,5 +39,6 @@ struct Gestures {
39}; 39};
40 40
41void extract_gestures(struct Gestures *gs, struct MTouch* mt); 41void extract_gestures(struct Gestures *gs, struct MTouch* mt);
42void output_gesture(const struct Gestures *gs);
42 43
43#endif 44#endif
diff --git a/include/hwdata.h b/include/hwdata.h
deleted file mode 100644
index 21864dc..0000000
--- a/include/hwdata.h
+++ /dev/null
@@ -1,75 +0,0 @@
1/***************************************************************************
2 *
3 * Multitouch X driver
4 * Copyright (C) 2008 Henrik Rydberg <rydberg@euromail.se>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 **************************************************************************/
21
22#ifndef HWDATA_H
23#define HWDATA_H
24
25#include "common.h"
26#include "button.h"
27
28#define BIT_MT_TOUCH_MAJOR 0
29#define BIT_MT_TOUCH_MINOR 1
30#define BIT_MT_WIDTH_MAJOR 2
31#define BIT_MT_WIDTH_MINOR 3
32#define BIT_MT_ORIENTATION 4
33#define BIT_MT_PRESSURE 5
34#define BIT_MT_POSITION_X 6
35#define BIT_MT_POSITION_Y 7
36#define BIT_MT_CNT 8
37
38struct FingerData {
39 int touch_major, touch_minor;
40 int width_major, width_minor;
41 int orientation, pressure;
42 int position_x, position_y;
43};
44
45/**
46 * struct HWData - hardware reads
47 *
48 * @finger: finger data
49 * @mask: bits corresponding to data actually read (readonly)
50 * @mread: bits corresponding to data in progress (writeonly)
51 * @button: bitmask of buttons
52 * @nfinger: number of fingers actually read (readonly)
53 * @nread: number of fingers in progress (writeonly)
54 *
55 */
56struct HWData {
57 struct FingerData finger[DIM_FINGER];
58 unsigned mask[DIM_FINGER], mread[DIM_FINGER];
59 unsigned button;
60 int nfinger, mtread, nread;
61 mstime_t evtime;
62};
63
64void init_hwdata(struct HWData *hw);
65int read_hwdata(struct HWData *hw, const struct input_event* ev);
66void output_hwdata(const struct HWData *hw);
67
68static inline int finger_dist2(const struct FingerData *a,
69 const struct FingerData *b)
70{
71 return dist2(a->position_x - b->position_x,
72 a->position_y - b->position_y);
73}
74
75#endif
diff --git a/include/hwstate.h b/include/hwstate.h
index 07d4ed6..4243292 100644
--- a/include/hwstate.h
+++ b/include/hwstate.h
@@ -22,26 +22,35 @@
22#ifndef HWSTATE_H 22#ifndef HWSTATE_H
23#define HWSTATE_H 23#define HWSTATE_H
24 24
25#include "mtdev-caps.h" 25#include "mtdev.h"
26#include "hwdata.h"
27 26
28/* zero id means not mapped (not touching) */
29struct FingerState { 27struct FingerState {
30 struct FingerData hw; 28 int touch_major, touch_minor;
31 int id; 29 int width_major, width_minor;
30 int orientation, pressure;
31 int position_x, position_y;
32 int tracking_id;
32}; 33};
33 34
34struct HWState { 35struct HWState {
35 struct FingerState finger[DIM_FINGER]; 36 struct FingerState data[DIM_FINGER];
37 bitmask_t used;
38 bitmask_t slot;
36 bitmask_t button; 39 bitmask_t button;
37 int nfinger;
38 mstime_t evtime; 40 mstime_t evtime;
39 int lastid;
40}; 41};
41 42
42void init_hwstate(struct HWState *s); 43void init_hwstate(struct HWState *s,
43void modify_hwstate(struct HWState *s, 44 const struct Capabilities *caps);
44 const struct HWData *hw, 45int modify_hwstate(struct HWState *s, struct MTDev *dev,
45 const struct Capabilities *caps); 46 const struct Capabilities *caps);
47void output_hwstate(const struct HWState *s);
48
49static inline int finger_dist2(const struct FingerState *a,
50 const struct FingerState *b)
51{
52 return dist2(a->position_x - b->position_x,
53 a->position_y - b->position_y);
54}
46 55
47#endif 56#endif
diff --git a/include/mtdev-caps.h b/include/mtdev-caps.h
index 4460eca..727cd11 100644
--- a/include/mtdev-caps.h
+++ b/include/mtdev-caps.h
@@ -23,6 +23,7 @@
23#define MTDEV_CAPS_H 23#define MTDEV_CAPS_H
24 24
25#include "common.h" 25#include "common.h"
26#include "button.h"
26#include "abs2mt.h" 27#include "abs2mt.h"
27#include "mtbit.h" 28#include "mtbit.h"
28 29
diff --git a/include/mtouch.h b/include/mtouch.h
index a495960..2b76652 100644
--- a/include/mtouch.h
+++ b/include/mtouch.h
@@ -22,16 +22,13 @@
22#ifndef MTOUCH_H 22#ifndef MTOUCH_H
23#define MTOUCH_H 23#define MTOUCH_H
24 24
25#include "mtdev-iobuf.h"
26#include "hwdata.h"
27#include "hwstate.h"
28#include "mtstate.h"
29#include "memory.h" 25#include "memory.h"
26#include "mtdev-iobuf.h"
30 27
31struct MTouch { 28struct MTouch {
32 struct Capabilities caps; 29 struct Capabilities caps;
30 struct MTDev dev;
33 struct IOBuffer buf; 31 struct IOBuffer buf;
34 struct HWData hw;
35 struct HWState hs; 32 struct HWState hs;
36 struct MTState prev_state, state; 33 struct MTState prev_state, state;
37 struct Memory mem; 34 struct Memory mem;
@@ -41,9 +38,7 @@ int configure_mtouch(struct MTouch *mt, int fd);
41int open_mtouch(struct MTouch *mt, int fd); 38int open_mtouch(struct MTouch *mt, int fd);
42int close_mtouch(struct MTouch *mt, int fd); 39int close_mtouch(struct MTouch *mt, int fd);
43 40
44int read_synchronized_event(struct MTouch *mt, int fd); 41int parse_event(struct MTouch *mt, const struct input_event *ev);
45void parse_event(struct MTouch *mt);
46
47 42
48static inline void mt_delay_movement(struct MTouch *mt, int t) 43static inline void mt_delay_movement(struct MTouch *mt, int t)
49{ 44{
diff --git a/include/mtstate.h b/include/mtstate.h
index b6b8e8d..a474114 100644
--- a/include/mtstate.h
+++ b/include/mtstate.h
@@ -24,14 +24,10 @@
24 24
25#include "hwstate.h" 25#include "hwstate.h"
26 26
27struct MTFinger {
28 struct FingerData hw;
29 int id, thumb;
30};
31
32struct MTState { 27struct MTState {
33 struct MTFinger finger[DIM_FINGER]; 28 struct FingerState finger[DIM_FINGER];
34 int nfinger; 29 int nfinger;
30 bitmask_t thumb;
35 bitmask_t button; 31 bitmask_t button;
36 mstime_t evtime; 32 mstime_t evtime;
37}; 33};
@@ -42,14 +38,14 @@ void extract_mtstate(struct MTState *s,
42 const struct Capabilities *caps); 38 const struct Capabilities *caps);
43void output_mtstate(const struct MTState *s); 39void output_mtstate(const struct MTState *s);
44 40
45const struct MTFinger *find_finger(const struct MTState *s, int id); 41const struct FingerState *find_finger(const struct MTState *s, int id);
46 42
47 43
48static inline int center_dist2(const struct MTFinger *a, 44static inline int center_dist2(const struct FingerState *a,
49 const struct Capabilities *caps) 45 const struct Capabilities *caps)
50{ 46{
51 return dist2(a->hw.position_x - get_cap_xmid(caps), 47 return dist2(a->position_x - get_cap_xmid(caps),
52 a->hw.position_y - get_cap_ymid(caps)); 48 a->position_y - get_cap_ymid(caps));
53} 49}
54 50
55static inline int center_maxdist2(const struct Capabilities *caps) 51static inline int center_maxdist2(const struct Capabilities *caps)