fix damage and boxes (shadows not fully handled)

modified:   src/Window.cpp
modified:   src/Window.hpp
modified:   src/layout/DwindleLayout.cpp
modified:   src/layout/MasterLayout.cpp
modified:   src/managers/AnimationManager.cpp
modified:   src/render/decorations/CHyprDropShadowDecoration.cpp
modified:   src/render/decorations/CHyprGroupBarDecoration.cpp
modified:   src/render/decorations/CHyprGroupBarDecoration.hpp
modified:   src/render/decorations/IHyprWindowDecoration.cpp
modified:   src/render/decorations/IHyprWindowDecoration.hpp

Signed-off-by: MightyPlaza <123664421+MightyPlaza@users.noreply.github.com>
This commit is contained in:
MightyPlaza 2023-09-12 19:26:08 +01:00
parent 48641b5343
commit 4b1338bbab
No known key found for this signature in database
GPG key ID: 284C27FD27A6DC0D
10 changed files with 91 additions and 116 deletions

View file

@ -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)}}; {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) { for (auto& wd : m_dWindowDecorations) {
const auto EXTENTS = wd->getWindowDecorationExtents(); const auto EXTENTS = wd->getWindowDecorationExtents();
if (EXTENTS.topLeft.x > maxExtents.topLeft.x) if (EXTENTS.isInternalDecoration)
maxExtents.topLeft.x = EXTENTS.topLeft.x; continue;
if (EXTENTS.topLeft.y > maxExtents.topLeft.y) maxOutterExtents.topLeft.x = std::max(maxOutterExtents.topLeft.x, EXTENTS.topLeft.x);
maxExtents.topLeft.y = EXTENTS.topLeft.y; maxOutterExtents.topLeft.y = std::max(maxOutterExtents.topLeft.y, EXTENTS.topLeft.y);
maxOutterExtents.bottomRight.x = std::max(maxOutterExtents.bottomRight.x, EXTENTS.bottomRight.x);
if (EXTENTS.bottomRight.x > maxExtents.bottomRight.x) maxOutterExtents.bottomRight.y = std::max(maxOutterExtents.bottomRight.y, EXTENTS.bottomRight.y);
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} + maxOutterExtents.topLeft,
m_seReservedInternal.bottomRight + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + maxOutterExtents.bottomRight};
if (m_pWLSurface.exists() && !m_bIsX11) { if (m_pWLSurface.exists() && !m_bIsX11) {
wlr_box surfaceExtents = {0, 0, 0, 0}; wlr_box surfaceExtents = {0, 0, 0, 0};
// TODO: this could be better, perhaps make a getFullWindowRegion? // 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}; return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
} }
SWindowDecorationExtents maxExtents = {{BORDERSIZE + 2, BORDERSIZE + 2}, {BORDERSIZE + 2, BORDERSIZE + 2}}; SWindowDecorationExtents maxExtents = {m_seReservedInternal.topLeft + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + m_seReservedExternal.topLeft,
m_seReservedInternal.bottomRight + Vector2D{BORDERSIZE + 2, BORDERSIZE + 2} + m_seReservedExternal.bottomRight};
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 // 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, 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 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) { wlr_box CWindow::getWindowInternalBox() {
const auto RESERVED = wd->getWindowDecorationReservedArea(); wlr_box internalBox = {m_vRealPosition.vec().x, m_vRealPosition.vec().y, m_vRealSize.vec().x, m_vRealSize.vec().y};
addExtentsToBox(&internalBox, &m_seReservedInternal);
if (RESERVED.bottomRight == Vector2D{} && RESERVED.topLeft == Vector2D{}) return internalBox;
continue;
extents.topLeft = extents.topLeft + RESERVED.topLeft;
extents.bottomRight = extents.bottomRight + RESERVED.bottomRight;
}
return extents;
} }
void CWindow::updateWindowDecos() { 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 // reset extents
m_seReservedInternal.topLeft = Vector2D(); m_seReservedInternal.topLeft = Vector2D();
m_seReservedInternal.bottomRight = Vector2D(); m_seReservedInternal.bottomRight = Vector2D();
@ -211,20 +193,23 @@ void CWindow::updateWindowDecos() {
m_seReservedExternal.bottomRight = Vector2D(); m_seReservedExternal.bottomRight = Vector2D();
for (auto& wd : m_dWindowDecorations) { for (auto& wd : m_dWindowDecorations) {
const auto RESERVED = wd->getWindowDecorationReservedArea(); const auto EXTENTS = wd->getWindowDecorationExtents();
if (RESERVED.isInternalDecoration) { if (EXTENTS.isInternalDecoration) {
m_seReservedInternal.topLeft.x = std::max(m_seReservedInternal.topLeft.x, RESERVED.topLeft.x); m_seReservedInternal.topLeft.x = std::max(m_seReservedInternal.topLeft.x, EXTENTS.topLeft.x);
m_seReservedInternal.topLeft.y = std::max(m_seReservedInternal.topLeft.y, RESERVED.topLeft.y); m_seReservedInternal.topLeft.y = std::max(m_seReservedInternal.topLeft.y, EXTENTS.topLeft.y);
m_seReservedInternal.bottomRight.x = std::max(m_seReservedInternal.bottomRight.x, RESERVED.bottomRight.x); m_seReservedInternal.bottomRight.x = std::max(m_seReservedInternal.bottomRight.x, EXTENTS.bottomRight.x);
m_seReservedInternal.bottomRight.y = std::max(m_seReservedInternal.bottomRight.y, RESERVED.bottomRight.y); m_seReservedInternal.bottomRight.y = std::max(m_seReservedInternal.bottomRight.y, EXTENTS.bottomRight.y);
} else { } else if (EXTENTS.isReservedArea) {
m_seReservedExternal.topLeft.x = std::max(m_seReservedExternal.topLeft.x, RESERVED.topLeft.x); m_seReservedExternal.topLeft.x = std::max(m_seReservedExternal.topLeft.x, EXTENTS.topLeft.x);
m_seReservedExternal.topLeft.y = std::max(m_seReservedExternal.topLeft.y, RESERVED.topLeft.y); m_seReservedExternal.topLeft.y = std::max(m_seReservedExternal.topLeft.y, EXTENTS.topLeft.y);
m_seReservedExternal.bottomRight.x = std::max(m_seReservedExternal.bottomRight.x, RESERVED.bottomRight.x); m_seReservedExternal.bottomRight.x = std::max(m_seReservedExternal.bottomRight.x, EXTENTS.bottomRight.x);
m_seReservedExternal.bottomRight.y = std::max(m_seReservedExternal.bottomRight.y, RESERVED.bottomRight.y); 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) if (recalc)
g_pLayoutManager->getCurrentLayout()->recalculateWindow(this); g_pLayoutManager->getCurrentLayout()->recalculateWindow(this);

View file

@ -337,6 +337,7 @@ class CWindow {
SWindowDecorationExtents getFullWindowExtents(); SWindowDecorationExtents getFullWindowExtents();
wlr_box getWindowInputBox(); wlr_box getWindowInputBox();
wlr_box getWindowIdealBoundingBoxIgnoreReserved(); wlr_box getWindowIdealBoundingBoxIgnoreReserved();
wlr_box getWindowInternalBox();
void updateWindowDecos(); void updateWindowDecos();
pid_t getPID(); pid_t getPID();
IHyprWindowDecoration* getDecorationByType(eDecorationType); IHyprWindowDecoration* getDecorationByType(eDecorationType);

View file

@ -148,22 +148,16 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
PWINDOW->m_sSpecialRenderData.rounding = false; PWINDOW->m_sSpecialRenderData.rounding = false;
PWINDOW->m_sSpecialRenderData.shadow = false; PWINDOW->m_sSpecialRenderData.shadow = false;
const auto RESERVED = PWINDOW->getFullWindowReservedArea(); 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);
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->updateWindowDecos(); PWINDOW->updateWindowDecos();
return; return;
} }
const int BORDERSIZE = PWINDOW->getRealBorderSize(); auto calcPos = PWINDOW->m_vPosition;
auto calcSize = PWINDOW->m_vSize;
auto calcPos = PWINDOW->m_vPosition + Vector2D(BORDERSIZE, BORDERSIZE);
auto calcSize = PWINDOW->m_vSize - Vector2D(2 * BORDERSIZE, 2 * BORDERSIZE);
const auto OFFSETTOPLEFT = Vector2D(DISPLAYLEFT ? gapsOut : gapsIn, DISPLAYTOP ? gapsOut : gapsIn); const auto OFFSETTOPLEFT = Vector2D(DISPLAYLEFT ? gapsOut : gapsIn, DISPLAYTOP ? gapsOut : gapsIn);

View file

@ -624,22 +624,16 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
PWINDOW->m_sSpecialRenderData.rounding = false; PWINDOW->m_sSpecialRenderData.rounding = false;
PWINDOW->m_sSpecialRenderData.shadow = false; PWINDOW->m_sSpecialRenderData.shadow = false;
const auto RESERVED = PWINDOW->getFullWindowReservedArea(); 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);
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->updateWindowDecos(); PWINDOW->updateWindowDecos();
return; return;
} }
const int BORDERSIZE = PWINDOW->getRealBorderSize(); auto calcPos = PWINDOW->m_vPosition;
auto calcSize = PWINDOW->m_vSize;
auto calcPos = PWINDOW->m_vPosition + Vector2D(BORDERSIZE, BORDERSIZE);
auto calcSize = PWINDOW->m_vSize - Vector2D(2 * BORDERSIZE, 2 * BORDERSIZE);
const auto OFFSETTOPLEFT = Vector2D(DISPLAYLEFT ? gapsOut : gapsIn, DISPLAYTOP ? gapsOut : gapsIn); const auto OFFSETTOPLEFT = Vector2D(DISPLAYLEFT ? gapsOut : gapsIn, DISPLAYTOP ? gapsOut : gapsIn);

View file

@ -247,11 +247,9 @@ void CAnimationManager::tick() {
const auto PDECO = PWINDOW->getDecorationByType(DECORATION_SHADOW); const auto PDECO = PWINDOW->getDecorationByType(DECORATION_SHADOW);
if (PDECO) { if (PDECO) {
const auto EXTENTS = PDECO->getWindowDecorationExtents(); auto EXTENTS = PDECO->getWindowDecorationExtents();
wlr_box dmg = PWINDOW->getWindowInternalBox();
wlr_box dmg = {PWINDOW->m_vRealPosition.vec().x - EXTENTS.topLeft.x, PWINDOW->m_vRealPosition.vec().y - EXTENTS.topLeft.y, addExtentsToBox(&dmg, &EXTENTS);
PWINDOW->m_vRealSize.vec().x + EXTENTS.topLeft.x + EXTENTS.bottomRight.x,
PWINDOW->m_vRealSize.vec().y + EXTENTS.topLeft.y + EXTENTS.bottomRight.y};
if (!*PSHADOWIGNOREWINDOW) { if (!*PSHADOWIGNOREWINDOW) {
// easy, damage the entire box // easy, damage the entire box

View file

@ -24,13 +24,16 @@ eDecorationType CHyprDropShadowDecoration::getDecorationType() {
} }
void CHyprDropShadowDecoration::damageEntire() { 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) if (*PSHADOWS != 1)
return; // disabled return; // disabled
wlr_box dm = m_pWindow->getWindowInternalBox();
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, dm.x -= BORDERSIZE;
m_vLastWindowSize.y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y}; dm.x -= BORDERSIZE;
dm.width += 2.0 * BORDERSIZE;
dm.height += 2.0 * BORDERSIZE;
g_pHyprRenderer->damageBox(&dm); 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 ROUNDING = m_pWindow->getRealRounding();
const auto BORDERSIZE = m_pWindow->getRealBorderSize(); 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}; wlr_box windowBox = {m_vLastWindowPos.x, m_vLastWindowPos.y, m_vLastWindowSize.x, m_vLastWindowSize.y};
addExtentsToBox(&windowBox, &(m_pWindow->m_seReservedInternal)); addExtentsToBox(&windowBox, &m_pWindow->m_seReservedInternal);
wlr_box fullBox = {windowBox.x - *PSHADOWSIZE - BORDERSIZE, windowBox.y - *PSHADOWSIZE - BORDERSIZE, windowBox.width + 2 * (*PSHADOWSIZE + BORDERSIZE), windowBox.x -= pMonitor->vecPosition.x + BORDERSIZE;
windowBox.height + 2 * (*PSHADOWSIZE + 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); 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) { if (PSHADOWOFFSET->x < 0) {
fullBox.x += PSHADOWOFFSET->x; fullBox.x += PSHADOWOFFSET->x;
} else if (PSHADOWOFFSET->x > 0) { } 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 { } 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) { if (PSHADOWOFFSET->y < 0) {
fullBox.y += PSHADOWOFFSET->y; fullBox.y += PSHADOWOFFSET->y;
} else if (PSHADOWOFFSET->y > 0) { } 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 { } 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}, //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.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}}; // 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.x += offset.x;
fullBox.y += offset.y; fullBox.y += offset.y;
@ -137,7 +148,7 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
return; // prevent assert failed 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); glStencilFunc(GL_NOTEQUAL, 1, -1);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);

View file

@ -194,10 +194,6 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
invalidateTextures(); invalidateTextures();
} }
SWindowDecorationExtents CHyprGroupBarDecoration::getWindowDecorationReservedArea() {
return m_seExtents;
}
CTitleTex* CHyprGroupBarDecoration::textureFromTitle(const std::string& title) { CTitleTex* CHyprGroupBarDecoration::textureFromTitle(const std::string& title) {
for (auto& tex : m_sTitleTexs.titleTexs) { for (auto& tex : m_sTitleTexs.titleTexs) {
if (tex->szContent == title) if (tex->szContent == title)

View file

@ -31,8 +31,6 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
virtual void damageEntire(); virtual void damageEntire();
virtual SWindowDecorationExtents getWindowDecorationReservedArea();
virtual CRegion getWindowDecorationRegion(); virtual CRegion getWindowDecorationRegion();
virtual void forceReload(CWindow*); virtual void forceReload(CWindow*);

View file

@ -8,19 +8,18 @@ IHyprWindowDecoration::IHyprWindowDecoration(CWindow* pWindow) {
IHyprWindowDecoration::~IHyprWindowDecoration() {} IHyprWindowDecoration::~IHyprWindowDecoration() {}
SWindowDecorationExtents IHyprWindowDecoration::getWindowDecorationReservedArea() {
return SWindowDecorationExtents{};
}
CRegion IHyprWindowDecoration::getWindowDecorationRegion() { CRegion IHyprWindowDecoration::getWindowDecorationRegion() {
const SWindowDecorationExtents RESERVED = getWindowDecorationReservedArea(); const SWindowDecorationExtents EXTENTS = getWindowDecorationExtents();
const int BORDERSIZE = RESERVED.isInternalDecoration ? 0 : m_pWindow->getRealBorderSize(); if (!EXTENTS.isInternalDecoration && !EXTENTS.isReservedArea)
return CRegion(m_pWindow->m_vRealPosition.vec().x - (BORDERSIZE + RESERVED.topLeft.x) * (int)(RESERVED.topLeft.x != 0), return CRegion(0, 0, 0, 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) + const int BORDERSIZE = EXTENTS.isInternalDecoration ? 0 : m_pWindow->getRealBorderSize();
(BORDERSIZE + RESERVED.bottomRight.x) * (int)(RESERVED.bottomRight.x != 0), return CRegion(m_pWindow->m_vRealPosition.vec().x - (BORDERSIZE + EXTENTS.topLeft.x) * (int)(EXTENTS.topLeft.x != 0),
m_pWindow->m_vRealSize.vec().y + (BORDERSIZE + RESERVED.topLeft.y) * (int)(RESERVED.topLeft.y != 0) + m_pWindow->m_vRealPosition.vec().y - (BORDERSIZE + EXTENTS.topLeft.y) * (int)(EXTENTS.topLeft.y != 0),
(BORDERSIZE + RESERVED.bottomRight.y) * (int)(RESERVED.bottomRight.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, .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)); m_pWindow->m_vRealSize.vec().y + 2 * BORDERSIZE));
} }

View file

@ -14,6 +14,7 @@ struct SWindowDecorationExtents {
Vector2D topLeft; Vector2D topLeft;
Vector2D bottomRight; Vector2D bottomRight;
bool isInternalDecoration = false; bool isInternalDecoration = false;
bool isReservedArea = true; // External Decorations Only
}; };
void addExtentsToBox(wlr_box*, SWindowDecorationExtents*); void addExtentsToBox(wlr_box*, SWindowDecorationExtents*);
@ -38,8 +39,6 @@ class IHyprWindowDecoration {
virtual void forceReload(CWindow*); virtual void forceReload(CWindow*);
virtual SWindowDecorationExtents getWindowDecorationReservedArea();
virtual CRegion getWindowDecorationRegion(); virtual CRegion getWindowDecorationRegion();
virtual bool allowsInput(); virtual bool allowsInput();