summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-30 14:55:42 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-30 14:55:42 +0200
commitb1c11f3d2e3db739742ea94d59ecbfe7878d1cd3 (patch)
tree128f352afb05d8a983bae2f8693059455d26d524 /src
parentda63503d5fc1fecf1b1c4e18061ac0f6d9a3221c (diff)
consider the full bb with deco in rendering
Diffstat (limited to 'src')
-rw-r--r--src/Window.cpp30
-rw-r--r--src/Window.hpp3
-rw-r--r--src/render/Renderer.cpp2
3 files changed, 34 insertions, 1 deletions
diff --git a/src/Window.cpp b/src/Window.cpp
index 5bb1738e..2182d47c 100644
--- a/src/Window.cpp
+++ b/src/Window.cpp
@@ -13,4 +13,34 @@ CWindow::~CWindow() {
g_pCompositor->m_pLastFocus = nullptr;
g_pCompositor->m_pLastWindow = nullptr;
}
+}
+
+wlr_box CWindow::getFullWindowBoundingBox() {
+
+ SWindowDecorationExtents maxExtents;
+
+ for (auto& wd : m_dWindowDecorations) {
+
+ 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;
} \ No newline at end of file
diff --git a/src/Window.hpp b/src/Window.hpp
index e7861237..7fd909ba 100644
--- a/src/Window.hpp
+++ b/src/Window.hpp
@@ -105,4 +105,7 @@ public:
return m_uSurface.xdg == rhs.m_uSurface.xdg && m_uSurface.xwayland == rhs.m_uSurface.xwayland && m_vPosition == rhs.m_vPosition && m_vSize == rhs.m_vSize && m_bFadingOut == rhs.m_bFadingOut;
}
+ // methods
+ wlr_box getFullWindowBoundingBox();
+
}; \ No newline at end of file
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 02824920..1c661829 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -32,7 +32,7 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
}
bool shouldRenderWindow(CWindow* pWindow, SMonitor* pMonitor) {
- wlr_box geometry = {pWindow->m_vRealPosition.vec().x, pWindow->m_vRealPosition.vec().y, pWindow->m_vRealSize.vec().x, pWindow->m_vRealSize.vec().y};
+ wlr_box geometry = pWindow->getFullWindowBoundingBox();
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, &geometry))
return false;