mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-08 18:20:30 +01:00
touchpad: add get_default_timeout for dwt and dwtp
I doubt this is really needed but our convention for all config options is set/get/get_default so let's stick with that. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1421>
This commit is contained in:
parent
6f79797308
commit
6d514ee6fa
6 changed files with 104 additions and 2 deletions
|
|
@ -3234,6 +3234,12 @@ tp_dwt_config_get_timeout(struct libinput_device *device)
|
|||
return tp->dwt.timeout;
|
||||
}
|
||||
|
||||
static usec_t
|
||||
tp_dwt_config_get_default_timeout(struct libinput_device *device)
|
||||
{
|
||||
return DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_2;
|
||||
}
|
||||
|
||||
static int
|
||||
tp_dwtp_config_is_available(struct libinput_device *device)
|
||||
{
|
||||
|
|
@ -3310,6 +3316,12 @@ tp_dwtp_config_get_timeout(struct libinput_device *device)
|
|||
return tp->palm.timeout;
|
||||
}
|
||||
|
||||
static usec_t
|
||||
tp_dwtp_config_get_default_timeout(struct libinput_device *device)
|
||||
{
|
||||
return DEFAULT_TRACKPOINT_ACTIVITY_TIMEOUT;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
tp_is_tpkb_combo_below(struct evdev_device *device)
|
||||
{
|
||||
|
|
@ -3348,8 +3360,9 @@ tp_init_dwt(struct tp_dispatch *tp, struct evdev_device *device)
|
|||
tp->dwt.config.get_default_enabled = tp_dwt_config_get_default;
|
||||
tp->dwt.config.set_timeout = tp_dwt_config_set_timeout;
|
||||
tp->dwt.config.get_timeout = tp_dwt_config_get_timeout;
|
||||
tp->dwt.config.get_default_timeout = tp_dwt_config_get_default_timeout;
|
||||
tp->dwt.dwt_enabled = tp_dwt_default_enabled(tp);
|
||||
tp->dwt.timeout = DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_2;
|
||||
tp->dwt.timeout = tp_dwt_config_get_default_timeout(&device->base);
|
||||
device->base.config.dwt = &tp->dwt.config;
|
||||
}
|
||||
|
||||
|
|
@ -3367,7 +3380,8 @@ tp_init_dwtp(struct tp_dispatch *tp, struct evdev_device *device)
|
|||
tp->palm.config.get_default_enabled = tp_dwtp_config_get_default;
|
||||
tp->palm.config.set_timeout = tp_dwtp_config_set_timeout;
|
||||
tp->palm.config.get_timeout = tp_dwtp_config_get_timeout;
|
||||
tp->palm.timeout = DEFAULT_TRACKPOINT_ACTIVITY_TIMEOUT;
|
||||
tp->palm.config.get_default_timeout = tp_dwtp_config_get_default_timeout;
|
||||
tp->palm.timeout = tp_dwtp_config_get_default_timeout(&device->base);
|
||||
device->base.config.dwtp = &tp->palm.config;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -466,6 +466,7 @@ struct libinput_device_config_dwt {
|
|||
enum libinput_config_status (*set_timeout)(struct libinput_device *device,
|
||||
usec_t timeout);
|
||||
usec_t (*get_timeout)(struct libinput_device *device);
|
||||
usec_t (*get_default_timeout)(struct libinput_device *device);
|
||||
};
|
||||
|
||||
struct libinput_device_config_dwtp {
|
||||
|
|
@ -479,6 +480,7 @@ struct libinput_device_config_dwtp {
|
|||
enum libinput_config_status (*set_timeout)(struct libinput_device *device,
|
||||
usec_t timeout);
|
||||
usec_t (*get_timeout)(struct libinput_device *device);
|
||||
usec_t (*get_default_timeout)(struct libinput_device *device);
|
||||
};
|
||||
|
||||
struct libinput_device_config_rotation {
|
||||
|
|
|
|||
|
|
@ -4961,6 +4961,15 @@ libinput_device_config_dwt_get_timeout(struct libinput_device *device)
|
|||
return usec_to_millis(device->config.dwt->get_timeout(device));
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT uint32_t
|
||||
libinput_device_config_dwt_get_default_timeout(struct libinput_device *device)
|
||||
{
|
||||
if (!libinput_device_config_dwt_is_available(device))
|
||||
return 0;
|
||||
|
||||
return usec_to_millis(device->config.dwt->get_default_timeout(device));
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT int
|
||||
libinput_device_config_dwtp_is_available(struct libinput_device *device)
|
||||
{
|
||||
|
|
@ -5025,6 +5034,15 @@ libinput_device_config_dwtp_get_timeout(struct libinput_device *device)
|
|||
return usec_to_millis(device->config.dwtp->get_timeout(device));
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT uint32_t
|
||||
libinput_device_config_dwtp_get_default_timeout(struct libinput_device *device)
|
||||
{
|
||||
if (!libinput_device_config_dwtp_is_available(device))
|
||||
return 0;
|
||||
|
||||
return usec_to_millis(device->config.dwtp->get_default_timeout(device));
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT int
|
||||
libinput_device_config_rotation_is_available(struct libinput_device *device)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6822,6 +6822,25 @@ libinput_device_config_dwt_set_timeout(struct libinput_device *device, uint32_t
|
|||
uint32_t
|
||||
libinput_device_config_dwt_get_timeout(struct libinput_device *device);
|
||||
|
||||
/**
|
||||
* @ingroup config
|
||||
*
|
||||
* Get the default disable-while-typing timeout.
|
||||
*
|
||||
* @param device The device to configure
|
||||
* @return The default timeout in milliseconds for this device.
|
||||
*
|
||||
* @see libinput_device_config_dwt_is_available
|
||||
* @see libinput_device_config_dwt_set_enabled
|
||||
* @see libinput_device_config_dwt_get_enabled
|
||||
* @see libinput_device_config_dwt_set_timeout
|
||||
* @see libinput_device_config_dwt_get_timeout
|
||||
*
|
||||
* @since 1.31
|
||||
*/
|
||||
uint32_t
|
||||
libinput_device_config_dwt_get_default_timeout(struct libinput_device *device);
|
||||
|
||||
/**
|
||||
* @ingroup config
|
||||
*
|
||||
|
|
@ -6967,6 +6986,25 @@ libinput_device_config_dwtp_set_timeout(struct libinput_device *device,
|
|||
uint32_t
|
||||
libinput_device_config_dwtp_get_timeout(struct libinput_device *device);
|
||||
|
||||
/**
|
||||
* @ingroup config
|
||||
*
|
||||
* Get the default disable-while-trackpointing timeout.
|
||||
*
|
||||
* @param device The device to configure
|
||||
* @return The default timeout in milliseconds for this device.
|
||||
*
|
||||
* @see libinput_device_config_dwtp_is_available
|
||||
* @see libinput_device_config_dwtp_set_enabled
|
||||
* @see libinput_device_config_dwtp_get_enabled
|
||||
* @see libinput_device_config_dwtp_set_timeout
|
||||
* @see libinput_device_config_dwtp_get_timeout
|
||||
*
|
||||
* @since 1.31
|
||||
*/
|
||||
uint32_t
|
||||
libinput_device_config_dwtp_get_default_timeout(struct libinput_device *device);
|
||||
|
||||
/**
|
||||
* @ingroup config
|
||||
*
|
||||
|
|
|
|||
|
|
@ -382,8 +382,10 @@ LIBINPUT_1.30 {
|
|||
} LIBINPUT_1.29;
|
||||
|
||||
LIBINPUT_1.31 {
|
||||
libinput_device_config_dwt_get_default_timeout;
|
||||
libinput_device_config_dwt_get_timeout;
|
||||
libinput_device_config_dwt_set_timeout;
|
||||
libinput_device_config_dwtp_get_default_timeout;
|
||||
libinput_device_config_dwtp_get_timeout;
|
||||
libinput_device_config_dwtp_set_timeout;
|
||||
libinput_tablet_tool_get_name;
|
||||
|
|
|
|||
|
|
@ -4496,6 +4496,19 @@ START_TEST(touchpad_dwt_edge_scroll_interrupt)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_dwt_config_default_timeout)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
if (!libinput_device_config_dwt_is_available(device))
|
||||
return LITEST_NOT_APPLICABLE;
|
||||
|
||||
litest_assert_int_eq(libinput_device_config_dwt_get_default_timeout(device),
|
||||
500U);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_dwt_config_default_on)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
|
|
@ -4546,6 +4559,19 @@ START_TEST(touchpad_dwt_config_default_on)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_dwtp_config_default_timeout)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
|
||||
if (!libinput_device_config_dwtp_is_available(device))
|
||||
return LITEST_NOT_APPLICABLE;
|
||||
|
||||
litest_assert_int_eq(libinput_device_config_dwtp_get_default_timeout(device),
|
||||
300U);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_dwtp_config_default_on)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
|
|
@ -7225,6 +7251,7 @@ TEST_COLLECTION(touchpad_dwt)
|
|||
litest_add(touchpad_dwt_click, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add(touchpad_dwt_edge_scroll, LITEST_TOUCHPAD, LITEST_CLICKPAD);
|
||||
litest_add(touchpad_dwt_edge_scroll_interrupt, LITEST_TOUCHPAD, LITEST_CLICKPAD);
|
||||
litest_add(touchpad_dwt_config_default_timeout, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add(touchpad_dwt_config_default_on, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add(touchpad_dwt_config_default_off, LITEST_ANY, LITEST_TOUCHPAD);
|
||||
litest_add(touchpad_dwt_disabled, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
|
|
@ -7236,6 +7263,7 @@ TEST_COLLECTION(touchpad_dwt)
|
|||
litest_add(touchpad_dwt_enable_before_touch, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add(touchpad_dwt_enable_during_tap, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add(touchpad_dwt_remove_kbd_while_active, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add(touchpad_dwtp_config_default_timeout, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add(touchpad_dwtp_config_default_on, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add(touchpad_dwtp_config_default_off, LITEST_ANY, LITEST_TOUCHPAD);
|
||||
litest_add_for_device(touchpad_dwt_apple, LITEST_BCM5974);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue