Commit graph

5517 commits

Author SHA1 Message Date
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
Peter Hutterer
2c6fa261a3 evdev: replace the debounce handler with a plugin
Same functionality but run as a plugin on the evdev stream instead.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1230>
2025-06-24 12:01:51 +10:00
Peter Hutterer
7d8fac2868 quirks: add a helper function for returning quirks for a device
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1230>
2025-06-24 12:01:51 +10:00
Peter Hutterer
6f403a0cc9 evdev: replace get_key_type with evdev_usage_is_button/key
Makes this easier to use from other areas and we never cared about the
key type NONE anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1230>
2025-06-24 12:01:51 +10:00
Borui Wang
9b28e7fd35 quirks: disable BTN_RIGHT on MS Surface Pro Flex Keyboard
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1236>
2025-06-23 23:21:12 +00:00
Peter Hutterer
b61a896407 util: fix the ANSI escape codes for bright colors, add some more
The previous incarnations of BRIGHT_FOO were actually bold foo. Change
the colors over to use the actual bright colors and make bold a separate
set of defines.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1240>
2025-06-23 12:52:57 +00:00
Peter Hutterer
0678ef2b98 util: add white to the ansi color escape codes
Can't be used because it's near invisible on white backgrounds
but have it for completeness.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1240>
2025-06-23 12:52:57 +00:00
Peter Hutterer
28a681932c wheel: match the state debug prefix with our other debug logs
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1240>
2025-06-23 12:52:56 +00:00
José Expósito
3a3e292d43 wheel: Rename scroll timeout callback function
The function name doesn't represent what the function really does.

Rename it and be consistent with the naming of other related functions
like wheel_set_scroll_timer() or wheel_cancel_scroll_timer().

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1241>
2025-06-23 02:18:24 +00:00
José Expósito
2461cdf497 wheel: Use libinput_device_has_capability()
Use this helper instead of checking manually.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1241>
2025-06-23 02:18:24 +00:00
José Expósito
35598db1ce wheel: Remove unused argument from fallback_wheel_process_relative()
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1241>
2025-06-23 02:18:24 +00:00
José Expósito
973d5ea587 wheel: Remove unused argument from fallback_rotate_wheel()
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1241>
2025-06-23 02:18:23 +00:00
cptpcrd
84085edc04 pad: honor send-events mode
The custom implementation of the send-events mode for tablet pads does
not actually suspend and resume the device, so events continue to be
sent despite the device being theoretically disabled. Fix this by
removing the custom send-events implementation in favor of
evdev_dispatch's implementation.

Also add a simple test to ensure the send-events mode works.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1238>
2025-06-23 01:58:29 +00:00
Peter Hutterer
fca5154d1d touchpad: fix a debug message "released" -> "is no longer palm"
The touch itself remains down and is now considered a finger again, so
let's make this message less ambiguous.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1239>
2025-06-23 10:40:37 +10:00
Peter Hutterer
29bb231114 plugin: require plugins to enable the frame callback for a device
The vast majority of plugins are only interested in a single or a few
devices. Require that they enable the frame callback for those devices
and don't notify them for any other frames.

Give each plugin a unique index and use that for a bitmask to check if
the plugin wants events for a particular device. If not, skip it.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1229>
2025-06-20 09:06:45 +00:00