[packages/libinput] - rel 2; add fixes from FC

arekm arekm at pld-linux.org
Wed Jun 3 14:47:32 CEST 2015


commit 973d192561a6d263b873797a3230212b21cef1a1
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Jun 3 14:47:27 2015 +0200

    - rel 2; add fixes from FC

 ...s-default-to-the-middle-button-for-button.patch |  46 ++++++++
 0001-filter-pass-last_velocity-as-argument.patch   |  58 +++++++++
 ...uchpad-reduce-tap-n-drag-timeout-to-300ms.patch |  32 +++++
 ...-filter-up-the-motion-timeout-to-1-second.patch |  34 ++++++
 0003-filter-enforce-minimum-velocity.patch         | 130 +++++++++++++++++++++
 libinput.spec                                      |  14 ++-
 6 files changed, 313 insertions(+), 1 deletion(-)
---
diff --git a/libinput.spec b/libinput.spec
index a670ec6..22796f2 100644
--- a/libinput.spec
+++ b/libinput.spec
@@ -7,11 +7,18 @@ Summary:	Input device library
 Summary(pl.UTF-8):	Biblioteka urządzeń wejściowych
 Name:		libinput
 Version:	0.16.0
-Release:	1
+Release:	2
 License:	MIT
 Group:		Libraries
 Source0:	http://www.freedesktop.org/software/libinput/%{name}-%{version}.tar.xz
 # Source0-md5:	a5f5e1bb8eb2cd3bb9f5bd48f296def8
+Patch0:		0001-filter-pass-last_velocity-as-argument.patch
+Patch1:		0002-filter-up-the-motion-timeout-to-1-second.patch
+Patch2:		0003-filter-enforce-minimum-velocity.patch
+#Bug fc 1225998 - Tap-and-drag touchpad behavior not configurable
+Patch3:		0001-touchpad-reduce-tap-n-drag-timeout-to-300ms.patch
+# Bug fc 1227182 - Middle click pastes on button press instead of release
+Patch4:		0001-evdev-always-default-to-the-middle-button-for-button.patch
 URL:		http://www.freedesktop.org/wiki/Software/libinput/
 %{?with_gui:BuildRequires:	cairo-devel}
 BuildRequires:	check-devel >= 0.9.10
@@ -84,6 +91,11 @@ Dokumentacja API biblioteki libinput.
 
 %prep
 %setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
 
 %build
 %configure \
diff --git a/0001-evdev-always-default-to-the-middle-button-for-button.patch b/0001-evdev-always-default-to-the-middle-button-for-button.patch
new file mode 100644
index 0000000..9aac84a
--- /dev/null
+++ b/0001-evdev-always-default-to-the-middle-button-for-button.patch
@@ -0,0 +1,46 @@
+From 5b940e6a3f066ff25034bcf5a83278b695ad6836 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Tue, 2 Jun 2015 16:32:41 +1000
+Subject: [PATCH libinput] evdev: always default to the middle button for
+ button-scrolling
+
+The current code only defaulted to the middle button for those devices that
+used button scrolling by default, requiring the user to enable button
+scrolling _and_ set the button before it is active. This causes some
+confusion.
+
+There is no real benefit to leaving the button at 0 when the scroll
+method isn't enabled anyway. So always default to the middle button (if
+available).
+
+https://bugzilla.redhat.com/show_bug.cgi?id=1227182
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+Reviewed-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/evdev.c | 9 +--------
+ 1 file changed, 1 insertion(+), 8 deletions(-)
+
+diff --git a/src/evdev.c b/src/evdev.c
+index ed1a9a3..8932b6c 100644
+--- a/src/evdev.c
++++ b/src/evdev.c
+@@ -1112,14 +1112,7 @@ evdev_scroll_get_default_button(struct libinput_device *device)
+ {
+ 	struct evdev_device *evdev = (struct evdev_device *)device;
+ 
+-	if (libevdev_has_property(evdev->evdev, INPUT_PROP_POINTING_STICK))
+-		return BTN_MIDDLE;
+-
+-	/* A device that defaults to button scrolling defaults
+-	   to BTN_MIDDLE */
+-	if (evdev_scroll_get_default_method(device) ==
+-		LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN &&
+-	    libevdev_has_event_code(evdev->evdev, EV_KEY, BTN_MIDDLE))
++	if( libevdev_has_event_code(evdev->evdev, EV_KEY, BTN_MIDDLE))
+ 		return BTN_MIDDLE;
+ 
+ 	return 0;
+-- 
+2.4.1
+
diff --git a/0001-filter-pass-last_velocity-as-argument.patch b/0001-filter-pass-last_velocity-as-argument.patch
new file mode 100644
index 0000000..852108c
--- /dev/null
+++ b/0001-filter-pass-last_velocity-as-argument.patch
@@ -0,0 +1,58 @@
+From 578c4e81c2606abb969972186b013f67fb152040 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Thu, 30 Apr 2015 15:23:34 +1000
+Subject: [PATCH libinput 1/3] filter: pass last_velocity as argument
+
+Let the caller set the various fields, here we just calculate stuff.
+No functional changes.
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+Reviewed-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/filter.c | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/src/filter.c b/src/filter.c
+index 0cdcb63..fe86215 100644
+--- a/src/filter.c
++++ b/src/filter.c
+@@ -197,17 +197,20 @@ acceleration_profile(struct pointer_accelerator *accel,
+ 
+ static double
+ calculate_acceleration(struct pointer_accelerator *accel,
+-		       void *data, double velocity, uint64_t time)
++		       void *data,
++		       double velocity,
++		       double last_velocity,
++		       uint64_t time)
+ {
+ 	double factor;
+ 
+ 	/* Use Simpson's rule to calculate the avarage acceleration between
+ 	 * the previous motion and the most recent. */
+ 	factor = acceleration_profile(accel, data, velocity, time);
+-	factor += acceleration_profile(accel, data, accel->last_velocity, time);
++	factor += acceleration_profile(accel, data, last_velocity, time);
+ 	factor += 4.0 *
+ 		acceleration_profile(accel, data,
+-				     (accel->last_velocity + velocity) / 2,
++				     (last_velocity + velocity) / 2,
+ 				     time);
+ 
+ 	factor = factor / 6.0;
+@@ -228,7 +231,11 @@ accelerator_filter(struct motion_filter *filter,
+ 
+ 	feed_trackers(accel, unaccelerated, time);
+ 	velocity = calculate_velocity(accel, time);
+-	accel_value = calculate_acceleration(accel, data, velocity, time);
++	accel_value = calculate_acceleration(accel,
++					     data,
++					     velocity,
++					     accel->last_velocity,
++					     time);
+ 
+ 	accelerated.x = accel_value * unaccelerated->x;
+ 	accelerated.y = accel_value * unaccelerated->y;
+-- 
+2.4.1
+
diff --git a/0001-touchpad-reduce-tap-n-drag-timeout-to-300ms.patch b/0001-touchpad-reduce-tap-n-drag-timeout-to-300ms.patch
new file mode 100644
index 0000000..14eed3c
--- /dev/null
+++ b/0001-touchpad-reduce-tap-n-drag-timeout-to-300ms.patch
@@ -0,0 +1,32 @@
+From b8518f8f7c1611c58badb9d73e66d9c722849b55 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Tue, 2 Jun 2015 13:04:44 +1000
+Subject: [PATCH libinput] touchpad: reduce tap-n-drag timeout to 300ms
+
+The current 500ms is too long, reduce it to 300ms instead. This is still long
+enough to get multiple movements but not that long that it feels like the
+button is stuck.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=90613
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+ src/evdev-mt-touchpad-tap.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c
+index 55b7916..b51f083 100644
+--- a/src/evdev-mt-touchpad-tap.c
++++ b/src/evdev-mt-touchpad-tap.c
+@@ -37,7 +37,7 @@
+ #define CASE_RETURN_STRING(a) case a: return #a
+ 
+ #define DEFAULT_TAP_TIMEOUT_PERIOD 180
+-#define DEFAULT_DRAG_TIMEOUT_PERIOD 500
++#define DEFAULT_DRAG_TIMEOUT_PERIOD 300
+ #define DEFAULT_TAP_MOVE_THRESHOLD TP_MM_TO_DPI_NORMALIZED(3)
+ 
+ enum tap_event {
+-- 
+2.4.1
+
diff --git a/0002-filter-up-the-motion-timeout-to-1-second.patch b/0002-filter-up-the-motion-timeout-to-1-second.patch
new file mode 100644
index 0000000..d7e9428
--- /dev/null
+++ b/0002-filter-up-the-motion-timeout-to-1-second.patch
@@ -0,0 +1,34 @@
+From a81051e5136aeb23ce0ed85e387ae2d9b9447faa Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Wed, 22 Apr 2015 11:46:57 +1000
+Subject: [PATCH libinput 2/3] filter: up the motion timeout to 1 second
+
+This timeout defines how far back in the events we search for velocity
+calculations. For really slow movements, 300ms is not enough. It causes the
+velocity to be 0 -> accel factor of 0 -> no movement.
+As a result, really slow movement does not move the cursor.
+
+Up the timeout to 1 second instead.
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+Reviewed-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/filter.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/filter.c b/src/filter.c
+index fe86215..3845c7f 100644
+--- a/src/filter.c
++++ b/src/filter.c
+@@ -78,7 +78,7 @@ filter_get_speed(struct motion_filter *filter)
+  */
+ 
+ #define MAX_VELOCITY_DIFF	1.0 /* units/ms */
+-#define MOTION_TIMEOUT		300 /* (ms) */
++#define MOTION_TIMEOUT		1000 /* (ms) */
+ #define NUM_POINTER_TRACKERS	16
+ 
+ struct pointer_tracker {
+-- 
+2.4.1
+
diff --git a/0003-filter-enforce-minimum-velocity.patch b/0003-filter-enforce-minimum-velocity.patch
new file mode 100644
index 0000000..61b5b16
--- /dev/null
+++ b/0003-filter-enforce-minimum-velocity.patch
@@ -0,0 +1,130 @@
+From 289e4675c81d2fe32650295ce2b6a66a1ebb9f24 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Wed, 22 Apr 2015 12:25:13 +1000
+Subject: [PATCH libinput 3/3] filter: enforce minimum velocity
+
+In the current code, a timeout or direction change on the first tracker will
+result in a velocity of 0. Really slow movements will thus always be zero, and
+the first event after a direction is swallowed.
+
+Enforce a minimum velocity:
+In the case of a timeout, assume the current velocity is that of
+distance/timeout. In the case of a direction change, the velocity is simply
+that since the last tracker.
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+Reviewed-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/filter.c    | 34 ++++++++++++++++++++++++++++++----
+ test/touchpad.c | 10 +++++-----
+ 2 files changed, 35 insertions(+), 9 deletions(-)
+
+diff --git a/src/filter.c b/src/filter.c
+index 3845c7f..c54d866 100644
+--- a/src/filter.c
++++ b/src/filter.c
+@@ -144,6 +144,24 @@ calculate_tracker_velocity(struct pointer_tracker *tracker, uint64_t time)
+ 	return normalized_length(tracker->delta) / tdelta; /* units/ms */
+ }
+ 
++static inline double
++calculate_velocity_after_timeout(struct pointer_tracker *tracker)
++{
++	/* First movement after timeout needs special handling.
++	 *
++	 * When we trigger the timeout, the last event is too far in the
++	 * past to use it for velocity calculation across multiple tracker
++	 * values.
++	 *
++	 * Use the motion timeout itself to calculate the speed rather than
++	 * the last tracker time. This errs on the side of being too fast
++	 * for really slow movements but provides much more useful initial
++	 * movement in normal use-cases (pause, move, pause, move)
++	 */
++	return calculate_tracker_velocity(tracker,
++					  tracker->time + MOTION_TIMEOUT);
++}
++
+ static double
+ calculate_velocity(struct pointer_accelerator *accel, uint64_t time)
+ {
+@@ -163,15 +181,23 @@ calculate_velocity(struct pointer_accelerator *accel, uint64_t time)
+ 
+ 		/* Stop if too far away in time */
+ 		if (time - tracker->time > MOTION_TIMEOUT ||
+-		    tracker->time > time)
++		    tracker->time > time) {
++			if (offset == 1)
++				result = calculate_velocity_after_timeout(tracker);
+ 			break;
++		}
++
++		velocity = calculate_tracker_velocity(tracker, time);
+ 
+ 		/* Stop if direction changed */
+ 		dir &= tracker->dir;
+-		if (dir == 0)
++		if (dir == 0) {
++			/* First movement after dirchange - velocity is that
++			 * of the last movement */
++			if (offset == 1)
++				result = velocity;
+ 			break;
+-
+-		velocity = calculate_tracker_velocity(tracker, time);
++		}
+ 
+ 		if (initial_velocity == 0.0) {
+ 			result = initial_velocity = velocity;
+diff --git a/test/touchpad.c b/test/touchpad.c
+index 5579c04..a747910 100644
+--- a/test/touchpad.c
++++ b/test/touchpad.c
+@@ -2959,7 +2959,7 @@ START_TEST(touchpad_edge_scroll)
+ 	litest_touch_up(dev, 0);
+ 
+ 	libinput_dispatch(li);
+-	litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 10);
++	litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 4);
+ 	litest_assert_empty_queue(li);
+ 
+ 	litest_touch_down(dev, 0, 99, 80);
+@@ -2967,7 +2967,7 @@ START_TEST(touchpad_edge_scroll)
+ 	litest_touch_up(dev, 0);
+ 
+ 	libinput_dispatch(li);
+-	litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -10);
++	litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -4);
+ 	litest_assert_empty_queue(li);
+ 
+ 	litest_touch_down(dev, 0, 20, 99);
+@@ -2975,7 +2975,7 @@ START_TEST(touchpad_edge_scroll)
+ 	litest_touch_up(dev, 0);
+ 
+ 	libinput_dispatch(li);
+-	litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 10);
++	litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 4);
+ 	litest_assert_empty_queue(li);
+ 
+ 	litest_touch_down(dev, 0, 70, 99);
+@@ -2983,7 +2983,7 @@ START_TEST(touchpad_edge_scroll)
+ 	litest_touch_up(dev, 0);
+ 
+ 	libinput_dispatch(li);
+-	litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -10);
++	litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -4);
+ 	litest_assert_empty_queue(li);
+ }
+ END_TEST
+@@ -3065,7 +3065,7 @@ START_TEST(touchpad_edge_scroll_no_motion)
+ 	litest_touch_up(dev, 0);
+ 	libinput_dispatch(li);
+ 
+-	litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 5);
++	litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 4);
+ 	litest_assert_empty_queue(li);
+ }
+ END_TEST
+-- 
+2.4.1
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libinput.git/commitdiff/973d192561a6d263b873797a3230212b21cef1a1



More information about the pld-cvs-commit mailing list