diff options
| author | Henrik Rydberg <rydberg@bitmath.org> | 2010-08-05 12:40:49 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-08-05 22:48:38 +0200 |
| commit | d8e8d112aa907f8021ae99e6d7cd7856f1d90b70 (patch) | |
| tree | d412cf84cd0280dcfa0695c2e0267cf8c1627b9c /src | |
| parent | 00f7895d101de2703dbcea3600a68c4f653a0378 (diff) | |
Add four-finger and five-finger gestures
Add four-finger and five-finger gestures, and move all gesture types
out to a separate file.
Signed-off-by: Henrik Rydberg <rydberg@bitmath.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.am | 1 | ||||
| -rw-r--r-- | src/gestures-combo.c | 12 | ||||
| -rw-r--r-- | src/gestures-pan.c | 12 | ||||
| -rw-r--r-- | src/gestures-pinch.c | 14 | ||||
| -rw-r--r-- | src/gestures-rotate.c | 12 |
5 files changed, 43 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 53b4300..4556610 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
| @@ -25,5 +25,6 @@ INCLUDES = -I$(top_srcdir)/include/ | |||
| 25 | libgrailincludedir = $(includedir) | 25 | libgrailincludedir = $(includedir) |
| 26 | libgrailinclude_HEADERS = \ | 26 | libgrailinclude_HEADERS = \ |
| 27 | $(top_srcdir)/include/grail-bits.h \ | 27 | $(top_srcdir)/include/grail-bits.h \ |
| 28 | $(top_srcdir)/include/grail-types.h \ | ||
| 28 | $(top_srcdir)/include/grail-touch.h \ | 29 | $(top_srcdir)/include/grail-touch.h \ |
| 29 | $(top_srcdir)/include/grail.h | 30 | $(top_srcdir)/include/grail.h |
diff --git a/src/gestures-combo.c b/src/gestures-combo.c index 8b4ad8c..7b8dbd5 100644 --- a/src/gestures-combo.c +++ b/src/gestures-combo.c | |||
| @@ -26,6 +26,15 @@ | |||
| 26 | #include <math.h> | 26 | #include <math.h> |
| 27 | #include <stdio.h> | 27 | #include <stdio.h> |
| 28 | 28 | ||
| 29 | static const int getype[DIM_TOUCH + 1] = { | ||
| 30 | 0, | ||
| 31 | 0, | ||
| 32 | GRAIL_TYPE_COMBO2, | ||
| 33 | GRAIL_TYPE_COMBO3, | ||
| 34 | GRAIL_TYPE_COMBO4, | ||
| 35 | GRAIL_TYPE_COMBO5, | ||
| 36 | }; | ||
| 37 | |||
| 29 | int gru_combo(struct grail *ge, | 38 | int gru_combo(struct grail *ge, |
| 30 | const struct touch_frame *frame) | 39 | const struct touch_frame *frame) |
| 31 | { | 40 | { |
| @@ -44,8 +53,7 @@ int gru_combo(struct grail *ge, | |||
| 44 | !move->r.tickle && !move->a.tickle) | 53 | !move->r.tickle && !move->a.tickle) |
| 45 | return 0; | 54 | return 0; |
| 46 | if (!state->active) { | 55 | if (!state->active) { |
| 47 | int type = move->ntouch == 2 ? GRAIL_TYPE_COMBO2 : | 56 | int type = getype[move->ntouch]; |
| 48 | move->ntouch == 3 ? GRAIL_TYPE_COMBO3 : 0; | ||
| 49 | if (!type) | 57 | if (!type) |
| 50 | return 0; | 58 | return 0; |
| 51 | state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame); | 59 | state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame); |
diff --git a/src/gestures-pan.c b/src/gestures-pan.c index 6c34e5d..3094007 100644 --- a/src/gestures-pan.c +++ b/src/gestures-pan.c | |||
| @@ -26,6 +26,15 @@ | |||
| 26 | #include <math.h> | 26 | #include <math.h> |
| 27 | #include <stdio.h> | 27 | #include <stdio.h> |
| 28 | 28 | ||
| 29 | static const int getype[DIM_TOUCH + 1] = { | ||
| 30 | 0, | ||
| 31 | 0, | ||
| 32 | GRAIL_TYPE_PAN, | ||
| 33 | GRAIL_TYPE_SWIPE, | ||
| 34 | GRAIL_TYPE_BRUSH, | ||
| 35 | GRAIL_TYPE_HAND, | ||
| 36 | }; | ||
| 37 | |||
| 29 | int gru_pan(struct grail *ge, | 38 | int gru_pan(struct grail *ge, |
| 30 | const struct touch_frame *frame) | 39 | const struct touch_frame *frame) |
| 31 | { | 40 | { |
| @@ -43,8 +52,7 @@ int gru_pan(struct grail *ge, | |||
| 43 | if (!move->x.tickle && !move->y.tickle) | 52 | if (!move->x.tickle && !move->y.tickle) |
| 44 | return 0; | 53 | return 0; |
| 45 | if (!state->active) { | 54 | if (!state->active) { |
| 46 | int type = move->ntouch == 2 ? GRAIL_TYPE_PAN : | 55 | int type = getype[move->ntouch]; |
| 47 | move->ntouch == 3 ? GRAIL_TYPE_SWIPE : 0; | ||
| 48 | if (!type) | 56 | if (!type) |
| 49 | return 0; | 57 | return 0; |
| 50 | state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame); | 58 | state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame); |
diff --git a/src/gestures-pinch.c b/src/gestures-pinch.c index 6c5392d..0721e02 100644 --- a/src/gestures-pinch.c +++ b/src/gestures-pinch.c | |||
| @@ -26,6 +26,15 @@ | |||
| 26 | #include <math.h> | 26 | #include <math.h> |
| 27 | #include <stdio.h> | 27 | #include <stdio.h> |
| 28 | 28 | ||
| 29 | static const int getype[DIM_TOUCH + 1] = { | ||
| 30 | 0, | ||
| 31 | 0, | ||
| 32 | GRAIL_TYPE_PINCH, | ||
| 33 | GRAIL_TYPE_SCALE, | ||
| 34 | GRAIL_TYPE_PICK, | ||
| 35 | GRAIL_TYPE_GRAB, | ||
| 36 | }; | ||
| 37 | |||
| 29 | int gru_pinch(struct grail *ge, | 38 | int gru_pinch(struct grail *ge, |
| 30 | const struct touch_frame *frame) | 39 | const struct touch_frame *frame) |
| 31 | { | 40 | { |
| @@ -40,11 +49,12 @@ int gru_pinch(struct grail *ge, | |||
| 40 | } | 49 | } |
| 41 | return 0; | 50 | return 0; |
| 42 | } | 51 | } |
| 52 | if (!move->a.tickle) | ||
| 53 | return 0; | ||
| 43 | if (!move->r.tickle) | 54 | if (!move->r.tickle) |
| 44 | return 0; | 55 | return 0; |
| 45 | if (!state->active) { | 56 | if (!state->active) { |
| 46 | int type = move->ntouch == 2 ? GRAIL_TYPE_PINCH : | 57 | int type = getype[move->ntouch]; |
| 47 | move->ntouch == 3 ? GRAIL_TYPE_SCALE : 0; | ||
| 48 | if (!type) | 58 | if (!type) |
| 49 | return 0; | 59 | return 0; |
| 50 | state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame); | 60 | state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame); |
diff --git a/src/gestures-rotate.c b/src/gestures-rotate.c index 90f9bdf..6c496d2 100644 --- a/src/gestures-rotate.c +++ b/src/gestures-rotate.c | |||
| @@ -26,6 +26,15 @@ | |||
| 26 | #include <math.h> | 26 | #include <math.h> |
| 27 | #include <stdio.h> | 27 | #include <stdio.h> |
| 28 | 28 | ||
| 29 | static const int getype[DIM_TOUCH + 1] = { | ||
| 30 | 0, | ||
| 31 | 0, | ||
| 32 | GRAIL_TYPE_ROTATE, | ||
| 33 | GRAIL_TYPE_TURN, | ||
| 34 | GRAIL_TYPE_WHIRL, | ||
| 35 | GRAIL_TYPE_REVOLVE, | ||
| 36 | }; | ||
| 37 | |||
| 29 | int gru_rotate(struct grail *ge, | 38 | int gru_rotate(struct grail *ge, |
| 30 | const struct touch_frame *frame) | 39 | const struct touch_frame *frame) |
| 31 | { | 40 | { |
| @@ -43,8 +52,7 @@ int gru_rotate(struct grail *ge, | |||
| 43 | if (!move->a.tickle) | 52 | if (!move->a.tickle) |
| 44 | return 0; | 53 | return 0; |
| 45 | if (!state->active) { | 54 | if (!state->active) { |
| 46 | int type = move->ntouch == 2 ? GRAIL_TYPE_ROTATE : | 55 | int type = getype[move->ntouch]; |
| 47 | move->ntouch == 3 ? GRAIL_TYPE_TURN : 0; | ||
| 48 | if (!type) | 56 | if (!type) |
| 49 | return 0; | 57 | return 0; |
| 50 | state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame); | 58 | state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame); |
