From 21a363a2486a713434e890fc1f6b86a180755230 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Wed, 16 Jun 2010 18:48:53 +0200 Subject: Add tapping logic This patch adds tap-to-click, tap-and-hold for dragging, two-finger and three-finger taps. Turned on by default for touch screens only; switch on in gestures.c. Signed-off-by: Henrik Rydberg --- include/gestures.h | 4 ++++ include/memory.h | 13 +++++++++++++ include/mtdev-iobuf.h | 1 + include/mtouch.h | 2 ++ 4 files changed, 20 insertions(+) (limited to 'include') diff --git a/include/gestures.h b/include/gestures.h index 1d70a25..6bc92cd 100644 --- a/include/gestures.h +++ b/include/gestures.h @@ -32,13 +32,17 @@ #define GS_HSWIPE 5 #define GS_SCALE 6 #define GS_ROTATE 7 +#define GS_TAP 8 struct Gestures { bitmask_t type, btmask, btdata; int same_fingers, dx, dy, scale, rot; + bitmask_t tapmask; + int ntap; }; void extract_gestures(struct Gestures *gs, struct MTouch* mt); +void extract_delayed_gestures(struct Gestures *gs, struct MTouch* mt); void output_gesture(const struct Gestures *gs); #endif diff --git a/include/memory.h b/include/memory.h index 1a1b688..3054828 100644 --- a/include/memory.h +++ b/include/memory.h @@ -40,6 +40,16 @@ * @mvforget: movement before this point in time is discarded * @dx: array of accumulated horiontal movement per finger * @dy: array of accumulated vertical movement per finger + * @tpdown: time of first touch + * @tpup: time of last release + * @tprelax: time of next possible touch + * @xdown: x position of first touch + * @ydown: y position of first touch + * @xup: x position of last release + * @yup: y position of last release + * @wait: time to wait for a second tap + * @maxtap: max number of pointing fingers during touch + * @ntap: number of taps in sequence * */ struct Memory { @@ -49,6 +59,9 @@ struct Memory { int ybar; mstime_t mvhold, mvforget; int dx[DIM_FINGER], dy[DIM_FINGER]; + mstime_t tpdown, tpup, tprelax; + int xdown, ydown, xup, yup; + int wait, maxtap, ntap; }; void init_memory(struct Memory *mem); diff --git a/include/mtdev-iobuf.h b/include/mtdev-iobuf.h index 976b85b..7d4265c 100644 --- a/include/mtdev-iobuf.h +++ b/include/mtdev-iobuf.h @@ -33,5 +33,6 @@ struct IOBuffer { void init_iobuf(struct IOBuffer *buf); const struct input_event *get_iobuf_event(struct IOBuffer *buf, int fd); +int poll_iobuf(struct IOBuffer *buf, int fd, int ms); #endif diff --git a/include/mtouch.h b/include/mtouch.h index 2b76652..c73eb29 100644 --- a/include/mtouch.h +++ b/include/mtouch.h @@ -40,6 +40,8 @@ int close_mtouch(struct MTouch *mt, int fd); int parse_event(struct MTouch *mt, const struct input_event *ev); +int mt_is_idle(struct MTouch *mt, int fd); + static inline void mt_delay_movement(struct MTouch *mt, int t) { mem_hold_movement(&mt->mem, mt->state.evtime + t); -- cgit v1.2.3