Hello community, here is the log from the commit of package libinput for openSUSE:Factory checked in at 2018-11-06 14:03:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libinput (Old) and /work/SRC/openSUSE:Factory/.libinput.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libinput" Tue Nov 6 14:03:56 2018 rev:68 rq:644188 version:1.12.2 Changes: -------- --- /work/SRC/openSUSE:Factory/libinput/libinput.changes 2018-10-09 15:53:11.218352422 +0200 +++ /work/SRC/openSUSE:Factory/.libinput.new/libinput.changes 2018-11-06 14:03:59.787483584 +0100 @@ -1,0 +2,19 @@ +Wed Oct 24 08:08:11 UTC 2018 - Jan Engelhardt <[email protected]> + +- Update to new upstream release 1.12.2 + * The Lenovo x220t and x60t do not disable the keyboard in + tablet-mode anymore. + * Button debouncing is now disabled on VMware virtual devices. + * The Wacom Intuos Pro PTH-660 palm threshold was restored to + the original value, it was changed accidentally. + * libinput now assumes that you only have one thumb per hand, + which is a statistically well-supported approximation. + * A 2-finger movement out of the software button area now will + no longer trigger spurious pointer motion events if one + finger exits the button area before the other one. + * The Wacom Intuos Pro PTH-660, when connected over Bluetooth, + sometimes caused an invalid event sequence that caused + libinput to lose track of the tap counter which again + triggered an assertion later. + +------------------------------------------------------------------- Old: ---- libinput-1.12.1.tar.xz libinput-1.12.1.tar.xz.sig New: ---- libinput-1.12.2.tar.xz libinput-1.12.2.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libinput.spec ++++++ --- /var/tmp/diff_new_pack.2tNYWw/_old 2018-11-06 14:04:00.463482703 +0100 +++ /var/tmp/diff_new_pack.2tNYWw/_new 2018-11-06 14:04:00.463482703 +0100 @@ -22,7 +22,7 @@ Name: libinput %define lname libinput10 -Version: 1.12.1 +Version: 1.12.2 Release: 0 Summary: Input device and event processing library License: MIT ++++++ libinput-1.12.1.tar.xz -> libinput-1.12.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/meson.build new/libinput-1.12.2/meson.build --- old/libinput-1.12.1/meson.build 2018-10-03 04:48:52.000000000 +0200 +++ new/libinput-1.12.2/meson.build 2018-10-24 07:45:24.000000000 +0200 @@ -1,5 +1,5 @@ project('libinput', 'c', 'cpp', - version : '1.12.1', + version : '1.12.2', license : 'MIT/Expat', default_options : [ 'c_std=gnu99', 'warning_level=2' ], meson_version : '>= 0.41.0') @@ -261,6 +261,7 @@ 'quirks/30-vendor-razer.quirks', 'quirks/30-vendor-synaptics.quirks', 'quirks/30-vendor-wacom.quirks', + 'quirks/30-vendor-vmware.quirks', 'quirks/50-system-acer.quirks', 'quirks/50-system-apple.quirks', 'quirks/50-system-asus.quirks', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/quirks/30-vendor-vmware.quirks new/libinput-1.12.2/quirks/30-vendor-vmware.quirks --- old/libinput-1.12.1/quirks/30-vendor-vmware.quirks 1970-01-01 01:00:00.000000000 +0100 +++ new/libinput-1.12.2/quirks/30-vendor-vmware.quirks 2018-10-24 07:45:24.000000000 +0200 @@ -0,0 +1,10 @@ +# Do not edit this file, it will be overwritten on update + +[VMWare Virtual PS/2 Mouse] +MatchName=*VirtualPS/2 VMware VMMouse* +ModelBouncingKeys=1 + +[VMware VMware Virtual USB Mouse] +MatchName=*VMware VMware Virtual USB Mouse* +ModelBouncingKeys=1 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/quirks/30-vendor-wacom.quirks new/libinput-1.12.2/quirks/30-vendor-wacom.quirks --- old/libinput-1.12.1/quirks/30-vendor-wacom.quirks 2018-10-03 04:48:52.000000000 +0200 +++ new/libinput-1.12.2/quirks/30-vendor-wacom.quirks 2018-10-24 07:45:24.000000000 +0200 @@ -11,4 +11,4 @@ MatchBus=usb MatchVendor=0x056A MatchProduct=0x0357 -AttrPalmSizeThreshold=1 +AttrPalmSizeThreshold=5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/quirks/50-system-lenovo.quirks new/libinput-1.12.2/quirks/50-system-lenovo.quirks --- old/libinput-1.12.1/quirks/50-system-lenovo.quirks 2018-10-03 04:48:52.000000000 +0200 +++ new/libinput-1.12.2/quirks/50-system-lenovo.quirks 2018-10-24 07:45:24.000000000 +0200 @@ -81,6 +81,19 @@ MatchDMIModalias=dmi:*svnIBM:*pvrThinkPadX41Tablet:* ModelTabletModeNoSuspend=1 +[Lenovo X60 Tablet] +MatchName=AT Translated Set 2 keyboard +MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPadX60Tablet:* +ModelTabletModeNoSuspend=1 + +# Lenovo X220 Tablet special bezel buttons are associated to the +# keyboard and would therefore mistakenly be deactivated as well. +# See https://gitlab.freedesktop.org/libinput/libinput/issues/154 +[Lenovo X220 Tablet] +MatchName=AT Translated Set 2 keyboard +MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPadX220Tablet:* +ModelTabletModeNoSuspend=1 + # Lenovo MIIX 720 comes with a detachable keyboard. We must not disable # the keyboard because some keys are still accessible on the screen and # volume rocker. See diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/src/evdev-mt-touchpad-buttons.c new/libinput-1.12.2/src/evdev-mt-touchpad-buttons.c --- old/libinput-1.12.1/src/evdev-mt-touchpad-buttons.c 2018-10-03 04:48:52.000000000 +0200 +++ new/libinput-1.12.2/src/evdev-mt-touchpad-buttons.c 2018-10-24 07:45:24.000000000 +0200 @@ -251,6 +251,36 @@ } } +/** + * Release any button in the bottom area, provided it started within a + * threshold around start_time (i.e. simultaneously with the other touch + * that triggered this call). + */ +static inline void +tp_button_release_other_bottom_touches(struct tp_dispatch *tp, + uint64_t other_start_time) +{ + struct tp_touch *t; + + tp_for_each_touch(tp, t) { + uint64_t tdelta; + + if (t->button.state != BUTTON_STATE_BOTTOM || + t->button.has_moved) + continue; + + if (other_start_time > t->button.initial_time) + tdelta = other_start_time - t->button.initial_time; + else + tdelta = t->button.initial_time - other_start_time; + + if (tdelta > ms2us(80)) + continue; + + t->button.has_moved = true; + } +} + static void tp_button_bottom_handle_event(struct tp_dispatch *tp, struct tp_touch *t, @@ -271,6 +301,14 @@ case BUTTON_EVENT_IN_TOP_L: case BUTTON_EVENT_IN_AREA: tp_button_set_state(tp, t, BUTTON_STATE_AREA, event); + + /* We just transitioned one finger from BOTTOM to AREA, + * if there are other fingers in BOTTOM that started + * simultaneously with this finger, release those fingers + * because they're part of a gesture. + */ + tp_button_release_other_bottom_touches(tp, + t->button.initial_time); break; case BUTTON_EVENT_UP: tp_button_set_state(tp, t, BUTTON_STATE_NONE, event); @@ -450,7 +488,7 @@ if (current != t->button.state) evdev_log_debug(tp->device, - "button state: touch %d from %s, event %s to %s\n", + "button state: touch %d from %-20s event %-24s to %-20s\n", t->index, button_state_to_str(current), button_event_to_str(event), @@ -464,6 +502,9 @@ struct phys_coords mm; double vector_length; + if (t->button.has_moved) + return; + switch (t->button.state) { case BUTTON_STATE_NONE: case BUTTON_STATE_AREA: @@ -482,8 +523,12 @@ mm = evdev_device_unit_delta_to_mm(tp->device, &delta); vector_length = hypot(mm.x, mm.y); - if (vector_length > 5.0 /* mm */) + if (vector_length > 5.0 /* mm */) { t->button.has_moved = true; + + tp_button_release_other_bottom_touches(tp, + t->button.initial_time); + } } void @@ -497,6 +542,7 @@ if (t->state == TOUCH_BEGIN) { t->button.initial = t->point; + t->button.initial_time = time; t->button.has_moved = false; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/src/evdev-mt-touchpad.c new/libinput-1.12.2/src/evdev-mt-touchpad.c --- old/libinput-1.12.1/src/evdev-mt-touchpad.c 2018-10-03 04:48:52.000000000 +0200 +++ new/libinput-1.12.2/src/evdev-mt-touchpad.c 2018-10-24 07:45:24.000000000 +0200 @@ -305,6 +305,18 @@ t->state == TOUCH_HOVERING) return; + /* Bug #161: touch ends in the same event frame where it restarts + again. That's a kernel bug, so let's complain. */ + if (t->state == TOUCH_MAYBE_END) { + evdev_log_bug_kernel(tp->device, + "touch %d ended and began in in same frame.\n", + t->index); + tp->nfingers_down++; + t->state = TOUCH_UPDATE; + t->has_ended = false; + return; + } + /* we begin the touch as hovering because until BTN_TOUCH happens we * don't know if it's a touch down or not. And BTN_TOUCH may happen * after ABS_MT_TRACKING_ID */ @@ -1143,6 +1155,28 @@ } } + /* If the finger is below the upper thumb line and we have another + * finger in the same area, neither finger is a thumb (unless we've + * already labeled it as such). + */ + if (t->point.y > tp->thumb.upper_thumb_line && + tp->nfingers_down > 1) { + struct tp_touch *other; + + tp_for_each_touch(tp, other) { + if (other->state != TOUCH_BEGIN && + other->state != TOUCH_UPDATE) + continue; + + if (other->point.y > tp->thumb.upper_thumb_line) { + t->thumb.state = THUMB_STATE_NO; + if (other->thumb.state == THUMB_STATE_MAYBE) + other->thumb.state = THUMB_STATE_NO; + break; + } + } + } + /* Note: a thumb at the edge of the touchpad won't trigger the * threshold, the surface area is usually too small. So we have a * two-stage detection: pressure and time within the area. @@ -1904,7 +1938,8 @@ t->pressure, tp_touch_active(tp, t) ? "" : "inactive"); } - evdev_log_debug(device, "touch state: %s\n", buf); + if (buf[0] != '\0') + evdev_log_debug(device, "touch state: %s\n", buf); } static void diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/src/evdev-mt-touchpad.h new/libinput-1.12.2/src/evdev-mt-touchpad.h --- old/libinput-1.12.1/src/evdev-mt-touchpad.h 2018-10-03 04:48:52.000000000 +0200 +++ new/libinput-1.12.2/src/evdev-mt-touchpad.h 2018-10-24 07:45:24.000000000 +0200 @@ -209,6 +209,7 @@ struct libinput_timer timer; struct device_coords initial; bool has_moved; /* has moved more than threshold */ + uint64_t initial_time; } button; struct { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/src/quirks.c new/libinput-1.12.2/src/quirks.c --- old/libinput-1.12.1/src/quirks.c 2018-10-03 04:48:52.000000000 +0200 +++ new/libinput-1.12.2/src/quirks.c 2018-10-24 07:45:24.000000000 +0200 @@ -34,6 +34,7 @@ #include <libudev.h> #include <dirent.h> #include <fnmatch.h> +#include <libgen.h> #include "libinput-versionsort.h" #include "libinput-util.h" @@ -413,7 +414,9 @@ { struct section *s = zalloc(sizeof(*s)); - xasprintf(&s->name, "%s (%s)", name, basename(path)); + char *path_dup = safe_strdup(path); + xasprintf(&s->name, "%s (%s)", name, basename(path_dup)); + free(path_dup); list_init(&s->link); list_init(&s->properties); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/test/litest-device-mouse-wheel-tilt.c new/libinput-1.12.2/test/litest-device-mouse-wheel-tilt.c --- old/libinput-1.12.1/test/litest-device-mouse-wheel-tilt.c 2018-10-03 04:48:52.000000000 +0200 +++ new/libinput-1.12.2/test/litest-device-mouse-wheel-tilt.c 2018-10-24 07:45:24.000000000 +0200 @@ -21,9 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ -#if HAVE_CONFIG_H #include "config.h" -#endif #include "litest.h" #include "litest-int.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/test/litest-device-vmware-virtual-usb-mouse.c new/libinput-1.12.2/test/litest-device-vmware-virtual-usb-mouse.c --- old/libinput-1.12.1/test/litest-device-vmware-virtual-usb-mouse.c 2018-10-03 04:48:52.000000000 +0200 +++ new/libinput-1.12.2/test/litest-device-vmware-virtual-usb-mouse.c 2018-10-24 07:45:24.000000000 +0200 @@ -95,7 +95,7 @@ TEST_DEVICE("vmware-virtmouse", .type = LITEST_VMWARE_VIRTMOUSE, - .features = LITEST_WHEEL | LITEST_BUTTON | LITEST_ABSOLUTE, + .features = LITEST_WHEEL | LITEST_BUTTON | LITEST_ABSOLUTE | LITEST_NO_DEBOUNCE, .interface = &interface, .name = "VMware VMware Virtual USB Mouse", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/test/litest.c new/libinput-1.12.2/test/litest.c --- old/libinput-1.12.1/test/litest.c 2018-10-03 04:48:52.000000000 +0200 +++ new/libinput-1.12.2/test/litest.c 2018-10-24 07:45:24.000000000 +0200 @@ -3571,6 +3571,12 @@ } void +litest_timeout_thumb(void) +{ + msleep(320); +} + +void litest_push_event_frame(struct litest_device *dev) { litest_assert(dev->skip_ev_syn >= 0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/test/litest.h new/libinput-1.12.2/test/litest.h --- old/libinput-1.12.1/test/litest.h 2018-10-03 04:48:52.000000000 +0200 +++ new/libinput-1.12.2/test/litest.h 2018-10-24 07:45:24.000000000 +0200 @@ -820,6 +820,9 @@ litest_timeout_hysteresis(void); void +litest_timeout_thumb(void); + +void litest_push_event_frame(struct litest_device *dev); void @@ -958,6 +961,15 @@ return methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER; } +static inline bool +litest_has_btnareas(struct litest_device *dev) +{ + struct libinput_device *device = dev->libinput_device; + uint32_t methods = libinput_device_config_click_get_methods(device); + + return methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS; +} + static inline void litest_enable_clickfinger(struct litest_device *dev) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/test/test-misc.c new/libinput-1.12.2/test/test-misc.c --- old/libinput-1.12.1/test/test-misc.c 2018-10-03 04:48:52.000000000 +0200 +++ new/libinput-1.12.2/test/test-misc.c 2018-10-24 07:45:24.000000000 +0200 @@ -838,15 +838,13 @@ } END_TEST -struct parser_test_dimension { - char *tag; - bool success; - int x, y; -}; - START_TEST(dimension_prop_parser) { - struct parser_test_dimension tests[] = { + struct parser_test_dimension { + char *tag; + bool success; + int x, y; + } tests[] = { { "10x10", true, 10, 10 }, { "1x20", true, 1, 20 }, { "1x8000", true, 1, 8000 }, @@ -887,15 +885,13 @@ } END_TEST -struct parser_test_reliability { - char *tag; - bool success; - enum switch_reliability reliability; -}; - START_TEST(reliability_prop_parser) { - struct parser_test_reliability tests[] = { + struct parser_test_reliability { + char *tag; + bool success; + enum switch_reliability reliability; + } tests[] = { { "reliable", true, RELIABILITY_RELIABLE }, { "unreliable", false, 0 }, { "", false, 0 }, @@ -926,17 +922,15 @@ } END_TEST -struct parser_test_calibration { - char *prop; - bool success; - float values[6]; -}; - START_TEST(calibration_prop_parser) { #define DEFAULT_VALUES { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 } const float untouched[6] = DEFAULT_VALUES; - struct parser_test_calibration tests[] = { + struct parser_test_calibration { + char *prop; + bool success; + float values[6]; + } tests[] = { { "", false, DEFAULT_VALUES }, { "banana", false, DEFAULT_VALUES }, { "1 2 3 a 5 6", false, DEFAULT_VALUES }, @@ -979,15 +973,13 @@ } END_TEST -struct parser_test_range { - char *tag; - bool success; - int hi, lo; -}; - START_TEST(range_prop_parser) { - struct parser_test_range tests[] = { + struct parser_test_range { + char *tag; + bool success; + int hi, lo; + } tests[] = { { "10:8", true, 10, 8 }, { "100:-1", true, 100, -1 }, { "-203813:-502023", true, -203813, -502023 }, @@ -1254,15 +1246,13 @@ } END_TEST -struct atod_test { - char *str; - bool success; - double val; -}; - START_TEST(safe_atod_test) { - struct atod_test tests[] = { + struct atod_test { + char *str; + bool success; + double val; + } tests[] = { { "10", true, 10 }, { "20", true, 20 }, { "-1", true, -1 }, @@ -1303,15 +1293,13 @@ } END_TEST -struct strsplit_test { - const char *string; - const char *delim; - const char *results[10]; -}; - START_TEST(strsplit_test) { - struct strsplit_test tests[] = { + struct strsplit_test { + const char *string; + const char *delim; + const char *results[10]; + } tests[] = { { "one two three", " ", { "one", "two", "three", NULL } }, { "one", " ", { "one", NULL } }, { "one two ", " ", { "one", "two", NULL } }, @@ -1347,20 +1335,18 @@ } END_TEST -struct kvsplit_dbl_test { - const char *string; - const char *psep; - const char *kvsep; - ssize_t nresults; - struct { - double a; - double b; - } results[32]; -}; - START_TEST(kvsplit_double_test) { - struct kvsplit_dbl_test tests[] = { + struct kvsplit_dbl_test { + const char *string; + const char *psep; + const char *kvsep; + ssize_t nresults; + struct { + double a; + double b; + } results[32]; + } tests[] = { { "1:2;3:4;5:6", ";", ":", 3, { {1, 2}, {3, 4}, {5, 6}}}, { "1.0x2.3 -3.2x4.5 8.090909x-6.00", " ", "x", 3, { {1.0, 2.3}, {-3.2, 4.5}, {8.090909, -6}}}, @@ -1399,15 +1385,13 @@ } END_TEST -struct strjoin_test { - char *strv[10]; - const char *joiner; - const char *result; -}; - START_TEST(strjoin_test) { - struct strjoin_test tests[] = { + struct strjoin_test { + char *strv[10]; + const char *joiner; + const char *result; + } tests[] = { { { "one", "two", "three", NULL }, " ", "one two three" }, { { "one", NULL }, "x", "one" }, { { "one", "two", NULL }, "x", "onextwo" }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/test/test-switch.c new/libinput-1.12.2/test/test-switch.c --- old/libinput-1.12.1/test/test-switch.c 2018-10-03 04:48:52.000000000 +0200 +++ new/libinput-1.12.2/test/test-switch.c 2018-10-24 07:45:24.000000000 +0200 @@ -865,6 +865,127 @@ } END_TEST +START_TEST(tablet_mode_disable_touchpad_on_resume) +{ + struct litest_device *sw = litest_current_device(); + struct litest_device *touchpad; + struct libinput *li = sw->libinput; + struct libinput_event *event; + bool have_switch_toggle = false; + + if (!switch_has_tablet_mode(sw)) + return; + + touchpad = switch_init_paired_touchpad(li); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + + libinput_suspend(li); + litest_switch_action(sw, + LIBINPUT_SWITCH_TABLET_MODE, + LIBINPUT_SWITCH_STATE_ON); + litest_drain_events(li); + libinput_resume(li); + libinput_dispatch(li); + + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + + type = libinput_event_get_type(event); + switch (type) { + case LIBINPUT_EVENT_DEVICE_ADDED: + break; + case LIBINPUT_EVENT_SWITCH_TOGGLE: + litest_is_switch_event(event, + LIBINPUT_SWITCH_TABLET_MODE, + LIBINPUT_SWITCH_STATE_ON); + have_switch_toggle = true; + break; + default: + ck_abort(); + } + libinput_event_destroy(event); + } + + ck_assert(have_switch_toggle); + + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); + litest_touch_up(touchpad, 0); + litest_assert_empty_queue(li); + + litest_switch_action(sw, + LIBINPUT_SWITCH_TABLET_MODE, + LIBINPUT_SWITCH_STATE_OFF); + libinput_dispatch(li); + event = libinput_get_event(li); + litest_is_switch_event(event, + LIBINPUT_SWITCH_TABLET_MODE, + LIBINPUT_SWITCH_STATE_OFF); + libinput_event_destroy(event); + + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); + litest_touch_up(touchpad, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_delete_device(touchpad); +} +END_TEST + +START_TEST(tablet_mode_enable_touchpad_on_resume) +{ + struct litest_device *sw = litest_current_device(); + struct litest_device *touchpad; + struct libinput *li = sw->libinput; + struct libinput_event *event; + + if (!switch_has_tablet_mode(sw)) + return; + + touchpad = switch_init_paired_touchpad(li); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + + litest_switch_action(sw, + LIBINPUT_SWITCH_TABLET_MODE, + LIBINPUT_SWITCH_STATE_ON); + libinput_suspend(li); + litest_drain_events(li); + + litest_switch_action(sw, + LIBINPUT_SWITCH_TABLET_MODE, + LIBINPUT_SWITCH_STATE_OFF); + + libinput_resume(li); + libinput_dispatch(li); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_ADDED); + + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); + litest_touch_up(touchpad, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_switch_action(sw, + LIBINPUT_SWITCH_TABLET_MODE, + LIBINPUT_SWITCH_STATE_ON); + libinput_dispatch(li); + event = libinput_get_event(li); + litest_is_switch_event(event, + LIBINPUT_SWITCH_TABLET_MODE, + LIBINPUT_SWITCH_STATE_ON); + libinput_event_destroy(event); + + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); + litest_touch_up(touchpad, 0); + litest_assert_empty_queue(li); + + litest_delete_device(touchpad); +} +END_TEST + START_TEST(tablet_mode_disable_keyboard) { struct litest_device *sw = litest_current_device(); @@ -938,6 +1059,109 @@ } END_TEST +START_TEST(tablet_mode_disable_keyboard_on_resume) +{ + struct litest_device *sw = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = sw->libinput; + struct libinput_event *event; + bool have_switch_toggle = false; + + if (!switch_has_tablet_mode(sw)) + return; + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_drain_events(li); + libinput_suspend(li); + + litest_switch_action(sw, + LIBINPUT_SWITCH_TABLET_MODE, + LIBINPUT_SWITCH_STATE_ON); + litest_drain_events(li); + + libinput_resume(li); + libinput_dispatch(li); + + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + + type = libinput_event_get_type(event); + switch (type) { + case LIBINPUT_EVENT_DEVICE_ADDED: + break; + case LIBINPUT_EVENT_SWITCH_TOGGLE: + litest_is_switch_event(event, + LIBINPUT_SWITCH_TABLET_MODE, + LIBINPUT_SWITCH_STATE_ON); + have_switch_toggle = true; + break; + default: + ck_abort(); + } + libinput_event_destroy(event); + } + + ck_assert(have_switch_toggle); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + litest_assert_empty_queue(li); + + litest_switch_action(sw, + LIBINPUT_SWITCH_TABLET_MODE, + LIBINPUT_SWITCH_STATE_OFF); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(tablet_mode_enable_keyboard_on_resume) +{ + struct litest_device *sw = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = sw->libinput; + + if (!switch_has_tablet_mode(sw)) + return; + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_switch_action(sw, + LIBINPUT_SWITCH_TABLET_MODE, + LIBINPUT_SWITCH_STATE_ON); + litest_drain_events(li); + libinput_suspend(li); + litest_drain_events(li); + + litest_switch_action(sw, + LIBINPUT_SWITCH_TABLET_MODE, + LIBINPUT_SWITCH_STATE_OFF); + + libinput_resume(li); + libinput_dispatch(li); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_ADDED); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_switch_action(sw, + LIBINPUT_SWITCH_TABLET_MODE, + LIBINPUT_SWITCH_STATE_ON); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + litest_assert_empty_queue(li); + + litest_delete_device(keyboard); +} +END_TEST + START_TEST(tablet_mode_disable_trackpoint) { struct litest_device *sw = litest_current_device(); @@ -1071,8 +1295,12 @@ litest_add_for_device("lid:keypress", lid_key_press, LITEST_GPIO_KEYS); litest_add("tablet-mode:touchpad", tablet_mode_disable_touchpad_on_init, LITEST_SWITCH, LITEST_ANY); + litest_add("tablet-mode:touchpad", tablet_mode_disable_touchpad_on_resume, LITEST_SWITCH, LITEST_ANY); + litest_add("tablet-mode:touchpad", tablet_mode_enable_touchpad_on_resume, LITEST_SWITCH, LITEST_ANY); litest_add("tablet-mode:keyboard", tablet_mode_disable_keyboard, LITEST_SWITCH, LITEST_ANY); litest_add("tablet-mode:keyboard", tablet_mode_disable_keyboard_on_init, LITEST_SWITCH, LITEST_ANY); + litest_add("tablet-mode:keyboard", tablet_mode_disable_keyboard_on_resume, LITEST_SWITCH, LITEST_ANY); + litest_add("tablet-mode:keyboard", tablet_mode_enable_keyboard_on_resume, LITEST_SWITCH, LITEST_ANY); litest_add("tablet-mode:trackpoint", tablet_mode_disable_trackpoint, LITEST_SWITCH, LITEST_ANY); litest_add("tablet-mode:trackpoint", tablet_mode_disable_trackpoint_on_init, LITEST_SWITCH, LITEST_ANY); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.1/test/test-touchpad.c new/libinput-1.12.2/test/test-touchpad.c --- old/libinput-1.12.1/test/test-touchpad.c 2018-10-03 04:48:52.000000000 +0200 +++ new/libinput-1.12.2/test/test-touchpad.c 2018-10-24 07:45:24.000000000 +0200 @@ -511,6 +511,43 @@ } END_TEST +START_TEST(touchpad_2fg_scroll_from_btnareas) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (!litest_has_2fg_scroll(dev) || + !litest_has_btnareas(dev)) + return; + + litest_enable_2fg_scroll(dev); + litest_enable_buttonareas(dev); + litest_drain_events(li); + + litest_touch_down(dev, 0, 30, 95); + litest_touch_down(dev, 1, 50, 95); + libinput_dispatch(li); + + /* First finger moves out of the area first but it's a scroll + * motion, should not trigger POINTER_MOTION */ + for (int i = 0; i < 5; i++) { + litest_touch_move(dev, 0, 30, 95 - i); + } + libinput_dispatch(li); + + for (int i = 0; i < 20; i++) { + litest_touch_move(dev, 0, 30, 90 - i); + litest_touch_move(dev, 1, 30, 95 - i); + } + libinput_dispatch(li); + + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); +} +END_TEST + START_TEST(touchpad_scroll_natural_defaults) { struct litest_device *dev = litest_current_device(); @@ -5199,6 +5236,76 @@ } END_TEST +START_TEST(touchpad_thumb_no_doublethumb) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_disable_tap(dev->libinput_device); + litest_enable_clickfinger(dev); + + if (!has_thumb_detect(dev)) + return; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 99); + litest_touch_down(dev, 1, 70, 99); + /* move touch to trigger the thumb detection */ + litest_touch_move(dev, 0, 50, 99.2); + + libinput_dispatch(li); + litest_timeout_thumb(); + libinput_dispatch(li); + + /* move touch to trigger the thumb detection */ + litest_touch_move(dev, 1, 70, 99.2); + libinput_dispatch(li); + + litest_touch_move_two_touches(dev, 50, 99, 70, 99, 0, -20, 10); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); +} +END_TEST + +START_TEST(touchpad_thumb_no_doublethumb_with_timeout) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_disable_tap(dev->libinput_device); + litest_enable_clickfinger(dev); + + if (!has_thumb_detect(dev)) + return; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 99.9); + libinput_dispatch(li); + litest_timeout_thumb(); + libinput_dispatch(li); + /* Thumbs don't have a timeout handler, so we have to move the thumb + * a bit to trigger. */ + litest_touch_move(dev, 0, 50, 99.8); + + /* first touch should now be a thumb */ + + litest_touch_down(dev, 1, 70, 99.9); + libinput_dispatch(li); + litest_timeout_thumb(); + libinput_dispatch(li); + litest_touch_move(dev, 1, 70, 99.8); + litest_touch_move_two_touches(dev, 50, 99, 70, 99, 0, -20, 10); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); +} +END_TEST + START_TEST(touchpad_tool_tripletap_touch_count) { struct litest_device *dev = litest_current_device(); @@ -6625,6 +6732,40 @@ } END_TEST +START_TEST(touchpad_end_start_touch) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_move(dev, 0, 50.1, 50.1); + libinput_dispatch(li); + + litest_push_event_frame(dev); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 50.2, 50.2); + litest_pop_event_frame(dev); + + litest_disable_log_handler(li); + libinput_dispatch(li); + litest_restore_log_handler(li); + + litest_assert_empty_queue(li); + + litest_timeout_tap(); + libinput_dispatch(li); + + litest_touch_move_to(dev, 0, 50.2, 50.2, 50, 70, 10); + litest_touch_up(dev, 0); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); +} +END_TEST + TEST_COLLECTION(touchpad) { struct range suspends = { SUSPEND_EXT_MOUSE, SUSPEND_COUNT }; @@ -6643,6 +6784,7 @@ litest_add("touchpad:scroll", touchpad_2fg_scroll_return_to_motion, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:scroll", touchpad_2fg_scroll_source, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:scroll", touchpad_2fg_scroll_semi_mt, LITEST_SEMI_MT, LITEST_SINGLE_TOUCH); + litest_add("touchpad:scroll", touchpad_2fg_scroll_from_btnareas, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:scroll", touchpad_scroll_natural_defaults, LITEST_TOUCHPAD, LITEST_ANY); litest_add("touchpad:scroll", touchpad_scroll_natural_enable_config, LITEST_TOUCHPAD, LITEST_ANY); litest_add("touchpad:scroll", touchpad_scroll_natural_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); @@ -6783,6 +6925,8 @@ litest_add("touchpad:thumb", touchpad_thumb_tap_hold_2ndfg, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:thumb", touchpad_thumb_tap_hold_2ndfg_tap, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH); litest_add("touchpad:thumb", touchpad_thumb_move_and_tap, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:thumb", touchpad_thumb_no_doublethumb, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:thumb", touchpad_thumb_no_doublethumb_with_timeout, LITEST_CLICKPAD, LITEST_ANY); litest_add_for_device("touchpad:bugs", touchpad_tool_tripletap_touch_count, LITEST_SYNAPTICS_TOPBUTTONPAD); litest_add_for_device("touchpad:bugs", touchpad_tool_tripletap_touch_count_late, LITEST_SYNAPTICS_TOPBUTTONPAD); @@ -6818,4 +6962,8 @@ litest_add_ranged("touchpad:suspend", touchpad_suspend_abba, LITEST_TOUCHPAD, LITEST_ANY, &suspends); litest_add_ranged("touchpad:suspend", touchpad_suspend_abab, LITEST_TOUCHPAD, LITEST_ANY, &suspends); + + /* Happens on the "Wacom Intuos Pro M Finger" but our test device + * has the same properties */ + litest_add_for_device("touchpad:bugs", touchpad_end_start_touch, LITEST_WACOM_FINGER); }
