summaryrefslogtreecommitdiff
path: root/src/desktop/view/Window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/desktop/view/Window.cpp')
-rw-r--r--src/desktop/view/Window.cpp26
1 files 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<int>(POS.x), sc<int>(POS.y), sc<int>(SIZE.x), sc<int>(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<int>(POS.x), sc<int>(POS.y), sc<int>(SIZE.x), sc<int>(SIZE.y)};
}