touchpad: fix stuck finger after a click

On a touchpad without resolution, the pinned finger was stuck. The motion
distance scale factor ended up as 0 and the finger never reached the threshold
of 3mm.
int was not the best choice of datatype for a value of 0.007...

Fix the data types for xdist/ydist at the same time, clamping to int may cause
erroneous (un)pinning.

Introduced in 8025b374d5

https://bugs.freedesktop.org/show_bug.cgi?id=91070

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2015-06-25 12:20:04 +10:00
parent f74769e77e
commit 56264a6ff6
2 changed files with 2 additions and 2 deletions

View file

@ -741,7 +741,7 @@ tp_init_buttons(struct tp_dispatch *tp,
/* 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;
const double 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);

View file

@ -426,7 +426,7 @@ tp_process_key(struct tp_dispatch *tp,
static void
tp_unpin_finger(struct tp_dispatch *tp, struct tp_touch *t)
{
unsigned int xdist, ydist;
double xdist, ydist;
if (!t->pinned.is_pinned)
return;