touchpad: Allow the center of pinned fingers to drift over time

Submitted by Hans de Goede on Dec. 5, 2014, 11:59 a.m.

Details

Message ID 1417780756-21294-1-git-send-email-hdegoede@redhat.com
State Not Applicable
Headers show

Not browsing as part of any series.

Commit Message

Hans de Goede Dec. 5, 2014, 11:59 a.m.
Allow the center of pinned fingers to drift over time, to avoid accidentally
unpinning fingers.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=86807
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 src/evdev-mt-touchpad.c | 5 +++++
 1 file changed, 5 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 8149c00..ad6b377 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -325,7 +325,12 @@  tp_unpin_finger(struct tp_dispatch *tp, struct tp_touch *t)
 			tp->buttons.motion_dist * tp->buttons.motion_dist) {
 		t->pinned.is_pinned = false;
 		tp_set_pointer(tp, t);
+		return;
 	}
+
+	/* The finger may slowly drift, adjust the center */
+	t->pinned.center_x = t->x + t->pinned.center_x / 2;
+	t->pinned.center_y = t->y + t->pinned.center_y / 2;
 }
 
 static void