diff options
| author | Vaxry <vaxry@vaxry.net> | 2023-11-16 17:31:52 +0000 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2023-11-16 17:31:52 +0000 |
| commit | 4868d4dfd3dca053915ddc3ec6444e7e96ebd8c6 (patch) | |
| tree | 0e89eb97c67867c562e34c25777c5115917ee968 | |
| parent | 859841f4d1ceb4060dcfcd2a94976805eaa39d62 (diff) | |
shadow: avoid fatal mutation of the windowBox for calcs
fixes #3865
| -rw-r--r-- | src/helpers/Box.cpp | 4 | ||||
| -rw-r--r-- | src/helpers/Box.hpp | 2 | ||||
| -rw-r--r-- | src/render/decorations/CHyprDropShadowDecoration.cpp | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/helpers/Box.cpp b/src/helpers/Box.cpp index 29aa81fa..3d57bc79 100644 --- a/src/helpers/Box.cpp +++ b/src/helpers/Box.cpp @@ -112,6 +112,10 @@ CBox CBox::roundInternal() { return CBox{std::floor(x), std::floor(y), std::floor(newW), std::floor(newH)}; } +CBox CBox::copy() const { + return CBox{*this}; +} + Vector2D CBox::pos() const { return {x, y}; } diff --git a/src/helpers/Box.hpp b/src/helpers/Box.hpp index cb07df06..5cb7f17f 100644 --- a/src/helpers/Box.hpp +++ b/src/helpers/Box.hpp @@ -52,6 +52,8 @@ class CBox { CBox& addExtents(const SWindowDecorationExtents& e); CBox& expand(const double& value); + CBox copy() const; + SWindowDecorationExtents extentsFrom(const CBox&); // this is the big box Vector2D middle() const; diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index 7138dc20..d8972376 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -129,7 +129,7 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D CRegion saveDamage = g_pHyprOpenGL->m_RenderData.damage; g_pHyprOpenGL->m_RenderData.damage = fullBox; - g_pHyprOpenGL->m_RenderData.damage.subtract(windowBox.expand(-ROUNDING * pMonitor->scale)).intersect(saveDamage); + g_pHyprOpenGL->m_RenderData.damage.subtract(windowBox.copy().expand(-ROUNDING * pMonitor->scale)).intersect(saveDamage); alphaFB.bind(); |
