mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-05 11:08:16 +02:00
touchpad: make gestures optional
Not all multi-finger touchpads are able to reliably produce gestures, so make it optional. This patch just adds a boolean (currently always true) that gets set on touchpad init time, i.e. it is not run-time configurable. Three and four-finger gestures are filtered out in gesture_notify(), if the cap isn't set the event is discarded. For two-finger gestures we prevent a transition to PINCH, so we don't inadvertently detect a pinch gesture and then not send events. This way, a 2fg gesture is always scroll. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
7b6bd641c7
commit
6295118c8e
3 changed files with 7 additions and 2 deletions
|
|
@ -295,7 +295,7 @@ tp_gesture_twofinger_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
|
||||||
((dir2 & 0x80) && (dir1 & 0x01))) {
|
((dir2 & 0x80) && (dir1 & 0x01))) {
|
||||||
tp_gesture_set_scroll_buildup(tp);
|
tp_gesture_set_scroll_buildup(tp);
|
||||||
return GESTURE_2FG_STATE_SCROLL;
|
return GESTURE_2FG_STATE_SCROLL;
|
||||||
} else {
|
} else if (tp->gesture.enabled) {
|
||||||
tp_gesture_get_pinch_info(tp,
|
tp_gesture_get_pinch_info(tp,
|
||||||
&tp->gesture.initial_distance,
|
&tp->gesture.initial_distance,
|
||||||
&tp->gesture.angle,
|
&tp->gesture.angle,
|
||||||
|
|
@ -303,6 +303,8 @@ tp_gesture_twofinger_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
|
||||||
tp->gesture.prev_scale = 1.0;
|
tp->gesture.prev_scale = 1.0;
|
||||||
return GESTURE_2FG_STATE_PINCH;
|
return GESTURE_2FG_STATE_PINCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return GESTURE_2FG_STATE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum tp_gesture_2fg_state
|
static enum tp_gesture_2fg_state
|
||||||
|
|
@ -563,6 +565,7 @@ tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time)
|
||||||
int
|
int
|
||||||
tp_init_gesture(struct tp_dispatch *tp)
|
tp_init_gesture(struct tp_dispatch *tp)
|
||||||
{
|
{
|
||||||
|
tp->gesture.enabled = true;
|
||||||
tp->gesture.twofinger_state = GESTURE_2FG_STATE_NONE;
|
tp->gesture.twofinger_state = GESTURE_2FG_STATE_NONE;
|
||||||
|
|
||||||
libinput_timer_init(&tp->gesture.finger_count_switch_timer,
|
libinput_timer_init(&tp->gesture.finger_count_switch_timer,
|
||||||
|
|
|
||||||
|
|
@ -1918,7 +1918,8 @@ tp_init(struct tp_dispatch *tp,
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
device->seat_caps |= EVDEV_DEVICE_POINTER;
|
device->seat_caps |= EVDEV_DEVICE_POINTER;
|
||||||
device->seat_caps |= EVDEV_DEVICE_GESTURE;
|
if (tp->gesture.enabled)
|
||||||
|
device->seat_caps |= EVDEV_DEVICE_GESTURE;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,7 @@ struct tp_dispatch {
|
||||||
} accel;
|
} accel;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
bool enabled;
|
||||||
bool started;
|
bool started;
|
||||||
unsigned int finger_count;
|
unsigned int finger_count;
|
||||||
unsigned int finger_count_pending;
|
unsigned int finger_count_pending;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue