mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 04:40:25 +01:00
touchpad: end tap-and-drag with an extra tap
Currently for the tap-and-drag gesture to end user has to wait for a timeout to expire. Make it possible to end the drag gesture by just tapping. The allowed finger sequences to start and end a drag are thus: tap, down, .... move ...., up <wait for timeout> tap, down, .... move ...., up, tap https://bugs.freedesktop.org/show_bug.cgi?id=90255 Signed-off-by: Velimir Lisec <lisec.velimir@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> State diagram changes and a doc change squashed in. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
12000e737e
commit
1ab385bc83
4 changed files with 302 additions and 218 deletions
|
|
@ -33,6 +33,10 @@ continue the dragging process, so that multiple touchpad-widths of distance
|
|||
can be covered easily. If two-fingers are supported by the hardware, a
|
||||
second finger can be used to drag while the first is held in-place.
|
||||
|
||||
An alternative method to end a drag process is to tap immediately after
|
||||
lifting the finger. The full sequence is thus: tap, finger down, drag,
|
||||
finger up, tap.
|
||||
|
||||
@section tap_constraints Constraints while tapping
|
||||
|
||||
A couple of constraints apply to the contact to be converted into a press, the most common ones are:
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 116 KiB |
|
|
@ -74,6 +74,7 @@ tap_state_to_str(enum tp_tap_state state)
|
|||
CASE_RETURN_STRING(TAP_STATE_DRAGGING);
|
||||
CASE_RETURN_STRING(TAP_STATE_DRAGGING_WAIT);
|
||||
CASE_RETURN_STRING(TAP_STATE_DRAGGING_OR_DOUBLETAP);
|
||||
CASE_RETURN_STRING(TAP_STATE_DRAGGING_OR_TAP);
|
||||
CASE_RETURN_STRING(TAP_STATE_DRAGGING_2);
|
||||
CASE_RETURN_STRING(TAP_STATE_MULTITAP);
|
||||
CASE_RETURN_STRING(TAP_STATE_MULTITAP_DOWN);
|
||||
|
|
@ -409,8 +410,8 @@ tp_tap_dragging_wait_handle_event(struct tp_dispatch *tp,
|
|||
|
||||
switch (event) {
|
||||
case TAP_EVENT_TOUCH:
|
||||
tp->tap.state = TAP_STATE_DRAGGING;
|
||||
tp_tap_clear_timer(tp);
|
||||
tp->tap.state = TAP_STATE_DRAGGING_OR_TAP;
|
||||
tp_tap_set_timer(tp, time);
|
||||
break;
|
||||
case TAP_EVENT_RELEASE:
|
||||
case TAP_EVENT_MOTION:
|
||||
|
|
@ -426,6 +427,32 @@ tp_tap_dragging_wait_handle_event(struct tp_dispatch *tp,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tp_tap_dragging_tap_handle_event(struct tp_dispatch *tp,
|
||||
struct tp_touch *t,
|
||||
enum tap_event event, uint64_t time)
|
||||
{
|
||||
|
||||
switch (event) {
|
||||
case TAP_EVENT_TOUCH:
|
||||
tp->tap.state = TAP_STATE_DRAGGING_2;
|
||||
tp_tap_clear_timer(tp);
|
||||
break;
|
||||
case TAP_EVENT_RELEASE:
|
||||
tp->tap.state = TAP_STATE_IDLE;
|
||||
tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
|
||||
break;
|
||||
case TAP_EVENT_MOTION:
|
||||
case TAP_EVENT_TIMEOUT:
|
||||
tp->tap.state = TAP_STATE_DRAGGING;
|
||||
break;
|
||||
case TAP_EVENT_BUTTON:
|
||||
tp->tap.state = TAP_STATE_DEAD;
|
||||
tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tp_tap_dragging2_handle_event(struct tp_dispatch *tp,
|
||||
struct tp_touch *t,
|
||||
|
|
@ -588,6 +615,9 @@ tp_tap_handle_event(struct tp_dispatch *tp,
|
|||
case TAP_STATE_DRAGGING_WAIT:
|
||||
tp_tap_dragging_wait_handle_event(tp, t, event, time);
|
||||
break;
|
||||
case TAP_STATE_DRAGGING_OR_TAP:
|
||||
tp_tap_dragging_tap_handle_event(tp, t, event, time);
|
||||
break;
|
||||
case TAP_STATE_DRAGGING_2:
|
||||
tp_tap_dragging2_handle_event(tp, t, event, time);
|
||||
break;
|
||||
|
|
@ -692,6 +722,7 @@ tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time)
|
|||
case TAP_STATE_TOUCH:
|
||||
case TAP_STATE_TAPPED:
|
||||
case TAP_STATE_DRAGGING_OR_DOUBLETAP:
|
||||
case TAP_STATE_DRAGGING_OR_TAP:
|
||||
case TAP_STATE_TOUCH_2:
|
||||
case TAP_STATE_TOUCH_3:
|
||||
case TAP_STATE_MULTITAP_DOWN:
|
||||
|
|
@ -870,6 +901,7 @@ tp_tap_dragging(struct tp_dispatch *tp)
|
|||
case TAP_STATE_DRAGGING:
|
||||
case TAP_STATE_DRAGGING_2:
|
||||
case TAP_STATE_DRAGGING_WAIT:
|
||||
case TAP_STATE_DRAGGING_OR_TAP:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ enum tp_tap_state {
|
|||
TAP_STATE_TOUCH_3,
|
||||
TAP_STATE_TOUCH_3_HOLD,
|
||||
TAP_STATE_DRAGGING_OR_DOUBLETAP,
|
||||
TAP_STATE_DRAGGING_OR_TAP,
|
||||
TAP_STATE_DRAGGING,
|
||||
TAP_STATE_DRAGGING_WAIT,
|
||||
TAP_STATE_DRAGGING_2,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue