mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-25 11:25:58 +01:00
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:
parent
48641b5343
commit
4b1338bbab
10 changed files with 91 additions and 116 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -31,8 +31,6 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
|
|||
|
||||
virtual void damageEntire();
|
||||
|
||||
virtual SWindowDecorationExtents getWindowDecorationReservedArea();
|
||||
|
||||
virtual CRegion getWindowDecorationRegion();
|
||||
|
||||
virtual void forceReload(CWindow*);
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue