From 963d6f71bb64125603d59c8bb70eaeec38c6fd72 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sat, 10 Apr 2010 22:57:26 +0200 Subject: Introduce the MTState The HWState keeps, for good reason, both touching fingers and fingers going away. However, this implies that additional logic is needed to keep track of the number of actual touching fingers. In particular the test for touching fingers is somewhat misplaced in hwstate.c. Moreover, HWState should only exist in one instance, since it contains data which does not need to be referred to during gesture extraction. This patch introduces the MTState structure, which keeps more digested data for gesture extraction. In particular, it only keeps the actual touches. Signed-off-by: Henrik Rydberg --- src/mtouch.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mtouch.c') diff --git a/src/mtouch.c b/src/mtouch.c index 5bf72ec..e47d69d 100644 --- a/src/mtouch.c +++ b/src/mtouch.c @@ -35,8 +35,9 @@ int open_mtouch(struct MTouch *mt, int fd) int rc; init_iobuf(&mt->buf); init_hwdata(&mt->hw); - init_hwstate(&mt->ohs); - init_hwstate(&mt->nhs); + init_hwstate(&mt->hs); + init_mtstate(&mt->prev_state); + init_mtstate(&mt->state); SYSCALL(rc = ioctl(fd, EVIOCGRAB, (pointer)1)); return rc; } @@ -59,5 +60,6 @@ int read_synchronized_event(struct MTouch *mt, int fd) void parse_event(struct MTouch *mt) { - modify_hwstate(&mt->nhs, &mt->hw, &mt->caps); + modify_hwstate(&mt->hs, &mt->hw, &mt->caps); + extract_mtstate(&mt->state, &mt->hs, &mt->caps); } -- cgit v1.2.3