summaryrefslogtreecommitdiff
path: root/src/evdev-mt-touchpad-buttons.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-06-12 17:29:41 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2015-06-16 10:18:48 +1000
commit8025b374d564f4a30b089e5cf6fd65e0c6af8da2 (patch)
tree9261e53cbec038506206b8163327a4e104f40434 /src/evdev-mt-touchpad-buttons.c
parentb48ecd186d8fb707e89bf04036a48600dc49125f (diff)
touchpad: set the finger pin distance to 5mm where possible
On touchpads with resolutions, use a 5mm motion threshold before we unpin the finger (allow motion events while a clickpad button is down). This should remove any erroneous finger movements while clicking, at the cost of having to move the finger a bit more for a single-finger click-and-drag (use two fingers already!) And drop the finger drifting, it was per-event based rather than time-based. So unless the motion threshold was hit in a single event it was possible to move the finger around the whole touchpad without ever unpinning it. Drop the finger drifting altogether, if the touchpad drifts by more than 5mm we have other issues. https://bugzilla.redhat.com/show_bug.cgi?id=1230462 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'src/evdev-mt-touchpad-buttons.c')
-rw-r--r--src/evdev-mt-touchpad-buttons.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index 5786ea8b..eb0ddcb0 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -31,7 +31,6 @@
#include "evdev-mt-touchpad.h"
-#define DEFAULT_BUTTON_MOTION_THRESHOLD 0.02 /* 2% of size */
#define DEFAULT_BUTTON_ENTER_TIMEOUT 100 /* ms */
#define DEFAULT_BUTTON_LEAVE_TIMEOUT 300 /* ms */
@@ -709,11 +708,19 @@ tp_init_buttons(struct tp_dispatch *tp,
absinfo_x = device->abs.absinfo_x;
absinfo_y = device->abs.absinfo_y;
- width = abs(absinfo_x->maximum - absinfo_x->minimum);
- height = abs(absinfo_y->maximum - absinfo_y->minimum);
- diagonal = sqrt(width*width + height*height);
-
- tp->buttons.motion_dist = diagonal * DEFAULT_BUTTON_MOTION_THRESHOLD;
+ /* pinned-finger motion threshold, see tp_unpin_finger.
+ The MAGIC for resolution-less touchpads ends up as 2% of the diagonal */
+ if (device->abs.fake_resolution) {
+ const int BUTTON_MOTION_MAGIC = 0.007;
+ width = abs(absinfo_x->maximum - absinfo_x->minimum);
+ height = abs(absinfo_y->maximum - absinfo_y->minimum);
+ diagonal = sqrt(width*width + height*height);
+ tp->buttons.motion_dist.x_scale_coeff = diagonal * BUTTON_MOTION_MAGIC;
+ tp->buttons.motion_dist.y_scale_coeff = diagonal * BUTTON_MOTION_MAGIC;
+ } else {
+ tp->buttons.motion_dist.x_scale_coeff = 1.0/absinfo_x->resolution;
+ tp->buttons.motion_dist.y_scale_coeff = 1.0/absinfo_y->resolution;
+ }
tp->buttons.config_method.get_methods = tp_button_config_click_get_methods;
tp->buttons.config_method.set_method = tp_button_config_click_set_method;