desktop/window: use workArea for idealBB (#12802)
This commit is contained in:
parent
bd7f9aad05
commit
9b93d621b1
1 changed files with 15 additions and 11 deletions
|
|
@ -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)};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue