summaryrefslogtreecommitdiff
path: root/src/Window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.cpp')
-rw-r--r--src/Window.cpp37
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;