configure.ac | 4 debian/changelog | 14 debian/patches/series | 1 debian/patches/touchpad-add-a-middle-button-software-area.diff | 302 ++++++++++ doc/t440-support.dox | 2 doc/tablet-support.dox | 3 src/evdev-mt-touchpad-buttons.c | 23 src/evdev-mt-touchpad-gestures.c | 3 src/evdev-mt-touchpad.c | 5 src/evdev-tablet.c | 4 src/evdev.c | 2 src/filter.c | 2 src/libinput.c | 2 src/libinput.h | 12 test/tablet.c | 10 test/trackpoint.c | 132 ++++ 16 files changed, 492 insertions(+), 29 deletions(-)
New commits: commit 6aef4eeecb3ed23fd4f0513546afaa0055cd6b67 Author: Timo Aaltonen <tjaal...@debian.org> Date: Thu Apr 14 13:18:13 2016 +0300 release to xenial diff --git a/debian/changelog b/debian/changelog index 56bf389..ed5d3d9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -libinput (1.2.3-1ubuntu1) UNRELEASED; urgency=medium +libinput (1.2.3-1ubuntu1) xenial; urgency=medium * Merge from debian. * touchpad-add-a-middle-button-software-area.diff: Add a software area for middle-button emulation. (LP: #1570282) - -- Timo Aaltonen <tjaal...@debian.org> Thu, 14 Apr 2016 12:28:32 +0300 + -- Timo Aaltonen <tjaal...@debian.org> Thu, 14 Apr 2016 13:17:43 +0300 libinput (1.2.3-1) unstable; urgency=medium commit 2641c775d55fe591bcbcbe568c03b2016ecbe0e6 Author: Timo Aaltonen <tjaal...@debian.org> Date: Thu Apr 14 13:17:40 2016 +0300 add middle-button area diff --git a/debian/changelog b/debian/changelog index 0dcc1d6..56bf389 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +libinput (1.2.3-1ubuntu1) UNRELEASED; urgency=medium + + * Merge from debian. + * touchpad-add-a-middle-button-software-area.diff: Add a software area + for middle-button emulation. (LP: #1570282) + + -- Timo Aaltonen <tjaal...@debian.org> Thu, 14 Apr 2016 12:28:32 +0300 + libinput (1.2.3-1) unstable; urgency=medium * New upstream release. diff --git a/debian/patches/series b/debian/patches/series index 63b23e6..1b21a7f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ touch-point-orientation-size.patch fix-premature-flushing-of-evdev-event-on-mx4.patch +touchpad-add-a-middle-button-software-area.diff diff --git a/debian/patches/touchpad-add-a-middle-button-software-area.diff b/debian/patches/touchpad-add-a-middle-button-software-area.diff new file mode 100644 index 0000000..441148a --- /dev/null +++ b/debian/patches/touchpad-add-a-middle-button-software-area.diff @@ -0,0 +1,302 @@ +commit 886b5a2cd8c785e48ddf5ceb4a902cd1f518d2a9 +Author: Peter Hutterer <peter.hutte...@who-t.net> +Date: Mon Apr 4 10:06:36 2016 +1000 + + touchpad: add a middle button software area + + Middle button interaction is most commonly to paste and it is a single-event + interaction (button press). We provided middle button in software button mode + by emulating it with a two-finger press with L+R down at the same time. This + is also what many touchpads are spectacularly bad at, it is very common to + detect the physical button down event before the second finger registers, + resulting in left or right clicks where a middle button should be triggered. + + Unless the fingers are resting on the touchpad for at least one scanout, the + success rate for middle button emulation is only at 70% or so. + + This patch adds a 25%-width middle button area between the left and the right + software button, everything else stays the same. To avoid immediate breakage, + the middle button emulation remains but may be removed in the future. + The doc is updated to only refer to the middle button area now. + + https://bugs.freedesktop.org/show_bug.cgi?id=94755 + + Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> + Reviewed-by: Hans de Goede <hdego...@redhat.com> + +diff --git a/doc/clickpad-softbuttons.dox b/doc/clickpad-softbuttons.dox +index a4f2e44..cf4c8c9 100644 +--- a/doc/clickpad-softbuttons.dox ++++ b/doc/clickpad-softbuttons.dox +@@ -20,16 +20,20 @@ generated by libinput and passed to the caller in response to a click. + @section software_buttons Software button areas + + On most clickpads, this is the default behavior. The bottom of the touchpad +-is split in the middle to generate left or right button events on click. The +-height of the button area depends on the hardware but is usually around +-10mm. ++is split into three distinct areas generate left, middle or right button ++events on click. The height of the button area depends on the hardware but ++is usually around 10mm. + + Left, right and middle button events can be triggered as follows: + - if a finger is in the main area or the left button area, a click generates + left button events. + - if a finger is in the right area, a click generates right button events. +-- if there is a finger in both the left and right button area, a click +- generates middle button events. ++- if a finger is in the middle area, a click generates middle button events. ++ ++The middle button is always centered on the touchpad and smaller in size ++than the left or right button. The actual size is device-dependent though as ++many touchpads do not have visible markings for the middle button the exact ++location of the button is not visibly obvious. + + @image html software-buttons.svg "Left, right and middle-button click with software button areas" + +diff --git a/doc/svg/software-buttons.svg b/doc/svg/software-buttons.svg +index 903535c..c0bc610 100644 +--- a/doc/svg/software-buttons.svg ++++ b/doc/svg/software-buttons.svg +@@ -41,8 +41,8 @@ + id="namedview4312" + showgrid="false" + inkscape:zoom="0.57798581" +- inkscape:cx="1134.9723" +- inkscape:cy="-71.183873" ++ inkscape:cx="842.57758" ++ inkscape:cy="-74.644166" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" +@@ -106,7 +106,7 @@ + id="rect2858-7" + style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:5.19376326;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker:none;enable-background:accumulate" /> + <g +- transform="matrix(0.79657897,0.11742288,-0.14814182,0.631399,665.11943,-345.64117)" ++ transform="matrix(0.79657897,0.11742288,-0.14814182,0.631399,749.8966,-336.99044)" + id="g3663-9-8"> + <path + d="m 388.57143,893.79076 -57.14285,-130 c 0,0 -30.0247,-58.84827 4.28571,-70.00001 27.07438,-8.79984 37.32196,9.59496 40,14.64286 27.54455,51.91936 84.64285,173.21429 84.64285,173.21429 l -0.71428,0 -71.07143,12.14286 z" +@@ -125,30 +125,6 @@ + inkscape:connector-curvature="0" /> + </g> + <g +- id="g4656" +- transform="translate(-0.31997204,0.28487182)"> +- <g +- id="g4639"> +- <path +- inkscape:connector-curvature="0" +- style="fill:none;stroke:#000000;stroke-width:0.72135597px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" +- id="path2820-0-5" +- d="m 970.15914,263.93369 32.58666,-97.47985 c 0,0 12.2603,-46.32869 38.5506,-33.925 20.7457,9.78778 17.4301,24.72594 16.4399,28.75425 -10.1846,41.43257 -30.105,105.84033 -30.105,105.84033 l -0.428,-0.37827 z" +- sodipodi:nodetypes="ccssccc" /> +- <path +- inkscape:connector-curvature="0" +- style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffccaa;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.00144271;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker:none;enable-background:accumulate" +- id="path2824-9-3" +- d="m 987.16367,214.84092 c 8.97014,-26.84686 16.75933,-50.19953 17.30923,-51.89481 3.8651,-11.91483 10.3862,-22.76212 16.5622,-27.54951 6.8496,-5.30946 13.8243,-5.75615 21.9108,-1.40323 3.7999,2.04543 6.0302,3.61208 8.2265,5.77836 2.5214,2.487 3.6881,4.17002 5.1008,7.35828 1.3655,3.08181 1.9391,7.11725 1.5051,10.58923 -0.597,4.77663 -10.2821,40.41668 -20.9931,77.25236 -7.7256,26.56907 -9.371,31.11182 -9.5644,31.10964 -0.1479,-0.002 -55.70067,-1.83937 -56.08626,-2.18017 -0.16723,-0.1478 6.29681,-19.93218 16.02913,-49.06015 z" +- sodipodi:nodetypes="scsssscsccs" /> +- <path +- inkscape:connector-curvature="0" +- style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.92000002;fill:#ffe6d5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.2;marker:none;enable-background:accumulate" +- id="path2824-7-8-8" +- d="m 1008.3595,164.57667 c 3.8651,-11.91483 7.6606,-19.35039 13.8366,-24.13778 6.8495,-5.30946 12.0833,-5.57765 20.1698,-1.22474 9.3061,4.73331 12.9905,9.62271 11.9094,19.03362 -6.3459,19.3209 -6.9054,22.12042 -9.2168,26.32727 -0.1479,-0.002 -33.6651,-14.70742 -35.0296,-15.23839 -1.4035,-0.54616 -1.8884,-3.70289 -1.6694,-4.75998 z" /> +- </g> +- </g> +- <g + transform="translate(-386.56163,2.2570367)" + id="g4656-3"> + <g +diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c +index 076eab0..a9b7521 100644 +--- a/src/evdev-mt-touchpad-buttons.c ++++ b/src/evdev-mt-touchpad-buttons.c +@@ -64,6 +64,7 @@ static inline const char* + button_event_to_str(enum button_event event) { + switch(event) { + CASE_RETURN_STRING(BUTTON_EVENT_IN_BOTTOM_R); ++ CASE_RETURN_STRING(BUTTON_EVENT_IN_BOTTOM_M); + CASE_RETURN_STRING(BUTTON_EVENT_IN_BOTTOM_L); + CASE_RETURN_STRING(BUTTON_EVENT_IN_TOP_R); + CASE_RETURN_STRING(BUTTON_EVENT_IN_TOP_M); +@@ -93,10 +94,20 @@ is_inside_bottom_right_area(const struct tp_dispatch *tp, + } + + static inline bool ++is_inside_bottom_middle_area(const struct tp_dispatch *tp, ++ const struct tp_touch *t) ++{ ++ return is_inside_bottom_button_area(tp, t) && ++ !is_inside_bottom_right_area(tp, t) && ++ t->point.x > tp->buttons.bottom_area.middlebutton_left_edge; ++} ++ ++static inline bool + is_inside_bottom_left_area(const struct tp_dispatch *tp, + const struct tp_touch *t) + { + return is_inside_bottom_button_area(tp, t) && ++ !is_inside_bottom_middle_area(tp, t) && + !is_inside_bottom_right_area(tp, t); + } + +@@ -192,6 +203,7 @@ tp_button_none_handle_event(struct tp_dispatch *tp, + { + switch (event) { + case BUTTON_EVENT_IN_BOTTOM_R: ++ case BUTTON_EVENT_IN_BOTTOM_M: + case BUTTON_EVENT_IN_BOTTOM_L: + tp_button_set_state(tp, t, BUTTON_STATE_BOTTOM, event); + break; +@@ -220,6 +232,7 @@ tp_button_area_handle_event(struct tp_dispatch *tp, + { + switch (event) { + case BUTTON_EVENT_IN_BOTTOM_R: ++ case BUTTON_EVENT_IN_BOTTOM_M: + case BUTTON_EVENT_IN_BOTTOM_L: + case BUTTON_EVENT_IN_TOP_R: + case BUTTON_EVENT_IN_TOP_M: +@@ -243,6 +256,7 @@ tp_button_bottom_handle_event(struct tp_dispatch *tp, + { + switch (event) { + case BUTTON_EVENT_IN_BOTTOM_R: ++ case BUTTON_EVENT_IN_BOTTOM_M: + case BUTTON_EVENT_IN_BOTTOM_L: + if (event != t->button.curr) + tp_button_set_state(tp, +@@ -273,6 +287,7 @@ tp_button_top_handle_event(struct tp_dispatch *tp, + { + switch (event) { + case BUTTON_EVENT_IN_BOTTOM_R: ++ case BUTTON_EVENT_IN_BOTTOM_M: + case BUTTON_EVENT_IN_BOTTOM_L: + tp_button_set_state(tp, t, BUTTON_STATE_TOP_TO_IGNORE, event); + break; +@@ -305,6 +320,7 @@ tp_button_top_new_handle_event(struct tp_dispatch *tp, + { + switch(event) { + case BUTTON_EVENT_IN_BOTTOM_R: ++ case BUTTON_EVENT_IN_BOTTOM_M: + case BUTTON_EVENT_IN_BOTTOM_L: + tp_button_set_state(tp, t, BUTTON_STATE_AREA, event); + break; +@@ -355,6 +371,7 @@ tp_button_top_to_ignore_handle_event(struct tp_dispatch *tp, + event); + break; + case BUTTON_EVENT_IN_BOTTOM_R: ++ case BUTTON_EVENT_IN_BOTTOM_M: + case BUTTON_EVENT_IN_BOTTOM_L: + case BUTTON_EVENT_IN_AREA: + break; +@@ -377,6 +394,7 @@ tp_button_ignore_handle_event(struct tp_dispatch *tp, + { + switch (event) { + case BUTTON_EVENT_IN_BOTTOM_R: ++ case BUTTON_EVENT_IN_BOTTOM_M: + case BUTTON_EVENT_IN_BOTTOM_L: + case BUTTON_EVENT_IN_TOP_R: + case BUTTON_EVENT_IN_TOP_M: +@@ -450,6 +468,8 @@ tp_button_handle_state(struct tp_dispatch *tp, uint64_t time) + + if (is_inside_bottom_right_area(tp, t)) + event = BUTTON_EVENT_IN_BOTTOM_R; ++ else if (is_inside_bottom_middle_area(tp, t)) ++ event = BUTTON_EVENT_IN_BOTTOM_M; + else if (is_inside_bottom_left_area(tp, t)) + event = BUTTON_EVENT_IN_BOTTOM_L; + else if (is_inside_top_right_area(tp, t)) +@@ -543,7 +563,14 @@ tp_init_softbuttons(struct tp_dispatch *tp, + } else { + tp->buttons.bottom_area.top_edge = height * .85 + yoffset; + } +- tp->buttons.bottom_area.rightbutton_left_edge = width/2 + xoffset; ++ ++ /* The middle button is 25% of the touchpad and centered. Many ++ * touchpads don't have markings for the middle button at all so we ++ * need to make it big enough to reliably hit it but not too big so ++ * it takes away all the space. ++ */ ++ tp->buttons.bottom_area.middlebutton_left_edge = width * 0.375 + xoffset; ++ tp->buttons.bottom_area.rightbutton_left_edge = width * 0.625 + xoffset; + } + + void +@@ -989,6 +1016,8 @@ tp_post_clickpadbutton_buttons(struct tp_dispatch *tp, uint64_t time) + break; + case BUTTON_EVENT_IN_TOP_M: + is_top = 1; ++ /* fallthrough */ ++ case BUTTON_EVENT_IN_BOTTOM_M: + area |= MIDDLE; + break; + case BUTTON_EVENT_IN_TOP_R: +diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h +index 1f05a03..7277726 100644 +--- a/src/evdev-mt-touchpad.h ++++ b/src/evdev-mt-touchpad.h +@@ -70,6 +70,7 @@ enum touch_palm_state { + + enum button_event { + BUTTON_EVENT_IN_BOTTOM_R = 30, ++ BUTTON_EVENT_IN_BOTTOM_M, + BUTTON_EVENT_IN_BOTTOM_L, + BUTTON_EVENT_IN_TOP_R, + BUTTON_EVENT_IN_TOP_M, +@@ -283,6 +284,7 @@ struct tp_dispatch { + struct { + int32_t top_edge; /* in device coordinates */ + int32_t rightbutton_left_edge; /* in device coordinates */ ++ int32_t middlebutton_left_edge; /* in device coordinates */ + } bottom_area; + + struct { +diff --git a/test/touchpad-buttons.c b/test/touchpad-buttons.c +index 064c29e..080c670 100644 +--- a/test/touchpad-buttons.c ++++ b/test/touchpad-buttons.c +@@ -987,6 +987,35 @@ START_TEST(clickpad_softbutton_left) + } + END_TEST + ++START_TEST(clickpad_softbutton_middle) ++{ ++ struct litest_device *dev = litest_current_device(); ++ struct libinput *li = dev->libinput; ++ ++ litest_drain_events(li); ++ ++ litest_touch_down(dev, 0, 50, 90); ++ litest_event(dev, EV_KEY, BTN_LEFT, 1); ++ litest_event(dev, EV_SYN, SYN_REPORT, 0); ++ ++ litest_assert_button_event(li, ++ BTN_MIDDLE, ++ LIBINPUT_BUTTON_STATE_PRESSED); ++ ++ litest_event(dev, EV_KEY, BTN_LEFT, 0); ++ litest_event(dev, EV_SYN, SYN_REPORT, 0); ++ litest_touch_up(dev, 0); ++ ++ litest_assert_button_event(li, ++ BTN_MIDDLE, ++ LIBINPUT_BUTTON_STATE_RELEASED); ++ ++ libinput_dispatch(li); ++ ++ litest_assert_empty_queue(li); ++} ++END_TEST ++ + START_TEST(clickpad_softbutton_right) + { + struct litest_device *dev = litest_current_device(); +@@ -1585,6 +1614,7 @@ litest_setup_tests(void) + 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_middle, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + litest_add("touchpad:softbutton", clickpad_softbutton_right, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + litest_add("touchpad:softbutton", clickpad_softbutton_left_tap_n_drag, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + litest_add("touchpad:softbutton", clickpad_softbutton_right_tap_n_drag, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); commit 19b55790b018b88876abbc829adbd5799b52e725 Author: Timo Aaltonen <tjaal...@debian.org> Date: Wed Apr 13 00:32:46 2016 +0300 release to unstable diff --git a/debian/changelog b/debian/changelog index f32c177..ac76aea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libinput (1.2.3-1) unstable; urgency=medium + + * New upstream release. + + -- Timo Aaltonen <tjaal...@debian.org> Tue, 12 Apr 2016 23:41:40 +0300 + libinput (1.2.2-1) unstable; urgency=medium * New upstream release. commit b3d41a8233c89eb1df4b1f9a0394da0f576467ae Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Apr 12 06:56:15 2016 +1000 configure.ac: libinput 1.2.3 Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/configure.ac b/configure.ac index 7d73183..876786c 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], [2]) -m4_define([libinput_micro_version], [2]) +m4_define([libinput_micro_version], [3]) 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=17:4:7 +LIBINPUT_LT_VERSION=17:5:7 AC_SUBST(LIBINPUT_LT_VERSION) AM_SILENT_RULES([yes]) commit ccc761d059c13cff1386a0fa7e356867fc55dd60 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Apr 11 07:18:07 2016 +1000 tablet: fix the airbrush slider range Supposed to be [-1, 1] but we only generated [0, 1] Reported-by: Carlos Garnacho <carl...@gnome.org> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> Tested-by: Carlos Garnacho <carl...@gnome.org> (cherry picked from commit 25a9f394fce25b093dce625128c2ddebed8020ec) diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 9a1ac52..84563a8 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -201,7 +201,7 @@ normalize_dist_slider(const struct input_absinfo *absinfo) double range = absinfo->maximum - absinfo->minimum; double value = (absinfo->value - absinfo->minimum) / range; - return value; + return value * 2 - 1; } static inline double diff --git a/test/tablet.c b/test/tablet.c index ad6ac45..3999c3d 100644 --- a/test/tablet.c +++ b/test/tablet.c @@ -2532,7 +2532,7 @@ START_TEST(airbrush_tool) } END_TEST -START_TEST(airbrush_wheel) +START_TEST(airbrush_slider) { struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; @@ -2541,6 +2541,7 @@ START_TEST(airbrush_wheel) const struct input_absinfo *abs; double val; double scale; + double expected; int v; if (!libevdev_has_event_code(dev->evdev, @@ -2574,7 +2575,10 @@ START_TEST(airbrush_wheel) ck_assert(libinput_event_tablet_tool_slider_has_changed(tev)); val = libinput_event_tablet_tool_get_slider_position(tev); - ck_assert_int_eq(val, (v - abs->minimum)/scale); + expected = ((v - abs->minimum)/scale) * 2 - 1; + ck_assert_double_eq(val, expected); + ck_assert_double_ge(val, -1.0); + ck_assert_double_le(val, 1.0); libinput_event_destroy(event); litest_assert_empty_queue(li); } @@ -3655,7 +3659,7 @@ litest_setup_tests(void) litest_add("tablet:mouse", mouse_rotation, LITEST_TABLET, LITEST_ANY); litest_add("tablet:mouse", mouse_wheel, LITEST_TABLET, LITEST_WHEEL); litest_add("tablet:airbrush", airbrush_tool, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:airbrush", airbrush_wheel, LITEST_TABLET, LITEST_ANY); + litest_add("tablet:airbrush", airbrush_slider, LITEST_TABLET, LITEST_ANY); litest_add("tablet:artpen", artpen_tool, LITEST_TABLET, LITEST_ANY); litest_add("tablet:artpen", artpen_rotation, LITEST_TABLET, LITEST_ANY); commit 364e0bb131b204252300f77909dbd6db92fdbc2a Author: Jonas Ådahl <jad...@gmail.com> Date: Fri Apr 8 15:51:27 2016 +0800 libinput: Actually return the default accel profile We just returned the current profile instead of the default one. Fix that. Signed-off-by: Jonas Ådahl <jad...@gmail.com> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> (cherry picked from commit ee6501d12f773d7b4a67a23463b91a3ce741b6a7) diff --git a/src/libinput.c b/src/libinput.c index 1480878..b6e660a 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -3105,7 +3105,7 @@ libinput_device_config_accel_get_default_profile(struct libinput_device *device) if (!libinput_device_config_accel_is_available(device)) return LIBINPUT_CONFIG_ACCEL_PROFILE_NONE; - return device->config.accel->get_profile(device); + return device->config.accel->get_default_profile(device); } LIBINPUT_EXPORT enum libinput_config_status commit 1845e549f412478e9e5a668124856d1f50b9bb1c Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Fri Apr 8 08:16:11 2016 +1000 doc: minor fixes Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> (cherry picked from commit f44de7cc4fe847be598e7025ec4cd81332b18575) diff --git a/doc/tablet-support.dox b/doc/tablet-support.dox index 0e719b7..35b9230 100644 --- a/doc/tablet-support.dox +++ b/doc/tablet-support.dox @@ -14,7 +14,8 @@ Most tablets provide two types of devices. The pysical tablet often provides a number of buttons and a touch ring or strip. Interaction on the drawing surface of the tablet requires a tool, usually in the shape of a stylus. The libinput interface exposed by devices with the @ref -LIBINPUT_DEVICE_CAP_TABLET_TOOL applies only to events generated by tools. +LIBINPUT_DEVICE_CAP_TABLET_TOOL capability applies only to events generated +by tools. Touch events on the tablet integrated into a screen itself are exposed through the @ref LIBINPUT_DEVICE_CAP_TOUCH capability. Touch events on a commit ca3cc403dec209b428e5990075f4c2ce99f30e0a Author: Eric Engestrom <e...@engestrom.ch> Date: Sun Apr 3 01:47:43 2016 +0100 Fix spelling mistakes Signed-off-by: Eric Engestrom <e...@engestrom.ch> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> (cherry picked from commit 7a81ba9cc29fec09458f7870e203b83ae4ffb9de) diff --git a/doc/t440-support.dox b/doc/t440-support.dox index 652a6d0..f4ce3ed 100644 --- a/doc/t440-support.dox +++ b/doc/t440-support.dox @@ -70,7 +70,7 @@ digraph top_button_routing touchpad -> libinput_tp [color="red4"] events_tp [label="other touchpad events"]; - events_topbutton [label="top sofware button events"]; + events_topbutton [label="top software button events"]; libinput_tp -> events_tp [arrowhead="none"] libinput_ts -> events_topbutton [color="red4"] diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 7359881..9a1ac52 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -516,7 +516,7 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet, axes.tilt.x = 0; axes.tilt.y = 0; - /* tilt is already coverted to left-handed, so mouse + /* tilt is already converted to left-handed, so mouse * rotation is converted to left-handed automatically */ } else { axes.rotation = tablet_handle_artpen_rotation(tablet, device); diff --git a/src/evdev.c b/src/evdev.c index a5c965d..6bb8986 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1306,7 +1306,7 @@ fallback_dispatch_create(struct libinput_device *device) evdev_init_sendevents(evdev_device, dispatch); /* BTN_MIDDLE is set on mice even when it's not present. So - * we can only use the absense of BTN_MIDDLE to mean something, i.e. + * we can only use the absence of BTN_MIDDLE to mean something, i.e. * we enable it by default on anything that only has L&R. * If we have L&R and no middle, we don't expose it as config * option */ diff --git a/src/filter.c b/src/filter.c index 4c39b0e..cf8996d 100644 --- a/src/filter.c +++ b/src/filter.c @@ -690,7 +690,7 @@ touchpad_lenovo_x230_accel_profile(struct motion_filter *filter, * trial-and-error. No other meaning should be interpreted. * The calculation is a compressed form of * pointer_accel_profile_linear(), look at the git history of that - * function for an explaination of what the min/max/etc. does. + * function for an explanation of what the min/max/etc. does. */ speed_in *= X230_MAGIC_SLOWDOWN / X230_TP_MAGIC_LOW_RES_FACTOR; diff --git a/src/libinput.h b/src/libinput.h index 819efa8..3449611 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -1340,7 +1340,7 @@ libinput_event_gesture_get_scale(struct libinput_event_gesture *event); * * The angle delta is defined as the change in angle of the line formed by * the 2 fingers of a pinch gesture. Clockwise rotation is represented - * by a postive delta, counter-clockwise by a negative delta. If e.g. the + * by a positive delta, counter-clockwise by a negative delta. If e.g. the * fingers are on the 12 and 6 location of a clock face plate and they move * to the 1 resp. 7 location in a single event then the angle delta is * 30 degrees. @@ -2308,7 +2308,7 @@ libinput_get_event(struct libinput *libinput); * * @param libinput A previously initialized libinput context * @return The event type of the next available event or @ref - * LIBINPUT_EVENT_NONE if no event is availble. + * LIBINPUT_EVENT_NONE if no event is available. */ enum libinput_event_type libinput_next_event_type(struct libinput *libinput); @@ -3590,7 +3590,7 @@ enum libinput_config_accel_profile { * * @param device The device to configure * - * @return A bitmask of all configurable modes availble on this device. + * @return A bitmask of all configurable modes available on this device. */ uint32_t libinput_device_config_accel_get_profiles(struct libinput_device *device); @@ -4234,7 +4234,7 @@ enum libinput_config_dwt_state { * @ingroup config * * Check if this device supports configurable disable-while-typing feature. - * This feature is usally available on built-in touchpads and disables the + * This feature is usually available on built-in touchpads and disables the * touchpad while typing. See @ref disable-while-typing for details. * * @param device The device to configure commit 2253cf69cbf6861003c2c8396bf0cc11fbd83612 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Mar 29 13:34:00 2016 +1000 touchpad: only post motion events if we have motion Because our delta calculation factors in previous events on touchpads (to reduce jitter) we may get a nonzero delta if we have an event that doesn't actually change x or y. Drop the t->dirty workaround introduced in a608d9d, an event that virtually disappears can mess up our state machines. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> (cherry picked from commit bc17185f426dae7a1ea4df6ba3459083c2d51f9b) diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index 3c8f5a7..7bbd3b8 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -500,7 +500,8 @@ tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time) switch (tp->gesture.finger_count) { case 1: - tp_gesture_post_pointer_motion(tp, time); + if (tp->queued & TOUCHPAD_EVENT_MOTION) + tp_gesture_post_pointer_motion(tp, time); break; case 2: case 3: diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index d0a8e27..082493c 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -904,10 +904,7 @@ tp_need_motion_history_reset(struct tp_dispatch *tp, uint64_t time) if (tp->device->model_flags & EVDEV_MODEL_LENOVO_T450_TOUCHPAD) { if (tp->queued & TOUCHPAD_EVENT_MOTION) { if (tp->quirks.nonmotion_event_count > 10) { - struct tp_touch *t; - - tp_for_each_touch(tp, t) - t->dirty = false; + tp->queued &= ~TOUCHPAD_EVENT_MOTION; rc = true; } tp->quirks.nonmotion_event_count = 0; commit 915cd9d9999373aecf3285cba7ead3126c1fdb3d Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Wed Mar 30 15:31:07 2016 +1000 touchpad: fix left-handed top software trackpoint buttons The previous code would swap the top software buttons depending on the touchpad's left-handed setting, not the trackpoint setting. Changing both devices to left-handed resulted in a double-swap, i.e. the trackpoint was always right-handed. https://bugs.freedesktop.org/show_bug.cgi?id=94733 Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> (cherry picked from commit 1ecf6d7a607c5f481eb9b3b6365d7b55a0f18c53) diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index 82c99c7..076eab0 100644 --- a/src/evdev-mt-touchpad-buttons.c +++ b/src/evdev-mt-touchpad-buttons.c @@ -963,6 +963,7 @@ tp_post_clickpadbutton_buttons(struct tp_dispatch *tp, uint64_t time) uint32_t current, old, button, is_top; enum libinput_button_state state; enum { AREA = 0x01, LEFT = 0x02, MIDDLE = 0x04, RIGHT = 0x08 }; + bool want_left_handed = true; current = tp->buttons.state; old = tp->buttons.old_state; @@ -1008,14 +1009,22 @@ tp_post_clickpadbutton_buttons(struct tp_dispatch *tp, uint64_t time) return 0; } - if ((area & MIDDLE) || ((area & LEFT) && (area & RIGHT))) - button = evdev_to_left_handed(tp->device, BTN_MIDDLE); - else if (area & RIGHT) - button = evdev_to_left_handed(tp->device, BTN_RIGHT); - else if (area & LEFT) - button = evdev_to_left_handed(tp->device, BTN_LEFT); - else /* main or no area (for clickfinger) is always BTN_LEFT */ + if ((area & MIDDLE) || ((area & LEFT) && (area & RIGHT))) { + button = BTN_MIDDLE; + } else if (area & RIGHT) { + button = BTN_RIGHT; + } else if (area & LEFT) { button = BTN_LEFT; + } else { /* main or no area (for clickfinger) is always BTN_LEFT */ + button = BTN_LEFT; + want_left_handed = false; + } + + if (is_top) + want_left_handed = false; + + if (want_left_handed) + button = evdev_to_left_handed(tp->device, button); tp->buttons.active = button; tp->buttons.active_is_topbutton = is_top; diff --git a/test/trackpoint.c b/test/trackpoint.c index 567fba8..5a68b19 100644 --- a/test/trackpoint.c +++ b/test/trackpoint.c @@ -150,6 +150,135 @@ START_TEST(trackpoint_scroll_source) } END_TEST +START_TEST(trackpoint_topsoftbuttons_left_handed_trackpoint) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *trackpoint; + struct libinput *li = touchpad->libinput; + enum libinput_config_status status; + struct libinput_event *event; + struct libinput_device *device; + + trackpoint = litest_add_device(li, LITEST_TRACKPOINT); + litest_drain_events(li); + /* touchpad right-handed, trackpoint left-handed */ + status = libinput_device_config_left_handed_set( + trackpoint->libinput_device, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_touch_down(touchpad, 0, 5, 5); + libinput_dispatch(li); + litest_button_click(touchpad, BTN_LEFT, true); + libinput_dispatch(li); + + event = libinput_get_event(li); + litest_is_button_event(event, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + device = libinput_event_get_device(event); + ck_assert(device == trackpoint->libinput_device); + libinput_event_destroy(event); + + litest_button_click(touchpad, BTN_LEFT, false); + libinput_dispatch(li); + event = libinput_get_event(li); + litest_is_button_event(event, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + device = libinput_event_get_device(event); + ck_assert(device == trackpoint->libinput_device); + libinput_event_destroy(event); + + litest_delete_device(trackpoint); +} +END_TEST + +START_TEST(trackpoint_topsoftbuttons_left_handed_touchpad) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *trackpoint; + struct libinput *li = touchpad->libinput; + enum libinput_config_status status; + struct libinput_event *event; + struct libinput_device *device; + + trackpoint = litest_add_device(li, LITEST_TRACKPOINT); + litest_drain_events(li); + /* touchpad left-handed, trackpoint right-handed */ + status = libinput_device_config_left_handed_set( + touchpad->libinput_device, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_touch_down(touchpad, 0, 5, 5); + libinput_dispatch(li); + litest_button_click(touchpad, BTN_LEFT, true); + libinput_dispatch(li); + + event = libinput_get_event(li); + litest_is_button_event(event, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); + device = libinput_event_get_device(event); + ck_assert(device == trackpoint->libinput_device); + libinput_event_destroy(event); + + litest_button_click(touchpad, BTN_LEFT, false); + libinput_dispatch(li); + event = libinput_get_event(li); + litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + device = libinput_event_get_device(event); + ck_assert(device == trackpoint->libinput_device); + libinput_event_destroy(event); + + litest_delete_device(trackpoint); +} +END_TEST + +START_TEST(trackpoint_topsoftbuttons_left_handed_both) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *trackpoint; + struct libinput *li = touchpad->libinput; + enum libinput_config_status status; + struct libinput_event *event; + struct libinput_device *device; + + trackpoint = litest_add_device(li, LITEST_TRACKPOINT); + litest_drain_events(li); + /* touchpad left-handed, trackpoint left-handed */ + status = libinput_device_config_left_handed_set( + touchpad->libinput_device, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + status = libinput_device_config_left_handed_set( + trackpoint->libinput_device, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_touch_down(touchpad, 0, 5, 5); + libinput_dispatch(li); + litest_button_click(touchpad, BTN_LEFT, true); + libinput_dispatch(li); + + event = libinput_get_event(li); + litest_is_button_event(event, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + device = libinput_event_get_device(event); + ck_assert(device == trackpoint->libinput_device); + libinput_event_destroy(event); + + litest_button_click(touchpad, BTN_LEFT, false); + libinput_dispatch(li); + event = libinput_get_event(li); + litest_is_button_event(event, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + device = libinput_event_get_device(event); + ck_assert(device == trackpoint->libinput_device); + libinput_event_destroy(event); + + litest_delete_device(trackpoint); +} +END_TEST void litest_setup_tests(void) { @@ -157,4 +286,7 @@ litest_setup_tests(void) litest_add("trackpoint:middlebutton", trackpoint_middlebutton_noscroll, LITEST_POINTINGSTICK, LITEST_ANY); litest_add("trackpoint:scroll", trackpoint_scroll, LITEST_POINTINGSTICK, LITEST_ANY); litest_add("trackpoint:scroll", trackpoint_scroll_source, LITEST_POINTINGSTICK, LITEST_ANY); + litest_add("trackpoint:left-handed", trackpoint_topsoftbuttons_left_handed_trackpoint, LITEST_TOPBUTTONPAD, LITEST_ANY); + litest_add("trackpoint:left-handed", trackpoint_topsoftbuttons_left_handed_touchpad, LITEST_TOPBUTTONPAD, LITEST_ANY); + litest_add("trackpoint:left-handed", trackpoint_topsoftbuttons_left_handed_both, LITEST_TOPBUTTONPAD, LITEST_ANY); } commit 2de6df3bb7b0f4e8ed7e2d59f3b29069cb9f9a52 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Mar 29 08:33:34 2016 +1000 Fix two doxygen groupings Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> (cherry picked from commit 455498e9d720c00b2d92d3dcf603a62dbc122a8e) diff --git a/src/libinput.h b/src/libinput.h index cf33492..819efa8 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -541,6 +541,8 @@ struct libinput_event_touch * libinput_event_get_touch_event(struct libinput_event *event); /** + * @ingroup event + * * Return the gesture event that is this input event. If the event type does * not match the gesture event types, this function returns NULL. * @@ -973,7 +975,7 @@ enum libinput_pointer_axis_source libinput_event_pointer_get_axis_source(struct libinput_event_pointer *event); /** - * @ingroup pointer + * @ingroup event_pointer * * Return the axis value in discrete steps for a given axis event. How a * value translates into a discrete step depends on the source.