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
const auto RENDERDATA = g_pLayoutManager->getCurrentLayout()->requestRenderHints(pWindow);
if (RENDERDATA.isBorderColor)
setBorderColor(RENDERDATA.borderColor * (1.f / 255.f));
if (RENDERDATA.isBorderGradient)
setBorderColor(*RENDERDATA.borderGradient);
else
setBorderColor(
pWindow == m_pLastWindow ?

View file

@ -13,6 +13,8 @@
CConfigManager::CConfigManager() {
configValues["general:col.active_border"].data = std::make_shared<CGradientValueData>(0xffffffff);
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();
setDefaultAnimationVars();
@ -94,9 +96,9 @@ void CConfigManager::setDefaultVars() {
configValues["decoration:dim_around"].floatValue = 0.4f;
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:col.group_border"].intValue = 0x66777700;
configValues["dwindle:col.group_border_active"].intValue = 0x66ffff00;
configValues["dwindle:force_split"].intValue = 0;
configValues["dwindle:preserve_split"].intValue = 0;
configValues["dwindle:special_scale_factor"].floatValue = 0.8f;

View file

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

View file

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