diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-06-16 18:48:53 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-06-16 18:54:52 +0200 |
| commit | 21a363a2486a713434e890fc1f6b86a180755230 (patch) | |
| tree | ca788ccf7c8269c5cbd41350463fa478aa499903 /include | |
| parent | 523d193b089111849873d9de0ec1bf29f4176fbc (diff) | |
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 <rydberg@euromail.se>
Diffstat (limited to 'include')
| -rw-r--r-- | include/gestures.h | 4 | ||||
| -rw-r--r-- | include/memory.h | 13 | ||||
| -rw-r--r-- | include/mtdev-iobuf.h | 1 | ||||
| -rw-r--r-- | include/mtouch.h | 2 |
4 files changed, 20 insertions, 0 deletions
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 @@ | |||
| 32 | #define GS_HSWIPE 5 | 32 | #define GS_HSWIPE 5 |
| 33 | #define GS_SCALE 6 | 33 | #define GS_SCALE 6 |
| 34 | #define GS_ROTATE 7 | 34 | #define GS_ROTATE 7 |
| 35 | #define GS_TAP 8 | ||
| 35 | 36 | ||
| 36 | struct Gestures { | 37 | struct Gestures { |
| 37 | bitmask_t type, btmask, btdata; | 38 | bitmask_t type, btmask, btdata; |
| 38 | int same_fingers, dx, dy, scale, rot; | 39 | int same_fingers, dx, dy, scale, rot; |
| 40 | bitmask_t tapmask; | ||
| 41 | int ntap; | ||
| 39 | }; | 42 | }; |
| 40 | 43 | ||
| 41 | void extract_gestures(struct Gestures *gs, struct MTouch* mt); | 44 | void extract_gestures(struct Gestures *gs, struct MTouch* mt); |
| 45 | void extract_delayed_gestures(struct Gestures *gs, struct MTouch* mt); | ||
| 42 | void output_gesture(const struct Gestures *gs); | 46 | void output_gesture(const struct Gestures *gs); |
| 43 | 47 | ||
| 44 | #endif | 48 | #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 @@ | |||
| 40 | * @mvforget: movement before this point in time is discarded | 40 | * @mvforget: movement before this point in time is discarded |
| 41 | * @dx: array of accumulated horiontal movement per finger | 41 | * @dx: array of accumulated horiontal movement per finger |
| 42 | * @dy: array of accumulated vertical movement per finger | 42 | * @dy: array of accumulated vertical movement per finger |
| 43 | * @tpdown: time of first touch | ||
| 44 | * @tpup: time of last release | ||
| 45 | * @tprelax: time of next possible touch | ||
| 46 | * @xdown: x position of first touch | ||
| 47 | * @ydown: y position of first touch | ||
| 48 | * @xup: x position of last release | ||
| 49 | * @yup: y position of last release | ||
| 50 | * @wait: time to wait for a second tap | ||
| 51 | * @maxtap: max number of pointing fingers during touch | ||
| 52 | * @ntap: number of taps in sequence | ||
| 43 | * | 53 | * |
| 44 | */ | 54 | */ |
| 45 | struct Memory { | 55 | struct Memory { |
| @@ -49,6 +59,9 @@ struct Memory { | |||
| 49 | int ybar; | 59 | int ybar; |
| 50 | mstime_t mvhold, mvforget; | 60 | mstime_t mvhold, mvforget; |
| 51 | int dx[DIM_FINGER], dy[DIM_FINGER]; | 61 | int dx[DIM_FINGER], dy[DIM_FINGER]; |
| 62 | mstime_t tpdown, tpup, tprelax; | ||
| 63 | int xdown, ydown, xup, yup; | ||
| 64 | int wait, maxtap, ntap; | ||
| 52 | }; | 65 | }; |
| 53 | 66 | ||
| 54 | void init_memory(struct Memory *mem); | 67 | 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 { | |||
| 33 | 33 | ||
| 34 | void init_iobuf(struct IOBuffer *buf); | 34 | void init_iobuf(struct IOBuffer *buf); |
| 35 | const struct input_event *get_iobuf_event(struct IOBuffer *buf, int fd); | 35 | const struct input_event *get_iobuf_event(struct IOBuffer *buf, int fd); |
| 36 | int poll_iobuf(struct IOBuffer *buf, int fd, int ms); | ||
| 36 | 37 | ||
| 37 | #endif | 38 | #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); | |||
| 40 | 40 | ||
| 41 | int parse_event(struct MTouch *mt, const struct input_event *ev); | 41 | int parse_event(struct MTouch *mt, const struct input_event *ev); |
| 42 | 42 | ||
| 43 | int mt_is_idle(struct MTouch *mt, int fd); | ||
| 44 | |||
| 43 | static inline void mt_delay_movement(struct MTouch *mt, int t) | 45 | static inline void mt_delay_movement(struct MTouch *mt, int t) |
| 44 | { | 46 | { |
| 45 | mem_hold_movement(&mt->mem, mt->state.evtime + t); | 47 | mem_hold_movement(&mt->mem, mt->state.evtime + t); |
