Commit graph

5731 commits

Author SHA1 Message Date
Peter Hutterer
e5e41ce7f5 CI: drop the separate python-format job
This is handled as part of the pre-commit hooks now which will also
ensure that we have the same version of ruff everywhere.

Fixes: a61c876412 ("pre-commit: drop black, use ruff-format instead")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1259>
2025-07-09 00:13:00 +00:00
Peter Hutterer
075a6dfaef plugin/wheel: ratelimit the 'missing hires' warning to once a day
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1260>
2025-07-08 04:02:50 +00:00
Peter Hutterer
9b7f933797 plugin/wheel: don't cancel the timer before re-setting it
Not needed and it saves us a bit of busywork.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1260>
2025-07-08 04:02:50 +00:00
Peter Hutterer
892e5d35c7 plugin: use evdev_frame_append_one() for simpler code
Instead of creating a struct and passing it in as array let's use the
helper function.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1260>
2025-07-08 04:02:50 +00:00
Peter Hutterer
a635176632 test: parametrize a test instead of in-test looping
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1260>
2025-07-08 04:02:50 +00:00
Peter Hutterer
9a9466b6a9 evdev: discard any frame with EV_SYN SYN_REPORT 1
When the kernel inserts a repeat frame it does that with EV_KEY code
value of 2 and the frame itself is a SYN_REPORT with value 1. Nothing in
libinput wants those repeat values, so let's discard them here before
anything tries to process them.

This inserted frame causes bugs on touchpads with EV_REP (rare enough)
because while the key event itself is dropped, the timestamp of the
frame still causes the next real frame's delta time to shorten,
resulting in wrong acceleration values.

Closes #1149

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1255>
2025-07-02 23:32:32 +00:00
Peter Hutterer
06d8750504 test: write pad events with a SYN_REPORT 0
The previous loop wrote whatever ring/strip value into the SYN_REPORT
event, causing frames with e.g. EV_SYN SYN_REPORT 7.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1255>
2025-07-02 23:32:32 +00:00
Peter Hutterer
dc48d28d74 test: de-duplicate some pad event handling with a helper
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1255>
2025-07-02 23:32:32 +00:00
Peter Hutterer
ce23e644aa test: keep waiting for a udev device on EAGAIN
This shouldn't happen because we turn off O_NONBLOCK on the udev
monitor's fd but sometimes this call fails with EAGAIN. If that happens,
keep busy-looping until we get some other error or success.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1257>
2025-07-02 12:46:50 +00:00
Peter Hutterer
6104fe44f1 test: if we fail to receive our udev device, abort with a useful error
This frequently fails when the runners are busy, so let's at least print
the errno to have *some* idea of what is failing.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1257>
2025-07-02 12:46:50 +00:00
Peter Hutterer
7135c2fc0c CI: retry valgrind jobs on failure
90% of failed valgrind jobs are caused by a race condition when a runner
is too slow. Instead of waiting for someone to click the retry button
let's just retry immediately again.

This could be fine-tuned to check for valgrind errors vs test suite
errors but for now this should do.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1257>
2025-07-02 12:46:50 +00:00
Peter Hutterer
27f4b0ae74 Move mtdev into a plugin
mtdev is used only for MT Protocol A device of which there are quite
few. But that protocol is also a perfect example for event frames in ->
different event frame out so let's move this into the plugin pipeline.

Because the plugin doesn't really have full access to the device's
internals we set up mtdev base on the libevdev information rather than
just handing it the fd and letting it extract the right info.

A minor functionality change: previously mtdev-backed devices returned
zero on libinput_device_touch_get_touch_count(). Now it is hardcoded to
10 - the number of callers that care about this is likely near zero.

Because it's now neatly factored out into a plugin we can also make
mtdev no longer a strict requirement.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1245>
2025-07-02 06:53:05 +00:00
Peter Hutterer
a86a9aedd6 Switch our internal dispatch interface to take an evdev frame
No functional changes, all the actual interfaces now simply loop through
the frame instead of expecting the dispatcher to do so.

The mtdev code changed slightly since we can shortcut in the non-mtdev
case.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1245>
2025-07-02 06:53:05 +00:00
Peter Hutterer
8141159beb Add evdev_frame_append_one()
This is the most common usage, let's add a helper.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1245>
2025-07-02 06:53:05 +00:00
Peter Hutterer
af6f53d55c git: add git-blame-ignore-revs to ignore the clang-format commits
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1256>
2025-07-02 12:43:13 +10:00
Peter Hutterer
31854a829a plugin: only register the wheel plugin on devices that have a wheel
Touchpad devices are pointers too in libinput but they don't usually
have wheels. Let's check for REL_WHEEL in device_new *and* then again
for the actual pointer capability in device_added.

Fixes: d1800a76fe ("evdev: Handle scroll wheel with a plugin")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1251>
2025-07-01 09:20:57 +00:00
Peter Hutterer
d458b86240 test: correct two capability checks
We have one test device that only has a horizontal scroll wheel but not
a vertical one, causing these tests to run unexpectedly.

One test needs both enabled (not strictly so but let's not bother) and
the other one only needs the vertical wheel.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1251>
2025-07-01 09:20:57 +00:00
Peter Hutterer
e77239f0c7 test: update a test for current kernels
This device was added before high-res scroll events existing in the
kernel and it's used in a test to verify that a device that has
ABS_MT_POSITION_X but not _Y doesn't get automatically ignored.

Said test (device_quirks_no_abs_mt_y) uses a wheel event to verify that
we do get events from this device.

Since then we've long had kernels that support hi-res scrolling and the
kernel takes care of those events for us. So let's update the device
description and the events we send to include the high-resolution
events. That doesn't change the validity of the test but stops it from
becoming a false positive.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1251>
2025-07-01 09:20:57 +00:00
Peter Hutterer
17731d415d Add a clang-format file for consistent code formatting
This *mostly* resembles our current coding style, at least to the extent
possible with clang-format.

There are a few oddities but they're not worth fighting over (for now)
and the most egregious violations have been addressed by shuffling
things around or just disabling clang-format in the previous commits.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:42:44 +10:00
Peter Hutterer
2a1095924b Run clang-format over the code
This uses the .clang-format file in the follow-up commit, but committed
prior to that to ease review of said file and various integrations.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:42:44 +10:00
Peter Hutterer
490084569d test: add missing libevdev and util-mem includes
This only worked because of the include order.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:39:46 +10:00
Peter Hutterer
ed29a4f200 test: disable clang-format in test collections
It's too much effort fighting clang-format for these snippets which
all don't really do much anyway but are important to be read easily.

Let's categorically disable all formatting in the test collections and
move on.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:36:14 +10:00
Peter Hutterer
aebf3cd491 Add trailing commas to prevent clang-format oddities
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:36:14 +10:00
Peter Hutterer
784312a494 test: add clang-format directives to prevent formatting
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:36:14 +10:00
Peter Hutterer
4295c9bc1f test: switch more tests to litest_with_parameters
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:36:14 +10:00
Peter Hutterer
45ab542cc3 test: move a comment to avoid confusing clang-format
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:36:14 +10:00
Peter Hutterer
c83bd808ae test: add missing NULL for a test device's udev properties
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:23:04 +10:00
Peter Hutterer
d6f081730a test: replace some litest_test_param_fetch with getters
The _fetch() api isn't very friendly to clang-format so let's use the
one that results in better formatting.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:23:04 +10:00
Peter Hutterer
3df080513a test: fix automatic -j0 in debugger
If we're running in a debugger we want -j0 set by default so we don't
have to follow forks. This was traditionally JOBS_SINGLE but with
the drop of the check framework it's now -j0.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1253>
2025-06-30 05:58:46 +00:00
Wren Turkal
60abf15755 Fix some inconsistent whitespace.
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1254>
2025-06-29 17:00:15 -07:00
Kacper Piwiński
812bcd68f7 util: use already computed strlen v2
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1252>
2025-06-29 17:38:48 +00:00
Kacper Piwiński
8ab0e53812 util: don't call function in macro argument v2
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1252>
2025-06-29 07:32:25 +00:00
Kacper Piwiński
8c15a01d16 util: don't call function in macro argument
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1252>
2025-06-29 07:21:27 +00:00
Kacper Piwiński
0c2fd88580 util: use already computed strlen
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1252>
2025-06-29 06:51:51 +00:00
Kacper Piwiński
cc3f0c783a util: change n type to size_t in strneq
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1252>
2025-06-29 06:38:52 +00:00
Peter Hutterer
2b22a0b4ba meson.build: require libevdev 1.10
Released in 2020, that's plenty old enough now to get rid of an ifdef.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1250>
2025-06-27 08:21:13 +00:00
Peter Hutterer
2e0c3c4af4 test: only check error messages for bugs
The use of the bug log handler should be replaced with the captured logs
now but meanwhile: don't abort if we're running in --verbose mode and
something prints a debug message before our expected bug error message.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1250>
2025-06-27 08:21:13 +00:00
Peter Hutterer
d9a949657e touchpad: rename a function for consistency
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1250>
2025-06-27 08:21:13 +00:00
Peter Hutterer
fc70dc90f0 test: replace two goto outs with _unref_
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1250>
2025-06-27 08:21:13 +00:00
Peter Hutterer
dc8f7c3671 util: allow strv_from_string() with NULL nelems
The caller may not care about the number of elements, let them be
careless.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1250>
2025-06-27 08:21:13 +00:00
Peter Hutterer
9a8254fbb6 doc/user: update architecture docs with the plugin pipeline
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1248>
2025-06-27 04:11:40 +00:00
José Expósito
d1800a76fe evdev: Handle scroll wheel with a plugin
Transform the code present in evdev-wheel.c into a internal plugin.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1235>
2025-06-25 00:43:29 +00:00
José Expósito
ee35e04207 wheel: Remove unnecessary pending event
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1235>
2025-06-25 00:43:29 +00:00
José Expósito
5bc683c8dd wheel: Drop high-resolution wheel emulation workaround
Remove the workaround used to emulate high-resolution wheel scroll
events on kernels < 5.0 (~6 years old kernels).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1235>
2025-06-25 00:43:29 +00:00
José Expósito
ed3cb9cc48 fallback: Remove fallback_init_debounce() declaration
A leftover from commit 2c6fa261a3 ("evdev: replace the debounce
handler with a plugin")

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1247>
2025-06-24 10:12:12 +02:00
Peter Hutterer
e99f0c995e evdev: rename evdev_device_dispatch_one to evdev_device_dispatch_frame
Because it now takes a frame as argument, no longer a single event.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1244>
2025-06-24 03:14:16 +00:00
Peter Hutterer
f003dbb6cb plugins: fix the timer name for the tablet proximity timer
Since every device has one of those, let's name it after the device's
system.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1244>
2025-06-24 03:14:16 +00:00
Peter Hutterer
d2316d7e93 plugins: fix some indentation in the eraser button plugin
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1244>
2025-06-24 03:14:16 +00:00
Peter Hutterer
65e7cd5953 tools: handle an empty quirks list in the libinput recording
Fixes: 548279abee ("tools: store virtual property in recordings")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1243>
2025-06-24 02:57:31 +00:00
Peter Hutterer
a2694738cb tools: per-slot-delta initialize the pressure thresholds to zero
Python is unhappy about comparing None to > 0

Fixes: 9c042e9620 ("tools: add pressure threshold support to analyze per-slot-delta")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1243>
2025-06-24 02:57:31 +00:00