From ad4f5f15f39f384f0d85f479fc0f3ee86440fe53 Mon Sep 17 00:00:00 2001 From: Mihail Costea Date: Mon, 9 Mar 2026 18:47:50 +0200 Subject: [PATCH] layout: fix drag_threshold window snap regression (rebased for #12890) (#13140) Guard position assignments in updateDragWindow() behind m_dragThresholdReached to prevent windows from snapping to cursor before drag_threshold is exceeded. Fixes: https://github.com/hyprwm/Hyprland/pull/13140 --- src/layout/supplementary/DragController.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layout/supplementary/DragController.cpp b/src/layout/supplementary/DragController.cpp index be70f4ac2..4257c913d 100644 --- a/src/layout/supplementary/DragController.cpp +++ b/src/layout/supplementary/DragController.cpp @@ -58,15 +58,15 @@ bool CDragStateController::updateDragWindow() { m_draggingTiled = false; m_draggingWindowOriginalFloatSize = DRAGGINGTARGET->lastFloatingSize(); - if (WAS_FULLSCREEN && DRAGGINGTARGET->floating()) { + if (WAS_FULLSCREEN && DRAGGINGTARGET->floating() && m_dragThresholdReached) { const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal(); DRAGGINGTARGET->setPositionGlobal(CBox{MOUSECOORDS - DRAGGINGTARGET->position().size() / 2.F, DRAGGINGTARGET->position().size()}); } else if (!DRAGGINGTARGET->floating() && m_dragMode == MBIND_MOVE) { Vector2D MINSIZE = DRAGGINGTARGET->minSize().value_or(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}); DRAGGINGTARGET->rememberFloatingSize((DRAGGINGTARGET->position().size() * 0.8489).clamp(MINSIZE, Vector2D{}).floor()); - DRAGGINGTARGET->setPositionGlobal(CBox{g_pInputManager->getMouseCoordsInternal() - DRAGGINGTARGET->position().size() / 2.F, DRAGGINGTARGET->position().size()}); if (m_dragThresholdReached) { + DRAGGINGTARGET->setPositionGlobal(CBox{g_pInputManager->getMouseCoordsInternal() - DRAGGINGTARGET->position().size() / 2.F, DRAGGINGTARGET->position().size()}); g_layoutManager->changeFloatingMode(DRAGGINGTARGET); m_draggingTiled = true; }