mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-28 06:10:06 +01:00
gestures: if fingers don't move, force a gesture by finger position
If the fingers rest on the touchpad without moving for a timeout, switch to pinch or swipe based on the finger position. We already switched to two-finger scrolling based on the timeout, now we also do so for 3 and 4 finger gestures. This gives us better reaction to small movements. This also fixes previously unreachable code: the test for the finger position required at least 3 fingers down but was within a condition that ensured only 2 fingers were down. This was introduced in11917061fe. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> (cherry picked from commitaf1e6c08ac)
This commit is contained in:
parent
a89619d792
commit
0a910a8ae6
1 changed files with 8 additions and 6 deletions
|
|
@ -331,21 +331,23 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
|
|||
int yres = tp->device->abs.absinfo_y->resolution;
|
||||
int vert_distance;
|
||||
|
||||
/* for two-finger gestures, if the fingers stay unmoving for a
|
||||
* while, assume (slow) scroll */
|
||||
if (tp->gesture.finger_count == 2) {
|
||||
if (time > (tp->gesture.initial_time + DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) {
|
||||
if (time > (tp->gesture.initial_time + DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) {
|
||||
/* for two-finger gestures, if the fingers stay unmoving for a
|
||||
* while, assume (slow) scroll */
|
||||
if (tp->gesture.finger_count == 2) {
|
||||
tp_gesture_set_scroll_buildup(tp);
|
||||
return GESTURE_STATE_SCROLL;
|
||||
}
|
||||
|
||||
/* Else check if one finger is > 20mm below the others */
|
||||
/* for 3+ finger gestures, check if one finger is > 20mm
|
||||
below the others */
|
||||
vert_distance = abs(first->point.y - second->point.y);
|
||||
if (vert_distance > 20 * yres &&
|
||||
tp->gesture.finger_count > 2 &&
|
||||
tp->gesture.enabled) {
|
||||
tp_gesture_init_pinch(tp);
|
||||
return GESTURE_STATE_PINCH;
|
||||
} else {
|
||||
return GESTURE_STATE_SWIPE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue