tablet: fix handling of AttrPressureRange quirk

tablet_get_quirked_pressure_thresholds() is wrong:
the pressure thresholds for tip press and tip release are swapped around.
This seems to be a regression introduced in commit 4bc27543e9.

This prevents AttrPressureRange from working as intended for tablets,
and causes weird things to happen if it's set.
(For example, when pressure is in the range between
the intended release threshold and the intended press threshold,
the "pressed" status flip-flops between 0 and 1 every frame).

Fix that.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1420>
This commit is contained in:
Michał Chojnowski 2026-02-02 08:06:39 +01:00
parent fe1d44637f
commit b58d5a165b

View file

@ -1142,8 +1142,8 @@ tablet_get_quirked_pressure_thresholds(struct tablet_dispatch *tablet, int *hi,
_unref_(quirks) *q = libinput_device_get_quirks(&device->base);
if (q && quirks_get_range(q, QUIRK_ATTR_PRESSURE_RANGE, &r)) {
if (r.lower < r.upper) {
*hi = r.lower;
*lo = r.upper;
*lo = r.lower;
*hi = r.upper;
status = true;
} else {
evdev_log_info(device,