diff options
author | vaxerski <[email protected]> | 2022-06-23 20:39:48 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-06-23 20:39:48 +0200 |
commit | f76b9c485246849bc3af838503fedbadf68023f5 (patch) | |
tree | f18fe6f0ca4fb0aa2b1ab6a2bf1f66259ea879b5 | |
parent | ae6007522600c969b5fe45b3888be5f12f343d1c (diff) | |
download | Hyprland-f76b9c485246849bc3af838503fedbadf68023f5.tar.gz Hyprland-f76b9c485246849bc3af838503fedbadf68023f5.zip |
fix: ignore reserved in getWindowInDirection
-rw-r--r-- | src/Compositor.cpp | 14 | ||||
-rw-r--r-- | src/Window.cpp | 25 | ||||
-rw-r--r-- | src/Window.hpp | 1 |
3 files changed, 36 insertions, 4 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 1861e5aa..be94c093 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -770,8 +770,11 @@ void CCompositor::cleanupFadingOut() { } CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) { - const auto POSA = pWindow->m_vPosition; - const auto SIZEA = pWindow->m_vSize; + + const auto WINDOWIDEALBB = pWindow->getWindowIdealBoundingBoxIgnoreReserved(); + + const auto POSA = Vector2D(WINDOWIDEALBB.x, WINDOWIDEALBB.y); + const auto SIZEA = Vector2D(WINDOWIDEALBB.width, WINDOWIDEALBB.height); auto longestIntersect = -1; CWindow* longestIntersectWindow = nullptr; @@ -780,8 +783,11 @@ CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) { if (&w == pWindow || !windowValidMapped(&w) || w.m_bIsFloating || !isWorkspaceVisible(w.m_iWorkspaceID)) continue; - const auto POSB = w.m_vPosition; - const auto SIZEB = w.m_vSize; + const auto BWINDOWIDEALBB = w.getWindowIdealBoundingBoxIgnoreReserved(); + + const auto POSB = Vector2D(BWINDOWIDEALBB.x, BWINDOWIDEALBB.y); + const auto SIZEB = Vector2D(BWINDOWIDEALBB.width, BWINDOWIDEALBB.height); + switch (dir) { case 'l': if (STICKS(POSA.x, POSB.x + SIZEB.x)) { diff --git a/src/Window.cpp b/src/Window.cpp index 2182d47c..8476360a 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -43,4 +43,29 @@ wlr_box CWindow::getFullWindowBoundingBox() { m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y}; return finalBox; +} + +wlr_box CWindow::getWindowIdealBoundingBoxIgnoreReserved() { + + const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); + + auto POS = m_vPosition; + auto SIZE = m_vSize; + + if (DELTALESSTHAN(POS.y - PMONITOR->vecPosition.y, PMONITOR->vecReservedTopLeft.y, 1)) { + POS.y = PMONITOR->vecPosition.y; + SIZE.y += PMONITOR->vecReservedTopLeft.y; + } + if (DELTALESSTHAN(POS.x - PMONITOR->vecPosition.x, PMONITOR->vecReservedTopLeft.x, 1)) { + POS.x = PMONITOR->vecPosition.x; + SIZE.x += PMONITOR->vecReservedTopLeft.x; + } + if (DELTALESSTHAN(POS.x + SIZE.x - PMONITOR->vecPosition.x, PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x, 1)) { + SIZE.x += PMONITOR->vecReservedBottomRight.x; + } + if (DELTALESSTHAN(POS.y + SIZE.y - PMONITOR->vecPosition.y, PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y, 1)) { + SIZE.y += PMONITOR->vecReservedBottomRight.y; + } + + return wlr_box{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y}; }
\ No newline at end of file diff --git a/src/Window.hpp b/src/Window.hpp index 7d357292..06140303 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -108,5 +108,6 @@ public: // methods wlr_box getFullWindowBoundingBox(); + wlr_box getWindowIdealBoundingBoxIgnoreReserved(); };
\ No newline at end of file |