From 1e3571eb5b00da73f7eb961975c21ceefa2dd366 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 29 May 2023 18:05:41 +0200 Subject: [PATCH] layout: don't reset to floating size on drag tiled --- src/layout/IHyprLayout.cpp | 4 ++++ src/layout/IHyprLayout.hpp | 1 + 2 files changed, 5 insertions(+) diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index fc461f93..b5663b69 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -189,8 +189,11 @@ void IHyprLayout::onBeginDragWindow() { DRAGGINGWINDOW->m_bDraggingTiled = false; + m_vDraggingWindowOriginalFloatSize = DRAGGINGWINDOW->m_vLastFloatingSize; + if (!DRAGGINGWINDOW->m_bIsFloating) { if (g_pInputManager->dragMode == MBIND_MOVE) { + DRAGGINGWINDOW->m_vLastFloatingSize = (DRAGGINGWINDOW->m_vRealSize.goalv() * 0.8489).clamp(Vector2D{5, 5}, Vector2D{}).floor(); changeWindowFloatingMode(DRAGGINGWINDOW); DRAGGINGWINDOW->m_bIsFloating = true; DRAGGINGWINDOW->m_bDraggingTiled = true; @@ -250,6 +253,7 @@ void IHyprLayout::onEndDragWindow() { DRAGGINGWINDOW->m_bIsFloating = false; g_pInputManager->refocus(); changeWindowFloatingMode(DRAGGINGWINDOW); + DRAGGINGWINDOW->m_vLastFloatingSize = m_vDraggingWindowOriginalFloatSize; } g_pHyprRenderer->damageWindow(DRAGGINGWINDOW); diff --git a/src/layout/IHyprLayout.hpp b/src/layout/IHyprLayout.hpp index f0704298..fe1f8b5b 100644 --- a/src/layout/IHyprLayout.hpp +++ b/src/layout/IHyprLayout.hpp @@ -153,6 +153,7 @@ interface IHyprLayout { Vector2D m_vLastDragXY; Vector2D m_vBeginDragPositionXY; Vector2D m_vBeginDragSizeXY; + Vector2D m_vDraggingWindowOriginalFloatSize; eRectCorner m_eGrabbedCorner = CORNER_TOPLEFT; CWindow* m_pLastTiledWindow = nullptr;