mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-07-27 10:11:55 -07:00
input: add sticky option for drag_lock (#10702)
* allow configuring the sticky option for `drag_lock` * enable sticky drag_lock by default as recommended by libinput recommended here: https://lists.freedesktop.org/archives/wayland-devel/2024-November/043860.html
This commit is contained in:
@@ -136,7 +136,7 @@ pkg_check_modules(
|
|||||||
pixman-1
|
pixman-1
|
||||||
xcursor
|
xcursor
|
||||||
libdrm
|
libdrm
|
||||||
libinput
|
libinput>=1.28
|
||||||
gbm
|
gbm
|
||||||
gio-2.0
|
gio-2.0
|
||||||
re2)
|
re2)
|
||||||
|
@@ -623,9 +623,10 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
|||||||
},
|
},
|
||||||
SConfigOptionDescription{
|
SConfigOptionDescription{
|
||||||
.value = "input:touchpad:drag_lock",
|
.value = "input:touchpad:drag_lock",
|
||||||
.description = "When enabled, lifting the finger off for a short time while dragging will not drop the dragged item.",
|
.description = "When enabled, lifting the finger off while dragging will not drop the dragged item. 0 -> disabled, 1 -> enabled with timeout, 2 -> enabled sticky."
|
||||||
.type = CONFIG_OPTION_BOOL,
|
"dragging will not drop the dragged item.",
|
||||||
.data = SConfigOptionDescription::SBoolData{false},
|
.type = CONFIG_OPTION_INT,
|
||||||
|
.data = SConfigOptionDescription::SRangeData{2, 0, 2},
|
||||||
},
|
},
|
||||||
SConfigOptionDescription{
|
SConfigOptionDescription{
|
||||||
.value = "input:touchpad:tap-and-drag",
|
.value = "input:touchpad:tap-and-drag",
|
||||||
|
@@ -652,7 +652,7 @@ CConfigManager::CConfigManager() {
|
|||||||
registerConfigVar("input:touchpad:middle_button_emulation", Hyprlang::INT{0});
|
registerConfigVar("input:touchpad:middle_button_emulation", Hyprlang::INT{0});
|
||||||
registerConfigVar("input:touchpad:tap-to-click", Hyprlang::INT{1});
|
registerConfigVar("input:touchpad:tap-to-click", Hyprlang::INT{1});
|
||||||
registerConfigVar("input:touchpad:tap-and-drag", Hyprlang::INT{1});
|
registerConfigVar("input:touchpad:tap-and-drag", Hyprlang::INT{1});
|
||||||
registerConfigVar("input:touchpad:drag_lock", Hyprlang::INT{0});
|
registerConfigVar("input:touchpad:drag_lock", Hyprlang::INT{2});
|
||||||
registerConfigVar("input:touchpad:scroll_factor", {1.f});
|
registerConfigVar("input:touchpad:scroll_factor", {1.f});
|
||||||
registerConfigVar("input:touchpad:flip_x", Hyprlang::INT{0});
|
registerConfigVar("input:touchpad:flip_x", Hyprlang::INT{0});
|
||||||
registerConfigVar("input:touchpad:flip_y", Hyprlang::INT{0});
|
registerConfigVar("input:touchpad:flip_y", Hyprlang::INT{0});
|
||||||
@@ -775,7 +775,7 @@ CConfigManager::CConfigManager() {
|
|||||||
m_config->addSpecialConfigValue("device", "middle_button_emulation", Hyprlang::INT{0});
|
m_config->addSpecialConfigValue("device", "middle_button_emulation", Hyprlang::INT{0});
|
||||||
m_config->addSpecialConfigValue("device", "tap-to-click", Hyprlang::INT{1});
|
m_config->addSpecialConfigValue("device", "tap-to-click", Hyprlang::INT{1});
|
||||||
m_config->addSpecialConfigValue("device", "tap-and-drag", Hyprlang::INT{1});
|
m_config->addSpecialConfigValue("device", "tap-and-drag", Hyprlang::INT{1});
|
||||||
m_config->addSpecialConfigValue("device", "drag_lock", Hyprlang::INT{0});
|
m_config->addSpecialConfigValue("device", "drag_lock", Hyprlang::INT{2});
|
||||||
m_config->addSpecialConfigValue("device", "left_handed", Hyprlang::INT{0});
|
m_config->addSpecialConfigValue("device", "left_handed", Hyprlang::INT{0});
|
||||||
m_config->addSpecialConfigValue("device", "scroll_method", {STRVAL_EMPTY});
|
m_config->addSpecialConfigValue("device", "scroll_method", {STRVAL_EMPTY});
|
||||||
m_config->addSpecialConfigValue("device", "scroll_button", Hyprlang::INT{0});
|
m_config->addSpecialConfigValue("device", "scroll_button", Hyprlang::INT{0});
|
||||||
|
@@ -1233,10 +1233,10 @@ void CInputManager::setPointerConfigs() {
|
|||||||
else
|
else
|
||||||
libinput_device_config_tap_set_drag_enabled(LIBINPUTDEV, LIBINPUT_CONFIG_DRAG_ENABLED);
|
libinput_device_config_tap_set_drag_enabled(LIBINPUTDEV, LIBINPUT_CONFIG_DRAG_ENABLED);
|
||||||
|
|
||||||
if (g_pConfigManager->getDeviceInt(devname, "drag_lock", "input:touchpad:drag_lock") == 0)
|
const auto TAP_DRAG_LOCK = g_pConfigManager->getDeviceInt(devname, "drag_lock", "input:touchpad:drag_lock");
|
||||||
libinput_device_config_tap_set_drag_lock_enabled(LIBINPUTDEV, LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
|
if (TAP_DRAG_LOCK >= 0 && TAP_DRAG_LOCK <= 2) {
|
||||||
else
|
libinput_device_config_tap_set_drag_lock_enabled(LIBINPUTDEV, static_cast<libinput_config_drag_lock_state>(TAP_DRAG_LOCK));
|
||||||
libinput_device_config_tap_set_drag_lock_enabled(LIBINPUTDEV, LIBINPUT_CONFIG_DRAG_LOCK_ENABLED);
|
}
|
||||||
|
|
||||||
if (libinput_device_config_tap_get_finger_count(LIBINPUTDEV)) // this is for tapping (like on a laptop)
|
if (libinput_device_config_tap_get_finger_count(LIBINPUTDEV)) // this is for tapping (like on a laptop)
|
||||||
libinput_device_config_tap_set_enabled(LIBINPUTDEV,
|
libinput_device_config_tap_set_enabled(LIBINPUTDEV,
|
||||||
|
@@ -21,7 +21,7 @@ executable(
|
|||||||
dependency('libdrm'),
|
dependency('libdrm'),
|
||||||
dependency('egl'),
|
dependency('egl'),
|
||||||
dependency('xkbcommon'),
|
dependency('xkbcommon'),
|
||||||
dependency('libinput'),
|
dependency('libinput', version: '>=1.28'),
|
||||||
dependency('re2'),
|
dependency('re2'),
|
||||||
xcb_dep,
|
xcb_dep,
|
||||||
xcb_composite_dep,
|
xcb_composite_dep,
|
||||||
|
Reference in New Issue
Block a user