support gradients in dwindle group colors

This commit is contained in:
Vaxry 2022-12-31 16:23:56 +01:00
parent a91d0a374a
commit 7f595ed0ca
4 changed files with 43 additions and 41 deletions

View file

@ -1486,8 +1486,8 @@ void CCompositor::updateWindowAnimatedDecorationValues(CWindow* pWindow) {
// border // border
const auto RENDERDATA = g_pLayoutManager->getCurrentLayout()->requestRenderHints(pWindow); const auto RENDERDATA = g_pLayoutManager->getCurrentLayout()->requestRenderHints(pWindow);
if (RENDERDATA.isBorderColor) if (RENDERDATA.isBorderGradient)
setBorderColor(RENDERDATA.borderColor * (1.f / 255.f)); setBorderColor(*RENDERDATA.borderGradient);
else else
setBorderColor( setBorderColor(
pWindow == m_pLastWindow ? pWindow == m_pLastWindow ?

View file

@ -13,6 +13,8 @@
CConfigManager::CConfigManager() { CConfigManager::CConfigManager() {
configValues["general:col.active_border"].data = std::make_shared<CGradientValueData>(0xffffffff); configValues["general:col.active_border"].data = std::make_shared<CGradientValueData>(0xffffffff);
configValues["general:col.inactive_border"].data = std::make_shared<CGradientValueData>(0xff444444); configValues["general:col.inactive_border"].data = std::make_shared<CGradientValueData>(0xff444444);
configValues["dwindle:col.group_border"].data = std::make_shared<CGradientValueData>(0x66777700);
configValues["dwindle:col.group_border_active"].data = std::make_shared<CGradientValueData>(0x66ffff00);
setDefaultVars(); setDefaultVars();
setDefaultAnimationVars(); setDefaultAnimationVars();
@ -94,9 +96,9 @@ void CConfigManager::setDefaultVars() {
configValues["decoration:dim_around"].floatValue = 0.4f; configValues["decoration:dim_around"].floatValue = 0.4f;
configValues["decoration:screen_shader"].strValue = STRVAL_EMPTY; configValues["decoration:screen_shader"].strValue = STRVAL_EMPTY;
((CGradientValueData*)configValues["dwindle:col.group_border"].data.get())->reset(0x66777700);
((CGradientValueData*)configValues["dwindle:col.group_border_active"].data.get())->reset(0x66ffff00);
configValues["dwindle:pseudotile"].intValue = 0; configValues["dwindle:pseudotile"].intValue = 0;
configValues["dwindle:col.group_border"].intValue = 0x66777700;
configValues["dwindle:col.group_border_active"].intValue = 0x66ffff00;
configValues["dwindle:force_split"].intValue = 0; configValues["dwindle:force_split"].intValue = 0;
configValues["dwindle:preserve_split"].intValue = 0; configValues["dwindle:preserve_split"].intValue = 0;
configValues["dwindle:special_scale_factor"].floatValue = 0.8f; configValues["dwindle:special_scale_factor"].floatValue = 0.8f;

View file

@ -1044,20 +1044,20 @@ SWindowRenderLayoutHints CHyprDwindleLayout::requestRenderHints(CWindow* pWindow
SWindowRenderLayoutHints hints; SWindowRenderLayoutHints hints;
static auto* const PGROUPCOLACTIVE = &g_pConfigManager->getConfigValuePtr("dwindle:col.group_border_active")->intValue; static auto* const PGROUPCOLACTIVE = &g_pConfigManager->getConfigValuePtr("dwindle:col.group_border_active")->data;
static auto* const PGROUPCOLINACTIVE = &g_pConfigManager->getConfigValuePtr("dwindle:col.group_border")->intValue; static auto* const PGROUPCOLINACTIVE = &g_pConfigManager->getConfigValuePtr("dwindle:col.group_border")->data;
const auto PNODE = getNodeFromWindow(pWindow); const auto PNODE = getNodeFromWindow(pWindow);
if (!PNODE) if (!PNODE)
return hints; // left for the future, maybe floating funkiness return hints; // left for the future, maybe floating funkiness
if (PNODE->isGroupMember()) { if (PNODE->isGroupMember()) {
hints.isBorderColor = true; hints.isBorderGradient = true;
if (pWindow == g_pCompositor->m_pLastWindow) if (pWindow == g_pCompositor->m_pLastWindow)
hints.borderColor = CColor(*PGROUPCOLACTIVE); hints.borderGradient = (CGradientValueData*)PGROUPCOLACTIVE->get();
else else
hints.borderColor = CColor(*PGROUPCOLINACTIVE); hints.borderGradient = (CGradientValueData*)PGROUPCOLINACTIVE->get();
} }
return hints; return hints;

View file

@ -5,8 +5,8 @@
#include <any> #include <any>
struct SWindowRenderLayoutHints { struct SWindowRenderLayoutHints {
bool isBorderColor = false; bool isBorderGradient = false;
CColor borderColor; CGradientValueData* borderGradient;
}; };
struct SLayoutMessageHeader { struct SLayoutMessageHeader {