diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-09-21 12:55:24 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-09-21 12:56:17 +0200 |
| commit | d9a9cafc00cf1ccfeb72c9d86644144687884ef4 (patch) | |
| tree | 5346dd4d4800743fe4edf6d52297841a530ea04c | |
| parent | 2323cf93203686e2f19c125f780486fbe2ee327c (diff) | |
Add tap emulation
Touchscreens always emit a button event when touching the
screen. Trackpads, however, are considered hovering while
touching the pad, and instead uses taps to emits button events,
which is traditionally implemented elsewhere, and thus leaves
a functionality discrepancy. This patch adds tap emulation to
grail, utilizing gesture engine.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| -rw-r--r-- | src/grail-api.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/grail-api.c b/src/grail-api.c index b7d1ce0..bf5a7df 100644 --- a/src/grail-api.c +++ b/src/grail-api.c | |||
| @@ -89,18 +89,32 @@ static void handle_abs_events(struct grail *ge, const struct input_event *syn) | |||
| 89 | struct move_model *move = &gru->move; | 89 | struct move_model *move = &gru->move; |
| 90 | struct tapping_model *tap = &gru->tapping; | 90 | struct tapping_model *tap = &gru->tapping; |
| 91 | int used_move = grail_mask_count(gin->types, sizeof(gin->types)); | 91 | int used_move = grail_mask_count(gin->types, sizeof(gin->types)); |
| 92 | int used_tap = grail_mask_get(gin->types, GRAIL_TYPE_TAP1); | ||
| 92 | int ismove = move->single && (move->active & fm_mask) && !used_move; | 93 | int ismove = move->single && (move->active & fm_mask) && !used_move; |
| 93 | int ishold = move->single && tap->active && !used_move; | 94 | int ishold = move->single && tap->active && !used_move; |
| 94 | int pointer = ismove || ishold; | 95 | int istap = gru->tapping.tap == 1 && !used_tap; |
| 96 | int pointer = move->single; | ||
| 95 | 97 | ||
| 96 | if (!impl->pointer_status && pointer) { | 98 | if (!impl->pointer_status && pointer) { |
| 97 | impl->report_x = impl->pointer_x; | 99 | impl->report_x = impl->pointer_x; |
| 98 | impl->report_y = impl->pointer_y; | 100 | impl->report_y = impl->pointer_y; |
| 99 | impl->report_time = syn->time; | 101 | impl->report_time = syn->time; |
| 100 | impl->pointer_status = 1; | 102 | impl->pointer_status = 1; |
| 101 | report_down(impl); | 103 | if (!used_move) |
| 104 | report_down(impl); | ||
| 105 | return; | ||
| 102 | } | 106 | } |
| 103 | if (pointer) { | 107 | |
| 108 | if (ishold) | ||
| 109 | return; | ||
| 110 | |||
| 111 | if (istap) { | ||
| 112 | report_down(impl); | ||
| 113 | evput(impl, impl->report_time, EV_KEY, BTN_LEFT, 1); | ||
| 114 | evput(impl, impl->report_time, EV_SYN, SYN_REPORT, 0); | ||
| 115 | evput(impl, syn->time, EV_KEY, BTN_LEFT, 0); | ||
| 116 | } else if (ismove) { | ||
| 117 | report_down(impl); | ||
| 104 | if (impl->report_x != impl->pointer_x) { | 118 | if (impl->report_x != impl->pointer_x) { |
| 105 | evput(impl, syn->time, EV_ABS, ABS_X, impl->pointer_x); | 119 | evput(impl, syn->time, EV_ABS, ABS_X, impl->pointer_x); |
| 106 | impl->report_x = impl->pointer_x; | 120 | impl->report_x = impl->pointer_x; |
