diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-02-28 22:32:42 +0000 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-02-28 22:32:42 +0000 |
| commit | 2187c6cf43681511c08c8c2c84cd5acff754e522 (patch) | |
| tree | 9d17b63e61ed0e99a7f99f38c058ff44fc259f93 /src/Window.cpp | |
| parent | 984c2fdc6857de66697a35aede457464cf7adc76 (diff) | |
Allow decos to request interactivity
Diffstat (limited to 'src/Window.cpp')
| -rw-r--r-- | src/Window.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/Window.cpp b/src/Window.cpp index e06c3d3a..1c3d0338 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -88,6 +88,43 @@ wlr_box CWindow::getWindowIdealBoundingBoxIgnoreReserved() { return wlr_box{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y}; } +wlr_box CWindow::getWindowInputBox() { + static auto* const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue; + + 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 = {{*PBORDERSIZE + 2, *PBORDERSIZE + 2}, {*PBORDERSIZE + 2, *PBORDERSIZE + 2}}; + + for (auto& wd : m_dWindowDecorations) { + + if (!wd->allowsInput()) + continue; + + const auto EXTENTS = wd->getWindowDecorationExtents(); + + 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; + + if (EXTENTS.bottomRight.y > maxExtents.bottomRight.y) + maxExtents.bottomRight.y = EXTENTS.bottomRight.y; + } + + // Add extents to the real base BB and return + wlr_box 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; +} + SWindowDecorationExtents CWindow::getFullWindowReservedArea() { SWindowDecorationExtents extents; |
