mirror of
https://github.com/hyprwm/hyprlock.git
synced 2024-12-21 21:09:49 +01:00
input-field: fix colorConfig caps, num and both when they are empty (#559)
This commit is contained in:
parent
d159e14e5b
commit
b9cf5151ba
3 changed files with 12 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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?";
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue