From 7d2c06ec7ea48c1a5a8bf9f90898caf8f1dd9ee0 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 26 Oct 2015 10:44:36 +1000 Subject: [PATCH 01/12] configure.ac: libinput 1.1.0 Signed-off-by: Peter Hutterer --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 6beafafe..0703dd87 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,8 @@ AC_PREREQ([2.64]) m4_define([libinput_major_version], [1]) -m4_define([libinput_minor_version], [0]) -m4_define([libinput_micro_version], [901]) +m4_define([libinput_minor_version], [1]) +m4_define([libinput_micro_version], [0]) m4_define([libinput_version], [libinput_major_version.libinput_minor_version.libinput_micro_version]) @@ -31,7 +31,7 @@ AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz]) # b) If interfaces have been changed or added, but binary compatibility has # been preserved, change to C+1:0:A+1 # c) If the interface is the same as the previous version, change to C:R+1:A -LIBINPUT_LT_VERSION=15:2:5 +LIBINPUT_LT_VERSION=16:0:6 AC_SUBST(LIBINPUT_LT_VERSION) AM_SILENT_RULES([yes]) From f012d78de4577e9c1b55a63033825d3b13c5d696 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 28 Oct 2015 09:18:18 +1000 Subject: [PATCH 02/12] evdev: whitespace fix Signed-off-by: Peter Hutterer --- src/evdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/evdev.c b/src/evdev.c index aef0456b..45c1b1b2 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -297,7 +297,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) /* Use unaccelerated deltas for pointing stick scroll */ if (evdev_post_trackpoint_scroll(device, unaccel, time)) - break; + break; /* Apply pointer acceleration. */ accel = filter_dispatch(device->pointer.filter, From 8b6cc1cc959c59255d87922fc5b07aa3c783906d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 28 Oct 2015 09:20:33 +1000 Subject: [PATCH 03/12] evdev: log a bug for missing pointer accel on relative events And use the unaccelerated motion events. Better than crashing, and better than a non-moving mouse. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 45c1b1b2..4c947d69 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -299,11 +299,18 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) if (evdev_post_trackpoint_scroll(device, unaccel, time)) break; - /* Apply pointer acceleration. */ - accel = filter_dispatch(device->pointer.filter, - &unaccel, - device, - time); + if (device->pointer.filter) { + /* Apply pointer acceleration. */ + accel = filter_dispatch(device->pointer.filter, + &unaccel, + device, + time); + } else { + log_bug_libinput(libinput, + "%s: accel filter missing\n", + udev_device_get_devnode(device->udev_device)); + accel = unaccel; + } if (normalized_is_zero(accel) && normalized_is_zero(unaccel)) break; From 91f11eb9619a3b580599d9bbbd2177150830cc2f Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 28 Oct 2015 09:05:37 +1000 Subject: [PATCH 04/12] evdev: don't handle motion events if the device isn't a pointer device This check is already in place for all other event types. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/evdev.c b/src/evdev.c index 4c947d69..ba1b5689 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -289,6 +289,9 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) case EVDEV_NONE: return; case EVDEV_RELATIVE_MOTION: + if (!(device->seat_caps & EVDEV_DEVICE_POINTER)) + break; + normalize_delta(device, &device->rel, &unaccel); raw.x = device->rel.x; raw.y = device->rel.y; From 38f20850e1d81b6636db093287f6d6209d1ca7ab Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 28 Oct 2015 09:13:24 +1000 Subject: [PATCH 05/12] evdev: init pointer acceleration for any device with pointer cap and rel x/y The Asus RoG Gladius exposes two event nodes, one mouse, one keyboard. The keyboard node has REL_X/Y and REL_HWHEEL on top of the various key bits and ABS_VOLUME. The keyboard node does not have BTN_* set, udev tags this device as a keyboard only, not as a pointer but we still initialize the pointer caps for it because of the wheel. When moving this mouse, some deltas (ca "1 in every 20") are sent through the keyboard node, causing a crash because we never initialized pointer acceleration. https://bugzilla.redhat.com/show_bug.cgi?id=1275407 Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev.c | 15 +- test/Makefile.am | 1 + test/litest-device-asus-rog-gladius.c | 334 ++++++++++++++++++++++++++ test/litest.c | 2 + test/litest.h | 1 + 5 files changed, 348 insertions(+), 5 deletions(-) create mode 100644 test/litest-device-asus-rog-gladius.c diff --git a/src/evdev.c b/src/evdev.c index ba1b5689..ec3abc6c 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2062,11 +2062,6 @@ evdev_configure_device(struct evdev_device *device) evdev_tag_trackpoint(device, device->udev_device); device->dpi = evdev_read_dpi_prop(device); - if (libevdev_has_event_code(evdev, EV_REL, REL_X) && - libevdev_has_event_code(evdev, EV_REL, REL_Y) && - evdev_init_accel(device, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE) == -1) - return -1; - device->seat_caps |= EVDEV_DEVICE_POINTER; log_info(libinput, @@ -2104,6 +2099,16 @@ evdev_configure_device(struct evdev_device *device) device->devname, devnode); } + if (device->seat_caps & EVDEV_DEVICE_POINTER && + libevdev_has_event_code(evdev, EV_REL, REL_X) && + libevdev_has_event_code(evdev, EV_REL, REL_Y) && + evdev_init_accel(device, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE) == -1) { + log_error(libinput, + "failed to initialize pointer acceleration for %s\n", + device->devname); + return -1; + } + return 0; } diff --git a/test/Makefile.am b/test/Makefile.am index cde93b36..ff1acdad 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -15,6 +15,7 @@ liblitest_la_SOURCES = \ litest-int.h \ litest-device-alps-semi-mt.c \ litest-device-alps-dualpoint.c \ + litest-device-asus-rog-gladius.c \ litest-device-atmel-hover.c \ litest-device-bcm5974.c \ litest-device-elantech-touchpad.c \ diff --git a/test/litest-device-asus-rog-gladius.c b/test/litest-device-asus-rog-gladius.c new file mode 100644 index 00000000..a44396f7 --- /dev/null +++ b/test/litest-device-asus-rog-gladius.c @@ -0,0 +1,334 @@ +/* + * Copyright © 2015 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include "litest.h" +#include "litest-int.h" + +/* Note: this is the second event node of this mouse only, the first event + * node is just a normal mouse */ + +static void litest_mouse_gladius_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_MOUSE_GLADIUS); + litest_set_current_device(d); +} + +static struct input_id input_id = { + .bustype = 0x3, + .vendor = 0x0b05, + .product = 0x181a, +}; + +static int events[] = { + EV_REL, REL_X, + EV_REL, REL_Y, + EV_REL, REL_HWHEEL, + EV_KEY, KEY_ESC, + EV_KEY, KEY_1, + EV_KEY, KEY_2, + EV_KEY, KEY_3, + EV_KEY, KEY_4, + EV_KEY, KEY_5, + EV_KEY, KEY_6, + EV_KEY, KEY_7, + EV_KEY, KEY_8, + EV_KEY, KEY_9, + EV_KEY, KEY_0, + EV_KEY, KEY_MINUS, + EV_KEY, KEY_EQUAL, + EV_KEY, KEY_BACKSPACE, + EV_KEY, KEY_TAB, + EV_KEY, KEY_Q, + EV_KEY, KEY_W, + EV_KEY, KEY_E, + EV_KEY, KEY_R, + EV_KEY, KEY_T, + EV_KEY, KEY_Y, + EV_KEY, KEY_U, + EV_KEY, KEY_I, + EV_KEY, KEY_O, + EV_KEY, KEY_P, + EV_KEY, KEY_LEFTBRACE, + EV_KEY, KEY_RIGHTBRACE, + EV_KEY, KEY_ENTER, + EV_KEY, KEY_LEFTCTRL, + EV_KEY, KEY_A, + EV_KEY, KEY_S, + EV_KEY, KEY_D, + EV_KEY, KEY_F, + EV_KEY, KEY_G, + EV_KEY, KEY_H, + EV_KEY, KEY_J, + EV_KEY, KEY_K, + EV_KEY, KEY_L, + EV_KEY, KEY_SEMICOLON, + EV_KEY, KEY_APOSTROPHE, + EV_KEY, KEY_GRAVE, + EV_KEY, KEY_LEFTSHIFT, + EV_KEY, KEY_BACKSLASH, + EV_KEY, KEY_Z, + EV_KEY, KEY_X, + EV_KEY, KEY_C, + EV_KEY, KEY_V, + EV_KEY, KEY_B, + EV_KEY, KEY_N, + EV_KEY, KEY_M, + EV_KEY, KEY_COMMA, + EV_KEY, KEY_DOT, + EV_KEY, KEY_SLASH, + EV_KEY, KEY_RIGHTSHIFT, + EV_KEY, KEY_KPASTERISK, + EV_KEY, KEY_LEFTALT, + EV_KEY, KEY_SPACE, + EV_KEY, KEY_CAPSLOCK, + EV_KEY, KEY_F1, + EV_KEY, KEY_F2, + EV_KEY, KEY_F3, + EV_KEY, KEY_F4, + EV_KEY, KEY_F5, + EV_KEY, KEY_F6, + EV_KEY, KEY_F7, + EV_KEY, KEY_F8, + EV_KEY, KEY_F9, + EV_KEY, KEY_F10, + EV_KEY, KEY_NUMLOCK, + EV_KEY, KEY_SCROLLLOCK, + EV_KEY, KEY_KP7, + EV_KEY, KEY_KP8, + EV_KEY, KEY_KP9, + EV_KEY, KEY_KPMINUS, + EV_KEY, KEY_KP4, + EV_KEY, KEY_KP5, + EV_KEY, KEY_KP6, + EV_KEY, KEY_KPPLUS, + EV_KEY, KEY_KP1, + EV_KEY, KEY_KP2, + EV_KEY, KEY_KP3, + EV_KEY, KEY_KP0, + EV_KEY, KEY_KPDOT, + EV_KEY, KEY_ZENKAKUHANKAKU, + EV_KEY, KEY_102ND, + EV_KEY, KEY_F11, + EV_KEY, KEY_F12, + EV_KEY, KEY_RO, + EV_KEY, KEY_KATAKANA, + EV_KEY, KEY_HIRAGANA, + EV_KEY, KEY_HENKAN, + EV_KEY, KEY_KATAKANAHIRAGANA, + EV_KEY, KEY_MUHENKAN, + EV_KEY, KEY_KPJPCOMMA, + EV_KEY, KEY_KPENTER, + EV_KEY, KEY_RIGHTCTRL, + EV_KEY, KEY_KPSLASH, + EV_KEY, KEY_SYSRQ, + EV_KEY, KEY_RIGHTALT, + EV_KEY, KEY_HOME, + EV_KEY, KEY_UP, + EV_KEY, KEY_PAGEUP, + EV_KEY, KEY_LEFT, + EV_KEY, KEY_RIGHT, + EV_KEY, KEY_END, + EV_KEY, KEY_DOWN, + EV_KEY, KEY_PAGEDOWN, + EV_KEY, KEY_INSERT, + EV_KEY, KEY_DELETE, + EV_KEY, KEY_MUTE, + EV_KEY, KEY_VOLUMEDOWN, + EV_KEY, KEY_VOLUMEUP, + EV_KEY, KEY_POWER, + EV_KEY, KEY_KPEQUAL, + EV_KEY, KEY_PAUSE, + EV_KEY, KEY_KPCOMMA, + EV_KEY, KEY_HANGEUL, + EV_KEY, KEY_HANJA, + EV_KEY, KEY_YEN, + EV_KEY, KEY_LEFTMETA, + EV_KEY, KEY_RIGHTMETA, + EV_KEY, KEY_COMPOSE, + EV_KEY, KEY_STOP, + EV_KEY, KEY_AGAIN, + EV_KEY, KEY_PROPS, + EV_KEY, KEY_UNDO, + EV_KEY, KEY_FRONT, + EV_KEY, KEY_COPY, + EV_KEY, KEY_OPEN, + EV_KEY, KEY_PASTE, + EV_KEY, KEY_FIND, + EV_KEY, KEY_CUT, + EV_KEY, KEY_HELP, + EV_KEY, KEY_MENU, + EV_KEY, KEY_CALC, + EV_KEY, KEY_SLEEP, + EV_KEY, KEY_FILE, + EV_KEY, KEY_WWW, + EV_KEY, KEY_COFFEE, + EV_KEY, KEY_MAIL, + EV_KEY, KEY_BOOKMARKS, + EV_KEY, KEY_BACK, + EV_KEY, KEY_FORWARD, + EV_KEY, KEY_EJECTCD, + EV_KEY, KEY_NEXTSONG, + EV_KEY, KEY_PLAYPAUSE, + EV_KEY, KEY_PREVIOUSSONG, + EV_KEY, KEY_STOPCD, + EV_KEY, KEY_RECORD, + EV_KEY, KEY_REWIND, + EV_KEY, KEY_PHONE, + EV_KEY, KEY_CONFIG, + EV_KEY, KEY_HOMEPAGE, + EV_KEY, KEY_REFRESH, + EV_KEY, KEY_EXIT, + EV_KEY, KEY_EDIT, + EV_KEY, KEY_SCROLLUP, + EV_KEY, KEY_SCROLLDOWN, + EV_KEY, KEY_KPLEFTPAREN, + EV_KEY, KEY_KPRIGHTPAREN, + EV_KEY, KEY_NEW, + EV_KEY, KEY_REDO, + EV_KEY, KEY_F13, + EV_KEY, KEY_F14, + EV_KEY, KEY_F15, + EV_KEY, KEY_F16, + EV_KEY, KEY_F17, + EV_KEY, KEY_F18, + EV_KEY, KEY_F19, + EV_KEY, KEY_F20, + EV_KEY, KEY_F21, + EV_KEY, KEY_F22, + EV_KEY, KEY_F23, + EV_KEY, KEY_F24, + EV_KEY, KEY_CLOSE, + EV_KEY, KEY_PLAY, + EV_KEY, KEY_FASTFORWARD, + EV_KEY, KEY_BASSBOOST, + EV_KEY, KEY_PRINT, + EV_KEY, KEY_CAMERA, + EV_KEY, KEY_CHAT, + EV_KEY, KEY_SEARCH, + EV_KEY, KEY_FINANCE, + EV_KEY, KEY_CANCEL, + EV_KEY, KEY_BRIGHTNESSDOWN, + EV_KEY, KEY_BRIGHTNESSUP, + EV_KEY, KEY_KBDILLUMTOGGLE, + EV_KEY, KEY_SEND, + EV_KEY, KEY_REPLY, + EV_KEY, KEY_FORWARDMAIL, + EV_KEY, KEY_SAVE, + EV_KEY, KEY_DOCUMENTS, + EV_KEY, KEY_UNKNOWN, + EV_KEY, KEY_VIDEO_NEXT, + EV_KEY, KEY_BRIGHTNESS_AUTO, + EV_KEY, BTN_0, + EV_KEY, KEY_SELECT, + EV_KEY, KEY_GOTO, + EV_KEY, KEY_INFO, + EV_KEY, KEY_PROGRAM, + EV_KEY, KEY_PVR, + EV_KEY, KEY_SUBTITLE, + EV_KEY, KEY_ZOOM, + EV_KEY, KEY_KEYBOARD, + EV_KEY, KEY_PC, + EV_KEY, KEY_TV, + EV_KEY, KEY_TV2, + EV_KEY, KEY_VCR, + EV_KEY, KEY_VCR2, + EV_KEY, KEY_SAT, + EV_KEY, KEY_CD, + EV_KEY, KEY_TAPE, + EV_KEY, KEY_TUNER, + EV_KEY, KEY_PLAYER, + EV_KEY, KEY_DVD, + EV_KEY, KEY_AUDIO, + EV_KEY, KEY_VIDEO, + EV_KEY, KEY_MEMO, + EV_KEY, KEY_CALENDAR, + EV_KEY, KEY_RED, + EV_KEY, KEY_GREEN, + EV_KEY, KEY_YELLOW, + EV_KEY, KEY_BLUE, + EV_KEY, KEY_CHANNELUP, + EV_KEY, KEY_CHANNELDOWN, + EV_KEY, KEY_LAST, + EV_KEY, KEY_NEXT, + EV_KEY, KEY_RESTART, + EV_KEY, KEY_SLOW, + EV_KEY, KEY_SHUFFLE, + EV_KEY, KEY_PREVIOUS, + EV_KEY, KEY_VIDEOPHONE, + EV_KEY, KEY_GAMES, + EV_KEY, KEY_ZOOMIN, + EV_KEY, KEY_ZOOMOUT, + EV_KEY, KEY_ZOOMRESET, + EV_KEY, KEY_WORDPROCESSOR, + EV_KEY, KEY_EDITOR, + EV_KEY, KEY_SPREADSHEET, + EV_KEY, KEY_GRAPHICSEDITOR, + EV_KEY, KEY_PRESENTATION, + EV_KEY, KEY_DATABASE, + EV_KEY, KEY_NEWS, + EV_KEY, KEY_VOICEMAIL, + EV_KEY, KEY_ADDRESSBOOK, + EV_KEY, KEY_MESSENGER, + EV_KEY, KEY_DISPLAYTOGGLE, + EV_KEY, KEY_SPELLCHECK, + EV_KEY, KEY_LOGOFF, + EV_KEY, KEY_MEDIA_REPEAT, + EV_KEY, KEY_IMAGES, + EV_KEY, KEY_BUTTONCONFIG, + EV_KEY, KEY_TASKMANAGER, + EV_KEY, KEY_JOURNAL, + EV_KEY, KEY_CONTROLPANEL, + EV_KEY, KEY_APPSELECT, + EV_KEY, KEY_SCREENSAVER, + EV_KEY, KEY_VOICECOMMAND, + EV_KEY, KEY_BRIGHTNESS_MIN, + EV_KEY, KEY_BRIGHTNESS_MAX, + EV_LED, LED_NUML, + EV_LED, LED_CAPSL, + EV_LED, LED_SCROLLL, + EV_LED, LED_COMPOSE, + EV_LED, LED_KANA, + -1 , -1, +}; + +static struct input_absinfo absinfo[] = { + { ABS_VOLUME, 0, 668, 0, 0, 0 }, + { .value = -1 } +}; + +struct litest_test_device litest_mouse_gladius_device = { + .type = LITEST_MOUSE_GLADIUS, + .features = LITEST_RELATIVE | LITEST_WHEEL | LITEST_KEYS, + .shortname = "mouse_gladius", + .setup = litest_mouse_gladius_setup, + .interface = NULL, + + .name = "ASUS ROG GLADIUS", + .id = &input_id, + .absinfo = absinfo, + .events = events, +}; diff --git a/test/litest.c b/test/litest.c index bfa28f44..c7cb2746 100644 --- a/test/litest.c +++ b/test/litest.c @@ -365,6 +365,7 @@ extern struct litest_test_device litest_generic_multitouch_screen_device; extern struct litest_test_device litest_nexus4_device; extern struct litest_test_device litest_magicpad_device; extern struct litest_test_device litest_elantech_touchpad_device; +extern struct litest_test_device litest_mouse_gladius_device; struct litest_test_device* devices[] = { &litest_synaptics_clickpad_device, @@ -396,6 +397,7 @@ struct litest_test_device* devices[] = { &litest_nexus4_device, &litest_magicpad_device, &litest_elantech_touchpad_device, + &litest_mouse_gladius_device, NULL, }; diff --git a/test/litest.h b/test/litest.h index 8a4b33d1..058057e2 100644 --- a/test/litest.h +++ b/test/litest.h @@ -142,6 +142,7 @@ enum litest_device_type { LITEST_NEXUS4_TOUCH_SCREEN = -28, LITEST_MAGIC_TRACKPAD = -29, LITEST_ELANTECH_TOUCHPAD = -30, + LITEST_MOUSE_GLADIUS = -31, }; enum litest_device_feature { From 9949d4ee0859ef8361afc00363a941ff3d133d88 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 2 Nov 2015 08:46:25 +1000 Subject: [PATCH 06/12] Fix libinput_device_group_find_group() to return NULL on failure struct list isn't a null-terminated list, list_for_each() causes 'g' to be set to the list head at the end of the loop. Returning that as group caused random memory to be overwritten. Signed-off-by: Peter Hutterer --- src/libinput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libinput.c b/src/libinput.c index f5c75b08..24f2b693 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -2011,7 +2011,7 @@ libinput_device_group_find_group(struct libinput *libinput, } } - return g; + return NULL; } void From e68598855a93e2ff71c11a3088d5f5a097de70dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Lepp=C3=A4nen?= Date: Thu, 17 Sep 2015 15:05:25 +0300 Subject: [PATCH 07/12] Documentation fixes to arrows in svg files There were two files (doc/svg/{edge,twofinger}-scrolling.svg) that had both arrow heads pointing to wrong direction. Those arrow heads used markers but their ids were defined wrong and therefore they displayed weirdly. On Firefox the arrow head that should have pointed to left pointed actually to right. This commit fixes that problem by defining the marker ids correctly. I tested on Firefox 40.0.3 that the arrow heads are now displayed correctly. Reviewed-by: Bryce Harrington Tested-by: Bryce Harrington Signed-off-by: Peter Hutterer --- doc/svg/edge-scrolling.svg | 2 +- doc/svg/twofinger-scrolling.svg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/svg/edge-scrolling.svg b/doc/svg/edge-scrolling.svg index cba72c50..c768e805 100644 --- a/doc/svg/edge-scrolling.svg +++ b/doc/svg/edge-scrolling.svg @@ -105,7 +105,7 @@ + style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow1Lstart-4);marker-end:url(#Arrow1Lend-2)" /> diff --git a/doc/svg/twofinger-scrolling.svg b/doc/svg/twofinger-scrolling.svg index e182a7fe..7830c254 100644 --- a/doc/svg/twofinger-scrolling.svg +++ b/doc/svg/twofinger-scrolling.svg @@ -127,7 +127,7 @@ + style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow1Lstart-4);marker-end:url(#Arrow1Lend-2)" /> From c9149562113ee3121862995511adf6c122f130f5 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 9 Nov 2015 10:18:17 +1000 Subject: [PATCH 08/12] test: add a device to check MOUSE_WHEEL_CLICK_ANGLE handling Signed-off-by: Peter Hutterer --- test/Makefile.am | 1 + test/litest-device-mouse-wheel-click-angle.c | 74 ++++++++++++++++++++ test/litest.c | 2 + test/litest.h | 1 + test/pointer.c | 34 +++++++-- 5 files changed, 107 insertions(+), 5 deletions(-) create mode 100644 test/litest-device-mouse-wheel-click-angle.c diff --git a/test/Makefile.am b/test/Makefile.am index ff1acdad..e4ed8e5d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -28,6 +28,7 @@ liblitest_la_SOURCES = \ litest-device-mouse.c \ litest-device-mouse-roccat.c \ litest-device-mouse-low-dpi.c \ + litest-device-mouse-wheel-click-angle.c \ litest-device-ms-surface-cover.c \ litest-device-protocol-a-touch-screen.c \ litest-device-qemu-usb-tablet.c \ diff --git a/test/litest-device-mouse-wheel-click-angle.c b/test/litest-device-mouse-wheel-click-angle.c new file mode 100644 index 00000000..1460ee31 --- /dev/null +++ b/test/litest-device-mouse-wheel-click-angle.c @@ -0,0 +1,74 @@ +/* + * Copyright © 2015 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include "litest.h" +#include "litest-int.h" + +static void litest_mouse_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_MOUSE_WHEEL_CLICK_ANGLE); + litest_set_current_device(d); +} + +static struct input_id input_id = { + .bustype = 0x3, + .vendor = 0x1234, + .product = 0x5678, +}; + +static int events[] = { + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_KEY, BTN_MIDDLE, + EV_REL, REL_X, + EV_REL, REL_Y, + EV_REL, REL_WHEEL, + -1 , -1, +}; + +static const char udev_rule[] = +"ACTION==\"remove\", GOTO=\"wheel_click_angle_end\"\n" +"KERNEL!=\"event*\", GOTO=\"wheel_click_angle_end\"\n" +"\n" +"ATTRS{name}==\"litest Wheel Click Angle Mouse*\",\\\n" +" ENV{MOUSE_WHEEL_CLICK_ANGLE}=\"-7\"\n" +"\n" +"LABEL=\"wheel_click_angle_end\""; + +struct litest_test_device litest_mouse_wheel_click_angle_device = { + .type = LITEST_MOUSE_WHEEL_CLICK_ANGLE, + .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL, + .shortname = "mouse-wheelclickangle", + .setup = litest_mouse_setup, + .interface = NULL, + + .name = "Wheel Click Angle Mouse", + .id = &input_id, + .absinfo = NULL, + .events = events, + .udev_rule = udev_rule, +}; diff --git a/test/litest.c b/test/litest.c index c7cb2746..65be6b5a 100644 --- a/test/litest.c +++ b/test/litest.c @@ -366,6 +366,7 @@ extern struct litest_test_device litest_nexus4_device; extern struct litest_test_device litest_magicpad_device; extern struct litest_test_device litest_elantech_touchpad_device; extern struct litest_test_device litest_mouse_gladius_device; +extern struct litest_test_device litest_mouse_wheel_click_angle_device; struct litest_test_device* devices[] = { &litest_synaptics_clickpad_device, @@ -398,6 +399,7 @@ struct litest_test_device* devices[] = { &litest_magicpad_device, &litest_elantech_touchpad_device, &litest_mouse_gladius_device, + &litest_mouse_wheel_click_angle_device, NULL, }; diff --git a/test/litest.h b/test/litest.h index 058057e2..ed23c8a2 100644 --- a/test/litest.h +++ b/test/litest.h @@ -143,6 +143,7 @@ enum litest_device_type { LITEST_MAGIC_TRACKPAD = -29, LITEST_ELANTECH_TOUCHPAD = -30, LITEST_MOUSE_GLADIUS = -31, + LITEST_MOUSE_WHEEL_CLICK_ANGLE = -32, }; enum litest_device_feature { diff --git a/test/pointer.c b/test/pointer.c index e12034a0..ba158158 100644 --- a/test/pointer.c +++ b/test/pointer.c @@ -473,6 +473,30 @@ START_TEST(pointer_button_auto_release) } END_TEST +static inline int +wheel_click_angle(struct litest_device *dev) +{ + struct udev_device *d; + const char *prop; + const int default_angle = 15; + int angle = default_angle; + + d = libinput_device_get_udev_device(dev->libinput_device); + litest_assert_ptr_notnull(d); + + prop = udev_device_get_property_value(d, "MOUSE_WHEEL_CLICK_ANGLE"); + if (!prop) + goto out; + + angle = parse_mouse_wheel_click_angle_property(prop); + if (angle == 0) + angle = default_angle; + +out: + udev_device_unref(d); + return angle; +} + static void test_wheel_event(struct litest_device *dev, int which, int amount) { @@ -481,11 +505,11 @@ test_wheel_event(struct litest_device *dev, int which, int amount) struct libinput_event_pointer *ptrev; enum libinput_pointer_axis axis; - /* the current evdev implementation scales the scroll wheel events - up by a factor 15 */ - const int scroll_step = 15; - int expected = amount * scroll_step; - int discrete = amount; + int scroll_step, expected, discrete;; + + scroll_step = wheel_click_angle(dev); + expected = amount * scroll_step; + discrete = amount; if (libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device)) { expected *= -1; From acfff361a7d0b7b86ccd68caede78187c1b8d474 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 9 Nov 2015 15:42:06 +1000 Subject: [PATCH 09/12] tools: take the start time before initializing the context Otherwise events that are already queued before the first libinput_dispatch() have a negative timestamp. Signed-off-by: Peter Hutterer --- tools/event-debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/event-debug.c b/tools/event-debug.c index 1ac00864..c6032962 100644 --- a/tools/event-debug.c +++ b/tools/event-debug.c @@ -471,6 +471,9 @@ main(int argc, char **argv) struct libinput *li; struct timespec tp; + clock_gettime(CLOCK_MONOTONIC, &tp); + start_time = tp.tv_sec * 1000 + tp.tv_nsec / 1000000; + tools_init_context(&context); if (tools_parse_args(argc, argv, &context)) @@ -480,9 +483,6 @@ main(int argc, char **argv) if (!li) return 1; - clock_gettime(CLOCK_MONOTONIC, &tp); - start_time = tp.tv_sec * 1000 + tp.tv_nsec / 1000000; - mainloop(li); libinput_unref(li); From 334c3faa7b20d510f36faed4aa12ba2f8c7b078c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 16 Nov 2015 07:44:12 +1000 Subject: [PATCH 10/12] doc: add a link to the dwt config call to the doc And link the software buttons sentence to the t440 page. Signed-off-by: Peter Hutterer --- doc/palm-detection.dox | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/palm-detection.dox b/doc/palm-detection.dox index d30a2070..73c81b2c 100644 --- a/doc/palm-detection.dox +++ b/doc/palm-detection.dox @@ -78,7 +78,10 @@ Notable behaviors of libinput's disable-while-typing feature: has stopped, it is thus possible to rest the palm on the touchpad while typing. - Physical buttons work even while the touchpad is disabled. This includes - software-emulated buttons. + @ref t440_support "software-emulated buttons". + +Disable-while-typing can be enabled and disabled by calling +libinput_device_config_dwt_set_enabled(). @section thumb-detection Thumb detection From 12e9a940b3ead32a6489170c1f234e66eb781147 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 16 Nov 2015 08:36:23 +1000 Subject: [PATCH 11/12] configure.ac: libinput 1.1.1 Signed-off-by: Peter Hutterer --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 0703dd87..c841a5fa 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ([2.64]) m4_define([libinput_major_version], [1]) m4_define([libinput_minor_version], [1]) -m4_define([libinput_micro_version], [0]) +m4_define([libinput_micro_version], [1]) m4_define([libinput_version], [libinput_major_version.libinput_minor_version.libinput_micro_version]) @@ -31,7 +31,7 @@ AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz]) # b) If interfaces have been changed or added, but binary compatibility has # been preserved, change to C+1:0:A+1 # c) If the interface is the same as the previous version, change to C:R+1:A -LIBINPUT_LT_VERSION=16:0:6 +LIBINPUT_LT_VERSION=16:1:6 AC_SUBST(LIBINPUT_LT_VERSION) AM_SILENT_RULES([yes]) From 09a296708aa291e0dd5ada2db14f288a3095b61e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 9 Nov 2015 16:21:36 +1000 Subject: [PATCH 12/12] touchpad: reduced the 2fg scroll threshold to 1mm At least on the t440, this is enough to trigger correct detection between pinch and scroll 90% of the time. Since scrolling is significantly more prevalent than gesturing, erring on the side of scrolling at the cost of misdetecting some gestures is acceptable. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-mt-touchpad-gestures.c | 2 +- test/gestures.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index cc26e2a9..80aa89ff 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -195,7 +195,7 @@ tp_gesture_get_direction(struct tp_dispatch *tp, struct tp_touch *touch) (tp->device->model_flags & EVDEV_MODEL_ELANTECH_TOUCHPAD) == 0) move_threshold = TP_MM_TO_DPI_NORMALIZED(4); else - move_threshold = TP_MM_TO_DPI_NORMALIZED(2); + move_threshold = TP_MM_TO_DPI_NORMALIZED(1); delta = device_delta(touch->point, touch->gesture.initial); diff --git a/test/gestures.c b/test/gestures.c index 9e447248..9fc73b97 100644 --- a/test/gestures.c +++ b/test/gestures.c @@ -294,13 +294,13 @@ START_TEST(gestures_spread) for (i = 0; i < 15; i++) { litest_push_event_frame(dev); if (dir_x > 0.0) - dir_x += 2; + dir_x += 1; else if (dir_x < 0.0) - dir_x -= 2; + dir_x -= 1; if (dir_y > 0.0) - dir_y += 2; + dir_y += 1; else if (dir_y < 0.0) - dir_y -= 2; + dir_y -= 1; litest_touch_move(dev, 0, 50 + dir_x,