diff options
| author | Mike Will <myQwil@gmail.com> | 2025-07-18 11:35:43 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-18 17:35:43 +0200 |
| commit | 260a13a12f6c9990c029650b615abd41cd2ab4c7 (patch) | |
| tree | edcdb8110c7a1bc5b9bc47dc90c7ea922b86c468 /src/desktop/Window.cpp | |
| parent | 088e8af95567398ea0e339698e086039eba140ef (diff) | |
snap: use window extents instead of border size (#11079)
* snap: use window extents instead of border size
`border_overlap` no longer does anything for window snapping, only monitor snapping.
Diffstat (limited to 'src/desktop/Window.cpp')
| -rw-r--r-- | src/desktop/Window.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index 8cdb5ceb..ceb21d09 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -236,6 +236,18 @@ CBox CWindow::getWindowIdealBoundingBoxIgnoreReserved() { return CBox{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y}; } +SBoxExtents CWindow::getWindowExtentsUnified(uint64_t properties) { + SBoxExtents extents = {.topLeft = {0, 0}, .bottomRight = {0, 0}}; + if (properties & RESERVED_EXTENTS) + extents.addExtents(g_pDecorationPositioner->getWindowDecorationReserved(m_self.lock())); + if (properties & INPUT_EXTENTS) + extents.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(m_self.lock(), true)); + if (properties & FULL_EXTENTS) + extents.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(m_self.lock(), false)); + + return extents; +} + CBox CWindow::getWindowBoxUnified(uint64_t properties) { if (m_windowData.dimAround.valueOrDefault()) { const auto PMONITOR = m_monitor.lock(); @@ -243,16 +255,8 @@ CBox CWindow::getWindowBoxUnified(uint64_t properties) { return {PMONITOR->m_position.x, PMONITOR->m_position.y, PMONITOR->m_size.x, PMONITOR->m_size.y}; } - SBoxExtents EXTENTS = {.topLeft = {0, 0}, .bottomRight = {0, 0}}; - if (properties & RESERVED_EXTENTS) - EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationReserved(m_self.lock())); - if (properties & INPUT_EXTENTS) - EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(m_self.lock(), true)); - if (properties & FULL_EXTENTS) - EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(m_self.lock(), false)); - CBox box = {m_realPosition->value().x, m_realPosition->value().y, m_realSize->value().x, m_realSize->value().y}; - box.addExtents(EXTENTS); + box.addExtents(getWindowExtentsUnified(properties)); return box; } |
