diff options
| author | memchr <118117622+memchr@users.noreply.github.com> | 2023-09-11 09:09:34 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-11 10:09:34 +0100 |
| commit | e96e0dc02d9368580100bbabd8f098746a42af6b (patch) | |
| tree | 72853f4b696bc5c90b26d9cfb713772c04b9b8a8 /src/layout/IHyprLayout.cpp | |
| parent | 3859607b6cf26ead21f4a23ee11458b7b67fe542 (diff) | |
refactor: utilize 'middle()' method for window/montior center (#3253)
Diffstat (limited to 'src/layout/IHyprLayout.cpp')
| -rw-r--r-- | src/layout/IHyprLayout.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index a000adb8..b0c1d50c 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -511,8 +511,7 @@ CWindow* IHyprLayout::getNextWindowCandidate(CWindow* pWindow) { return m_pLastTiledWindow; // if we don't, let's try to find any window that is in the middle - if (const auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowIdeal(pWindow->m_vRealPosition.goalv() + pWindow->m_vRealSize.goalv() / 2.f); - PWINDOWCANDIDATE && PWINDOWCANDIDATE != pWindow) + if (const auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowIdeal(pWindow->middle()); PWINDOWCANDIDATE && PWINDOWCANDIDATE != pWindow) return PWINDOWCANDIDATE; // if not, floating window @@ -527,7 +526,7 @@ CWindow* IHyprLayout::getNextWindowCandidate(CWindow* pWindow) { } // if it was a tiled window, we first try to find the window that will replace it. - const auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowIdeal(pWindow->m_vRealPosition.goalv() + pWindow->m_vRealSize.goalv() / 2.f); + const auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowIdeal(pWindow->middle()); if (!PWINDOWCANDIDATE || pWindow == PWINDOWCANDIDATE || !PWINDOWCANDIDATE->m_bIsMapped || PWINDOWCANDIDATE->isHidden() || PWINDOWCANDIDATE->m_bX11ShouldntFocus || PWINDOWCANDIDATE->m_iX11Type == 2 || PWINDOWCANDIDATE->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID) |
