diff options
| author | MightyPlaza <123664421+MightyPlaza@users.noreply.github.com> | 2024-02-04 15:40:20 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-04 15:40:20 +0000 |
| commit | cbadf3e3f31ab5ad5d192daac5f2ca930d08b8fb (patch) | |
| tree | 40fe310e5ffb955a19b32a2c8d234b3bdf9e45cb /src/Window.cpp | |
| parent | 1ed4f1cb254ce4b4e55727d972998be1ef4baf22 (diff) | |
input: focus window on mouse down on decoration (#4514)
Also unifies vectorToWindow funcs
Diffstat (limited to 'src/Window.cpp')
| -rw-r--r-- | src/Window.cpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/src/Window.cpp b/src/Window.cpp index d821b1b9..1a7b9de9 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -139,35 +139,25 @@ CBox CWindow::getWindowIdealBoundingBoxIgnoreReserved() { return CBox{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y}; } -CBox CWindow::getWindowInputBox() { - const int BORDERSIZE = getRealBorderSize(); +CBox CWindow::getWindowBoxUnified(uint64_t properties) { if (m_sAdditionalConfigData.dimAround) { const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; } - SWindowDecorationExtents maxExtents = {{BORDERSIZE + 2, BORDERSIZE + 2}, {BORDERSIZE + 2, BORDERSIZE + 2}}; - - const auto EXTENTS = g_pDecorationPositioner->getWindowDecorationExtents(this, true); - - if (EXTENTS.topLeft.x > maxExtents.topLeft.x) - maxExtents.topLeft.x = EXTENTS.topLeft.x; - - if (EXTENTS.topLeft.y > maxExtents.topLeft.y) - maxExtents.topLeft.y = EXTENTS.topLeft.y; - - if (EXTENTS.bottomRight.x > maxExtents.bottomRight.x) - maxExtents.bottomRight.x = EXTENTS.bottomRight.x; + SWindowDecorationExtents EXTENTS = {{0, 0}, {0, 0}}; + if (properties & RESERVED_EXTENTS) + EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationReserved(this)); + if (properties & INPUT_EXTENTS) + EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(this, true)); + if (properties & FULL_EXTENTS) + EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(this, false)); - if (EXTENTS.bottomRight.y > maxExtents.bottomRight.y) - maxExtents.bottomRight.y = EXTENTS.bottomRight.y; + CBox box = {m_vRealPosition.vec().x, m_vRealPosition.vec().y, m_vRealSize.vec().x, m_vRealSize.vec().y}; + box.addExtents(EXTENTS); - // Add extents to the real base BB and return - CBox finalBox = {m_vRealPosition.vec().x - maxExtents.topLeft.x, m_vRealPosition.vec().y - maxExtents.topLeft.y, - m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x, m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y}; - - return finalBox; + return box; } CBox CWindow::getWindowMainSurfaceBox() { |
