diff options
| author | Darksome <dev@darkso.me> | 2022-07-15 19:42:03 +0300 |
|---|---|---|
| committer | Darksome <dev@darkso.me> | 2022-07-15 19:42:03 +0300 |
| commit | 5388b54442614cb0d3d445f101e7cd86bf64c125 (patch) | |
| tree | 26057ff185e423e944e8b250ed7fe26654b69623 /src/layout/IHyprLayout.cpp | |
| parent | cb8a6f881b11e9a269fd5f7aa64eafe2beda0b0d (diff) | |
| parent | 6306d4dae3fa221a6099e109c7faef60bac4fac5 (diff) | |
Merge upstream
Diffstat (limited to 'src/layout/IHyprLayout.cpp')
| -rw-r--r-- | src/layout/IHyprLayout.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index a7f2facf..9f258b44 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -45,7 +45,7 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) { Vector2D middlePoint = Vector2D(desiredGeometry.x, desiredGeometry.y) + Vector2D(desiredGeometry.width, desiredGeometry.height) / 2.f; // TODO: detect a popup in a more consistent way. - if (!g_pCompositor->isPointOnAnyMonitor(middlePoint) || (desiredGeometry.x == 0 && desiredGeometry.y == 0)) { + if ((desiredGeometry.x == 0 && desiredGeometry.y == 0)) { // if it's not, fall back to the center placement pWindow->m_vRealPosition = PMONITOR->vecPosition + Vector2D((PMONITOR->vecSize.x - desiredGeometry.width) / 2.f, (PMONITOR->vecSize.y - desiredGeometry.height) / 2.f); } else { @@ -65,10 +65,12 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) { pWindow->m_vRealSize.setValue(pWindow->m_vRealSize.goalv()); } - g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goalv()); - g_pCompositor->fixXWaylandWindowsOnWorkspace(PMONITOR->activeWorkspace); + if (pWindow->m_iX11Type != 2) { + g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goalv()); + g_pCompositor->fixXWaylandWindowsOnWorkspace(PMONITOR->activeWorkspace); - g_pCompositor->moveWindowToTop(pWindow); + g_pCompositor->moveWindowToTop(pWindow); + } } void IHyprLayout::onBeginDragWindow() { @@ -210,9 +212,23 @@ void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) { // fix pseudo leaving artifacts g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID)); } else { + pWindow->m_vSize = pWindow->m_vRealSize.vec(); + pWindow->m_vPosition = pWindow->m_vRealPosition.vec(); + onWindowRemovedTiling(pWindow); g_pCompositor->moveWindowToTop(pWindow); + + const auto POS = pWindow->m_vRealPosition.goalv(); + const auto SIZ = pWindow->m_vRealSize.goalv(); + + pWindow->m_vRealPosition.setValueAndWarp(POS + Vector2D(5, 5)); + pWindow->m_vRealSize.setValueAndWarp(SIZ - Vector2D(10, 10)); + + pWindow->m_vRealPosition = POS; + pWindow->m_vRealSize = SIZ; + + g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID)); } } |
