mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-07 07:40:16 +01:00
touchpad: change tap motion threshold to 3 mm
Previous code used a device coordinate threshold of 300 which won't work on Elantech touchpads (1280 vs the ~4000 that synaptics has). Convert to normalized DPI and reduce the threshold to 3mm. https://bugs.freedesktop.org/show_bug.cgi?id=89206 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
7a54360ed3
commit
38ee2c7aac
2 changed files with 9 additions and 3 deletions
|
|
@ -37,7 +37,7 @@
|
|||
#define CASE_RETURN_STRING(a) case a: return #a;
|
||||
|
||||
#define DEFAULT_TAP_TIMEOUT_PERIOD 180
|
||||
#define DEFAULT_TAP_MOVE_THRESHOLD 30
|
||||
#define DEFAULT_TAP_MOVE_THRESHOLD TP_MM_TO_DPI_NORMALIZED(3)
|
||||
|
||||
enum tap_event {
|
||||
TAP_EVENT_TOUCH = 12,
|
||||
|
|
@ -527,12 +527,15 @@ tp_tap_handle_event(struct tp_dispatch *tp,
|
|||
}
|
||||
|
||||
static bool
|
||||
tp_tap_exceeds_motion_threshold(struct tp_dispatch *tp, struct tp_touch *t)
|
||||
tp_tap_exceeds_motion_threshold(struct tp_dispatch *tp,
|
||||
struct tp_touch *t)
|
||||
{
|
||||
int threshold = DEFAULT_TAP_MOVE_THRESHOLD;
|
||||
double dx, dy;
|
||||
|
||||
tp_get_delta(t, &dx, &dy);
|
||||
dx = abs(t->tap.initial_x - t->x);
|
||||
dy = abs(t->tap.initial_y - t->y);
|
||||
tp_normalize_delta(tp, &dx, &dy);
|
||||
|
||||
return dx * dx + dy * dy > threshold * threshold;
|
||||
}
|
||||
|
|
@ -568,6 +571,8 @@ tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time)
|
|||
|
||||
if (t->state == TOUCH_BEGIN) {
|
||||
t->tap.state = TAP_TOUCH_STATE_TOUCH;
|
||||
t->tap.initial_x = t->x;
|
||||
t->tap.initial_y = t->y;
|
||||
tp_tap_handle_event(tp, t, TAP_EVENT_TOUCH, time);
|
||||
} else if (t->state == TOUCH_END) {
|
||||
tp_tap_handle_event(tp, t, TAP_EVENT_RELEASE, time);
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ struct tp_touch {
|
|||
|
||||
struct {
|
||||
enum tp_tap_touch_state state;
|
||||
int32_t initial_x, initial_y;
|
||||
} tap;
|
||||
|
||||
struct {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue