platform/upstream/libinput.git
2 years agoevdev: apply calibration for touch arbitration
hrdl [Thu, 2 Feb 2023 06:52:40 +0000 (07:52 +0100)]
evdev: apply calibration for touch arbitration

Rectangle-based touch arbitration should respect calibration. This
fixes #853.

Signed-off-by: hrdl <git@hrdl.eu>
2 years agoevdev-tablet: clip touch arbitration rectangle
hrdl [Tue, 7 Feb 2023 10:19:35 +0000 (11:19 +0100)]
evdev-tablet: clip touch arbitration rectangle

Previously the arbitration rectangle would be moved to lie completely in
the first quadrant of the coordinate system.

Signed-off-by: hrdl <51402-hrdl@users.noreply.gitlab.freedesktop.org>
2 years agoquirk: Google Chromebook Atlas (Pixelbook go)
gogogoghost [Sun, 5 Feb 2023 08:31:18 +0000 (16:31 +0800)]
quirk: Google Chromebook Atlas (Pixelbook go)

Signed-off-by: Jax Leach <heiguiyj@gmail.com>
2 years agotools: add --replay-after and --once to libinput replay
Peter Hutterer [Fri, 3 Feb 2023 04:16:27 +0000 (14:16 +1000)]
tools: add --replay-after and --once to libinput replay

For the cases where it's not possible to hit enter to start the replay
because e.g. we cannot change focus, etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: add generic quirk for Dell 2-in-1 models for side volume buttons
Bill A [Mon, 6 Feb 2023 17:46:01 +0000 (17:46 +0000)]
quirks: add generic quirk for Dell 2-in-1 models for side volume buttons

Signed-off-by: Bill A's avatarBill A <vukk.euob@gmail.com>
2 years agofilter: validate custom acceleration function's points size
Yinon Burgansky [Thu, 26 Jan 2023 23:23:35 +0000 (01:23 +0200)]
filter: validate custom acceleration function's points size

Adds min and max size limit for custom acceleration function's points.
Adds tests to make sure validation works properly.

Signed-off-by: Yinon Burgansky <51504-Yinon@users.noreply.gitlab.freedesktop.org>
2 years agoquirk: Lenovo P14s Gen 1 AMD Trackpoint
Diep Pham [Sat, 28 Jan 2023 16:06:06 +0000 (16:06 +0000)]
quirk: Lenovo P14s Gen 1 AMD Trackpoint

2 years agodoc/user: fix trackpoint quirks path
José Expósito [Mon, 23 Jan 2023 18:26:12 +0000 (19:26 +0100)]
doc/user: fix trackpoint quirks path

Fix a small typo in the file name.

Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/851
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agofix: add apple m2 keyboard quirks
Cyril LEVIS [Mon, 23 Jan 2023 08:55:08 +0000 (09:55 +0100)]
fix: add apple m2 keyboard quirks

this fix dwt https://github.com/AsahiLinux/linux/issues/103

Signed-off-by: Cyril Levis <git@levis.name>
2 years agoImprove X280 support
Richard Stefun [Mon, 23 Jan 2023 14:00:53 +0000 (15:00 +0100)]
Improve X280 support

Signed-off-by: Richard Stefun <richard.stefun@icloud.com>
2 years agoquicks: invert horizontal scrolling for Logitech MX Master 3S
Zhangyuan Nie [Tue, 17 Jan 2023 02:43:46 +0000 (18:43 -0800)]
quicks: invert horizontal scrolling for Logitech MX Master 3S

Signed-off-by: Zhangyuan Nie <yuan@znie.org>
2 years agodoc/user: fix sphinx warning
Peter Hutterer [Tue, 17 Jan 2023 02:28:58 +0000 (12:28 +1000)]
doc/user: fix sphinx warning

WARNING: extlinks: Sphinx-6.0 will require a caption string to contain
exactly one '%s' and all other '%' need to be escaped as '%%'.

Well, let's do that then!

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoIntroduce custom acceleration profile
Yinon Burgansky [Mon, 12 Dec 2022 22:23:59 +0000 (00:23 +0200)]
Introduce custom acceleration profile

The custom acceleration profile allow the user to define custom
acceleration functions for each movement type per device, giving
full control over accelerations behavior at different speeds.

This commit introduces 2 movement types which corresponds to the
2 profiles currently in use by libinput.

regular filter is Motion type.
constant filter is Fallback type.

This allows possible expansion of new movement types for the
different devices.

The custom pointer acceleration profile gives the user full control over the
acceleration behavior at different speeds.
The user needs to provide a custom acceleration function f(x) where
the x-axis is the device speed and the y-axis is the pointer speed.

The user should take into account the native device dpi and screen dpi in
order to achieve the desired behavior/feel of the acceleration.

The custom acceleration function is defined using n points which are spaced
uniformly along the x-axis, starting from 0 and continuing in constant steps.
There by the points defining the custom function are:
(0 * step, f[0]), (1 * step, f[1]), ..., ((n-1) * step, f[n-1])
where f is a list of n unitless values defining the acceleration
factor for each velocity.
When a velocity value does not lie exactly on those points, a linear
interpolation of the two closest points will be calculated.
When a velocity value is greater than the max point defined, a linear
extrapolation of the two biggest points will be calculated.

Signed-off-by: Yinon Burgansky <51504-Yinon@users.noreply.gitlab.freedesktop.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agodoc/api: set HAVE_DOT to YES
Peter Hutterer [Tue, 10 Jan 2023 03:23:56 +0000 (13:23 +1000)]
doc/api: set HAVE_DOT to YES

dot is required in meson.build, so we can hardcoded it here

Fixes: libinput/build/doc/api/libinput.h:4087: warning: ignoring \dot command because HAVE_DOT is not set
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agofilter: add helper functions to create/destroy a delta smoothener
Peter Hutterer [Tue, 22 Nov 2022 01:34:06 +0000 (11:34 +1000)]
filter: add helper functions to create/destroy a delta smoothener

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: touchpad: add ModelPressurePad
José Expósito [Mon, 16 Jan 2023 18:18:40 +0000 (19:18 +0100)]
quirks: touchpad: add ModelPressurePad

Unlike in traditional touchpads, whose pressure value equals contact
size, on pressure pads pressure is a real physical axis.

We don't take advantage of the pressure information reported by
pressure pads yet, so we disable it to avoid errors.

Add a new model quirk for pressure pads instead of disabling
ABS_MT_PRESSURE and ABS_PRESSURE.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotools: fflush the output in debug-events after each set of events
Peter Hutterer [Thu, 12 Jan 2023 23:23:52 +0000 (09:23 +1000)]
tools: fflush the output in debug-events after each set of events

Fixes e.g. the case where debug-events is used to get the initial device
list but no more. Since we never flush, the content is stuck in the
buffers and gets lost.

Easy way to reproduce: `libinput debug-events | cat`, then ctrl+c and see
nothing show up (before this patch, anyway).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: add quirks for Dell Precision5680 Touchpad
Charles Wang [Wed, 11 Jan 2023 09:16:13 +0000 (17:16 +0800)]
quirks: add quirks for Dell Precision5680 Touchpad

This touchpad is a pressure pad and needs the pressure
handling disable.

Fixes https://gitlab.freedesktop.org/libinput/libinput/-/issues/849

Signed-off-by: Charles Wang <charles.goodix@gmail.com>
2 years agoCI: use meson compile over ninja directly in meson-build.sh
Peter Hutterer [Thu, 5 Jan 2023 23:38:47 +0000 (09:38 +1000)]
CI: use meson compile over ninja directly in meson-build.sh

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoCI: make the meson-build.sh script even more generic
Peter Hutterer [Thu, 5 Jan 2023 23:34:43 +0000 (09:34 +1000)]
CI: make the meson-build.sh script even more generic

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoCI: give the meson-build.sh script a proper license tag
Peter Hutterer [Thu, 5 Jan 2023 23:44:11 +0000 (09:44 +1000)]
CI: give the meson-build.sh script a proper license tag

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agomeson.build: fix a deprecation warning
Peter Hutterer [Fri, 6 Jan 2023 03:19:15 +0000 (13:19 +1000)]
meson.build: fix a deprecation warning

get_pkgconfig_variable is deprecated

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: add quirk for Dell Latitude 5290 2-in-1
José Expósito [Sun, 1 Jan 2023 15:40:01 +0000 (16:40 +0100)]
quirks: add quirk for Dell Latitude 5290 2-in-1

Fixes https://gitlab.freedesktop.org/libinput/libinput/-/issues/846
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoquirks: add quirks for Glorious Model O mouse
Samuel Reddy [Fri, 23 Dec 2022 08:13:10 +0000 (19:13 +1100)]
quirks: add quirks for Glorious Model O mouse

Signed-off-by: Samuel Reddy <samuelsumukhreddy@gmail.com>
2 years agotools/record: fix quirk error message
José Expósito [Mon, 12 Dec 2022 18:13:58 +0000 (19:13 +0100)]
tools/record: fix quirk error message

When libinput-record fails to parse the quirks, it suggest to use the
--verbose flag to get more details. However, libinput-record does not
support the --verbose flag.

Replace the error message and add a link to the documentation instead.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agobuild: override dependency for use as subproject
Simon Ser [Fri, 9 Dec 2022 10:17:33 +0000 (11:17 +0100)]
build: override dependency for use as subproject

Allows e.g. compositors to setup libinput as a subproject. Makes
it easier to ad support for libinput features which haven't been
released yet.

Signed-off-by: Simon Ser <contact@emersion.fr>
2 years agodoc/user: document the new list-kernel-devices tool
Peter Hutterer [Fri, 9 Dec 2022 03:16:29 +0000 (13:16 +1000)]
doc/user: document the new list-kernel-devices tool

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotools: add a --hid toggle to libinput-list-kernel-devices
Peter Hutterer [Wed, 7 Dec 2022 23:59:39 +0000 (09:59 +1000)]
tools: add a --hid toggle to libinput-list-kernel-devices

Lists all SUBSYSTEM=hid devices, including the respective hidraw and
evdev nodes.

Note that this takes a shortcut in the udev handling: in theory we
*should* compare the hidraw/evdev parent device with our hid device. In
practice, checking if the devpath starts with the same substring is good
enough.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotools: add a libinput list-kernel-devices tool
Peter Hutterer [Wed, 7 Dec 2022 23:41:14 +0000 (09:41 +1000)]
tools: add a libinput list-kernel-devices tool

Same as libinput list-devices, but lists the available event nodes. This
effectively does the same as libinput record without arguments but it's
more obvious in what it is supposed to do and thus easier to point to.

Also, it uses pyudev instead of libevdev so it does not need to run as
root to discover devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoAllow rotation on all mice and for any angle
Lucas Zampieri [Mon, 5 Dec 2022 22:57:51 +0000 (22:57 +0000)]
Allow rotation on all mice and for any angle

Previously we restricted rotation to trackballs only and to multiples
of 90 degrees. Update rotation allow angles other than multiples of 90.

Also enable rotation on all mice. The only devices without rotation
are now pointing sticks.

Fixes #827

Signed-off-by: Lucas Zampieri <lzampier@redhat.com>
2 years agoevdev: only read the trackpoint multiplier on trackpoints
Peter Hutterer [Thu, 1 Dec 2022 01:40:35 +0000 (11:40 +1000)]
evdev: only read the trackpoint multiplier on trackpoints

Check the tag before we read any multiplier quirks. And don't bother
reading the DPI for trackpoints either because it doesn't make sense for
those devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: add quirks for Positivo-Vaio touchpad
José Expósito [Tue, 22 Nov 2022 18:45:17 +0000 (19:45 +0100)]
quirks: add quirks for Positivo-Vaio touchpad

The generic quirk introduced in commit d1f274c78119 ("quirks: add a
more generic match for the 5288 Synaptics clickpad") affects the
touchpad (with physical buttons) present in the Positivo-Vaio.

Fixes #819
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoquirks: allow overriding of AttrEventCode and AttrInputProp
Peter Hutterer [Tue, 15 Nov 2022 03:53:43 +0000 (13:53 +1000)]
quirks: allow overriding of AttrEventCode and AttrInputProp

This switches the quirk from AttrEventCodeEnable/Disable to just
AttrEventCode with a +/- prefix for each entry.
This switches the quirk from AttrInputPropEnable/Disable to just
AttrInputProp with a +/- prefix for each entry.

Previously, both event codes and input props would only apply the
last-matching section entry for a device. Furthermore, an earlier Disable entry
would take precedence over a later Enable entry. For example, a set of
sections with these lines *should* enable left, right and middle:

  [first]
  AttrEventCodeEnable=BTN_LEFT;BTN_RIGHT;BTN_MIDDLE

  [second]
  AttrEventCodeDisable=BTN_RIGHT

  [third]
  AttrEventCodeEnable=BTN_LEFT;BTN_RIGHT;

Alas: the first line was effectively ignored (quirks only returned the
last-matching one, i.e. the one from "third"). And due to implementation
details in evdev.c, the Disable attribute was processed after Enable,
i.e. the device was enabled for left + right and then disabled for
right. As a result, the device only had BTN_LEFT enabled.

Fix this by changing the attribute to carry both enable/disable
information and merging the commands together.

Internally, all quirks matching a device are simply ref'd into an array
in the struct quirks. The applied value is simply the last entry in the
array corresponding to our quirk.

For AttrEventCode and AttrInputProp instead do this:
- switch them to a tuple with the code as first entry and a boolean
  enable/disable as second entry
- if the struct quirk already has an entry for either, append the more
  recent one to the existing entry (instead of creating a new entry in
  the array). This way we have all entries that match and in-order of
  precedence - i.e. we can process them left-to-right to end up
  with the right state.

Fixes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/821
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agogitlab CI: add a job to check for whitespace issues
Peter Hutterer [Mon, 21 Nov 2022 23:44:08 +0000 (09:44 +1000)]
gitlab CI: add a job to check for whitespace issues

Trailing whitespaces and tab after a space are a no-go.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotools: fix a tab after space whitespace issue
Peter Hutterer [Mon, 21 Nov 2022 23:56:12 +0000 (09:56 +1000)]
tools: fix a tab after space whitespace issue

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoRemove duplicate empty lines in our source
Peter Hutterer [Tue, 22 Nov 2022 22:41:07 +0000 (08:41 +1000)]
Remove duplicate empty lines in our source

We only touch src and tools, imported headers from include are not ours
to change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoRemove a few empty lines with nothing but a lonely tab
Peter Hutterer [Tue, 22 Nov 2022 22:38:11 +0000 (08:38 +1000)]
Remove a few empty lines with nothing but a lonely tab

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoRemove trailing whitespaces in the tree
Peter Hutterer [Mon, 21 Nov 2022 23:24:00 +0000 (09:24 +1000)]
Remove trailing whitespaces in the tree

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotablet: increase touch arbitration rectangle height
José Expósito [Wed, 23 Nov 2022 07:48:55 +0000 (08:48 +0100)]
tablet: increase touch arbitration rectangle height

A user was experiencing issues with their hand being recognized as
touch input above the stylus tip.

Since touch above the stylus should be rare, increase the touch
arbitration rectangle height by 50mm.

Fix: https://gitlab.freedesktop.org/libinput/libinput/-/issues/809
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agosparse: make some variables static
José Expósito [Wed, 23 Nov 2022 18:17:32 +0000 (19:17 +0100)]
sparse: make some variables static

When compiling with Sparse enabled:

$ CC=cgcc meson builddir

Fix warnings about variables that should be made static.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotest: fix uninitialized variables
José Expósito [Wed, 23 Nov 2022 17:50:38 +0000 (18:50 +0100)]
test: fix uninitialized variables

Fix the warnings generated:

[232/243] Compiling C object libinput-test-suite.p/test_test-pad.c.o
../test/test-pad.c:211:3: warning: variable 'count' is uninitialized
when used here [-Wuninitialized]
        count++;
        ^~~~~
../test/test-pad.c:261:3: warning: variable 'count' is uninitialized
when used here [-Wuninitialized]
        count++;
        ^~~~~

When building with Clang v15 and without libwacom:

$ CC=clang CXX=clang++ meson builddir -Dlibwacom=false

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotest: fix compiler warning when -Dlibwacom=false
José Expósito [Wed, 23 Nov 2022 17:47:32 +0000 (18:47 +0100)]
test: fix compiler warning when -Dlibwacom=false

Fix the warning generated:

[129/243] Compiling C object libinput-test-suite.p/test_test-touchpad.c.o
../test/test-touchpad.c:2679:1: warning: unused
function 'touchpad_has_rotation' [-Wunused-function]
touchpad_has_rotation(struct libevdev *evdev)
^

When building with Clang v15 and without libwacom:

$ CC=clang CXX=clang++ meson builddir -Dlibwacom=false

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotablet: fix compiler warning when -Dlibwacom=false
José Expósito [Wed, 23 Nov 2022 17:42:34 +0000 (18:42 +0100)]
tablet: fix compiler warning when -Dlibwacom=false

Fix the warning generated:

[82/243] Compiling C object libinput.so.10.13.0.p/src_evdev-tablet.c.o
../src/evdev-tablet.c:938:1: warning: unused function
'tool_set_bits_from_libwacom' [-Wunused-function]
tool_set_bits_from_libwacom(const struct tablet_dispatch *tablet,
^

When building with Clang v15 and without libwacom:

$ CC=clang CXX=clang++ meson builddir -Dlibwacom=false

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotablet-pad-leds: fix compiler warning when -Dlibwacom=false
José Expósito [Wed, 23 Nov 2022 17:32:11 +0000 (18:32 +0100)]
tablet-pad-leds: fix compiler warning when -Dlibwacom=false

Fix the warnings generated:

../src/evdev-tablet-pad-leds.c:54:1: warning: unused function
'pad_mode_toggle_button_new' [-Wunused-function]
pad_mode_toggle_button_new(struct pad_dispatch *pad,
^

../src/evdev-tablet-pad-leds.c:194:1: warning: unused function
'pad_group_new' [-Wunused-function]
pad_group_new(struct pad_dispatch *pad,
^

../src/evdev-tablet-pad-leds.c:238:1: warning: unused function
'pad_led_get_sysfs_base_path' [-Wunused-function]
pad_led_get_sysfs_base_path(struct evdev_device *device,
^

When building with Clang v15 and without libwacom:

$ CC=clang CXX=clang++ meson builddir -Dlibwacom=false

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotest: remove unused variable
José Expósito [Wed, 23 Nov 2022 17:28:01 +0000 (18:28 +0100)]
test: remove unused variable

Fix warning building with Clang v15:

../test/test-pad.c:334:15: warning: variable 'expected_number'
set but not used [-Wunused-but-set-variable]
unsigned int expected_number = 0;

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoquirks: Add Apple MTP touchpad quirk
Hector Martin [Tue, 22 Nov 2022 04:52:24 +0000 (13:52 +0900)]
quirks: Add Apple MTP touchpad quirk

Apple M2 (and presumably newer) laptops now embed the touchpad
controller into the main SoC, and use a new internal communications
protocol between it and the main CPU. This isn't really a "bus" like
SPI or I2C, so the downstream kernel driver currently uses the (not
well supported) HOST bus type. MatchBus can't match on that, so let's
just use a name match (plus the vendor ID, which is still valid and
the usual Apple one).

Signed-off-by: Hector Martin <marcan@marcan.st>
2 years agotest: print the usage from the symbols-leak-test
Peter Hutterer [Tue, 22 Nov 2022 03:59:09 +0000 (13:59 +1000)]
test: print the usage from the symbols-leak-test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agodoc/user: explicitly specify language as en
Peter Hutterer [Tue, 22 Nov 2022 04:25:41 +0000 (14:25 +1000)]
doc/user: explicitly specify language as en

Unlikely we'll ever have the docs fully translated (or translated at
all...) anyway.

Fixes "WARNING: Invalid configuration value found: 'language = None'.
Update your configuration to a valid language code. Falling back to 'en'
(English)."

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agolibinput 1.22.0 upstream_bkup_20240104 upstream_work_20230126 1.22.0 upstream/1.22.0
José Expósito [Sat, 19 Nov 2022 11:21:06 +0000 (12:21 +0100)]
libinput 1.22.0

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agogitlab CI: pre-install all packages we need
Peter Hutterer [Fri, 1 Jul 2022 04:40:20 +0000 (14:40 +1000)]
gitlab CI: pre-install all packages we need

Running "dnf install" during a job can lead to issues when the image is
old - package renames/replacements/etc. may require a dnf upgrade to get
those packages sorted first before our dnf install works.

This hasn't been a problem for us because we had weekly rebuilds of the
images scheduled and were usually on the latest package set but let's do
this properly anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agogitlab CI: update freebsd to 13.1
Peter Hutterer [Tue, 15 Nov 2022 22:33:51 +0000 (08:33 +1000)]
gitlab CI: update freebsd to 13.1

This gets rid of of the following error:
  ld-elf.so.1: /lib/libc.so.7: version FBSD_1.7 required by /usr/local/lib/libpython3.9.so.1.0 not found

Too tired to debug what is really going on, so let's pretend the update
is the best way to fix this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agogitlab CI: don't install valgrind, it's already in the template
Peter Hutterer [Fri, 1 Jul 2022 04:33:17 +0000 (14:33 +1000)]
gitlab CI: don't install valgrind, it's already in the template

This has been a noop for quite a while, so we might as well skip it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotouchpad: add escape and asterisk to the DWT blacklist
José Expósito [Mon, 14 Nov 2022 17:38:13 +0000 (18:38 +0100)]
touchpad: add escape and asterisk to the DWT blacklist

The escape key can be used to cancel a drag and drop action in some
desktop environments. However, it triggers disable-while-typing, ending
the drag and drop action rather than cancelling it.

Add it to the tp_key_ignore_for_dwt() set to avoid it.

Since I'm here, add the asterisk key as it is the only numpad key not
ignored by tp_key_ignore_for_dwt().

Fix: https://gitlab.freedesktop.org/libinput/libinput/-/issues/820  # [1]
Suggested-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoutil: use ck_assert_ptr_eq() instead of ck_assert_ptr_null()
José Expósito [Mon, 14 Nov 2022 18:06:07 +0000 (19:06 +0100)]
util: use ck_assert_ptr_eq() instead of ck_assert_ptr_null()

The ck_assert_ptr_null() function is not available in the version of
the check library included in 20.04 LTS Focal (0.10.0).

Use ck_assert_ptr_eq() to avoid compilation errors.

Fixes: eeae8906dbbb ("util: return the number of elements from strv_from_string")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoutil: return the number of elements from strv_from_string
Yinon Burgansky [Wed, 5 Oct 2022 15:20:06 +0000 (18:20 +0300)]
util: return the number of elements from strv_from_string

Signed-off-by: Yinon Burgansky <51504-Yinon@users.noreply.gitlab.freedesktop.org>
2 years agodebug-gui: avoid locking pointer twice
José Expósito [Mon, 10 Oct 2022 06:14:55 +0000 (08:14 +0200)]
debug-gui: avoid locking pointer twice

On Sway, and probably other Wayland compositors based on wlroots, the
window_lock_pointer() was called twice.

Avoid errors when window_lock_pointer() is invoked multiple times.

Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/808
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotools: hide debug-gui help when building with -Ddebug-gui=false
José Expósito [Mon, 10 Oct 2022 06:27:05 +0000 (08:27 +0200)]
tools: hide debug-gui help when building with -Ddebug-gui=false

Some distributions, like Fedora, compile libinput with the debug-gui
option set to false.

Running "libinput debug-gui" indicates that the program is not
installed; however, the help message suggests that  the command is
available.

Hide debug-gui from the help message when it is not included.

Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/480
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agomeson.build: always set HAVE_GTK_WAYLAND
José Expósito [Sun, 9 Oct 2022 18:07:59 +0000 (20:07 +0200)]
meson.build: always set HAVE_GTK_WAYLAND

In commit 6a1bd5b0c9be ("meson.build: check gtk targets before
building") introduced a custom config option to check whether Wayland
is supported by GTK or not.

However, in some cases the config option is not set generating this
warning:

    ../tools/libinput-debug-gui.c:51:5: warning: "HAVE_GTK_WAYLAND" is
    not defined, evaluates to 0 [-Wundef]
       51 | #if HAVE_GTK_WAYLAND
          |     ^~~~~~~~~~~~~~~~

Make sure to always set HAVE_GTK_WAYLAND.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotablet: avoid errors calling libevdev_get_abs_info()
José Expósito [Mon, 3 Oct 2022 10:53:22 +0000 (12:53 +0200)]
tablet: avoid errors calling libevdev_get_abs_info()

Commit 806d4a1393db ("tablet: check libevdev_get_abs_info() return
value") prevented a crash when tilt was deactivated by a quirk.
For more information check [1].

Add similar checks before calling libevdev_get_abs_info() to avoid
possible crashes.

[1] https://gitlab.freedesktop.org/libinput/libinput/-/issues/805
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoFix Framework quirk so it wirks with 12 gen intel
Tadhg McDonald-Jensen [Fri, 23 Sep 2022 16:26:36 +0000 (12:26 -0400)]
Fix Framework quirk so it wirks with 12 gen intel

Removes a colon from frameworks quirks dmi match
so it matches pnLaptop(12thGenIntelCore) on newer model

Signed-off-by: Tadhg McDonald-Jensen <tadhgmister@gmail.com>
2 years agotablet: check libevdev_get_abs_info() return value
José Expósito [Mon, 12 Sep 2022 16:28:38 +0000 (18:28 +0200)]
tablet: check libevdev_get_abs_info() return value

Commit b5f0536a4f93 ("quirks: add a quirk for the Wacom 524c device")
added the quirk "AttrEventCodeDisable=ABS_TILT_X;ABS_TILT_Y;" to the
Wacom 524c.

When using the pen in a display with tilt support, the tilt X/Y axes
are set as changed. Using the pen again, but this time in the display
without tilt support, will try to get the tilt information, crashing.

Check the return value of libevdev_get_abs_info() to avoid this crash.

Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/805
Fixes: b5f0536a4f93 ("quirks: add a quirk for the Wacom 524c device")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agofilter: add a flat trackpoint accel
Peter Hutterer [Mon, 5 Sep 2022 01:33:57 +0000 (11:33 +1000)]
filter: add a flat trackpoint accel

Previously, trackpoints got assigned the normal flat profile which does not
accommodate for the trackpoint magic multiplier *and* had a config range
that was too small if you take the multiplire indo account anyway.

Fix this by adding a trackpoint-specific flat accel that has a wider
configuration range and take sthe magic multiplier into account.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agofilter: apply the same factor for constant motion as for normal motion
Peter Hutterer [Sun, 4 Sep 2022 23:56:16 +0000 (09:56 +1000)]
filter: apply the same factor for constant motion as for normal motion

Users that want a flat pointer acceleration want the input speed to
match 1:1 to the output speed, barring a fixed constant multiplier.
This will apply to things like button scrolling as well, so let's map
the constant accel function to the non-constant accel functions to the
speed setting applies to every movement.

This is applied to both the flat and the touchpad flat filter.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agofilter: don't normalize the speed again in the default mouse filter
Peter Hutterer [Sun, 4 Sep 2022 23:46:54 +0000 (09:46 +1000)]
filter: don't normalize the speed again in the default mouse filter

The first thing this filter does is normalize the coordinates to
1000dpi, i.e. all other values are in normalized coordinates.

By normalizing the speed again we get an invalid value, effectively
stretching or compressing the acceleration curve. e.g. on a 5000dpi
mouse the estimated speed was 1/5 of the real speed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoevdev: use filter_dispatch_constant() for the lenovo trackpoint "wheel"
Peter Hutterer [Sun, 4 Sep 2022 23:26:21 +0000 (09:26 +1000)]
evdev: use filter_dispatch_constant() for the lenovo trackpoint "wheel"

Rather than normalizing manually, leave this up to the pointer acceleration
code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoevdev: use filter_dispatch_constant() for button scrolling
Peter Hutterer [Sun, 4 Sep 2022 23:26:21 +0000 (09:26 +1000)]
evdev: use filter_dispatch_constant() for button scrolling

Our pointer filter code has two functions - one for accelerated movement
and one for "constant" movement (i.e. no accel factor provided but same
conversions). Let's use that instead of a manual normalization.

This fixes an issue with button scrolling on high-dpi mice in the flat
pointer acceleration: normal pointer motion in the flat profile isn't
normalized but the button scrolling was - resulting in e.g. 5 times
slower motion for button scrolling on a 5000dpi mouse.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agofilter: don't normalize the const filter approach
Peter Hutterer [Sun, 4 Sep 2022 23:35:23 +0000 (09:35 +1000)]
filter: don't normalize the const filter approach

The filter vs const filter is supposed to be for accelerated vs
non-accelerated motion (e.g. pointer motion vs scrolling) - in both
cases the returned value is supposed to be in the same coordinate
system, just once with an extra accel factor applied.

This was broken in the flat and low-dpi profiles: in both of those the
accelerated filter does *not* normalize, it merely applies the fixed/adaptive factor.
The constant filter normalized however. The result was that on e.g. a
5000dpi mouse the constant motion was 5 times slower than the
accelerated motion, even with a factor of 1.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agofilter: constify the interfaces and make them static
Peter Hutterer [Mon, 5 Sep 2022 01:33:20 +0000 (11:33 +1000)]
filter: constify the interfaces and make them static

No functional change

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoevdev: rename post_trackpoint_scroll to post_button_scroll
Peter Hutterer [Sun, 4 Sep 2022 23:15:39 +0000 (09:15 +1000)]
evdev: rename post_trackpoint_scroll to post_button_scroll

This is no longer trackpoint-only, so let's rename this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agofilter: localize a few variables
Peter Hutterer [Sun, 4 Sep 2022 22:48:12 +0000 (08:48 +1000)]
filter: localize a few variables

No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agofilter: constify the tracker API
Peter Hutterer [Fri, 2 Sep 2022 04:53:45 +0000 (14:53 +1000)]
filter: constify the tracker API

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agofilter: remove an unnecessary layer of indirection
Peter Hutterer [Fri, 2 Sep 2022 04:34:56 +0000 (14:34 +1000)]
filter: remove an unnecessary layer of indirection

This is a leftover from when some of the filter code was shared between
pointer acceleration methods (pre v1.11 or so). Now these functions are
duplicated across files, so both the names and what they do isn't
necessarily reflective anymore.

Let's drop one layer of indirection to make the code a bit easier to
understand.

No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agofilter: fix the mix of normalized vs device coordinates
Peter Hutterer [Fri, 2 Sep 2022 04:23:04 +0000 (14:23 +1000)]
filter: fix the mix of normalized vs device coordinates

No functional changes, this is just for improving readability and a
leftover when some of these functions were used by multiple filters.

This filter normalizes the data first, then applies the acceleration to
the normalized values. So let's keep the data in normalized_coords
structs and only drop to device_float_coords when we have to to use the
tracker API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agofilter: a few whitespace fixes and extra comments
Peter Hutterer [Fri, 2 Sep 2022 04:18:26 +0000 (14:18 +1000)]
filter: a few whitespace fixes and extra comments

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoCI: drop the job count for the valgrind test suite to 2
Peter Hutterer [Thu, 1 Sep 2022 00:57:45 +0000 (10:57 +1000)]
CI: drop the job count for the valgrind test suite to 2

Too many timing-related failures with 4 or (the default) 8 jobs, clearly
our runners aren't fast enough.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoCI: in b2c, compile on the host, then test in qemu
Benjamin Tissoires [Thu, 11 Aug 2022 05:19:14 +0000 (07:19 +0200)]
CI: in b2c, compile on the host, then test in qemu

Looks like we are having clock skew issues on qemu, so given that
we just need qemu in the image, we can compile on the host (reliable)
and then only start the tests in qemu.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2 years agoCI: start a full systemd environment before running the testsuite
Benjamin Tissoires [Thu, 5 Aug 2021 13:17:27 +0000 (15:17 +0200)]
CI: start a full systemd environment before running the testsuite

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2 years agoCI: include systemd-udev in the fedora image
Benjamin Tissoires [Fri, 30 Jul 2021 10:05:01 +0000 (12:05 +0200)]
CI: include systemd-udev in the fedora image

This will allow us to have the udevadm tool and systemd-udevd available
while running inside qemu

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2 years agoCI: rely on b2c to start qemu tests
Benjamin Tissoires [Fri, 30 Jul 2021 09:30:32 +0000 (11:30 +0200)]
CI: rely on b2c to start qemu tests

This allows us to not have to create a specific image, and also
should be more reliable because we don't have to boot a full distribution
each time we just start our test suite.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2 years agoCI: do not retry the qemu runs
Benjamin Tissoires [Fri, 30 Jul 2021 10:06:40 +0000 (12:06 +0200)]
CI: do not retry the qemu runs

They should be more reliable now, so no need to try them twice

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2 years agoCI: remove unused test
Benjamin Tissoires [Fri, 30 Jul 2021 09:28:41 +0000 (11:28 +0200)]
CI: remove unused test

I am pretty sure this one guard is a leftover from a previous version.
That is because use_for_custom_build_tests is true when
use_for_qemu_tests is, so probably a useless test here.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2 years agoCI: make freebsd slightly more in line with others
Benjamin Tissoires [Thu, 29 Jul 2021 16:54:45 +0000 (18:54 +0200)]
CI: make freebsd slightly more in line with others

the combination of want_qemu and skip_container is not very straight
forward.

What we actually have, is that freebsd is only qemu based, so there is
no point in really having a `_QEMU` tag for it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2 years agoCI: remove one occurrence of fedora instead of distro.name
Benjamin Tissoires [Thu, 11 Aug 2022 05:47:40 +0000 (07:47 +0200)]
CI: remove one occurrence of fedora instead of distro.name

For .{{distro.name}}-build@template, everything is parametrized with the
distro name, so having plain 'fedora' might bite us in the future.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2 years agoCI: prettify the include of templates
Benjamin Tissoires [Thu, 29 Jul 2021 16:50:57 +0000 (18:50 +0200)]
CI: prettify the include of templates

Makes the resulting file easier to read

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2 years agogitlab-ci: add commandline options to the meson-build.sh script
Peter Hutterer [Wed, 31 Aug 2022 05:51:20 +0000 (15:51 +1000)]
gitlab-ci: add commandline options to the meson-build.sh script

The various --skip-build, --skip-test and --skip-setup skip the
respective step, the --run-test argument runs the test even where
MESON_TEST_ARGS is nil.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agogitlab-ci: explicitly call "meson setup" to improve readability
Peter Hutterer [Wed, 31 Aug 2022 05:41:35 +0000 (15:41 +1000)]
gitlab-ci: explicitly call "meson setup" to improve readability

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agogitlab-ci: export MESON_TESTTHREADS so meson actually sees it
Peter Hutterer [Wed, 31 Aug 2022 05:37:37 +0000 (15:37 +1000)]
gitlab-ci: export MESON_TESTTHREADS so meson actually sees it

Unlike NINJA_ARGS this isn't passed into meson, it's picked from the
env.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoevdev: remove duplicate "device is a switch" message
Peter Hutterer [Tue, 23 Aug 2022 03:22:31 +0000 (13:22 +1000)]
evdev: remove duplicate "device is a switch" message

We log this a few lines south of here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: add generic quirks for ARM based chromebooks
Leonard Lausen [Mon, 22 Aug 2022 00:47:47 +0000 (00:47 +0000)]
quirks: add generic quirks for ARM based chromebooks

Signed-off-by: Leonard Lausen <leonard@lausen.nl>
2 years agoquirks: add quirks for Acer Spin 513 (Lazor)
Leonard Lausen [Wed, 10 Aug 2022 22:13:39 +0000 (22:13 +0000)]
quirks: add quirks for Acer Spin 513 (Lazor)

Signed-off-by: Leonard Lausen <leonard@lausen.nl>
2 years agotools: add missing dwtp option setting
Peter Hutterer [Mon, 8 Aug 2022 03:56:11 +0000 (13:56 +1000)]
tools: add missing dwtp option setting

Fixes 1f1ddbc6dff0cf0451e3c9ac923f9821278560aa

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agogitlab ci: drop EOL'd ubuntu 21.10
Peter Hutterer [Wed, 3 Aug 2022 03:42:47 +0000 (13:42 +1000)]
gitlab ci: drop EOL'd ubuntu 21.10

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: update quirks for Lenovo IdeaPad Duet 3
Boris Pek [Fri, 15 Jul 2022 06:34:22 +0000 (09:34 +0300)]
quirks: update quirks for Lenovo IdeaPad Duet 3

My tablet has substring pvrIdeaPadDuet310IGL5-LTE in modalias and there are
other modifications of this model on a market so the mask for DMI should be
simplified to cover more devices.

Signed-off-by: Boris Pek <bpek@astralinux.ru>
2 years agodoc/user: minor rewording of the pointer accel profile list
Peter Hutterer [Thu, 14 Jul 2022 05:35:38 +0000 (15:35 +1000)]
doc/user: minor rewording of the pointer accel profile list

This just makes it easier to add new profiles to the list without ending
up with a word salad.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agolibwacom: fix warnings building without libwacom
José Expósito [Tue, 12 Jul 2022 17:44:59 +0000 (19:44 +0200)]
libwacom: fix warnings building without libwacom

When the libwacom build option is set to false the compiler throws
these warnings:

../udev/libinput-device-group.c:95:1: warning: ‘wacom_handle_ekr’ defined but not used [-Wunused-function]
   95 | wacom_handle_ekr(struct udev_device *device,
      | ^~~~~~~~~~~~~~~~
[205/237] Compiling C object 'libinput-test-suite@exe/test_test-tablet.c.o'.
../test/test-tablet.c:5440:1: warning: ‘verify_left_handed_touch_sequence’ defined but not used [-Wunused-function]
 5440 | verify_left_handed_touch_sequence(struct litest_device *finger,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../test/test-tablet.c:5385:1: warning: ‘verify_left_handed_tablet_sequence’ defined but not used [-Wunused-function]
 5385 | verify_left_handed_tablet_sequence(struct litest_device *tablet,
 #     | ^~~~~~~~~~~~~~~~
 #     | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Add the required guards to fix the warnings.

Fix #791.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoevdev: fix a tab vs space indentation issue
Peter Hutterer [Mon, 11 Jul 2022 11:01:35 +0000 (21:01 +1000)]
evdev: fix a tab vs space indentation issue

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agomeson: use install_emptydir to create directory
illiliti [Sun, 3 Jul 2022 15:14:15 +0000 (18:14 +0300)]
meson: use install_emptydir to create directory

instead of install_subdir. Fixes muon - a strictly-conforming meson
implementation which doesn't implement deprecated and broken-by-design
functionality.

For more info, see: https://mesonbuild.com/Reference-manual_functions.html#install_subdir

Signed-off-by: illiliti <illiliti@protonmail.com>
2 years agoquirks: Add quirks to improve tablet-mode on the Surface Laptop Studio
Maximilian Luz [Mon, 4 Jul 2022 23:33:04 +0000 (01:33 +0200)]
quirks: Add quirks to improve tablet-mode on the Surface Laptop Studio

The Microsoft Surface Laptop Studio can operate in multiple postures. In
one of these, dubbed "slate/tent", the screen is angled roughly 45°,
covering the keyboard but not the touchpad. Unfortunately, this state is
(as far as we can tell) indiscernible to the display being flipped 180°
backwards (dubbed "slate/flipped"), where the keyboard points away from
the user and is now behind the screen.

Due to this, it makes sense to enable tablet-mode in this (general)
"slate" state, which is what the corresponding kernel driver currently
does. This, for example, can tell desktop environments to bring up a
touch keyboard in certain situations and to allow for automatic screen
rotation (which is required in the "flipped" mode).

Unfortunately, libinput disables all integrated peripherals, including
the touchpad, when tablet-mode is on, rendering the touchpad unusable in
the "slate/tent" state. Therefore, set ModelTabletModeNoSuspend=1 to
keep the touchpad functional. For simplicity, apply this quirk to all
input devices on the Surface Laptop Studio. Those are already disabled
by firmware in the respective postures, meaning things work well without
suspension by libinput.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
2 years agoquirks: Add quirks for Surface Laptop Studio touchpad
Maximilian Luz [Mon, 4 Jul 2022 23:24:21 +0000 (01:24 +0200)]
quirks: Add quirks for Surface Laptop Studio touchpad

The touchpad on the Microsoft Surface Laptop Studio is force-sensitive.
The default values used by libinput do not seem to work well (causing
touches to not be recognized), so configure it with known-good values.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
2 years agoquirks: add volume rocker quirk for Lenovo IdeaPad Duet 3i
Max Huber [Sun, 10 Jul 2022 12:11:57 +0000 (12:11 +0000)]
quirks: add volume rocker quirk for Lenovo IdeaPad Duet 3i

Signed-off-by: Max Huber <ycbcr@disroot.org>