diff options
| author | nyx <nnyyxxxx@protonmail.com> | 2025-04-13 11:32:53 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-13 17:32:53 +0200 |
| commit | 06469b33919bf1806024e73a1540be50d7819ace (patch) | |
| tree | 0f82b00589510a0701921b808b46dbda0422f22b /src/layout/IHyprLayout.cpp | |
| parent | 303a10d27c7d9147b6c2256c0da4d4941051f66b (diff) | |
IHyprLayout: center floating window at cursor when picked up from fullscreen (#10063)
Diffstat (limited to 'src/layout/IHyprLayout.cpp')
| -rw-r--r-- | src/layout/IHyprLayout.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index 90bdb9e6..c7607377 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -945,9 +945,10 @@ Vector2D IHyprLayout::predictSizeForNewWindow(PHLWINDOW pWindow) { bool IHyprLayout::updateDragWindow() { const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow.lock(); + const bool WAS_FULLSCREEN = DRAGGINGWINDOW->isFullscreen(); if (g_pInputManager->m_bDragThresholdReached) { - if (DRAGGINGWINDOW->isFullscreen()) { + if (WAS_FULLSCREEN) { Debug::log(LOG, "Dragging a fullscreen window"); g_pCompositor->setWindowFullscreenInternal(DRAGGINGWINDOW, FSMODE_NONE); } @@ -963,7 +964,11 @@ bool IHyprLayout::updateDragWindow() { DRAGGINGWINDOW->m_bDraggingTiled = false; m_vDraggingWindowOriginalFloatSize = DRAGGINGWINDOW->m_vLastFloatingSize; - if (!DRAGGINGWINDOW->m_bIsFloating && g_pInputManager->dragMode == MBIND_MOVE) { + + if (WAS_FULLSCREEN && DRAGGINGWINDOW->m_bIsFloating) { + const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal(); + *DRAGGINGWINDOW->m_vRealPosition = MOUSECOORDS - DRAGGINGWINDOW->m_vRealSize->goal() / 2.f; + } else if (!DRAGGINGWINDOW->m_bIsFloating && g_pInputManager->dragMode == MBIND_MOVE) { Vector2D MINSIZE = DRAGGINGWINDOW->requestedMinSize().clamp(DRAGGINGWINDOW->m_sWindowData.minSize.valueOr(Vector2D(MIN_WINDOW_SIZE, MIN_WINDOW_SIZE))); DRAGGINGWINDOW->m_vLastFloatingSize = (DRAGGINGWINDOW->m_vRealSize->goal() * 0.8489).clamp(MINSIZE, Vector2D{}).floor(); *DRAGGINGWINDOW->m_vRealPosition = g_pInputManager->getMouseCoordsInternal() - DRAGGINGWINDOW->m_vRealSize->goal() / 2.f; |
