From 9b93d621b1019e8378b8a902edb7ba8dd8baf204 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Thu, 1 Jan 2026 16:48:23 +0100 Subject: [PATCH] desktop/window: use workArea for idealBB (#12802) --- src/desktop/view/Window.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/desktop/view/Window.cpp b/src/desktop/view/Window.cpp index b0e6a365..3031284c 100644 --- a/src/desktop/view/Window.cpp +++ b/src/desktop/view/Window.cpp @@ -246,7 +246,7 @@ CBox CWindow::getFullWindowBoundingBox() const { CBox CWindow::getWindowIdealBoundingBoxIgnoreReserved() { const auto PMONITOR = m_monitor.lock(); - if (!PMONITOR) + if (!PMONITOR || !m_workspace) return {m_position, m_size}; auto POS = m_position; @@ -259,21 +259,25 @@ CBox CWindow::getWindowIdealBoundingBoxIgnoreReserved() { return CBox{sc(POS.x), sc(POS.y), sc(SIZE.x), sc(SIZE.y)}; } - if (DELTALESSTHAN(POS.y - PMONITOR->m_position.y, PMONITOR->m_reservedArea.top(), 1)) { + // get work area + const auto WORKAREA = g_pLayoutManager->getCurrentLayout()->workAreaOnWorkspace(m_workspace); + const auto RESERVED = CReservedArea{PMONITOR->logicalBox(), WORKAREA}; + + if (DELTALESSTHAN(POS.y - PMONITOR->m_position.y, RESERVED.top(), 1)) { POS.y = PMONITOR->m_position.y; - SIZE.y += PMONITOR->m_reservedArea.top(); + SIZE.y += RESERVED.top(); } - if (DELTALESSTHAN(POS.x - PMONITOR->m_position.x, PMONITOR->m_reservedArea.left(), 1)) { + if (DELTALESSTHAN(POS.x - PMONITOR->m_position.x, RESERVED.left(), 1)) { POS.x = PMONITOR->m_position.x; - SIZE.x += PMONITOR->m_reservedArea.left(); - } - if (DELTALESSTHAN(POS.x + SIZE.x - PMONITOR->m_position.x, PMONITOR->m_size.x - PMONITOR->m_reservedArea.right(), 1)) { - SIZE.x += PMONITOR->m_reservedArea.right(); - } - if (DELTALESSTHAN(POS.y + SIZE.y - PMONITOR->m_position.y, PMONITOR->m_size.y - PMONITOR->m_reservedArea.bottom(), 1)) { - SIZE.y += PMONITOR->m_reservedArea.bottom(); + SIZE.x += RESERVED.left(); } + if (DELTALESSTHAN(POS.x + SIZE.x - PMONITOR->m_position.x, PMONITOR->m_size.x - RESERVED.right(), 1)) + SIZE.x += RESERVED.right(); + + if (DELTALESSTHAN(POS.y + SIZE.y - PMONITOR->m_position.y, PMONITOR->m_size.y - RESERVED.bottom(), 1)) + SIZE.y += RESERVED.bottom(); + return CBox{sc(POS.x), sc(POS.y), sc(SIZE.x), sc(SIZE.y)}; }