platform/upstream/libinput.git
6 months agolibinput 1.27.0 1.27.0
Peter Hutterer [Tue, 19 Nov 2024 03:41:21 +0000 (13:41 +1000)]
libinput 1.27.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 months agoquirks: lower AttrTrackpointMultiplier for ThinkPad X200/201 to 0.25
Mingcong Bai [Thu, 14 Nov 2024 13:57:52 +0000 (21:57 +0800)]
quirks: lower AttrTrackpointMultiplier for ThinkPad X200/201 to 0.25

Upstream commit 43cd2cbf83e0 ("data: add the dell trackpoint multipliers")
broke the default acceleration profile on Lenovo ThinkPad X200/201, where
the cursor speeds became so quick that it was practically impossible to
control. Merely dragging on the TrackPoint lightly would result in the
cursor flying from corner-to-corner.

I have tested on a Lenovo ThinkPad X201 to find
`AttrTrackpointMultiplier=0.25' the most reasonable and closest to the
default behaviour on Windows 7 with Lenovo's driver.

Not sure about ThinkPad X200s/201s, but I suspect that they would have
similar issues (with the multiplier set to 1.25). I have just ordered both
models to experiment with and will report back with another patch if I
find similar issue.

Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1080>

7 months agoquirks: add pressure pad quirk for Lenovo ThinkBook 14 G7+ ASP
Mingcong Bai [Tue, 12 Nov 2024 03:29:27 +0000 (11:29 +0800)]
quirks: add pressure pad quirk for Lenovo ThinkBook 14 G7+ ASP

Some Lenovo ThinkBook 14 G7+ ASP models ship with pressure pads (nominally
"Force Pad"). However, they do not appear to be declared as such by the
firmware.

Add a quirk to make them work.

Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1079>

7 months agozsh: update completion to include latest debug-events options
Peter Hutterer [Mon, 4 Nov 2024 21:52:18 +0000 (07:52 +1000)]
zsh: update completion to include latest debug-events options

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1077>

7 months agozsh: sort the debug-events argument (mostly) alphabetically
Peter Hutterer [Mon, 4 Nov 2024 21:45:10 +0000 (07:45 +1000)]
zsh: sort the debug-events argument (mostly) alphabetically

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1077>

7 months agotablet: ignore movements started outside the configured area
Peter Hutterer [Fri, 1 Nov 2024 04:30:51 +0000 (14:30 +1000)]
tablet: ignore movements started outside the configured area

If a tablet has an area configured and the pen goes into proximity
outside this area, ignore all events from this sequence. This truly
deactivates that area so it can even be used for e.g. placing a pen
there.

For simplicity, a sequence that starts outside the configured area will
be completely ignored, i.e. moving into the tablet area will not trigger
any fake proximity events as we cross into the allowed area. This
requires quite a bit of effort and it's unclear if it's really needed by
users - we can reconsider when we get complaints.

We do however accept a proximity event within within 3% of the
configured area.  This gives us 6mm on a 200mm tablet where we can move
in from the area and still have events work, i.e. some error margin for
where a user needs both an area and work closes to the edge of that
area.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>

7 months agotablet: implement support for area configuration for external tablets
Peter Hutterer [Thu, 13 Jun 2024 00:31:37 +0000 (10:31 +1000)]
tablet: implement support for area configuration for external tablets

For external tablets like the Intuos series we now expose the area
rectangle configuration and the (minimum) implementation required to
make this work.

Because an area configuration may apply late and tablet events usually
get scaled by the compositor we need to store the current axis extents
in each event. This is to behave correctly in this events sequence:

1. tool proximity in
2. caller changes config, config is pending
3. tool moves, generates events
4. tool goes out of prox, new config applies
5. caller processes motion events from step 3

If the caller in step five uses any of the get_x_transformed calls these
need to be scaled relative to the original area, not the one set in
step 2.

The current implementation merely clips into the area so moving a stylus
outside the area will be equivalent to moving it along the respective
edge of the area. It's not a true dead zone yet.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>

7 months agoAdd tablet area configuration
Peter Hutterer [Wed, 12 Jun 2024 23:00:21 +0000 (09:00 +1000)]
Add tablet area configuration

This adds the configuration option to define a rectangle that serves as
an input area on external tablets such as an Intuos.

The intention behind this is to make this input area behave as if it was
the only physical input area on this tablet with libinput emulating
proximity events as required for where the tools moves in and out
of this area.

This could also be achieved with the existing calibration setting but
area configuration is not calibration and we don't want to expose other
side-effects of the matrix (e.g. scaling and rotation) for these
devices.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>

7 months agotablet: use our absinfo_x/y struct instead of the libevdev one
Peter Hutterer [Fri, 14 Jun 2024 00:36:59 +0000 (10:36 +1000)]
tablet: use our absinfo_x/y struct instead of the libevdev one

device->abs.absinfo_x/y points to the x/y axis we want to use and
that axis is used in all the evdev helper function. For consistency
use that one here too.

This is for consistency only and has no effect on tablet devices, the
only time this isn't ABS_X/Y is on multitouch devices where that points to
ABS_MT_POSITION_X/Y.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>

7 months agoMove evdev_convert_to_mm to a more generic helper
Peter Hutterer [Thu, 13 Jun 2024 04:10:06 +0000 (14:10 +1000)]
Move evdev_convert_to_mm to a more generic helper

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>

7 months agoMove scale_axis to a utility header so we can re-use it better
Peter Hutterer [Thu, 13 Jun 2024 03:09:44 +0000 (13:09 +1000)]
Move scale_axis to a utility header so we can re-use it better

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>

7 months agotools/debug-events: print bugs in bold red
Peter Hutterer [Fri, 1 Nov 2024 06:00:12 +0000 (16:00 +1000)]
tools/debug-events: print bugs in bold red

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>

7 months agoeditorconfig: add settings for sym files
José Expósito [Mon, 4 Nov 2024 09:25:00 +0000 (10:25 +0100)]
editorconfig: add settings for sym files

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1076>

7 months agotools: sort the options in debug-events match page
Peter Hutterer [Mon, 4 Nov 2024 05:48:21 +0000 (15:48 +1000)]
tools: sort the options in debug-events match page

We now have enough config options that having them unsorted makes it
hard to find the right option.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1075>

7 months agotablet: default to a built-in tablet
Peter Hutterer [Tue, 29 Oct 2024 10:17:00 +0000 (20:17 +1000)]
tablet: default to a built-in tablet

The vast majority of devices that libwacom doesn't know about are the
various built-in ones. Since the only effect in our code here is that we
enable the calibration matrix, let's default to built-in if we don't
know any better - better to have the matrix and not use it than to not
be able to calibrate a tablet.

Note that libwacom 2.11 and later also now default to a built-in tablet.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1074>

7 months agotest: fix two race conditions waiting for proximity events
Peter Hutterer [Thu, 31 Oct 2024 05:10:11 +0000 (15:10 +1000)]
test: fix two race conditions waiting for proximity events

This test does a prox in/out and immediately drains events.
Where we are slow enough we may drain only one (or none) of the
proximity events which causes a failure later in the test.

Similar issue with the second test where we may get a delayed tip event.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1074>

7 months agotablet: centralize the libwacom handling
Peter Hutterer [Mon, 28 Oct 2024 23:46:05 +0000 (09:46 +1000)]
tablet: centralize the libwacom handling

Instead of re-creating the the libwacom device from the database every
time we need it let's create it once during tablet|pad_init and pass it
down to the functions.

This allows us to have one point per tablet/pad where we can log an
error if the device is not supported by libwacom - previously this was
printed during the left-handed setup.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1073>

7 months agotablet: minor rework to remove one ifdef HAVE_LIBWACOM
Peter Hutterer [Mon, 28 Oct 2024 23:23:09 +0000 (09:23 +1000)]
tablet: minor rework to remove one ifdef HAVE_LIBWACOM

Change to a boolean for more obvious return values and move the ifdef
into the function so we can skip the ifdef in the caller.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1073>

7 months agopad: support dial modeswitch buttons
Peter Hutterer [Mon, 28 Oct 2024 01:46:27 +0000 (11:46 +1000)]
pad: support dial modeswitch buttons

This requires unreleased updates to libwacom [1], currently hiding
behind an ifdef so we don't require that particular version.

[1] https://github.com/linuxwacom/libwacom/pull/805

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>

7 months agopad: rework the tablet pad mode setup
Peter Hutterer [Thu, 24 Oct 2024 05:47:02 +0000 (15:47 +1000)]
pad: rework the tablet pad mode setup

This was historically based on the LEDs on the device: we'd loop through
the LEDs and assign them to pad mode groups, then figure out which
button is the mode toggle for that group and finally which buttons
are in the same position as that toggle button.

Devices like the XP Pen ACK05 Remote don't have LEDs though but they do
have a mode toggle button [1] inside the dial. Let's support those by
switching the initialization on its head: search for mode toggle
buttons, create a mode group per toggle button, then associate
LEDs with that group.

The outcome should be functionally the same for devices with LEDs but
allows us to create mode groups where no LEDs exist.

Closes #1045

[1] As per Windows default button behavior

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>

7 months agopad: don't clobber the errno if the pad led failed to initialize
Peter Hutterer [Thu, 24 Oct 2024 04:47:38 +0000 (14:47 +1000)]
pad: don't clobber the errno if the pad led failed to initialize

pad_led_destroy() may call something that sets errno, so let's protect
against that.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>

7 months agopad: remove an unused argument
Peter Hutterer [Thu, 24 Oct 2024 04:27:30 +0000 (14:27 +1000)]
pad: remove an unused argument

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>

7 months agopad: rename an argument for more clarity
Peter Hutterer [Wed, 23 Oct 2024 02:49:35 +0000 (12:49 +1000)]
pad: rename an argument for more clarity

Yes, we're using the LED count here but what it is used for is the
number of modes.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>

7 months agotest: mark the pad group tests as basically broken by expectation
Peter Hutterer [Thu, 24 Oct 2024 10:17:27 +0000 (20:17 +1000)]
test: mark the pad group tests as basically broken by expectation

Since our implementation uses the sysfs LED files and we don't have
those, all our test devices have the single fallback mode and no
more. Add a comment to all these tests to make that clear and enforce a
single mode only so it's more obvious.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>

7 months agotest: fix 3 compiler warnings when building without libwacom
Peter Hutterer [Mon, 28 Oct 2024 05:56:33 +0000 (15:56 +1000)]
test: fix 3 compiler warnings when building without libwacom

signed/unsigned and an unused variable.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>

7 months agotest: fix strip values being passed to ring functions
Peter Hutterer [Mon, 28 Oct 2024 05:54:05 +0000 (15:54 +1000)]
test: fix strip values being passed to ring functions

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>

7 months agoCI: collect valgrind log files too
Peter Hutterer [Mon, 21 Oct 2024 03:35:00 +0000 (13:35 +1000)]
CI: collect valgrind log files too

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: add --output-file to print test logs to a file
Peter Hutterer [Mon, 21 Oct 2024 02:12:45 +0000 (12:12 +1000)]
test: add --output-file to print test logs to a file

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: drop the --xml-prefix option
Peter Hutterer [Mon, 21 Oct 2024 02:08:00 +0000 (12:08 +1000)]
test: drop the --xml-prefix option

litest-runner outputs in YAML and no-one ever looks at the XML files
anyway. They are used to provide nice pipeline summaries but again,
no-one looks at those because they're not very useful.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agoCI: disable forking for valgrind tests
Peter Hutterer [Mon, 21 Oct 2024 01:12:58 +0000 (11:12 +1000)]
CI: disable forking for valgrind tests

With the new test suite runner we get one fork per test which will
eventually slow down valgrind enough so our tests fail.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: add --filter-rangeval to only run tests with a range value
Peter Hutterer [Wed, 16 Oct 2024 23:04:36 +0000 (09:04 +1000)]
test: add --filter-rangeval to only run tests with a range value

For ranged tests (e.g. gesture tests) it's convenient to be able to run
those with a value of N (e.g. 3 fingers) instead ov having to run all of
them all the time.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: add ability to collect test results from a nonforking test
Peter Hutterer [Wed, 16 Oct 2024 22:29:22 +0000 (08:29 +1000)]
test: add ability to collect test results from a nonforking test

Use longjmp to try to get out of a test error. This will only work for
errors triggered by our own test suite (i.e. not for SIGSEGV and
friends) but that's good enough for most things.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: move the quirks setup into the global setup func
Peter Hutterer [Wed, 16 Oct 2024 08:31:51 +0000 (18:31 +1000)]
test: move the quirks setup into the global setup func

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: add runner support for a global setup/teardown func
Peter Hutterer [Wed, 16 Oct 2024 08:31:35 +0000 (18:31 +1000)]
test: add runner support for a global setup/teardown func

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: the created files list doesn't need to be a global
Peter Hutterer [Wed, 16 Oct 2024 01:08:41 +0000 (11:08 +1000)]
test: the created files list doesn't need to be a global

This list was used in the signal handler but that is no longer the case,
so let's localize this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: move the rest of the custom initialization to litest_run
Peter Hutterer [Wed, 16 Oct 2024 01:04:08 +0000 (11:04 +1000)]
test: move the rest of the custom initialization to litest_run

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: move tty disabling closer to the actual running of the tests
Peter Hutterer [Wed, 16 Oct 2024 01:02:21 +0000 (11:02 +1000)]
test: move tty disabling closer to the actual running of the tests

And move the litest-specific condition out into the caller so
disable_tty() only cares about the TTY, not any surrounding conditions.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: only force gdb to no-fork, valgrind can fork
Peter Hutterer [Tue, 15 Oct 2024 09:27:39 +0000 (19:27 +1000)]
test: only force gdb to no-fork, valgrind can fork

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: intercept and collect valgrind errors
Peter Hutterer [Tue, 15 Oct 2024 07:05:06 +0000 (17:05 +1000)]
test: intercept and collect valgrind errors

This works because we always invoke with --exit-errorcode=3 from the
test suite. It won't work for manual invocations but oh well.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: move litest_free_test_list to inside ifndef NO_MAIN
Peter Hutterer [Tue, 15 Oct 2024 05:47:19 +0000 (15:47 +1000)]
test: move litest_free_test_list to inside ifndef NO_MAIN

This is now only called from one spot, so let's move it so it is
ifdef'd out.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: make the utils test a "pure" litest-runner test
Peter Hutterer [Tue, 15 Oct 2024 05:46:07 +0000 (15:46 +1000)]
test: make the utils test a "pure" litest-runner test

Now that we have the runner let's use it directly for this set of simple
test.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: add --exit-first to the litest test suite runner
Peter Hutterer [Tue, 15 Oct 2024 05:28:56 +0000 (15:28 +1000)]
test: add --exit-first to the litest test suite runner

Exits upon the first failed test.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: remove now-unused check-double-macros.h
Peter Hutterer [Sat, 12 Oct 2024 10:24:44 +0000 (20:24 +1000)]
test: remove now-unused check-double-macros.h

We no longer use those functions, so let's drop them.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: move the quirks context init into litest_run
Peter Hutterer [Wed, 16 Oct 2024 01:18:24 +0000 (11:18 +1000)]
test: move the quirks context init into litest_run

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: add litest-runner as test suite runner
Peter Hutterer [Sat, 12 Oct 2024 00:31:42 +0000 (10:31 +1000)]
test: add litest-runner as test suite runner

This replaces check. The code is a copy of pwtest which I wrote years
ago for pipewire but adjusted for us here the last few days.

There are a few advantages over check:
- Ability to SKIP tests or mark them as NOT_APPLICABLE, the latter
  of which is used for early checks if a device doesn't meet
  requirements.
- it captures stdout/stderr separately
- colors!
- YAML output format makes it a lot easier to read the results and
  eventually parse them for e.g. "restart failed tests"

Less abstraction: we set up the tests, pass them to the runner and run
them with the given number of forks. This is an improvement over before
where we forked into N test suites which each called check which then
forked again. Since we're now keeping track of those processes
ourselves we can also write tests that are expected to fail with
signals.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: fix utils test for types for litest assertions
Peter Hutterer [Sat, 12 Oct 2024 10:31:11 +0000 (20:31 +1000)]
test: fix utils test for types for litest assertions

check always typecasts to intmax_t so a lot of type mismatches were
hidden.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: convert utils test to litest_assert
Peter Hutterer [Sat, 12 Oct 2024 10:32:34 +0000 (20:32 +1000)]
test: convert utils test to litest_assert

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: make the utils test another litest
Peter Hutterer [Sat, 12 Oct 2024 10:20:14 +0000 (20:20 +1000)]
test: make the utils test another litest

This doesn't really gain us anything for now but it's prep work for
dropping check and the custom invocations of check.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agoutil: add a generic stringbuffer with a few helper functions
Peter Hutterer [Fri, 11 Oct 2024 05:52:04 +0000 (15:52 +1000)]
util: add a generic stringbuffer with a few helper functions

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agoutil: add the range handling as separate header file
Peter Hutterer [Mon, 14 Oct 2024 04:39:07 +0000 (14:39 +1000)]
util: add the range handling as separate header file

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: move the deviceless check into ltest_add_tcase
Peter Hutterer [Wed, 16 Oct 2024 01:21:29 +0000 (11:21 +1000)]
test: move the deviceless check into ltest_add_tcase

This is out of place here, check this when we are about
to add the test, not later when the tests are about to be run.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: filter out duplicate name/device combos in --list
Peter Hutterer [Sun, 13 Oct 2024 23:24:26 +0000 (09:24 +1000)]
test: filter out duplicate name/device combos in --list

This doesn't have an effect yet because ranged tests are handled inside
check. But in the future these tests will be split up individually so
de-duplicating is useful here.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: make litest_backtrace() available from outside litest.c
Peter Hutterer [Sat, 12 Oct 2024 00:35:29 +0000 (10:35 +1000)]
test: make litest_backtrace() available from outside litest.c

Prep-work for adding a new runner

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agotest: append, not insert the suites
Peter Hutterer [Thu, 17 Oct 2024 01:45:22 +0000 (11:45 +1000)]
test: append, not insert the suites

list_append() came later than list_insert() and there's an argument to
be made that tests added later should be run first since they're less
likely to succeed. But it's a lot harder to read test logs when they are
in reverse order, and with the TEST_COLLECTION() macro the order of the
test suite is not obvious anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agoutil: add a bunch more time conversions
Peter Hutterer [Mon, 21 Oct 2024 01:07:34 +0000 (11:07 +1000)]
util: add a bunch more time conversions

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agoutil: move libinput_now() into a utility function
Peter Hutterer [Mon, 21 Oct 2024 01:07:14 +0000 (11:07 +1000)]
util: move libinput_now() into a utility function

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agoutil: add xclose(fd) to close-and-reset an fd
Peter Hutterer [Tue, 15 Oct 2024 01:52:12 +0000 (11:52 +1000)]
util: add xclose(fd) to close-and-reset an fd

This prevents accidentally leaving the fd set after closing.

And it includes the -1 check so we don't need this everywhere ourselves
(not that we use it right now but valgrind likes to complain about
this).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>

7 months agopre-commit: drop black, use ruff-format instead
Peter Hutterer [Tue, 29 Oct 2024 03:25:20 +0000 (13:25 +1000)]
pre-commit: drop black, use ruff-format instead

And switch to the current-ish version of the ruff pre-commit hook,
including updating the repo.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1072>

7 months agotools: change direct type check to isinstance
Peter Hutterer [Tue, 29 Oct 2024 03:26:57 +0000 (13:26 +1000)]
tools: change direct type check to isinstance

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1072>

7 months agoutil: make a float to int conversion explicit
Peter Hutterer [Wed, 19 Jun 2024 23:50:15 +0000 (09:50 +1000)]
util: make a float to int conversion explicit

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1071>

7 months agoutil: add the backtrace printing function as separate util
Peter Hutterer [Sun, 20 Oct 2024 23:16:04 +0000 (09:16 +1000)]
util: add the backtrace printing function as separate util

Might as well make this easier to re-use since it doesn't do anything
specific to litest.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1066>

7 months agopad: default a pad group to mode 0 if all LEDs are off
Peter Hutterer [Tue, 22 Oct 2024 05:03:09 +0000 (15:03 +1000)]
pad: default a pad group to mode 0 if all LEDs are off

Since our API doesn't accomodate for "dunno" we need to pick a mode that
we are actually in. This happens on the Intuos Pro 2 (PTH-660) which has
all LEDs on brightness zero, resulting in a failure to set up the modes
and we're left without a mode button.

Fix it by just picking zero as the default mode until specified
otherwise.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1069>

7 months agopad: move a function to save on an ifdef
Peter Hutterer [Tue, 22 Oct 2024 03:34:46 +0000 (13:34 +1000)]
pad: move a function to save on an ifdef

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1069>

7 months agopad: don't print a clobbered errno
Peter Hutterer [Tue, 22 Oct 2024 02:15:04 +0000 (12:15 +1000)]
pad: don't print a clobbered errno

is_litest_device() may change errno since it calls into libudev.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1069>

7 months agotools: print full pad mode group info in libinput-list-devices
Peter Hutterer [Tue, 22 Oct 2024 01:55:09 +0000 (11:55 +1000)]
tools: print full pad mode group info in libinput-list-devices

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1068>

7 months agotools: add rel dial support to libinput-list-devices
Peter Hutterer [Tue, 22 Oct 2024 01:54:45 +0000 (11:54 +1000)]
tools: add rel dial support to libinput-list-devices

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1068>

7 months agotest: split the touchpad tests into a palm and a dwt test collection
Peter Hutterer [Thu, 17 Oct 2024 23:42:11 +0000 (09:42 +1000)]
test: split the touchpad tests into a palm and a dwt test collection

dwt and palm tests have a lot of timeouts to wait for so let's split
those out.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agotest: split the tablet left-handed tests out into a separate collection
Peter Hutterer [Thu, 17 Oct 2024 23:30:12 +0000 (09:30 +1000)]
test: split the tablet left-handed tests out into a separate collection

These aren't complicated but there's a lot of them so let's run them
separately to make the overall tablet test shorter.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agoCI: move the "device" test suite to the "misc" set of suites
Peter Hutterer [Thu, 17 Oct 2024 22:56:38 +0000 (08:56 +1000)]
CI: move the "device" test suite to the "misc" set of suites

That one is still with the gestures but only takes 1-2 minutes, the
gestures takes 13 minutes. Let's move it to misc which currently has an
overall runtime of only 2 min anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agotest: split out the touchpad tap tests into multiple collections
Peter Hutterer [Thu, 17 Oct 2024 09:35:16 +0000 (19:35 +1000)]
test: split out the touchpad tap tests into multiple collections

These take a long time and have a reasonable high chance of failure due
to the timing constraints. Let's split them up so they don't hog the
runners for that long and in case they fail, we only need to re-run a
short test.

Before: one test running approx 21 min, now 3 tests running approx 7 +
11 + 4 min.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agomeson: break out the test suites into manual list
Peter Hutterer [Thu, 17 Oct 2024 09:34:11 +0000 (19:34 +1000)]
meson: break out the test suites into manual list

If we start having multiple TEST_COLLECTION() in the same file we can
no longer use the file name - so a manually maintained list it is.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agotest: make the TEST_COLLECTION() macro re-usable in the same file
Peter Hutterer [Thu, 17 Oct 2024 09:25:39 +0000 (19:25 +1000)]
test: make the TEST_COLLECTION() macro re-usable in the same file

Concat the line number to the generated variable names, this way we can
have more than one TEST_COLLECTION() in the same file.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agotest: detach the suite handling from the file names
Peter Hutterer [Thu, 17 Oct 2024 09:55:25 +0000 (19:55 +1000)]
test: detach the suite handling from the file names

Instead of extracting the suite name from the test's file name use the
current suite that is being parsed. This way we pave the way for
multiple suites in the same file.

This uses a global because otherwise we'd have to redo all the
litest_add() functions but it does the job here.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agotest: match the tablet's pad test collection with the file name
Peter Hutterer [Thu, 17 Oct 2024 10:30:08 +0000 (20:30 +1000)]
test: match the tablet's pad test collection with the file name

This is currently a requirement, so let's match this before we run
into issues here re-structuring stuff.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agotablet: fix a memory leak caused by an early return
Peter Hutterer [Thu, 17 Oct 2024 22:38:47 +0000 (08:38 +1000)]
tablet: fix a memory leak caused by an early return

Previously we'd return early, failing to libwacom_destroy() the device.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1064>

7 months agoCI: set the LITEST_JOBS in the template, not the script
Peter Hutterer [Thu, 17 Oct 2024 03:57:19 +0000 (13:57 +1000)]
CI: set the LITEST_JOBS in the template, not the script

Fixes: 70c57e964450 ("CI: drop the job count for the valgrind test suite to 2")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1063>

7 months agotest: use a litest helper instead of return code comparison
Peter Hutterer [Wed, 16 Oct 2024 01:27:27 +0000 (11:27 +1000)]
test: use a litest helper instead of return code comparison

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: rename a variable to indicate suites, not tests
Peter Hutterer [Wed, 16 Oct 2024 01:26:15 +0000 (11:26 +1000)]
test: rename a variable to indicate suites, not tests

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: rename all_tests to all_test_suites
Peter Hutterer [Wed, 16 Oct 2024 01:24:15 +0000 (11:24 +1000)]
test: rename all_tests to all_test_suites

This is a a list of struct suite with the various tests inside that
suite.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: check for verbosity immediately in main()
Peter Hutterer [Wed, 16 Oct 2024 01:14:11 +0000 (11:14 +1000)]
test: check for verbosity immediately in main()

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: check for empty tests immediately, not later when we're running
Peter Hutterer [Wed, 16 Oct 2024 01:12:42 +0000 (11:12 +1000)]
test: check for empty tests immediately, not later when we're running

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: init the global devices/test lists immediately
Peter Hutterer [Wed, 16 Oct 2024 01:10:18 +0000 (11:10 +1000)]
test: init the global devices/test lists immediately

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: add restore_tty helper and use it
Peter Hutterer [Wed, 16 Oct 2024 00:55:55 +0000 (10:55 +1000)]
test: add restore_tty helper and use it

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: init the device list via argument
Peter Hutterer [Wed, 16 Oct 2024 00:26:31 +0000 (10:26 +1000)]
test: init the device list via argument

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: add a helper for deleting a created file
Peter Hutterer [Tue, 15 Oct 2024 01:46:58 +0000 (11:46 +1000)]
test: add a helper for deleting a created file

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: switch a bunch of tests from abort() to one with a message
Peter Hutterer [Mon, 14 Oct 2024 11:35:36 +0000 (21:35 +1000)]
test: switch a bunch of tests from abort() to one with a message

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: fix litest_abort_msg() not starting a new line
Peter Hutterer [Mon, 14 Oct 2024 11:42:26 +0000 (21:42 +1000)]
test: fix litest_abort_msg() not starting a new line

Most callers of litest_abort_msg() don't add '\n' so the output was
mangled.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agodoc: correct that the test suite is indeed run in the CI
Peter Hutterer [Tue, 15 Oct 2024 05:31:52 +0000 (15:31 +1000)]
doc: correct that the test suite is indeed run in the CI

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: switch the tests to use enum comparisons
Peter Hutterer [Mon, 16 Sep 2024 06:49:38 +0000 (16:49 +1000)]
test: switch the tests to use enum comparisons

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: add macros to compare enum values
Peter Hutterer [Mon, 16 Sep 2024 06:30:40 +0000 (16:30 +1000)]
test: add macros to compare enum values

This requires switching a lot of int_eq/int_ne over to enum_eq/enum_ne
because the compiler doesn't infer the right type from a harcoded enum
value - it just defaults to int.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: switch a bunch of integer comparisons to right sizes
Peter Hutterer [Fri, 11 Oct 2024 03:55:56 +0000 (13:55 +1000)]
test: switch a bunch of integer comparisons to right sizes

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: switch ck_assert over to litest_assert
Peter Hutterer [Mon, 16 Sep 2024 06:20:26 +0000 (16:20 +1000)]
test: switch ck_assert over to litest_assert

This is the first step in switching away from the check framework.
Our litest macros already do almost exactly the same anyway so most of
this is a simple sed with a few compiler fixes where things mismatch
(nonnull -> notnull) and (_tol -> _epsilon).

This now generates a whole bunch of integer mismatch warnings: check
casts everything to intmax_t whereas we use typeof, so lots of warnings
especially for enums.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: add litest string comparison macros
Peter Hutterer [Mon, 16 Sep 2024 06:13:44 +0000 (16:13 +1000)]
test: add litest string comparison macros

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: replace manual "almost equal" with the new double epsilon
Peter Hutterer [Mon, 14 Oct 2024 00:14:56 +0000 (10:14 +1000)]
test: replace manual "almost equal" with the new double epsilon

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: fix some checks using ints to compare doubles
Peter Hutterer [Mon, 14 Oct 2024 05:26:57 +0000 (15:26 +1000)]
test: fix some checks using ints to compare doubles

Theoretically we should be using ck_assert_double_eq here for
consistency but this patch  is part of a series eventually
replacing those calls, so let's jump to litest_assert_double
directly to avoid further rebase conflicts.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: fix a touch test comparing ints to doubles
Peter Hutterer [Mon, 14 Oct 2024 05:20:21 +0000 (15:20 +1000)]
test: fix a touch test comparing ints to doubles

We were checking doubles for integers but better to check that we're
close to the maximum range without actually being over.

This worked because check typecasts to uint_max_t but let's be explicit
here.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: add a macro to compare two doubles with a specific epsilon
Peter Hutterer [Mon, 16 Sep 2024 06:05:11 +0000 (16:05 +1000)]
test: add a macro to compare two doubles with a specific epsilon

Same as ck_assert_double_tol

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: initialize a variable to make scan-build happy
Peter Hutterer [Sun, 13 Oct 2024 01:06:39 +0000 (11:06 +1000)]
test: initialize a variable to make scan-build happy

Assuming safe_atoi works as expected, `fuzz` cannot be
uninitialized by the time we get here. But let's init it anyway to make
scan-build happy.

[202/249] Compiling C object libinput-test-suite.p/test_test-touch.c.o
../../../test/test-touch.c:964:2: warning: Assigned value is garbage or undefined [core.uninitialized.Assign]
  964 |         litest_assert_int_eq(fuzz, 10); /* device-specific */
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note that this error message is the result of a follow-up commit,
this commit is shuffled before so we have bisectable build.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: add litest_assert_event_type_not_one_of
Peter Hutterer [Mon, 14 Oct 2024 08:58:24 +0000 (18:58 +1000)]
test: add litest_assert_event_type_not_one_of

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: replace ck_abort with litest_abort_msg()
Peter Hutterer [Tue, 8 Oct 2024 09:27:28 +0000 (19:27 +1000)]
test: replace ck_abort with litest_abort_msg()

Weirdly, that also required initializing two variables to NULL to stop a
compiler warning.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>