configure.ac | 4 - 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 +++++++++++++++++++++++++++++++++++++++ 13 files changed, 175 insertions(+), 29 deletions(-)
New commits: 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.