diff --git a/src/Window.cpp b/src/Window.cpp index 8e4450c8..483dedf6 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -35,25 +35,24 @@ SWindowDecorationExtents CWindow::getFullWindowExtents() { {PMONITOR->vecSize.x - (m_vRealPosition.vec().x - PMONITOR->vecPosition.x), PMONITOR->vecSize.y - (m_vRealPosition.vec().y - PMONITOR->vecPosition.y)}}; } - SWindowDecorationExtents maxExtents = {{BORDERSIZE + 2, BORDERSIZE + 2}, {BORDERSIZE + 2, BORDERSIZE + 2}}; + SWindowDecorationExtents maxOutterExtents = {{}, {}}; 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.isInternalDecoration) + continue; - 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; + maxOutterExtents.topLeft.x = std::max(maxOutterExtents.topLeft.x, EXTENTS.topLeft.x); + maxOutterExtents.topLeft.y = std::max(maxOutterExtents.topLeft.y, EXTENTS.topLeft.y); + maxOutterExtents.bottomRight.x = std::max(maxOutterExtents.bottomRight.x, EXTENTS.bottomRight.x); + maxOutterExtents.bottomRight.y = std::max(maxOutterExtents.bottomRight.y, EXTENTS.bottomRight.y); } + SWindowDecorationExtents maxExtents = {m_seReservedInternal.topLeft + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + maxOutterExtents.topLeft, + m_seReservedInternal.bottomRight + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + maxOutterExtents.bottomRight}; + if (m_pWLSurface.exists() && !m_bIsX11) { wlr_box surfaceExtents = {0, 0, 0, 0}; // TODO: this could be better, perhaps make a getFullWindowRegion? @@ -142,27 +141,8 @@ wlr_box CWindow::getWindowInputBox() { return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; } - SWindowDecorationExtents maxExtents = {{BORDERSIZE + 2, BORDERSIZE + 2}, {BORDERSIZE + 2, BORDERSIZE + 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; - } + SWindowDecorationExtents maxExtents = {m_seReservedInternal.topLeft + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + m_seReservedExternal.topLeft, + m_seReservedInternal.bottomRight + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + m_seReservedExternal.bottomRight}; // 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, @@ -172,19 +152,15 @@ wlr_box CWindow::getWindowInputBox() { } SWindowDecorationExtents CWindow::getFullWindowReservedArea() { - SWindowDecorationExtents extents; + const int BORDERSIZE = getRealBorderSize(); + return {m_seReservedInternal.topLeft + m_seReservedExternal.topLeft + Vector2D(BORDERSIZE, BORDERSIZE), + m_seReservedInternal.bottomRight + m_seReservedExternal.bottomRight + Vector2D(BORDERSIZE, BORDERSIZE)}; +} - for (auto& wd : m_dWindowDecorations) { - const auto RESERVED = wd->getWindowDecorationReservedArea(); - - if (RESERVED.bottomRight == Vector2D{} && RESERVED.topLeft == Vector2D{}) - continue; - - extents.topLeft = extents.topLeft + RESERVED.topLeft; - extents.bottomRight = extents.bottomRight + RESERVED.bottomRight; - } - - return extents; +wlr_box CWindow::getWindowInternalBox() { + wlr_box internalBox = {m_vRealPosition.vec().x, m_vRealPosition.vec().y, m_vRealSize.vec().x, m_vRealSize.vec().y}; + addExtentsToBox(&internalBox, &m_seReservedInternal); + return internalBox; } void CWindow::updateWindowDecos() { @@ -204,6 +180,12 @@ void CWindow::updateWindowDecos() { } } + // handle this better later + auto i1 = m_seReservedInternal.topLeft; + auto i2 = m_seReservedInternal.bottomRight; + auto e1 = m_seReservedExternal.topLeft; + auto e2 = m_seReservedExternal.bottomRight; + // reset extents m_seReservedInternal.topLeft = Vector2D(); m_seReservedInternal.bottomRight = Vector2D(); @@ -211,20 +193,23 @@ void CWindow::updateWindowDecos() { m_seReservedExternal.bottomRight = Vector2D(); for (auto& wd : m_dWindowDecorations) { - const auto RESERVED = wd->getWindowDecorationReservedArea(); - if (RESERVED.isInternalDecoration) { - m_seReservedInternal.topLeft.x = std::max(m_seReservedInternal.topLeft.x, RESERVED.topLeft.x); - m_seReservedInternal.topLeft.y = std::max(m_seReservedInternal.topLeft.y, RESERVED.topLeft.y); - m_seReservedInternal.bottomRight.x = std::max(m_seReservedInternal.bottomRight.x, RESERVED.bottomRight.x); - m_seReservedInternal.bottomRight.y = std::max(m_seReservedInternal.bottomRight.y, RESERVED.bottomRight.y); - } else { - m_seReservedExternal.topLeft.x = std::max(m_seReservedExternal.topLeft.x, RESERVED.topLeft.x); - m_seReservedExternal.topLeft.y = std::max(m_seReservedExternal.topLeft.y, RESERVED.topLeft.y); - m_seReservedExternal.bottomRight.x = std::max(m_seReservedExternal.bottomRight.x, RESERVED.bottomRight.x); - m_seReservedExternal.bottomRight.y = std::max(m_seReservedExternal.bottomRight.y, RESERVED.bottomRight.y); + const auto EXTENTS = wd->getWindowDecorationExtents(); + if (EXTENTS.isInternalDecoration) { + m_seReservedInternal.topLeft.x = std::max(m_seReservedInternal.topLeft.x, EXTENTS.topLeft.x); + m_seReservedInternal.topLeft.y = std::max(m_seReservedInternal.topLeft.y, EXTENTS.topLeft.y); + m_seReservedInternal.bottomRight.x = std::max(m_seReservedInternal.bottomRight.x, EXTENTS.bottomRight.x); + m_seReservedInternal.bottomRight.y = std::max(m_seReservedInternal.bottomRight.y, EXTENTS.bottomRight.y); + } else if (EXTENTS.isReservedArea) { + m_seReservedExternal.topLeft.x = std::max(m_seReservedExternal.topLeft.x, EXTENTS.topLeft.x); + m_seReservedExternal.topLeft.y = std::max(m_seReservedExternal.topLeft.y, EXTENTS.topLeft.y); + m_seReservedExternal.bottomRight.x = std::max(m_seReservedExternal.bottomRight.x, EXTENTS.bottomRight.x); + m_seReservedExternal.bottomRight.y = std::max(m_seReservedExternal.bottomRight.y, EXTENTS.bottomRight.y); } } + if (i1 != m_seReservedInternal.topLeft || i2 != m_seReservedInternal.bottomRight || e1 != m_seReservedExternal.topLeft || e2 != m_seReservedExternal.bottomRight) + recalc = true; + if (recalc) g_pLayoutManager->getCurrentLayout()->recalculateWindow(this); diff --git a/src/Window.hpp b/src/Window.hpp index d3265bf5..f11ea32a 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -337,6 +337,7 @@ class CWindow { SWindowDecorationExtents getFullWindowExtents(); wlr_box getWindowInputBox(); wlr_box getWindowIdealBoundingBoxIgnoreReserved(); + wlr_box getWindowInternalBox(); void updateWindowDecos(); pid_t getPID(); IHyprWindowDecoration* getDecorationByType(eDecorationType); diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index 1ce47d96..1a6a470e 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -148,22 +148,16 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for PWINDOW->m_sSpecialRenderData.rounding = false; PWINDOW->m_sSpecialRenderData.shadow = false; - const auto RESERVED = PWINDOW->getFullWindowReservedArea(); - - const int BORDERSIZE = PWINDOW->getRealBorderSize(); - - PWINDOW->m_vRealPosition = PWINDOW->m_vPosition + Vector2D(BORDERSIZE, BORDERSIZE) + RESERVED.topLeft; - PWINDOW->m_vRealSize = PWINDOW->m_vSize - Vector2D(2 * BORDERSIZE, 2 * BORDERSIZE) - (RESERVED.topLeft + RESERVED.bottomRight); + PWINDOW->m_vRealPosition = PWINDOW->m_vPosition + PWINDOW->m_seReservedInternal.topLeft + PWINDOW->m_seReservedExternal.topLeft; + PWINDOW->m_vRealSize = PWINDOW->m_vSize - (PWINDOW->m_seReservedInternal.topLeft + PWINDOW->m_seReservedInternal.bottomRight) - (PWINDOW->m_seReservedExternal.topLeft + PWINDOW->m_seReservedExternal.bottomRight); PWINDOW->updateWindowDecos(); return; } - const int BORDERSIZE = PWINDOW->getRealBorderSize(); - - auto calcPos = PWINDOW->m_vPosition + Vector2D(BORDERSIZE, BORDERSIZE); - auto calcSize = PWINDOW->m_vSize - Vector2D(2 * BORDERSIZE, 2 * BORDERSIZE); + auto calcPos = PWINDOW->m_vPosition; + auto calcSize = PWINDOW->m_vSize; const auto OFFSETTOPLEFT = Vector2D(DISPLAYLEFT ? gapsOut : gapsIn, DISPLAYTOP ? gapsOut : gapsIn); diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index 6fa168c4..c5d4bfc6 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -624,22 +624,16 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { PWINDOW->m_sSpecialRenderData.rounding = false; PWINDOW->m_sSpecialRenderData.shadow = false; - const auto RESERVED = PWINDOW->getFullWindowReservedArea(); - - const int BORDERSIZE = PWINDOW->getRealBorderSize(); - - PWINDOW->m_vRealPosition = PWINDOW->m_vPosition + Vector2D(BORDERSIZE, BORDERSIZE) + RESERVED.topLeft; - PWINDOW->m_vRealSize = PWINDOW->m_vSize - Vector2D(2 * BORDERSIZE, 2 * BORDERSIZE) - (RESERVED.topLeft + RESERVED.bottomRight); + PWINDOW->m_vRealPosition = PWINDOW->m_vPosition + PWINDOW->m_seReservedInternal.topLeft + PWINDOW->m_seReservedExternal.topLeft; + PWINDOW->m_vRealSize = PWINDOW->m_vSize - (PWINDOW->m_seReservedInternal.topLeft + PWINDOW->m_seReservedInternal.bottomRight) - (PWINDOW->m_seReservedExternal.topLeft + PWINDOW->m_seReservedExternal.bottomRight); PWINDOW->updateWindowDecos(); return; } - const int BORDERSIZE = PWINDOW->getRealBorderSize(); - - auto calcPos = PWINDOW->m_vPosition + Vector2D(BORDERSIZE, BORDERSIZE); - auto calcSize = PWINDOW->m_vSize - Vector2D(2 * BORDERSIZE, 2 * BORDERSIZE); + auto calcPos = PWINDOW->m_vPosition; + auto calcSize = PWINDOW->m_vSize; const auto OFFSETTOPLEFT = Vector2D(DISPLAYLEFT ? gapsOut : gapsIn, DISPLAYTOP ? gapsOut : gapsIn); diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index 64cb1c0c..c9b33370 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -247,11 +247,9 @@ void CAnimationManager::tick() { const auto PDECO = PWINDOW->getDecorationByType(DECORATION_SHADOW); if (PDECO) { - const auto EXTENTS = PDECO->getWindowDecorationExtents(); - - wlr_box dmg = {PWINDOW->m_vRealPosition.vec().x - EXTENTS.topLeft.x, PWINDOW->m_vRealPosition.vec().y - EXTENTS.topLeft.y, - PWINDOW->m_vRealSize.vec().x + EXTENTS.topLeft.x + EXTENTS.bottomRight.x, - PWINDOW->m_vRealSize.vec().y + EXTENTS.topLeft.y + EXTENTS.bottomRight.y}; + auto EXTENTS = PDECO->getWindowDecorationExtents(); + wlr_box dmg = PWINDOW->getWindowInternalBox(); + addExtentsToBox(&dmg, &EXTENTS); if (!*PSHADOWIGNOREWINDOW) { // easy, damage the entire box diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index a54cc8bb..167679e7 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -24,13 +24,16 @@ eDecorationType CHyprDropShadowDecoration::getDecorationType() { } void CHyprDropShadowDecoration::damageEntire() { - static auto* const PSHADOWS = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue; + static auto* const PSHADOWS = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue; + const auto BORDERSIZE = m_pWindow->getRealBorderSize(); if (*PSHADOWS != 1) return; // disabled - - wlr_box dm = {m_vLastWindowPos.x - m_seExtents.topLeft.x, m_vLastWindowPos.y - m_seExtents.topLeft.y, m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x, - m_vLastWindowSize.y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y}; + wlr_box dm = m_pWindow->getWindowInternalBox(); + dm.x -= BORDERSIZE; + dm.x -= BORDERSIZE; + dm.width += 2.0 * BORDERSIZE; + dm.height += 2.0 * BORDERSIZE; g_pHyprRenderer->damageBox(&dm); } @@ -77,11 +80,15 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D const auto ROUNDING = m_pWindow->getRealRounding(); const auto BORDERSIZE = m_pWindow->getRealBorderSize(); - wlr_box windowBox = {m_vLastWindowPos.x - pMonitor->vecPosition.x, m_vLastWindowPos.y - pMonitor->vecPosition.y, m_vLastWindowSize.x, m_vLastWindowSize.y}; - addExtentsToBox(&windowBox, &(m_pWindow->m_seReservedInternal)); + wlr_box windowBox = {m_vLastWindowPos.x, m_vLastWindowPos.y, m_vLastWindowSize.x, m_vLastWindowSize.y}; + addExtentsToBox(&windowBox, &m_pWindow->m_seReservedInternal); - wlr_box fullBox = {windowBox.x - *PSHADOWSIZE - BORDERSIZE, windowBox.y - *PSHADOWSIZE - BORDERSIZE, windowBox.width + 2 * (*PSHADOWSIZE + BORDERSIZE), - windowBox.height + 2 * (*PSHADOWSIZE + BORDERSIZE)}; + windowBox.x -= pMonitor->vecPosition.x + BORDERSIZE; + windowBox.y -= pMonitor->vecPosition.y + BORDERSIZE; + windowBox.width += 2.0 * BORDERSIZE; + windowBox.height += 2.0 * BORDERSIZE; + + wlr_box fullBox = {windowBox.x - *PSHADOWSIZE, windowBox.y - *PSHADOWSIZE, windowBox.width + 2.0 * *PSHADOWSIZE, windowBox.height + 2.0 * *PSHADOWSIZE}; const float SHADOWSCALE = std::clamp(*PSHADOWSCALE, 0.f, 1.f); @@ -94,22 +101,26 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D if (PSHADOWOFFSET->x < 0) { fullBox.x += PSHADOWOFFSET->x; } else if (PSHADOWOFFSET->x > 0) { - fullBox.x = windowBox.x + windowBox.width - fullBox.width + (SHADOWSCALE * *PSHADOWSIZE) + BORDERSIZE + PSHADOWOFFSET->x - pMonitor->vecPosition.x; + fullBox.x = windowBox.x + windowBox.width - fullBox.width + (SHADOWSCALE * *PSHADOWSIZE) + PSHADOWOFFSET->x - pMonitor->vecPosition.x; } else { - fullBox.x += ((windowBox.width + 2.0 * (*PSHADOWSIZE + BORDERSIZE)) - NEWSIZE.x) / 2.0; + fullBox.x += ((windowBox.width + 2.0 * *PSHADOWSIZE) - NEWSIZE.x) / 2.0; } if (PSHADOWOFFSET->y < 0) { fullBox.y += PSHADOWOFFSET->y; } else if (PSHADOWOFFSET->y > 0) { - fullBox.y = windowBox.y + windowBox.height - fullBox.height + (SHADOWSCALE * *PSHADOWSIZE) + BORDERSIZE + PSHADOWOFFSET->y - pMonitor->vecPosition.y; + fullBox.y = windowBox.y + windowBox.height - fullBox.height + (SHADOWSCALE * *PSHADOWSIZE) + PSHADOWOFFSET->y - pMonitor->vecPosition.y; } else { - fullBox.y += ((windowBox.height + 2.0 * (*PSHADOWSIZE + BORDERSIZE)) - NEWSIZE.y) / 2.0; + fullBox.y += ((windowBox.height + 2.0 * *PSHADOWSIZE) - NEWSIZE.y) / 2.0; } - m_seExtents = {{m_vLastWindowPos.x - fullBox.x - pMonitor->vecPosition.x + 2, m_vLastWindowPos.y - fullBox.y - pMonitor->vecPosition.y + 2}, - {fullBox.x + fullBox.width + pMonitor->vecPosition.x - m_vLastWindowPos.x - m_vLastWindowSize.x + 2, - fullBox.y + fullBox.height + pMonitor->vecPosition.y - m_vLastWindowPos.y - m_vLastWindowSize.y + 2}}; + //m_seExtents = {{m_vLastWindowPos.x - fullBox.x - pMonitor->vecPosition.x + 2, m_vLastWindowPos.y - fullBox.y - pMonitor->vecPosition.y + 2}, + // {fullBox.x + fullBox.width + pMonitor->vecPosition.x - m_vLastWindowPos.x - m_vLastWindowSize.x + 2, + // fullBox.y + fullBox.height + pMonitor->vecPosition.y - m_vLastWindowPos.y - m_vLastWindowSize.y + 2}}; + + m_seExtents.topLeft = {*PSHADOWSIZE, *PSHADOWSIZE}; + m_seExtents.bottomRight = {*PSHADOWSIZE, *PSHADOWSIZE}; + m_seExtents.isReservedArea = false; fullBox.x += offset.x; fullBox.y += offset.y; @@ -137,7 +148,7 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D return; // prevent assert failed } - g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 0), ROUNDING * pMonitor->scale); + g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 0), (ROUNDING + BORDERSIZE) * pMonitor->scale); glStencilFunc(GL_NOTEQUAL, 1, -1); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index 5c2701c2..6f764f9a 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -194,10 +194,6 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D& invalidateTextures(); } -SWindowDecorationExtents CHyprGroupBarDecoration::getWindowDecorationReservedArea() { - return m_seExtents; -} - CTitleTex* CHyprGroupBarDecoration::textureFromTitle(const std::string& title) { for (auto& tex : m_sTitleTexs.titleTexs) { if (tex->szContent == title) diff --git a/src/render/decorations/CHyprGroupBarDecoration.hpp b/src/render/decorations/CHyprGroupBarDecoration.hpp index 49d20e7a..1044d2a0 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.hpp +++ b/src/render/decorations/CHyprGroupBarDecoration.hpp @@ -31,8 +31,6 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration { virtual void damageEntire(); - virtual SWindowDecorationExtents getWindowDecorationReservedArea(); - virtual CRegion getWindowDecorationRegion(); virtual void forceReload(CWindow*); diff --git a/src/render/decorations/IHyprWindowDecoration.cpp b/src/render/decorations/IHyprWindowDecoration.cpp index a9e131fc..b95adbd5 100644 --- a/src/render/decorations/IHyprWindowDecoration.cpp +++ b/src/render/decorations/IHyprWindowDecoration.cpp @@ -8,19 +8,18 @@ IHyprWindowDecoration::IHyprWindowDecoration(CWindow* pWindow) { IHyprWindowDecoration::~IHyprWindowDecoration() {} -SWindowDecorationExtents IHyprWindowDecoration::getWindowDecorationReservedArea() { - return SWindowDecorationExtents{}; -} - CRegion IHyprWindowDecoration::getWindowDecorationRegion() { - const SWindowDecorationExtents RESERVED = getWindowDecorationReservedArea(); - const int BORDERSIZE = RESERVED.isInternalDecoration ? 0 : m_pWindow->getRealBorderSize(); - return CRegion(m_pWindow->m_vRealPosition.vec().x - (BORDERSIZE + RESERVED.topLeft.x) * (int)(RESERVED.topLeft.x != 0), - m_pWindow->m_vRealPosition.vec().y - (BORDERSIZE + RESERVED.topLeft.y) * (int)(RESERVED.topLeft.y != 0), - m_pWindow->m_vRealSize.vec().x + (BORDERSIZE + RESERVED.topLeft.x) * (int)(RESERVED.topLeft.x != 0) + - (BORDERSIZE + RESERVED.bottomRight.x) * (int)(RESERVED.bottomRight.x != 0), - m_pWindow->m_vRealSize.vec().y + (BORDERSIZE + RESERVED.topLeft.y) * (int)(RESERVED.topLeft.y != 0) + - (BORDERSIZE + RESERVED.bottomRight.y) * (int)(RESERVED.bottomRight.y != 0)) + const SWindowDecorationExtents EXTENTS = getWindowDecorationExtents(); + if (!EXTENTS.isInternalDecoration && !EXTENTS.isReservedArea) + return CRegion(0, 0, 0, 0); + + const int BORDERSIZE = EXTENTS.isInternalDecoration ? 0 : m_pWindow->getRealBorderSize(); + return CRegion(m_pWindow->m_vRealPosition.vec().x - (BORDERSIZE + EXTENTS.topLeft.x) * (int)(EXTENTS.topLeft.x != 0), + m_pWindow->m_vRealPosition.vec().y - (BORDERSIZE + EXTENTS.topLeft.y) * (int)(EXTENTS.topLeft.y != 0), + m_pWindow->m_vRealSize.vec().x + (BORDERSIZE + EXTENTS.topLeft.x) * (int)(EXTENTS.topLeft.x != 0) + + (BORDERSIZE + EXTENTS.bottomRight.x) * (int)(EXTENTS.bottomRight.x != 0), + m_pWindow->m_vRealSize.vec().y + (BORDERSIZE + EXTENTS.topLeft.y) * (int)(EXTENTS.topLeft.y != 0) + + (BORDERSIZE + EXTENTS.bottomRight.y) * (int)(EXTENTS.bottomRight.y != 0)) .subtract(CRegion(m_pWindow->m_vRealPosition.vec().x - BORDERSIZE, m_pWindow->m_vRealPosition.vec().y - BORDERSIZE, m_pWindow->m_vRealSize.vec().x + 2 * BORDERSIZE, m_pWindow->m_vRealSize.vec().y + 2 * BORDERSIZE)); } diff --git a/src/render/decorations/IHyprWindowDecoration.hpp b/src/render/decorations/IHyprWindowDecoration.hpp index 11d44218..e03f49fe 100644 --- a/src/render/decorations/IHyprWindowDecoration.hpp +++ b/src/render/decorations/IHyprWindowDecoration.hpp @@ -14,6 +14,7 @@ struct SWindowDecorationExtents { Vector2D topLeft; Vector2D bottomRight; bool isInternalDecoration = false; + bool isReservedArea = true; // External Decorations Only }; void addExtentsToBox(wlr_box*, SWindowDecorationExtents*); @@ -38,8 +39,6 @@ class IHyprWindowDecoration { virtual void forceReload(CWindow*); - virtual SWindowDecorationExtents getWindowDecorationReservedArea(); - virtual CRegion getWindowDecorationRegion(); virtual bool allowsInput();