libinput 1.8.2

This commit is contained in:
Peter Hutterer 2017-09-07 17:21:10 +10:00
parent 817b4343ff
commit cdbbf32d3a
4 changed files with 7 additions and 286 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
/libinput-1.7.902.tar.xz
/libinput-1.8.0.tar.xz
/libinput-1.8.1.tar.xz
/libinput-1.8.2.tar.xz

View File

@ -1,282 +0,0 @@
From a7e79ed5a69556c71bb9dd2f0047e4833affa929 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Sat, 29 Jul 2017 13:59:40 +0100
Subject: [PATCH libinput] gestures: don't try to pinch for nfingers > slots
We don't know the position of the third finger on 2-slot touchpads, differing
between swipe and pinch is reliable. Simply disable 3-finger pinch and always
use swipe; 3fg pinch is uncommon anyway and it's better to have one of the
gestures working reliably than both unreliably.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
---
src/evdev-mt-touchpad-gestures.c | 7 +-
test/test-gestures.c | 211 ---------------------------------------
2 files changed, 6 insertions(+), 212 deletions(-)
diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index a20b26d4..26bdef5a 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -334,6 +334,10 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
if (tp->gesture.finger_count == 2) {
tp_gesture_set_scroll_buildup(tp);
return GESTURE_STATE_SCROLL;
+ /* more fingers than slots, don't bother with pinch, always
+ * assume swipe */
+ } else if (tp->gesture.finger_count > tp->num_slots) {
+ return GESTURE_STATE_SWIPE;
}
/* for 3+ finger gestures, check if one finger is > 20mm
@@ -356,7 +360,8 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
/* If both touches are moving in the same direction assume
* scroll or swipe */
- if (tp_gesture_same_directions(dir1, dir2)) {
+ if (tp->gesture.finger_count > tp->num_slots ||
+ tp_gesture_same_directions(dir1, dir2)) {
if (tp->gesture.finger_count == 2) {
tp_gesture_set_scroll_buildup(tp);
return GESTURE_STATE_SCROLL;
diff --git a/test/test-gestures.c b/test/test-gestures.c
index ce1012d4..e95d1a01 100644
--- a/test/test-gestures.c
+++ b/test/test-gestures.c
@@ -754,110 +754,6 @@ START_TEST(gestures_pinch_3fg)
}
END_TEST
-START_TEST(gestures_pinch_3fg_btntool)
-{
- struct litest_device *dev = litest_current_device();
- struct libinput *li = dev->libinput;
- struct libinput_event *event;
- struct libinput_event_gesture *gevent;
- double dx, dy;
- int cardinal = _i; /* ranged test */
- double dir_x, dir_y;
- int i;
- double scale, oldscale;
- double angle;
- int cardinals[8][2] = {
- { 0, 30 },
- { 30, 30 },
- { 30, 0 },
- { 30, -30 },
- { 0, -30 },
- { -30, -30 },
- { -30, 0 },
- { -30, 30 },
- };
-
- if (libevdev_get_num_slots(dev->evdev) > 2 ||
- !libinput_device_has_capability(dev->libinput_device,
- LIBINPUT_DEVICE_CAP_GESTURE))
- return;
-
- dir_x = cardinals[cardinal][0];
- dir_y = cardinals[cardinal][1];
-
- litest_drain_events(li);
-
- litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y);
- litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y);
- litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
- litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
- litest_event(dev, EV_SYN, SYN_REPORT, 0);
- libinput_dispatch(li);
-
- for (i = 0; i < 8; i++) {
- litest_push_event_frame(dev);
- if (dir_x > 0.0)
- dir_x -= 2;
- else if (dir_x < 0.0)
- dir_x += 2;
- if (dir_y > 0.0)
- dir_y -= 2;
- else if (dir_y < 0.0)
- dir_y += 2;
- litest_touch_move(dev,
- 0,
- 50 + dir_x,
- 50 + dir_y);
- litest_touch_move(dev,
- 1,
- 50 - dir_x,
- 50 - dir_y);
- litest_pop_event_frame(dev);
- libinput_dispatch(li);
- }
-
- event = libinput_get_event(li);
- gevent = litest_is_gesture_event(event,
- LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
- 3);
- dx = libinput_event_gesture_get_dx(gevent);
- dy = libinput_event_gesture_get_dy(gevent);
- scale = libinput_event_gesture_get_scale(gevent);
- ck_assert(dx == 0.0);
- ck_assert(dy == 0.0);
- ck_assert(scale == 1.0);
-
- libinput_event_destroy(event);
-
- while ((event = libinput_get_event(li)) != NULL) {
- gevent = litest_is_gesture_event(event,
- LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
- 3);
-
- oldscale = scale;
- scale = libinput_event_gesture_get_scale(gevent);
-
- ck_assert(scale < oldscale);
-
- angle = libinput_event_gesture_get_angle_delta(gevent);
- ck_assert_double_le(fabs(angle), 1.0);
-
- libinput_event_destroy(event);
- libinput_dispatch(li);
- }
-
- litest_touch_up(dev, 0);
- litest_touch_up(dev, 1);
- libinput_dispatch(li);
- event = libinput_get_event(li);
- gevent = litest_is_gesture_event(event,
- LIBINPUT_EVENT_GESTURE_PINCH_END,
- 3);
- ck_assert(!libinput_event_gesture_get_cancelled(gevent));
- libinput_event_destroy(event);
-}
-END_TEST
-
START_TEST(gestures_pinch_4fg)
{
struct litest_device *dev = litest_current_device();
@@ -969,111 +865,6 @@ START_TEST(gestures_pinch_4fg)
}
END_TEST
-START_TEST(gestures_pinch_4fg_btntool)
-{
- struct litest_device *dev = litest_current_device();
- struct libinput *li = dev->libinput;
- struct libinput_event *event;
- struct libinput_event_gesture *gevent;
- double dx, dy;
- int cardinal = _i; /* ranged test */
- double dir_x, dir_y;
- int i;
- double scale, oldscale;
- double angle;
- int cardinals[8][2] = {
- { 0, 30 },
- { 30, 30 },
- { 30, 0 },
- { 30, -30 },
- { 0, -30 },
- { -30, -30 },
- { -30, 0 },
- { -30, 30 },
- };
-
- if (libevdev_get_num_slots(dev->evdev) > 2 ||
- !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_QUADTAP) ||
- !libinput_device_has_capability(dev->libinput_device,
- LIBINPUT_DEVICE_CAP_GESTURE))
- return;
-
- dir_x = cardinals[cardinal][0];
- dir_y = cardinals[cardinal][1];
-
- litest_drain_events(li);
-
- litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y);
- litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y);
- litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
- litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 1);
- litest_event(dev, EV_SYN, SYN_REPORT, 0);
- libinput_dispatch(li);
-
- for (i = 0; i < 8; i++) {
- litest_push_event_frame(dev);
- if (dir_x > 0.0)
- dir_x -= 3;
- else if (dir_x < 0.0)
- dir_x += 3;
- if (dir_y > 0.0)
- dir_y -= 3;
- else if (dir_y < 0.0)
- dir_y += 3;
- litest_touch_move(dev,
- 0,
- 50 + dir_x,
- 50 + dir_y);
- litest_touch_move(dev,
- 1,
- 50 - dir_x,
- 50 - dir_y);
- litest_pop_event_frame(dev);
- libinput_dispatch(li);
- }
-
- event = libinput_get_event(li);
- gevent = litest_is_gesture_event(event,
- LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
- 4);
- dx = libinput_event_gesture_get_dx(gevent);
- dy = libinput_event_gesture_get_dy(gevent);
- scale = libinput_event_gesture_get_scale(gevent);
- ck_assert(dx == 0.0);
- ck_assert(dy == 0.0);
- ck_assert(scale == 1.0);
-
- libinput_event_destroy(event);
-
- while ((event = libinput_get_event(li)) != NULL) {
- gevent = litest_is_gesture_event(event,
- LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
- 4);
-
- oldscale = scale;
- scale = libinput_event_gesture_get_scale(gevent);
-
- ck_assert(scale < oldscale);
-
- angle = libinput_event_gesture_get_angle_delta(gevent);
- ck_assert_double_le(fabs(angle), 1.5);
-
- libinput_event_destroy(event);
- libinput_dispatch(li);
- }
-
- litest_touch_up(dev, 0);
- litest_touch_up(dev, 1);
- libinput_dispatch(li);
- event = libinput_get_event(li);
- gevent = litest_is_gesture_event(event,
- LIBINPUT_EVENT_GESTURE_PINCH_END,
- 4);
- ck_assert(!libinput_event_gesture_get_cancelled(gevent));
- libinput_event_destroy(event);
-}
-END_TEST
-
START_TEST(gestures_spread)
{
struct litest_device *dev = litest_current_device();
@@ -1282,9 +1073,7 @@ litest_setup_tests_gestures(void)
litest_add_ranged("gestures:swipe", gestures_swipe_4fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
- litest_add_ranged("gestures:pinch", gestures_pinch_3fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch_4fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
- litest_add_ranged("gestures:pinch", gestures_pinch_4fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_spread, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch_vertical_positon, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &fingers);
--
2.13.5

View File

@ -4,8 +4,8 @@
%global gitversion 58abea394
Name: libinput
Version: 1.8.1
Release: 4%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Version: 1.8.2
Release: 1%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Summary: Input device library
License: MIT
@ -18,7 +18,6 @@ Source2: commitid
Source0: http://www.freedesktop.org/software/libinput/libinput-%{version}.tar.xz
%endif
Patch01: 0001-gestures-don-t-try-to-pinch-for-nfingers-slots.patch
Patch02: 0001-touchpad-don-t-resume-a-disabled-touchpad.patch
BuildRequires: git-core
@ -106,6 +105,9 @@ git am -p1 %{patches} < /dev/null
%changelog
* Thu Sep 07 2017 Peter Hutterer <peter.hutterer@redhat.com> 1.8.2-1
- libinput 1.8.2
* Tue Sep 05 2017 Peter Hutterer <peter.hutterer@redhat.com> 1.8.1-4
- Don't try pinching when the finger number exceeds available slots
- Don't resume a disabled touchpad after a lid switch open (#1448962)

View File

@ -1 +1 @@
SHA512 (libinput-1.8.1.tar.xz) = 1566ccb7d1721ee2d16badc404896d31e3ac45fda71e2577db17141a507594f3827ed0a389bb537f946cb380d77feedef8e71df76ac89f8c11c44463df01ee4f
SHA512 (libinput-1.8.2.tar.xz) = 555a7680cc8aaf62c5370a865f3aff0a933d42d94a3d8861c072666b02c9e1be45ea39de9a749a9575cdfb613b6150e412e18559d94d4919f21ca4680a3c76a7