allow reload and fix locked on groupbar gradient

modified:   src/config/ConfigManager.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-01 23:16:34 +01:00
parent 8a4381cb36
commit 6fdac9c209
No known key found for this signature in database
GPG key ID: 284C27FD27A6DC0D
5 changed files with 28 additions and 10 deletions

View file

@ -1648,6 +1648,8 @@ void CConfigManager::loadConfigLoadVars() {
w->updateDynamicRules();
w->updateSpecialRenderData();
for (auto& wd : w->m_dWindowDecorations)
wd->forceReload(w.get());
}
// Update window border colors

View file

@ -6,6 +6,8 @@
// shared things to conserve VRAM
static CTexture m_tGradientActive;
static CTexture m_tGradientInactive;
static CTexture m_tGradientLockedActive;
static CTexture m_tGradientLockedInactive;
CHyprGroupBarDecoration::CHyprGroupBarDecoration(CWindow* pWindow) : IHyprWindowDecoration(pWindow) {
m_pWindow = pWindow;
@ -136,10 +138,12 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
rect.y -= rect.height;
rect.width = BARW * pMonitor->scale;
refreshGradients();
if (*PGRADIENTS == 1)
g_pHyprOpenGL->renderTexture((m_dwGroupMembers[i] == g_pCompositor->m_pLastWindow ? m_tGradientActive : m_tGradientInactive), &rect, 1.0);
if (*PGRADIENTS == 1) {
refreshGradients();
g_pHyprOpenGL->renderTexture((m_dwGroupMembers[i] == g_pCompositor->m_pLastWindow ? (GROUPLOCKED ? m_tGradientLockedActive : m_tGradientActive) :
(GROUPLOCKED ? m_tGradientLockedInactive : m_tGradientInactive)),
&rect, 1.0);
}
rect.y -= (*PTITLEFONTSIZE + 2 * BAR_TEXT_PAD) * 0.2 * pMonitor->scale;
rect.height = (*PTITLEFONTSIZE + 2 * BAR_TEXT_PAD) * pMonitor->scale;
@ -293,12 +297,10 @@ void CHyprGroupBarDecoration::refreshGradients() {
static auto* const PGROUPCOLACTIVELOCKED = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.locked_active")->data;
static auto* const PGROUPCOLINACTIVELOCKED = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.locked_inactive")->data;
const bool GROUPLOCKED = m_pWindow->getGroupHead()->m_sGroupData.locked;
const auto* const PCOLACTIVE = GROUPLOCKED ? PGROUPCOLACTIVELOCKED : PGROUPCOLACTIVE;
const auto* const PCOLINACTIVE = GROUPLOCKED ? PGROUPCOLINACTIVELOCKED : PGROUPCOLINACTIVE;
renderGradientTo(m_tGradientActive, ((CGradientValueData*)PCOLACTIVE->get())->m_vColors[0]);
renderGradientTo(m_tGradientInactive, ((CGradientValueData*)PCOLINACTIVE->get())->m_vColors[0]);
renderGradientTo(m_tGradientActive, ((CGradientValueData*)PGROUPCOLACTIVE->get())->m_vColors[0]);
renderGradientTo(m_tGradientInactive, ((CGradientValueData*)PGROUPCOLINACTIVE->get())->m_vColors[0]);
renderGradientTo(m_tGradientLockedActive, ((CGradientValueData*)PGROUPCOLACTIVELOCKED->get())->m_vColors[0]);
renderGradientTo(m_tGradientLockedInactive, ((CGradientValueData*)PGROUPCOLINACTIVELOCKED->get())->m_vColors[0]);
}
int CHyprGroupBarDecoration::getBarHeight() {
@ -309,6 +311,12 @@ int CHyprGroupBarDecoration::getBarHeight() {
return BARHEIGHT + (*PRENDERTITLES ? *PTITLEFONTSIZE : 0);
}
void CHyprGroupBarDecoration::forceReload(CWindow* pWindow) {
m_tGradientActive.destroyTexture();
m_tGradientInactive.destroyTexture();
updateWindow(pWindow);
}
bool CHyprGroupBarDecoration::allowsInput() {
return true;
}

View file

@ -33,6 +33,8 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
virtual SWindowDecorationExtents getWindowDecorationReservedArea();
virtual void forceReload(CWindow*);
virtual bool allowsInput();
private:

View file

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

View file

@ -33,6 +33,8 @@ class IHyprWindowDecoration {
virtual void damageEntire() = 0;
virtual void forceReload(CWindow*);
virtual SWindowDecorationExtents getWindowDecorationReservedArea();
virtual CRegion getWindowDecorationRegion();