aboutsummaryrefslogtreecommitdiffstats
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)
downloadxorg-input-kobomultitouch-8dff8642c43a473713d48533974d9c7883bbc5c1.tar.gz
xorg-input-kobomultitouch-8dff8642c43a473713d48533974d9c7883bbc5c1.tar.bz2
xorg-input-kobomultitouch-8dff8642c43a473713d48533974d9c7883bbc5c1.zip
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)
int open_mtouch(struct MTouch *mt, int fd)
{
int rc;
+ mtdev_init(&mt->dev, &mt->caps);
init_iobuf(&mt->buf);
- init_hwdata(&mt->hw);
- init_hwstate(&mt->hs);
+ init_hwstate(&mt->hs, &mt->caps);
init_mtstate(&mt->prev_state);
init_mtstate(&mt->state);
init_memory(&mt->mem);
@@ -50,18 +50,11 @@ int close_mtouch(struct MTouch *mt, int fd)
return rc;
}
-int read_synchronized_event(struct MTouch *mt, int fd)
+int parse_event(struct MTouch *mt, const struct input_event *ev)
{
- const struct input_event *ev;
- while (ev = get_iobuf_event(&mt->buf, fd))
- if (read_hwdata(&mt->hw, ev))
- return 1;
- return 0;
-}
-
-void parse_event(struct MTouch *mt)
-{
- modify_hwstate(&mt->hs, &mt->hw, &mt->caps);
+ mtdev_push(&mt->dev, &mt->caps, ev);
+ if (!modify_hwstate(&mt->hs, &mt->dev, &mt->caps))
+ return 0;
extract_mtstate(&mt->state, &mt->hs, &mt->caps);
#if 0
output_mtstate(&mt->state);
@@ -70,4 +63,5 @@ void parse_event(struct MTouch *mt)
#if 0
output_memory(&mt->mem);
#endif
+ return 1;
}