libinput 0.18.0

This commit is contained in:
Peter Hutterer 2015-06-22 14:59:12 +10:00
parent 5003f6ebc2
commit 911bbb8421
8 changed files with 7 additions and 440 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@
/libinput-0.15.0.tar.xz
/libinput-0.16.0.tar.xz
/libinput-0.17.0.tar.xz
/libinput-0.18.0.tar.xz

View File

@ -1,52 +0,0 @@
From f6313a9d010f03a66fd1f68e0bbd5e073101f342 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu, 4 Jun 2015 11:40:15 +1000
Subject: [PATCH libinput] filter: require minimum acceleration factor of 0.3
For really slow motions, the previous acceleration factor would go down to
effectively zero. So the slower the mouse motion was, the more it would be
slowed down which made the mouse at low speeds almost unusable.
Cap the minimum acceleration at 0.3 which provides a predictable slow motion
for the cursor when high precision is required.
New/old acceleration functions comparison:
^
| /
| /
ty| _________/
| / /
| / /
| / /
|/ / <----- new minimum accel factor
| /
|/___________________>
tx
i.e. the general shape is maintained, but it doesn't go to zero anymore. The
functions aren't parallel, the new shape is slightly flatter than the previous
one and they meet at the point where the functions flatten for the threshold
(tx/ty). ascii art has its limits...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
src/filter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/filter.c b/src/filter.c
index c54d866..ed5a184 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -354,7 +354,7 @@ pointer_accel_profile_linear(struct motion_filter *filter,
const double threshold = accel_filter->threshold; /* units/ms */
const double incline = accel_filter->incline;
- s1 = min(1, speed_in * 5);
+ s1 = min(1, 0.3 + speed_in * 4);
s2 = 1 + (speed_in - threshold) * incline;
return min(max_accel, s2 > 1 ? s2 : s1);
--
2.4.1

View File

@ -1,101 +0,0 @@
From cd701f2d75a48e3bfc1e28cb087d7ddb607f60ba Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 16 Jun 2015 15:39:48 +1000
Subject: [PATCH libinput] touchpad: disable right-edge palm detection for edge
scrolling
Most scroll motions would be labelled a palm.
https://bugs.freedesktop.org/show_bug.cgi?id=90980
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
src/evdev-mt-touchpad-edge-scroll.c | 2 +-
src/evdev-mt-touchpad.c | 3 +++
src/evdev-mt-touchpad.h | 3 +++
test/touchpad.c | 21 +++++++++++++++++++++
4 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c
index f5cfa9d..56f1e8a 100644
--- a/src/evdev-mt-touchpad-edge-scroll.c
+++ b/src/evdev-mt-touchpad-edge-scroll.c
@@ -75,7 +75,7 @@ edge_event_to_str(enum scroll_event event)
return NULL;
}
-static uint32_t
+uint32_t
tp_touch_get_edge(struct tp_dispatch *tp, struct tp_touch *t)
{
uint32_t edge = EDGE_NONE;
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 293760d..356f9b9 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -558,6 +558,9 @@ tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
tp_button_is_inside_softbutton_area(tp, t))
return;
+ if (tp_touch_get_edge(tp, t) & EDGE_RIGHT)
+ return;
+
t->palm.state = PALM_EDGE;
t->palm.time = time;
t->palm.first = t->point;
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 04610af..9357969 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -399,6 +399,9 @@ tp_edge_scroll_stop_events(struct tp_dispatch *tp, uint64_t time);
int
tp_edge_scroll_touch_active(struct tp_dispatch *tp, struct tp_touch *t);
+uint32_t
+tp_touch_get_edge(struct tp_dispatch *tp, struct tp_touch *t);
+
int
tp_init_gesture(struct tp_dispatch *tp);
diff --git a/test/touchpad.c b/test/touchpad.c
index 8e68597..d6e3cf2 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -3330,6 +3330,26 @@ START_TEST(touchpad_palm_detect_at_edge)
}
END_TEST
+START_TEST(touchpad_no_palm_detect_at_edge_for_edge_scrolling)
+{
+ struct litest_device *dev = litest_current_device();
+ struct libinput *li = dev->libinput;
+
+ if (!touchpad_has_palm_detect_size(dev))
+ return;
+
+ enable_edge_scroll(dev);
+
+ litest_drain_events(li);
+
+ litest_touch_down(dev, 0, 99, 50);
+ litest_touch_move_to(dev, 0, 99, 50, 99, 70, 5, 0);
+ litest_touch_up(dev, 0);
+
+ litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS);
+}
+END_TEST
+
START_TEST(touchpad_palm_detect_at_bottom_corners)
{
struct litest_device *dev = litest_current_device();
@@ -5232,6 +5252,7 @@ litest_setup_tests(void)
litest_add("touchpad:palm", touchpad_palm_detect_palm_stays_palm, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:palm", touchpad_palm_detect_no_palm_moving_into_edges, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:palm", touchpad_palm_detect_tap, LITEST_TOUCHPAD, LITEST_ANY);
+ litest_add("touchpad:palm", touchpad_no_palm_detect_at_edge_for_edge_scrolling, LITEST_TOUCHPAD, LITEST_CLICKPAD);
litest_add("touchpad:left-handed", touchpad_left_handed, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD);
litest_add("touchpad:left-handed", touchpad_left_handed_clickpad, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
--
2.4.3

View File

@ -1,32 +0,0 @@
From b48ecd186d8fb707e89bf04036a48600dc49125f Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri, 12 Jun 2015 17:24:33 +1000
Subject: [PATCH libinput] touchpad: fix pinned finger drifting
This caused the finger to be unpinned on the first motion event after the
click, effectively disabling this feature.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
---
src/evdev-mt-touchpad.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index c82d733..ce79530 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -440,8 +440,8 @@ tp_unpin_finger(struct tp_dispatch *tp, struct tp_touch *t)
}
/* The finger may slowly drift, adjust the center */
- t->pinned.center.x = t->point.x + t->pinned.center.x / 2;
- t->pinned.center.y = t->point.y + t->pinned.center.y / 2;
+ t->pinned.center.x = (t->point.x + t->pinned.center.x)/2;
+ t->pinned.center.y = (t->point.y + t->pinned.center.y)/2;
}
static void
--
2.4.3

View File

@ -1,52 +0,0 @@
From f13fbc96e84b2bb78bb61886d79aaaeaf8a9b4a1 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu, 11 Jun 2015 16:31:00 +1000
Subject: [PATCH libinput] touchpad: make the hysteresis dependent on physical
distance
Some touchpads, e.g. the Cyapa in the Acer c720 have a small axis range
([0, 870], [0, 470]), so the diagonal/magic value yields a hysteresis margin
of 1 device unit. On that device, that's one-tenth of a millimeter, causing
pointer motion just by holding the finger.
For touchpads that provide a physical resolution, set the hysteresis axes to
0.5mm and do away with the magic factor.
https://bugzilla.redhat.com/show_bug.cgi?id=1230441
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
---
src/evdev-mt-touchpad.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 34cc85d..c82d733 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1492,10 +1492,18 @@ tp_init(struct tp_dispatch *tp,
EV_ABS,
ABS_MT_DISTANCE);
- tp->hysteresis_margin.x =
- diagonal / DEFAULT_HYSTERESIS_MARGIN_DENOMINATOR;
- tp->hysteresis_margin.y =
- diagonal / DEFAULT_HYSTERESIS_MARGIN_DENOMINATOR;
+ if (device->abs.fake_resolution) {
+ tp->hysteresis_margin.x =
+ diagonal / DEFAULT_HYSTERESIS_MARGIN_DENOMINATOR;
+ tp->hysteresis_margin.y =
+ diagonal / DEFAULT_HYSTERESIS_MARGIN_DENOMINATOR;
+ } else {
+ int res_x = tp->device->abs.absinfo_x->resolution,
+ res_y = tp->device->abs.absinfo_y->resolution;
+
+ tp->hysteresis_margin.x = res_x/2;
+ tp->hysteresis_margin.y = res_y/2;
+ }
if (tp_init_accel(tp, diagonal) != 0)
return -1;
--
2.4.3

View File

@ -1,194 +0,0 @@
From 8025b374d564f4a30b089e5cf6fd65e0c6af8da2 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri, 12 Jun 2015 17:29:41 +1000
Subject: [PATCH libinput] 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>
---
src/evdev-mt-touchpad-buttons.c | 19 ++++++++++------
src/evdev-mt-touchpad.c | 10 ++++-----
src/evdev-mt-touchpad.h | 5 ++++-
src/libinput-util.h | 6 ++++++
test/touchpad.c | 48 +++++++++++++++++++++++++++++++++++++++++
5 files changed, 75 insertions(+), 13 deletions(-)
diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index 5786ea8..eb0ddcb 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;
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index ce79530..6f11599 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -431,17 +431,15 @@ tp_unpin_finger(struct tp_dispatch *tp, struct tp_touch *t)
return;
xdist = abs(t->point.x - t->pinned.center.x);
+ xdist *= tp->buttons.motion_dist.x_scale_coeff;
ydist = abs(t->point.y - t->pinned.center.y);
+ ydist *= tp->buttons.motion_dist.y_scale_coeff;
- if (xdist * xdist + ydist * ydist >=
- tp->buttons.motion_dist * tp->buttons.motion_dist) {
+ /* 3mm movement -> unpin */
+ if (vector_length(xdist, ydist) >= 3.0) {
t->pinned.is_pinned = false;
return;
}
-
- /* The finger may slowly drift, adjust the center */
- t->pinned.center.x = (t->point.x + t->pinned.center.x)/2;
- t->pinned.center.y = (t->point.y + t->pinned.center.y)/2;
}
static void
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index fef5cb3..bd2d163 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -223,7 +223,10 @@ struct tp_dispatch {
bool click_pending;
uint32_t state;
uint32_t old_state;
- uint32_t motion_dist; /* for pinned touches */
+ struct {
+ double x_scale_coeff;
+ double y_scale_coeff;
+ } motion_dist; /* for pinned touches */
unsigned int active; /* currently active button, for release event */
bool active_is_topbutton; /* is active a top button? */
diff --git a/src/libinput-util.h b/src/libinput-util.h
index 910406c..224e4b6 100644
--- a/src/libinput-util.h
+++ b/src/libinput-util.h
@@ -284,4 +284,10 @@ int parse_mouse_dpi_property(const char *prop);
int parse_mouse_wheel_click_angle_property(const char *prop);
double parse_trackpoint_accel_property(const char *prop);
+static inline double
+vector_length(double x, double y)
+{
+ return sqrt(x * x + y * y);
+}
+
#endif /* LIBINPUT_UTIL_H */
diff --git a/test/touchpad.c b/test/touchpad.c
index 692698c..1e5e97b 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -2153,6 +2153,53 @@ START_TEST(clickpad_click_n_drag)
}
END_TEST
+START_TEST(clickpad_finger_pin)
+{
+ struct litest_device *dev = litest_current_device();
+ struct libinput *li = dev->libinput;
+ struct libevdev *evdev = dev->evdev;
+ const struct input_absinfo *abs;
+
+ abs = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X);
+ ck_assert_notnull(abs);
+ if (abs->resolution == 0)
+ return;
+
+ litest_drain_events(li);
+
+ /* make sure the movement generates pointer events when
+ not pinned */
+ litest_touch_down(dev, 0, 50, 50);
+ litest_touch_move_to(dev, 0, 50, 50, 52, 52, 10, 1);
+ litest_touch_move_to(dev, 0, 52, 52, 48, 48, 10, 1);
+ litest_touch_move_to(dev, 0, 48, 48, 50, 50, 10, 1);
+ litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
+
+ litest_button_click(dev, BTN_LEFT, true);
+ litest_drain_events(li);
+
+ litest_touch_move_to(dev, 0, 50, 50, 52, 52, 10, 1);
+ litest_touch_move_to(dev, 0, 52, 52, 48, 48, 10, 1);
+ litest_touch_move_to(dev, 0, 48, 48, 50, 50, 10, 1);
+
+ litest_assert_empty_queue(li);
+
+ litest_button_click(dev, BTN_LEFT, false);
+ litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON);
+
+ /* still pinned after release */
+ litest_touch_move_to(dev, 0, 50, 50, 52, 52, 10, 1);
+ litest_touch_move_to(dev, 0, 52, 52, 48, 48, 10, 1);
+ litest_touch_move_to(dev, 0, 48, 48, 50, 50, 10, 1);
+
+ litest_assert_empty_queue(li);
+
+ /* move to unpin */
+ litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10, 1);
+ litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
+}
+END_TEST
+
START_TEST(clickpad_softbutton_left)
{
struct litest_device *dev = litest_current_device();
@@ -5144,6 +5191,7 @@ litest_setup_tests(void)
litest_add("touchpad:click", touchpad_btn_left, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD);
litest_add("touchpad:click", clickpad_btn_left, LITEST_CLICKPAD, LITEST_ANY);
litest_add("touchpad:click", clickpad_click_n_drag, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH);
+ litest_add("touchpad:click", clickpad_finger_pin, LITEST_CLICKPAD, LITEST_ANY);
litest_add("touchpad:softbutton", clickpad_softbutton_left, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
litest_add("touchpad:softbutton", clickpad_softbutton_right, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD);
--
2.4.3

View File

@ -4,8 +4,8 @@
%global gitversion 58abea394
Name: libinput
Version: 0.17.0
Release: 5%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Version: 0.18.0
Release: 1%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Summary: Input device library
License: MIT
@ -18,12 +18,6 @@ Source2: commitid
Source0: http://www.freedesktop.org/software/libinput/libinput-%{version}.tar.xz
%endif
Patch01: 0001-filter-require-minimum-acceleration-factor-of-0.3.patch
Patch02: 0001-touchpad-fix-pinned-finger-drifting.patch
Patch03: 0001-touchpad-set-the-finger-pin-distance-to-5mm-where-po.patch
Patch04: 0001-touchpad-disable-right-edge-palm-detection-for-edge-.patch
Patch05: 0001-touchpad-make-the-hysteresis-dependent-on-physical-d.patch
BuildRequires: git
BuildRequires: autoconf automake libtool pkgconfig
BuildRequires: libevdev-devel
@ -100,6 +94,9 @@ find $RPM_BUILD_ROOT -name '*.la' -delete
%changelog
* Mon Jun 22 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.18.0-1
- libinput 0.18.0
* Tue Jun 16 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.17.0-5
- Use physical values for the hystersis where possible (#1230462)
- Disable right-edge palm detection when edge scrolling is active

View File

@ -1 +1 @@
57f3d86cbf8e97dd312fbc54d59a2c02 libinput-0.17.0.tar.xz
0ddbb0d53d58dec0a86de6791560011a libinput-0.18.0.tar.xz