Add support for LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY

Use it as the default, as recommended by the libinput release
notes:
https://lists.freedesktop.org/archives/wayland-devel/2024-November/043860.html
This commit is contained in:
Simon Ser 2024-11-20 20:50:27 +01:00 committed by Kirill Primak
parent e2409aa496
commit bbadf9b8b1
4 changed files with 18 additions and 3 deletions

View file

@ -15,6 +15,11 @@ struct cmd_results *input_cmd_drag_lock(int argc, char **argv) {
return cmd_results_new(CMD_FAILURE, "No input device defined.");
}
#if HAVE_LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY
if (strcmp(argv[0], "enabled_sticky")) {
ic->drag_lock = LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY;
} else
#endif
if (parse_boolean(argv[0], true)) {
ic->drag_lock = LIBINPUT_CONFIG_DRAG_LOCK_ENABLED;
} else {

View file

@ -272,6 +272,10 @@ bool sway_input_configure_libinput_device(struct sway_input_device *input_device
}
if (ic->drag_lock != INT_MIN) {
changed |= set_tap_drag_lock(device, ic->drag_lock);
} else {
#if HAVE_LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY
changed |= set_tap_drag_lock(device, LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY);
#endif
}
if (ic->pointer_accel != FLT_MIN) {
changed |= set_accel_speed(device, ic->pointer_accel);
@ -354,8 +358,12 @@ void sway_input_reset_libinput_device(struct sway_input_device *input_device) {
libinput_device_config_tap_get_default_button_map(device));
changed |= set_tap_drag(device,
libinput_device_config_tap_get_default_drag_enabled(device));
#if HAVE_LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY
changed |= set_tap_drag_lock(device, LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY);
#else
changed |= set_tap_drag_lock(device,
libinput_device_config_tap_get_default_drag_lock_enabled(device));
#endif
changed |= set_accel_speed(device,
libinput_device_config_accel_get_default_speed(device));
changed |= set_rotation_angle(device,

View file

@ -152,8 +152,9 @@ The following commands may only be used in the configuration file.
*input* <identifier> drag enabled|disabled
Enables or disables tap-and-drag for specified input device.
*input* <identifier> drag_lock enabled|disabled
Enables or disables drag lock for specified input device.
*input* <identifier> drag_lock enabled|disabled|enabled_sticky
Enables or disables drag lock for specified input device. The default is
_enabled_sticky_.
*input* <identifier> dwt enabled|disabled
Enables or disables disable-while-typing for the specified input device.

View file

@ -1174,7 +1174,8 @@ following properties will be included for devices that support them:
: Whether tap-and-drag is enabled. It can be _enabled_ or _disabled_
|- tap_drag_lock
: string
: Whether drag-lock is enabled. It can be _enabled_ or _disabled_
: Whether drag-lock is enabled. It can be _enabled_, _disabled_ or
_enabled_sticky_
|- accel_speed
: double
: The pointer-acceleration in use