platform/upstream/libinput.git
2 years agowheel: allow to scroll while middle button is pressed
José Expósito [Wed, 29 Dec 2021 17:17:02 +0000 (18:17 +0100)]
wheel: allow to scroll while middle button is pressed

Since cd4f2f32b57a ("fallback: disable mouse scroll wheel while middle
button is pressed") the mouse wheel is inhibited while the mouse wheel
is pressed.

The original intention of this feature was to avoid unintended scroll
while pressing the scroll wheel. However, now that high-resolution
scroll is fully integrated in libinput we can improve this feature and
filter unintended scroll (below half a detent) and allow it when it is
intended (over half a detent).

Remove the "WHEEL_STATE_PRESSED" state from the wheel state machine and
let the general heuristics handle this case.

Also, remove the specific tests for this feature as now it is covered
by the general test cases.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoquirks: Remove Lenovo Trackpoint Keyboard II quirk
José Expósito [Wed, 29 Dec 2021 17:11:55 +0000 (18:11 +0100)]
quirks: Remove Lenovo Trackpoint Keyboard II quirk

The device sends its own scroll events when its trackpoint is moved
while the middle button is pressed.

Because scroll events are not going to be inhibited after a certain
amount of scroll is detected in a follow up commit, remove the quirk.

This reverts 53bd70f4c7e2 ("quirks: Lenovo Trackpoint Keyboard II")

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agomeson.build: disable -Wunused when building the litest selftest
Peter Hutterer [Wed, 22 Dec 2021 22:18:06 +0000 (08:18 +1000)]
meson.build: disable -Wunused when building the litest selftest

We use check directly to test the various litest bits, so if ifdef out
the litest main() and a few other bits. This results in compiler
warnings that aren't worth fixing - a lot of moving code around for no
real benefit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoevdev: silence a clang compiler warning
Peter Hutterer [Mon, 12 Jul 2021 11:09:15 +0000 (21:09 +1000)]
evdev: silence a clang compiler warning

Signed-off-by:Peter Hutterer <peter.hutterer@who-t.net>

2 years agotablet: handle a BTN_TOOL_PEN on top of BTN_TOOL_RUBBER
Peter Hutterer [Wed, 17 Nov 2021 06:24:00 +0000 (16:24 +1000)]
tablet: handle a BTN_TOOL_PEN on top of BTN_TOOL_RUBBER

The Wacom 524C device triggers a kernel bug in the InRange and Invert
handling. Every time BTN_TOUCH is set/unset the device also sets/unsets
BTN_TOOL_PEN even when we nominally have the eraser in proximity.

The event sequence effectively looks like this:

    # on prox in
    BTN_TOOL_RUBBER 1
    -- SYN_REPORT ---
    # on tip down
    BTN_TOOL_PEN 1
    BTN_TOUCH 1
    -- SYN_REPORT ---
    # on tip up
    BTN_TOUCH 0
    BTN_TOOL_PEN 0
    -- SYN_REPORT ---
    # on prox out
    BTN_TOOL_RUBBER 1
    -- SYN_REPORT ---

To work around this, bias our duplicate tool detection code towards the
eraser - if we have an eraser in-prox already and the pen goes
in-prox, ignore it and continue with the eraser. But if we have a pen
in-prox and the eraser goes in-prox as well, force a prox-out for the
pen and put the eraser in-prox.

Recording originally from
https://github.com/linuxwacom/xf86-input-wacom/issues/186

Fixes #702

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotest: add a test device for the Wacom 524C device
Peter Hutterer [Wed, 17 Nov 2021 04:29:35 +0000 (14:29 +1000)]
test: add a test device for the Wacom 524C device

This device triggers a kernel bug in the InRange and Invert handling,
every time BTN_TOUCH is set the device also sets BTN_TOOL_PEN even when
we currently have the eraser in proximity.

Recording from https://github.com/linuxwacom/xf86-input-wacom/issues/186

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotest: allow for a hold end event when verifying touch motion
Peter Hutterer [Wed, 8 Dec 2021 06:26:16 +0000 (16:26 +1000)]
test: allow for a hold end event when verifying touch motion

Depending on how quick the test suite runs we may get a hold end event
here. Let's silently ignore that one since we aren't interested in it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agogestures: do not use thumb for pinch when is used to press the clickpad
José Expósito [Wed, 8 Dec 2021 16:32:03 +0000 (17:32 +0100)]
gestures: do not use thumb for pinch when is used to press the clickpad

The changes made in ca3df8a076d54a93b3c2fb8a5eea4326d487050c to improve
pinch detection introduced a regression:

When the thumb is used to press the clickpad it is automatically tagged
as thumb and the gesture state machine does not initialize it, leaving
its initial X and Y position set to 0.
When another finger is put on the clickpad, the distance moved by the
thumb is checked and because its initial position is 0 movement is
detected.

Add an additional check to take into account only thumbs that are used
in the gesture.

Fix #708

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agodoc/user: write an article explaining the different contexts
Peter Hutterer [Tue, 7 Dec 2021 05:39:10 +0000 (15:39 +1000)]
doc/user: write an article explaining the different contexts

This is a common question I need to answer, let's make this a link I can
copy/paste instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotimer: only warn about timer expiry issues when we're more than 20ms behind
Peter Hutterer [Tue, 7 Dec 2021 01:18:07 +0000 (11:18 +1000)]
timer: only warn about timer expiry issues when we're more than 20ms behind

The most common trigger for this is the debouncing timer which is a mere
12ms and is effectively unavoidable, virtually every caller will
trigger those messages at some point.

Let's add a grace period of 20ms below which we don't log this message
to avoid logspam. And in the process, bump the equivalent warning
message up to 20ms as well.

Related #711

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotimer: rate-limit the "timer expiry in the past" error messages
Peter Hutterer [Tue, 7 Dec 2021 01:11:32 +0000 (11:11 +1000)]
timer: rate-limit the "timer expiry in the past" error messages

We already ratelimit the normal notification about event processing
lagging behind but in the case of timers actually expiring late, we'd
pass those messages on. So lots of clicks on a slow-reponse system
resulted in lots of messages triggered by the debounce timers.

Use the same ratelimiting as the event processing warning, 5 messages
per hour which should be a good balance between warning and not spamming
the log.

Fixes #711

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoevdev: improve joystick and gamepad detection
José Expósito [Tue, 23 Nov 2021 17:07:53 +0000 (18:07 +0100)]
evdev: improve joystick and gamepad detection

The EVDEV_UDEV_TAG_JOYSTICK is set when a joystick or gamepad button
is found. However, it can not be used to identify joysticks or
gamepads because there are keyboards that also have it. Even worse,
many joysticks also map KEY_* and thus are tagged as keyboards.

In order to be able to detect joysticks and gamepads and
differentiate them from keyboards, apply the following rules:

  1. The device is tagged as joystick but not as tablet
  2. It has at least 2 joystick buttons
  3. It doesn't have 10 keyboard keys

Fix #701
Fix #415
Fix #703

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoevdev: refactor joystick/gamepad detection
José Expósito [Tue, 23 Nov 2021 17:07:27 +0000 (18:07 +0100)]
evdev: refactor joystick/gamepad detection

Move the logic to detect joysticks and gamepads to its own function.

Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotouchpad: revert the clickpad detection mechanism
José Expósito [Thu, 2 Dec 2021 11:52:56 +0000 (12:52 +0100)]
touchpad: revert the clickpad detection mechanism

Use the previous heuristics to detect clickpads where a touchpad was
handled as a clickpad when:

 - The property INPUT_PROP_BUTTONPAD is set
 - The property INPUT_PROP_BUTTONPAD is NOT set but the touchpad only
   has BTN_LEFT

Revert a37d6dcc9c2ec7ebd0d3609e01da1cfcec28db6e:
"touchpad: if we have a right button, let's assume it's not a clickpad"
MR:  https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/614
BUG: https://gitlab.freedesktop.org/libinput/libinput/-/issues/595

Fix #704

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoquirks: changes touchpad pressure Lenovo Yoga 2 Pro
Joaquin Gonzalez [Tue, 16 Nov 2021 05:40:07 +0000 (02:40 -0300)]
quirks: changes touchpad pressure Lenovo Yoga 2 Pro

Adds touchpad pressure configuration for Lenovo Yoga 2 Pro in order to avoid random cursor jumps on finger up.

Signed-off-by: Joaquin Gonzalez <joaquin.gonzalez.uy@gmail.com>
2 years agodoc/user: fix broken link to "Observations on trackpoint input data"
José Expósito [Sun, 28 Nov 2021 12:49:14 +0000 (13:49 +0100)]
doc/user: fix broken link to "Observations on trackpoint input data"

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotest: add a tablet test for eraser tip down
Peter Hutterer [Wed, 17 Nov 2021 05:55:22 +0000 (15:55 +1000)]
test: add a tablet test for eraser tip down

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotest: add missing tool event in the aiptek tablet test device
Peter Hutterer [Wed, 17 Nov 2021 22:21:42 +0000 (08:21 +1000)]
test: add missing tool event in the aiptek tablet test device

Needed for eraser tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotest: add tip down/up helper functions
Peter Hutterer [Wed, 17 Nov 2021 04:46:07 +0000 (14:46 +1000)]
test: add tip down/up helper functions

Add two helper functions that set/unset BTN_TOUCH together with the
specified axes and switch all tests over.

Devices can override the tip down/up sequence.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: add ModelBouncingKeys for A4Tech X-710BK Mouse
Alexander Radovich [Tue, 16 Nov 2021 06:38:06 +0000 (07:38 +0100)]
quirks: add ModelBouncingKeys for A4Tech X-710BK Mouse

Signed-off-by: Alexander Radovich <rexuru17@gmail.com>
2 years agoUse bit(foo) instead of (1 << foo)
Peter Hutterer [Thu, 18 Nov 2021 00:10:49 +0000 (10:10 +1000)]
Use bit(foo) instead of (1 << foo)

Translates to the same thing, but the bit() helper is nicer and less
likely to be typoed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: add a quirk for the Wacom 524c device
Peter Hutterer [Wed, 17 Nov 2021 05:48:14 +0000 (15:48 +1000)]
quirks: add a quirk for the Wacom 524c device

Has tilt, doesn't use it

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: make a wacom quirk more descriptive
Peter Hutterer [Wed, 17 Nov 2021 05:46:00 +0000 (15:46 +1000)]
quirks: make a wacom quirk more descriptive

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agodoc/user: add an example udev rule for LIBINPUT_IGNORE_DEVICE
Peter Hutterer [Mon, 15 Nov 2021 01:14:10 +0000 (11:14 +1000)]
doc/user: add an example udev rule for LIBINPUT_IGNORE_DEVICE

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agodoc/user: expand the udev rules for better readability
Peter Hutterer [Mon, 15 Nov 2021 01:20:39 +0000 (11:20 +1000)]
doc/user: expand the udev rules for better readability

Split it over multiple lines and use fake cat command to show where that
rule could live.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: add a more generic match for the 5288 Synaptics clickpad
Peter Hutterer [Mon, 8 Nov 2021 04:12:22 +0000 (14:12 +1000)]
quirks: add a more generic match for the 5288 Synaptics clickpad

This is a clickpad announcing BTN_RIGHT in different machines, see
issue #674, #689, #629 and MR !701. There are at least 4 machines that
ship with this device that we had to quirk independently, possibly
others so disabling BTN_RIGHT on all of them makes sense.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: Dell 15R touchpad settings for firmware v3
Gary Wolfe [Fri, 22 Jan 2021 22:10:01 +0000 (17:10 -0500)]
quirks: Dell 15R touchpad settings for firmware v3

Trackpad sensitivity adjustment only needed for v3 for Dell Inspiron 15R N5110.
Fixes #565 and #676.

Signed-off-by: Gary Wolfe <avidgamefan@yahoo.com>
2 years agogestures: rename event handlers
José Expósito [Mon, 8 Nov 2021 17:05:16 +0000 (18:05 +0100)]
gestures: rename event handlers

Follow the name convention used in evdev-wheel.c and rename the handle
event functions from "tp_gesture_[STATE]_handle_event" to
"tp_gesture_handle_event_on_state_[STATE]".

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agowheel: accumulate scroll when direction changes
José Expósito [Thu, 30 Sep 2021 15:50:26 +0000 (17:50 +0200)]
wheel: accumulate scroll when direction changes

Most mice with high-resolution support have a mechanism in place to
adjust the wheel to a detent. When scrolling, it is possible to stop
between two detents and this mechanism could generate a small amount of
scroll in the oposite direction.

Track the scroll direction in the wheel state machine and reset it when
the direction changes to avoid this issue.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agowheel: ignore initial small scroll deltas
José Expósito [Wed, 29 Sep 2021 16:32:54 +0000 (18:32 +0200)]
wheel: ignore initial small scroll deltas

Mice with high-resolution support can generate deltas when the finger is
put on the wheel or when the user tries to click the wheel.

To avoid sending involuntary scroll events, add an extra state the the
wheel state machine to accumulate scroll deltas.
While the accumulated scroll is lower than a certain threshold, ignore
them until the threshold is reached.

Since no finish event is sent by the mouse, reset the state machine
after a period of scroll inactivity.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agowheel: handle with a state machine
José Expósito [Mon, 27 Sep 2021 07:02:57 +0000 (09:02 +0200)]
wheel: handle with a state machine

In order to be able to add more complex rules in the future, transform
the current wheel handling code into a state machine.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agowheel: refactor wheel scroll flushing
José Expósito [Sun, 26 Sep 2021 16:39:32 +0000 (18:39 +0200)]
wheel: refactor wheel scroll flushing

Move the logic to flush wheel scroll to it's own funtion.
Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agowheel: centralize wheel handling
José Expósito [Sun, 26 Sep 2021 16:15:51 +0000 (18:15 +0200)]
wheel: centralize wheel handling

Move the logic to handle wheels to its own file.
Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agogestures: cancel hold gestures on thumb detection
José Expósito [Tue, 2 Nov 2021 18:37:07 +0000 (19:37 +0100)]
gestures: cancel hold gestures on thumb detection

Before hold gestures where implemented, when a thumb was detected it
was enough to reset the state machine.
However, now it is possible to detect a thumb while a hold gesture is
in course.

Cancel any ongoing gesture when a thumb is detected to avoid dropping
the gesture end event.

See #693

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agodoc/user: fix broken link to systemd 60-evdev.hwdb
José Expósito [Sat, 30 Oct 2021 10:10:10 +0000 (12:10 +0200)]
doc/user: fix broken link to systemd 60-evdev.hwdb

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agolibinput 1.19.2 1.19.2
Peter Hutterer [Thu, 21 Oct 2021 04:19:49 +0000 (14:19 +1000)]
libinput 1.19.2

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: add quirk for GPD Win Max
A-w-x [Wed, 20 Oct 2021 13:36:56 +0000 (13:36 +0000)]
quirks: add quirk for GPD Win Max

clickpad that announces BTN_RIGHT

Signed-off-by: A-w-x <awxkrnl@gmail.com>
2 years agotest: use a plain libinput context for the log priority check
Peter Hutterer [Tue, 19 Oct 2021 03:01:23 +0000 (13:01 +1000)]
test: use a plain libinput context for the log priority check

Don't use the litest wrapper context here, it changes log priority if
the test suite is run with --verbose, causing the test to fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: relax DMI modalias match for Purism Librem 14v1
Travis Wrightsman [Mon, 11 Oct 2021 23:14:56 +0000 (19:14 -0400)]
quirks: relax DMI modalias match for Purism Librem 14v1

Both "svnPurism:pnLibrem14:" and "svnPurism:pnlibrem_14:" are possible

Signed-off-by: Travis Wrightsman <travis@wrightsman.org>
2 years agoevdev: avoid usage of bogus BTN_FORWARD name
Eduardo de Souza Cruz [Mon, 11 Oct 2021 20:29:12 +0000 (17:29 -0300)]
evdev: avoid usage of bogus BTN_FORWARD name

Signed-off-by: Eduardo Cruz <eduardo.cruz@kdemail.net>
2 years agoquirks: Update dmi for StarBook Mk V
Sean Rhodes [Fri, 8 Oct 2021 12:08:23 +0000 (13:08 +0100)]
quirks: Update dmi for StarBook Mk V

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2 years agoevdev: disable button scroll timeout for extra mouse buttons
Eduardo de Souza Cruz [Sun, 10 Oct 2021 23:32:36 +0000 (23:32 +0000)]
evdev: disable button scroll timeout for extra mouse buttons

Signed-off-by: Eduardo Cruz <eduardo.cruz@kdemail.net>
2 years agogestures: avoid processing the last hold and motion event twice
José Expósito [Thu, 7 Oct 2021 06:34:43 +0000 (08:34 +0200)]
gestures: avoid processing the last hold and motion event twice

During the transition from GESTURE_STATE_HOLD_AND_MOTION to
GESTURE_STATE_POINTER_MOTION the last pointer motion event was
processed twice.

Fix #680

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoquirks: Add quirk for StarLabs clickpads with two phyisical buttons
Sean Rhodes [Mon, 4 Oct 2021 09:19:52 +0000 (10:19 +0100)]
quirks: Add quirk for StarLabs clickpads with two phyisical buttons

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2 years agolibinput 1.19.1 1.19.1
Peter Hutterer [Mon, 27 Sep 2021 22:16:24 +0000 (08:16 +1000)]
libinput 1.19.1

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agofallback: hires scroll heuristics for buggy devices
José Expósito [Fri, 24 Sep 2021 16:08:01 +0000 (18:08 +0200)]
fallback: hires scroll heuristics for buggy devices

Some devices might announce support for high-resolution scroll wheel
by enabling REL_WHEEL_HI_RES and/or REL_HWHEEL_HI_RES but never send
a high-resolution scroll event.

When the first low-resolution scroll event is received without any
previous high-resolution event, print a kernel bug warning and start
emulating high-resolution scroll events.

Fix #668

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotest: add kernel bugs to log handler
José Expósito [Fri, 24 Sep 2021 15:50:53 +0000 (17:50 +0200)]
test: add kernel bugs to log handler

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoquirks: update the Dell N5110 touchpad quirk
Peter Hutterer [Mon, 27 Sep 2021 22:12:59 +0000 (08:12 +1000)]
quirks: update the Dell N5110 touchpad quirk

Later versions of this same model seem to have a different ALPS touchpad
and don't need the pressure settings. Narrow down this match so we only
apply to the one from the actual bug report in #565.

Fixes #676

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: add quirk for the Prestigio Smartbook 141 C2 touchpad
Peter Hutterer [Sun, 26 Sep 2021 19:54:09 +0000 (05:54 +1000)]
quirks: add quirk for the Prestigio Smartbook 141 C2 touchpad

Fixes #674

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agolibinput: add hold to get base event
José Expósito [Fri, 24 Sep 2021 17:06:53 +0000 (19:06 +0200)]
libinput: add hold to get base event

LIBINPUT_EVENT_GESTURE_HOLD_BEGIN and LIBINPUT_EVENT_GESTURE_HOLD_END
were missing from libinput_event_gesture_get_base_event.

Add them to avoid triggering an erroneous client bug warning.

Fix #671

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoevdev: v120 scroll: invert horizontal scrolling quirk
José Expósito [Tue, 21 Sep 2021 17:21:03 +0000 (19:21 +0200)]
evdev: v120 scroll: invert horizontal scrolling quirk

When required, invert horizontal scrolling in evdev_notify_axis_wheel
following the QUIRK_MODEL_INVERT_HORIZONTAL_SCROLLING quirk.

Fix #669

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotouchpad: mark USB touchpads as internal by default
Peter Hutterer [Mon, 20 Sep 2021 01:53:45 +0000 (11:53 +1000)]
touchpad: mark USB touchpads as internal by default

External touchpads using USB are vanishingly few, built-in touchpads
that use USB are comparatively common. So let's default to internal,
for vendors like Logitech and Wacom that only make external touchpads we
have special conditions in place anyway.

Fixes #664

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotouchpad: use the model flags to determine internal vs external
Peter Hutterer [Mon, 20 Sep 2021 01:56:11 +0000 (11:56 +1000)]
touchpad: use the model flags to determine internal vs external

When pairing a trackpoint, use the model flags for the touchpad, don't
use a separate set of conditions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agodoc: guarantee end sequence for continuous scroll
José Expósito [Sun, 19 Sep 2021 19:23:41 +0000 (21:23 +0200)]
doc: guarantee end sequence for continuous scroll

GTK handles LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS as
GDK_SCROLL_SMOOTH, the same event type that is used to handle
LIBINPUT_EVENT_POINTER_SCROLL_FINGER.

Because Mutter and other compositors, like wlroots based compositors,
translate libinput terminating event to axis_stop instead of doing their
own emulation, if libinput stops sending terminating events, it will
cause client bugs.

Since libinput always sends the terminating event for trackpoints and
button scrolling and there are even tests in place to check for them,
update the documentation to guarantee the terminating scroll sequence.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotouchpad: reduce the jumping cursor warnings to 5 per day
Peter Hutterer [Thu, 16 Sep 2021 23:00:38 +0000 (09:00 +1000)]
touchpad: reduce the jumping cursor warnings to 5 per day

It's been a while since we really could do something about those jumps,
so let's assume most of these are informative and not a bug in libinput.
For that let's not spam the user's journal and ratelimit it to a handful
a day.

Per day because that increases the chance of an error being present in
the recent logs if the user does search for it.

Related #663

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotouchpad: fix leak when the touchpad is removed before the dwt keyboard
Peter Hutterer [Tue, 14 Sep 2021 09:53:04 +0000 (19:53 +1000)]
touchpad: fix leak when the touchpad is removed before the dwt keyboard

If a touchpad is removed before its dwt-paired keyboard, we're leaking
the keyboard struct. Fix this by cleaning up properly when our device is
removed.

This is the cause of many failed tests in the udev backend tests during
the CI valgrind run. Because we're testing the udev backend it will add
any devices created by tests run in parallel, some of which are keyboard
devices. Depening on the test completions, the keyboards may or may not
get removed before this device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agolibinput 1.19.0 1.19.0
Peter Hutterer [Tue, 14 Sep 2021 07:44:35 +0000 (17:44 +1000)]
libinput 1.19.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: no button debouncing on generic emulated mouse
José Expósito [Sun, 12 Sep 2021 15:11:27 +0000 (17:11 +0200)]
quirks: no button debouncing on generic emulated mouse

When the kernel doesn't support a touchpad, the device is handled as a
generic mouse named "ImPS/2 Generic Wheel Mouse".
Taps are handled as button clicks and the button debouncing code makes
it difficult to double click.

Add a quirk to disable button debouncing for this devices.

Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/656

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoutil: add a function to parse bool properties
José Expósito [Sun, 12 Sep 2021 15:09:20 +0000 (17:09 +0200)]
util: add a function to parse bool properties

Move the logic used to parse boolean quirks and udev flags to a common
function in utils.

Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agouse ARRAY_FOR_EACH when traverse array
weizhixiang [Mon, 30 Aug 2021 09:39:56 +0000 (18:39 +0900)]
use ARRAY_FOR_EACH when traverse array

Signed-off-by: weizhixiang <weizhixiang@uniontech.com>
2 years agoquirks: Microsoft Surface Pro 3 Cover
José Expósito [Mon, 6 Sep 2021 16:51:01 +0000 (18:51 +0200)]
quirks: Microsoft Surface Pro 3 Cover

Mark the Microsoft Surface Pro 3 Cover keyboard as internal.

Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/655

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agodoc: add missing literal blocks in contributing
José Expósito [Mon, 6 Sep 2021 06:42:28 +0000 (08:42 +0200)]
doc: add missing literal blocks in contributing

Add missing literal blocks in the section "Failed pipeline errors"
introduced in 140b4b78530b62f8dc70645153b75b4adae23ed9.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoquirks: Pine64 PineBook Pro keyboard
Clayton Craft [Sun, 5 Sep 2021 20:53:44 +0000 (13:53 -0700)]
quirks: Pine64 PineBook Pro keyboard

The keyboard is 'internal' (built-in), and attached over usb.

Signed-off-by: Clayton Craft <clayton@craftyguy.net>
2 years agolibinput 1.18.901 1.18.901
Peter Hutterer [Wed, 1 Sep 2021 04:09:26 +0000 (14:09 +1000)]
libinput 1.18.901

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoHigh-resolution scroll wheel support
Peter Hutterer [Thu, 22 Nov 2018 00:24:54 +0000 (10:24 +1000)]
High-resolution scroll wheel support

Starting with kernel v5.0 two new axes are available for high-resolution wheel
scrolling: REL_WHEEL_HI_RES and REL_HWHEEL_HI_RES. Both axes send data in
fractions of 120 where each multiple of 120 amounts to one logical scroll
event. Fractions of 120 indicate a wheel movement less than one detent.

This commit adds a new API for scroll events. Three new event types that encode
the axis source in the event type name and a new API to get a normalized-to-120
value that also used by Windows and the kernel (each multiple of 120 represents
a logical scroll click).

This addresses a main shortcoming with the existing API - it was unreliable to
calculate the click angle based on the axis value+discrete events and thus any
caller using the axis value alone would be left with some ambiguity. With the
v120 API it's now possible to (usually) calculate the click angle, but more
importantly it provides the simplest hw-independent way of scrolling by a
click or a fraction of a click.

A new event type is required, the only way to integrate the v120 value
otherwise was to start sending events with a discrete value of 0. This
would break existing xf86-input-libinput (divide by zero, fixed in 0.28.2) and
weston (general confusion). mutter, kwin are unaffected.

With the new API, the old POINTER_AXIS event are deprecated - callers should use
the new API where available and discard any POINTER_AXIS events.

Notable: REL_WHEEL/REL_HWHEEL are emulated by the kernel but there's no
guarantee that they'll come every accumulated 120 values, e.g. Logitech mice
often send events that don't add up to 120 per detent.

We use the kernel's wheel click emulation instead of doing our own.

libinput guarantees high-resolution events even on pre-5.0 kernels.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotest: refactor litest_assert_event_type logic
José Expósito [Sat, 24 Jul 2021 11:54:24 +0000 (13:54 +0200)]
test: refactor litest_assert_event_type logic

Extract the logic in litest_assert_event_type to a generic function,
litest_assert_event_type_is_one_of, that takes a variable number of
expected event types.

Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoquirks: Thinkpad T470 trackpoint multiplier
Dmitry Maluka [Thu, 26 Aug 2021 21:06:30 +0000 (23:06 +0200)]
quirks: Thinkpad T470 trackpoint multiplier

Set multiplier for T470 to 0.4, same as for T480.

Trackpoint behavior on T470 was good before 1.9.0 (more precisely,
before the commit 87b568) when a new trackpoint acceleration algorithm
was introduced instead of the traditional linear filter. Since then
it is too sensitive and seems impossible to fine-tune using hw settings
or libinput accel speed setting.

With multiplier set to 0.4 it is as good (or better) as in 1.8.4.
Sensitivity feels the same as in 1.8.4 with the same hw settings for
speed and sensitivity.

Signed-off-by: Dmitry Maluka <dmitrymaluka@gmail.com>
2 years agoquirks: Lenovo Trackpoint Keyboard II
José Expósito [Tue, 24 Aug 2021 16:01:59 +0000 (18:01 +0200)]
quirks: Lenovo Trackpoint Keyboard II

The device sends its own scroll events when its trackpoint is moved
while the middle button is pressed.

Because scroll events are inhibited while the middle button is pressed
a quirk is necessary for this device to not inhibit scroll events.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotest: create devices for our udev seat checks
Peter Hutterer [Tue, 3 Aug 2021 22:53:47 +0000 (08:53 +1000)]
test: create devices for our udev seat checks

This way we can ensure that at least one device is available, and that
it is the device we want.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoeditorconfig: add settings for meson files
José Expósito [Tue, 3 Aug 2021 17:55:39 +0000 (19:55 +0200)]
editorconfig: add settings for meson files

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotest: use MESON_TESTTHREADS to determine the number of jobs
Peter Hutterer [Tue, 3 Aug 2021 02:03:23 +0000 (12:03 +1000)]
test: use MESON_TESTTHREADS to determine the number of jobs

meson uses MESON_TESTTHREADS to determine the number of parallel test
jobs. Since our main test suite cannot be run in parallel anyway, use
that same variable in litest to determine how many jobs we should fork
off.

In the CI pipeline, we can use FDO_CI_CONCURRENT to pass that down so we
don't end up running a billion jobs on a test runner.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agomeson.build: use the / operator instead of join_paths
José Expósito [Tue, 3 Aug 2021 17:53:36 +0000 (19:53 +0200)]
meson.build: use the / operator instead of join_paths

Starting with meson v0.49.0, the "/" operator can be used instead of
join_paths.

Update meson to v0.49.0 and remove all calls to join_paths.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoci: update to GTK 4 when available
José Expósito [Wed, 16 Jun 2021 21:45:58 +0000 (23:45 +0200)]
ci: update to GTK 4 when available

Update GTK to version 4 on Fedora, Arch and Alpine Linux.

Not updating Debian and FreeBSD because the package is not available yet
and Ubuntu because it is not available on 20.10.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agodebug-gui: pointer locking on X11
José Expósito [Thu, 29 Jul 2021 17:01:44 +0000 (19:01 +0200)]
debug-gui: pointer locking on X11

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agodebug-gui: pointer locking on Wayland
José Expósito [Wed, 16 Jun 2021 20:53:45 +0000 (22:53 +0200)]
debug-gui: pointer locking on Wayland

Use the pointer constraints protocol to lock the pointer on Wayland.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agodebug-gui: migrate to GTK4
José Expósito [Thu, 29 Jul 2021 16:07:32 +0000 (18:07 +0200)]
debug-gui: migrate to GTK4

Global:

- Stop passing commandline arguments to gtk_init:
  https://docs.gtk.org/gtk4/migrating-3to4.html#stop-passing-commandline-arguments-to-gtk_init

window_init function:

- gtk_window_new doesn't require a type anymore

- gtk_window_iconify has been renamed to gtk_window_minimize

- gtk_container_add has been removed in favor of container specific
  APIs. Use gtk_window_set_child in this case.

- gtk_widget_show_all has been removed, widgets are now visible by
  default:
  https://docs.gtk.org/gtk4/migrating-3to4.html#widgets-are-now-visible-by-default

- gtk_widget_set_events to NULL is no longer required, widgets must set
  their event handlers explicitly now:
  https://blog.gtk.org/2020/04/29/custom-widgets-in-gtk-4-input/

window_delete_event_cb function:

- Use the new close-request event:
  https://docs.gtk.org/gtk4/migrating-3to4.html#stop-using-gtkwidget-event-signals

map_event_cb function:

- gtk_widget_set_cursor_from_name instead of gdk_window_set_cursor

- Wait until the draw area is resized to use the whole window to start
  calculating sizes

window_place_ui_elements function:

- Use gtk_widget_get_width and gtk_widget_get_height instead of
  gtk_window_get_size

Drawing:

- Use gtk_drawing_area_set_draw_func instead of the GtkWidget::draw
  signal:
  https://docs.gtk.org/gtk4/migrating-3to4.html#adapt-to-drawing-model-changes

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotools/debug-gui: refactor UI element placement
José Expósito [Thu, 29 Jul 2021 17:33:42 +0000 (19:33 +0200)]
tools/debug-gui: refactor UI element placement

Move the code used to pace the different UI elements to its own
function.

Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotools/debug-gui: use GMainLoop instead of gtk_main
José Expósito [Thu, 10 Jun 2021 18:07:00 +0000 (20:07 +0200)]
tools/debug-gui: use GMainLoop instead of gtk_main

Migrate to GMainLoop because gtk_main is deprecated in GTK 4.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotools/debug-gui: move gtk_main_quit to a function
José Expósito [Thu, 10 Jun 2021 18:06:23 +0000 (20:06 +0200)]
tools/debug-gui: move gtk_main_quit to a function

Wrap the calls to gtk_main_quit in its own function.

Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agomeson.build: disable documentation by default
Peter Hutterer [Tue, 3 Aug 2021 02:10:18 +0000 (12:10 +1000)]
meson.build: disable documentation by default

This does little other than drag in a whole bunch of dependencies. The
libinput documentation is designed to be consumed online, so there's no
need building it on every machine.

We leave the dependencies installed in the images because it's a lot
easier to remove them and test if the build still works than adding them
and dragging in every updated package since we built the image.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: Chuwi AeroBook Plus has a clickpad falsely claiming to have BTN_RIGHT
satrmb [Fri, 30 Jul 2021 20:59:22 +0000 (22:59 +0200)]
quirks: Chuwi AeroBook Plus has a clickpad falsely claiming to have BTN_RIGHT

Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
2 years agotest: Add test for parsing of boolean quirk attributes.
Quytelda Kahja [Fri, 30 Jul 2021 12:53:18 +0000 (05:53 -0700)]
test: Add test for parsing of boolean quirk attributes.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
2 years agodoc: add common failed pipeline errors
José Expósito [Thu, 29 Jul 2021 09:35:02 +0000 (11:35 +0200)]
doc: add common failed pipeline errors

Add a section in the contributing documentation with common pipeline
errors and how to fix them and point to this page when the CI fails.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agogitlab CI: drop dependencies between jobs
Peter Hutterer [Wed, 28 Jul 2021 23:22:48 +0000 (09:22 +1000)]
gitlab CI: drop dependencies between jobs

None of our jobs rely on the artifacts of a previous job, so let's not
pass those around. Make this part of the default policy and include it
from every job.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoAdd section for Lenovo Yoga C930 tablet in 50-system-lenovo.quirks.
Quytelda Kahja [Mon, 26 Jul 2021 03:20:17 +0000 (20:20 -0700)]
Add section for Lenovo Yoga C930 tablet in 50-system-lenovo.quirks.

Fixes #632.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
2 years agoquirks: Add tablet smoothing attribute.
Quytelda Kahja [Mon, 26 Jul 2021 02:23:06 +0000 (19:23 -0700)]
quirks: Add tablet smoothing attribute.

https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/512 disables
input smoothing for AES devices. However, some AES devices produce
segmented/wobbly curves without smoothing. This change introduces an
`AttrTabletSmoothing` boolean property, which overrides the default smoothing
behavior.

See #632

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
2 years agoUpdate quirks/50-system-chuwi.quirks
Sanjiv [Wed, 28 Jul 2021 04:27:56 +0000 (04:27 +0000)]
Update quirks/50-system-chuwi.quirks

Author:    Sanjiv <sanjerat@gmail.com>
Date:      Wed Jul 28 04:27:56 2021 +0000
Signed-off-by: Sanjiv Erat <sanjerat@gmail.com>
2 years agoquirks: add Framework Touchpad Quirk
Kevin Anderson [Wed, 28 Jul 2021 20:44:19 +0000 (16:44 -0400)]
quirks: add Framework Touchpad Quirk

Handle a bug that the touchpad announces BTN_RIGHT

Signed-off-by: Kevin Anderson <andersonkw2@gmail.com>
2 years agogitlab CI: debug the meson_build script
Peter Hutterer [Wed, 28 Jul 2021 02:39:57 +0000 (12:39 +1000)]
gitlab CI: debug the meson_build script

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoDefine the versionsort overrides as inlines
Peter Hutterer [Wed, 28 Jul 2021 01:21:17 +0000 (11:21 +1000)]
Define the versionsort overrides as inlines

Squashes compiler warnings about unused functions given this header is
included in multiple files.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agogitlab CI: use the ci-templates FreeBSD templates
Peter Hutterer [Mon, 26 Jul 2021 01:13:17 +0000 (11:13 +1000)]
gitlab CI: use the ci-templates FreeBSD templates

Replace our cross-compilation for FreeBSD with a proper template.
FreeBSD doesn't do normal containers so we need a bunch of if/else to
skip the container builds.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agogitlab CI: move the SUITES handling to the template where it matters
Peter Hutterer [Wed, 28 Jul 2021 02:43:34 +0000 (12:43 +1000)]
gitlab CI: move the SUITES handling to the template where it matters

Should have been part of 9133693b15eb8211c7b08eb2f486a88d915715f6.

This fixes an issue with calls to meson_build.sh with an otherwise empty
MESON_TEST_ARGS - thanks to the space before $SUITES it would no longer
the zero-string condition in meson_build.sh.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agogitlab CI: update to latest ci-templates
Peter Hutterer [Tue, 27 Jul 2021 23:00:00 +0000 (09:00 +1000)]
gitlab CI: update to latest ci-templates

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agogitlab CI: split the qemu meson build parts out as separate template
Peter Hutterer [Mon, 26 Jul 2021 01:03:03 +0000 (11:03 +1000)]
gitlab CI: split the qemu meson build parts out as separate template

This was part of the test-suite-vm template but to make it easily
re-usable split out the parts that are just about building in a qemu
image from the parts that are specific to running the test suites.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agogitlab CI: name the qemu tags per distribution
Peter Hutterer [Mon, 26 Jul 2021 00:47:18 +0000 (10:47 +1000)]
gitlab CI: name the qemu tags per distribution

Having only one qemu tag worked only because we only had one
distribution using qemu. If we have multiple of those we just
duplicate/overwrite the variable so let's not do that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agodoc/user: move the hold gesture section up to the others
Peter Hutterer [Tue, 27 Jul 2021 04:29:16 +0000 (14:29 +1000)]
doc/user: move the hold gesture section up to the others

Better structuring this way: pinch, swipe, hold, then other comments

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agodoc/user: fix the line alignments for the hold gesture tables
Peter Hutterer [Tue, 27 Jul 2021 04:26:14 +0000 (14:26 +1000)]
doc/user: fix the line alignments for the hold gesture tables

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agodoc/user: make "verifying install" command portable
Andrea Ippolito [Thu, 22 Jul 2021 07:45:45 +0000 (07:45 +0000)]
doc/user: make "verifying install" command portable

According to the linker man page libraries are searched in the following paths:
LD_LIBRARY_PATH environment variable
Paths in the cache file /etc/ld.so.cache
/lib, /usr/lib, /lib64 and /usr/lib64
As we are not using LD_LIBRARY_PATH, we can rely on ldconfig as a fairly portable solution because it "creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/lib and /usr/lib)".

Tested on fedora 34, manjaro 2021.07, kubuntu 21.04

Signed-off-by: Andrea Ippolito <andrea.ippo@gmail.com>
2 years agotouchpad: remove two unused functions
Peter Hutterer [Thu, 22 Jul 2021 05:27:45 +0000 (15:27 +1000)]
touchpad: remove two unused functions

These functions have been unused since 1668cd5e8158a4d98516bfc7432af78be934253f

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoMark some functions as printf-like to silence some compiler warnings
Peter Hutterer [Thu, 22 Jul 2021 05:25:03 +0000 (15:25 +1000)]
Mark some functions as printf-like to silence some compiler warnings

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>