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

@ -124,8 +124,8 @@ void CConfigManager::setDefaultVars() {
((CGradientValueData*)configValues["group:col.border_inactive"].data.get())->reset(0x66777700); ((CGradientValueData*)configValues["group:col.border_inactive"].data.get())->reset(0x66777700);
((CGradientValueData*)configValues["group:col.border_locked_active"].data.get())->reset(0x66ff5500); ((CGradientValueData*)configValues["group:col.border_locked_active"].data.get())->reset(0x66ff5500);
((CGradientValueData*)configValues["group:col.border_locked_inactive"].data.get())->reset(0x66775500); ((CGradientValueData*)configValues["group:col.border_locked_inactive"].data.get())->reset(0x66775500);
configValues["group:insert_after_current"].intValue = 1; configValues["group:insert_after_current"].intValue = 1;
configValues["group:focus_removed_window"].intValue = 1; configValues["group:focus_removed_window"].intValue = 1;
configValues["group:groupbar:enabled"].intValue = 1; configValues["group:groupbar:enabled"].intValue = 1;
configValues["group:groupbar:font"].strValue = "Sans"; configValues["group:groupbar:font"].strValue = "Sans";
@ -1653,7 +1653,7 @@ void CConfigManager::loadConfigLoadVars() {
w->updateSpecialRenderData(); w->updateSpecialRenderData();
for (auto& wd : w->m_dWindowDecorations) for (auto& wd : w->m_dWindowDecorations)
wd->forceReload(w.get()); wd->forceReload();
g_pLayoutManager->getCurrentLayout()->recalculateWindow(w.get()); 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.width = NEWSIZE.x;
fullBox.height = NEWSIZE.y; fullBox.height = NEWSIZE.y;
// either was broken or it is now
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) {

View file

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

View file

@ -33,7 +33,7 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
virtual CRegion getWindowDecorationRegion(); virtual CRegion getWindowDecorationRegion();
virtual void forceReload(CWindow*); virtual void forceReload();
virtual bool allowsInput(); virtual bool allowsInput();
@ -67,6 +67,7 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
void invalidateTextures(); void invalidateTextures();
void refreshGradients(); void refreshGradients();
void loadConfig();
struct STitleTexs { struct STitleTexs {
// STitleTexs* overriden = nullptr; // TODO: make shit shared in-group to decrease VRAM usage. // 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)); m_pWindow->m_vRealSize.vec().y + 2 * BORDERSIZE));
} }
void IHyprWindowDecoration::forceReload(CWindow* pWindow) { void IHyprWindowDecoration::forceReload() {
updateWindow(pWindow); updateWindow(m_pWindow);
} }
bool IHyprWindowDecoration::allowsInput() { bool IHyprWindowDecoration::allowsInput() {

View file

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