diff --git a/src/config/ConfigDataValues.hpp b/src/config/ConfigDataValues.hpp index e09eed5..7e7e339 100644 --- a/src/config/ConfigDataValues.hpp +++ b/src/config/ConfigDataValues.hpp @@ -83,7 +83,9 @@ class CGradientValueData : public ICustomConfigValueData { /* Float corresponding to the angle (rad) */ float m_fAngle = 0; - // + /* Whether this gradient stores a fallback value (not exlicitly set) */ + bool m_bIsFallback = false; + bool operator==(const CGradientValueData& other) const { if (other.m_vColors.size() != m_vColors.size() || m_fAngle != other.m_fAngle) return false; diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 79cf164..1b73836 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -80,6 +80,7 @@ static Hyprlang::CParseResult configHandleGradientSet(const char* VALUE, void** CVarList varlist(V, 0, ' '); DATA->m_vColors.clear(); + DATA->m_bIsFallback = false; std::string parseError = ""; @@ -110,6 +111,11 @@ static Hyprlang::CParseResult configHandleGradientSet(const char* VALUE, void** } } + if (V.empty()) { + DATA->m_bIsFallback = true; + DATA->m_vColors.push_back(0); // transparent + } + if (DATA->m_vColors.size() == 0) { Debug::log(WARN, "Error parsing gradient {}", V); parseError = "Error parsing gradient " + V + ": No colors?"; diff --git a/src/renderer/widgets/PasswordInputField.cpp b/src/renderer/widgets/PasswordInputField.cpp index 948a62e..f3b6944 100644 --- a/src/renderer/widgets/PasswordInputField.cpp +++ b/src/renderer/widgets/PasswordInputField.cpp @@ -56,10 +56,9 @@ CPasswordInputField::CPasswordInputField(const Vector2D& viewport_, const std::u dots.size = std::clamp(dots.size, 0.2f, 0.8f); dots.spacing = std::clamp(dots.spacing, -1.f, 1.f); colorConfig.transitionMs = std::clamp(colorConfig.transitionMs, 0, 1000); - - colorConfig.both = colorConfig.both->m_vColors.empty() ? colorConfig.outer : colorConfig.both; - colorConfig.caps = colorConfig.caps->m_vColors.empty() ? colorConfig.outer : colorConfig.caps; - colorConfig.num = colorConfig.num->m_vColors.empty() ? colorConfig.outer : colorConfig.num; + colorConfig.both = colorConfig.both->m_bIsFallback ? colorConfig.outer : colorConfig.both; + colorConfig.caps = colorConfig.caps->m_bIsFallback ? colorConfig.outer : colorConfig.caps; + colorConfig.num = colorConfig.num->m_bIsFallback ? colorConfig.outer : colorConfig.num; colorState.inner = colorConfig.inner; colorState.outer = *colorConfig.outer;