summaryrefslogtreecommitdiff
path: root/src/mtouch.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-06-16 02:30:41 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-06-16 02:30:41 +0200
commit8dff8642c43a473713d48533974d9c7883bbc5c1 (patch)
treeea8513c76d38f2612a1202d30abf0f2e768f204c /src/mtouch.c
parent1c73d171b2814bf2809aa48c2d4b683a064a4f7e (diff)
refactor: Replace hwdata by mtdev
This patch makes the switch, from using hwdata and the associated type A parser, to using mtdev and the associated type B parser. A command-line gesture test program is included. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/mtouch.c')
-rw-r--r--src/mtouch.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/mtouch.c b/src/mtouch.c
index ad077b7..959783a 100644
--- a/src/mtouch.c
+++ b/src/mtouch.c
@@ -33,9 +33,9 @@ int configure_mtouch(struct MTouch *mt, int fd)
33int open_mtouch(struct MTouch *mt, int fd) 33int open_mtouch(struct MTouch *mt, int fd)
34{ 34{
35 int rc; 35 int rc;
36 mtdev_init(&mt->dev, &mt->caps);
36 init_iobuf(&mt->buf); 37 init_iobuf(&mt->buf);
37 init_hwdata(&mt->hw); 38 init_hwstate(&mt->hs, &mt->caps);
38 init_hwstate(&mt->hs);
39 init_mtstate(&mt->prev_state); 39 init_mtstate(&mt->prev_state);
40 init_mtstate(&mt->state); 40 init_mtstate(&mt->state);
41 init_memory(&mt->mem); 41 init_memory(&mt->mem);
@@ -50,18 +50,11 @@ int close_mtouch(struct MTouch *mt, int fd)
50 return rc; 50 return rc;
51} 51}
52 52
53int read_synchronized_event(struct MTouch *mt, int fd) 53int parse_event(struct MTouch *mt, const struct input_event *ev)
54{ 54{
55 const struct input_event *ev; 55 mtdev_push(&mt->dev, &mt->caps, ev);
56 while (ev = get_iobuf_event(&mt->buf, fd)) 56 if (!modify_hwstate(&mt->hs, &mt->dev, &mt->caps))
57 if (read_hwdata(&mt->hw, ev)) 57 return 0;
58 return 1;
59 return 0;
60}
61
62void parse_event(struct MTouch *mt)
63{
64 modify_hwstate(&mt->hs, &mt->hw, &mt->caps);
65 extract_mtstate(&mt->state, &mt->hs, &mt->caps); 58 extract_mtstate(&mt->state, &mt->hs, &mt->caps);
66#if 0 59#if 0
67 output_mtstate(&mt->state); 60 output_mtstate(&mt->state);
@@ -70,4 +63,5 @@ void parse_event(struct MTouch *mt)
70#if 0 63#if 0
71 output_memory(&mt->mem); 64 output_memory(&mt->mem);
72#endif 65#endif
66 return 1;
73} 67}