diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index fc020d7ac..b1812828b 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -480,6 +480,7 @@ CConfigManager::CConfigManager() { registerConfigVar("misc:layers_hog_keyboard_focus", Hyprlang::INT{1}); registerConfigVar("misc:animate_manual_resizes", Hyprlang::INT{0}); registerConfigVar("misc:animate_mouse_windowdragging", Hyprlang::INT{0}); + registerConfigVar("misc:debounce_drag", Hyprlang::INT{2}); registerConfigVar("misc:disable_autoreload", Hyprlang::INT{0}); registerConfigVar("misc:enable_swallow", Hyprlang::INT{0}); registerConfigVar("misc:swallow_regex", {STRVAL_EMPTY}); diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index 18c100b72..d4383ca4c 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -589,7 +589,8 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) { static auto PANIMATEMOUSE = CConfigValue("misc:animate_mouse_windowdragging"); static auto PANIMATE = CConfigValue("misc:animate_manual_resizes"); - static auto SNAPENABLED = CConfigValue("general:snap:enabled"); + static auto SNAPENABLED = CConfigValue("general:snap:enabled"); + static auto PDEBOUNCEDRAG = CConfigValue("misc:debounce_drag"); const auto TIMERDELTA = std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - TIMER).count(); const auto MSDELTA = std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - MSTIMER).count(); @@ -602,7 +603,10 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) { if (m_mouseMoveEventCount == 1) totalMs = 0; - if (MSMONITOR > 16.0) { + // Apply debounce automatically for 60Hz monitors (MSMONITOR > 16.0), + // or manually if user explicitly enables it. High-refresh users get max smoothness by default. + // 0 = off, 1 = on, 2 = auto (default) + if ((MSMONITOR > 16.0 && *PDEBOUNCEDRAG == 2) || *PDEBOUNCEDRAG == 1) { totalMs += MSDELTA < MSMONITOR ? MSDELTA : std::round(totalMs * 1.0 / m_mouseMoveEventCount); m_mouseMoveEventCount += 1;