implement loadConfig() in groupbar decoration

modified:   src/config/ConfigManager.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-15 01:15:12 +01:00
parent b9009a7cf9
commit 0500b94f81
No known key found for this signature in database
GPG key ID: 284C27FD27A6DC0D
6 changed files with 13 additions and 10 deletions

View file

@ -1653,7 +1653,7 @@ void CConfigManager::loadConfigLoadVars() {
w->updateSpecialRenderData();
for (auto& wd : w->m_dWindowDecorations)
wd->forceReload(w.get());
wd->forceReload();
g_pLayoutManager->getCurrentLayout()->recalculateWindow(w.get());
}

View file

@ -97,7 +97,6 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
fullBox.width = NEWSIZE.x;
fullBox.height = NEWSIZE.y;
// either was broken or it is now
if (PSHADOWOFFSET->x < 0) {
fullBox.x += PSHADOWOFFSET->x;
} else if (PSHADOWOFFSET->x > 0) {

View file

@ -11,7 +11,7 @@ static CTexture m_tGradientLockedInactive;
CHyprGroupBarDecoration::CHyprGroupBarDecoration(CWindow* pWindow) : IHyprWindowDecoration(pWindow) {
m_pWindow = pWindow;
forceReload(m_pWindow);
loadConfig();
}
CHyprGroupBarDecoration::~CHyprGroupBarDecoration() {}
@ -345,7 +345,7 @@ void CHyprGroupBarDecoration::refreshGradients() {
renderGradientTo(m_tGradientLockedInactive, ((CGradientValueData*)PGROUPCOLINACTIVELOCKED->get())->m_vColors[0]);
}
void CHyprGroupBarDecoration::forceReload(CWindow* pWindow) {
void CHyprGroupBarDecoration::loadConfig() {
static auto* const PENABLED = &g_pConfigManager->getConfigValuePtr("group:groupbar:enabled")->intValue;
static auto* const PMODE = &g_pConfigManager->getConfigValuePtr("group:groupbar:mode")->intValue;
static auto* const PHEIGHT = &g_pConfigManager->getConfigValuePtr("group:groupbar:height")->intValue;
@ -369,7 +369,10 @@ void CHyprGroupBarDecoration::forceReload(CWindow* pWindow) {
m_iBarHeight = *PMODE != 1 ? *PHEIGHT : BAR_INDICATOR_HEIGHT;
m_iGradientHeight = *PMODE == 1 ? *PHEIGHT : 0;
}
void CHyprGroupBarDecoration::forceReload() {
loadConfig();
refreshGradients();
}

View file

@ -33,7 +33,7 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
virtual CRegion getWindowDecorationRegion();
virtual void forceReload(CWindow*);
virtual void forceReload();
virtual bool allowsInput();
@ -67,6 +67,7 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
void invalidateTextures();
void refreshGradients();
void loadConfig();
struct STitleTexs {
// STitleTexs* overriden = nullptr; // TODO: make shit shared in-group to decrease VRAM usage.

View file

@ -24,8 +24,8 @@ CRegion IHyprWindowDecoration::getWindowDecorationRegion() {
m_pWindow->m_vRealSize.vec().y + 2 * BORDERSIZE));
}
void IHyprWindowDecoration::forceReload(CWindow* pWindow) {
updateWindow(pWindow);
void IHyprWindowDecoration::forceReload() {
updateWindow(m_pWindow);
}
bool IHyprWindowDecoration::allowsInput() {

View file

@ -37,7 +37,7 @@ class IHyprWindowDecoration {
virtual void damageEntire() = 0;
virtual void forceReload(CWindow*);
virtual void forceReload();
virtual CRegion getWindowDecorationRegion();