touchpad: make the dwt/dwtp timeout inclusive min/max

This makes it easier in callers that don't really differ between
inclusive and exclusive and makes the visualization in UIs a bit
nicer to look at too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1377>
This commit is contained in:
Peter Hutterer 2025-12-10 09:14:22 +10:00 committed by Marge Bot
parent bde6d07d57
commit 0285001272
2 changed files with 4 additions and 4 deletions

View file

@ -3174,7 +3174,7 @@ tp_dwt_config_set_timeout(struct libinput_device *device, uint64_t timeout)
struct evdev_device *evdev = evdev_device(device);
struct tp_dispatch *tp = (struct tp_dispatch *)evdev->dispatch;
if (timeout <= ms2us(100) || timeout >= ms2us(5000))
if (timeout < ms2us(100) || timeout > ms2us(5000))
return LIBINPUT_CONFIG_STATUS_INVALID;
tp->dwt.timeout = timeout;
@ -3249,7 +3249,7 @@ tp_dwtp_config_set_timeout(struct libinput_device *device, uint64_t timeout)
struct evdev_device *evdev = evdev_device(device);
struct tp_dispatch *tp = (struct tp_dispatch *)evdev->dispatch;
if (timeout <= ms2us(100) || timeout >= ms2us(5000))
if (timeout < ms2us(100) || timeout > ms2us(5000))
return LIBINPUT_CONFIG_STATUS_INVALID;
tp->palm.timeout = timeout;

View file

@ -4532,11 +4532,11 @@ START_TEST(touchpad_dwt_config_default_on)
litest_assert_int_eq(timeout, 600U);
/* Too short, too long */
status = libinput_device_config_dwt_set_timeout(device, 10);
status = libinput_device_config_dwt_set_timeout(device, 99);
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
timeout = libinput_device_config_dwt_get_timeout(device);
litest_assert_int_eq(timeout, 600U);
status = libinput_device_config_dwt_set_timeout(device, 5000);
status = libinput_device_config_dwt_set_timeout(device, 5001);
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
timeout = libinput_device_config_dwt_get_timeout(device);
litest_assert_int_eq(timeout, 600U);