diff options
| author | s1dd <140317709+nots1dd@users.noreply.github.com> | 2025-05-09 00:31:49 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-08 21:01:49 +0200 |
| commit | f01e3043b81d1ad7d886f0502b445bdf3cea0ccc (patch) | |
| tree | f67ac13301e9c3a08175dba521198e9ff3c7737f /src/desktop/WindowRule.cpp | |
| parent | 04c98abd1fe7f3d63c6060ea175e0a5cd9cd9947 (diff) | |
desktop: cleanup code and use std::ranges (#10289)
Diffstat (limited to 'src/desktop/WindowRule.cpp')
| -rw-r--r-- | src/desktop/WindowRule.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/desktop/WindowRule.cpp b/src/desktop/WindowRule.cpp index db1b0dde..48bf2ff0 100644 --- a/src/desktop/WindowRule.cpp +++ b/src/desktop/WindowRule.cpp @@ -15,10 +15,9 @@ static const auto RULES_PREFIX = std::unordered_set<std::string>{ CWindowRule::CWindowRule(const std::string& rule, const std::string& value, bool isV2, bool isExecRule) : m_value(value), m_rule(rule), m_v2(isV2), m_execRule(isExecRule) { const auto VALS = CVarList(rule, 2, ' '); - const bool VALID = RULES.contains(rule) || std::any_of(RULES_PREFIX.begin(), RULES_PREFIX.end(), [&rule](auto prefix) { return rule.starts_with(prefix); }) || - (NWindowProperties::boolWindowProperties.find(VALS[0]) != NWindowProperties::boolWindowProperties.end()) || - (NWindowProperties::intWindowProperties.find(VALS[0]) != NWindowProperties::intWindowProperties.end()) || - (NWindowProperties::floatWindowProperties.find(VALS[0]) != NWindowProperties::floatWindowProperties.end()); + const bool VALID = RULES.contains(rule) || std::ranges::any_of(RULES_PREFIX, [&rule](auto prefix) { return rule.starts_with(prefix); }) || + (NWindowProperties::boolWindowProperties.contains(VALS[0])) || (NWindowProperties::intWindowProperties.contains(VALS[0])) || + (NWindowProperties::floatWindowProperties.contains(VALS[0])); if (!VALID) return; @@ -84,9 +83,9 @@ CWindowRule::CWindowRule(const std::string& rule, const std::string& value, bool else { // check if this is a prop. const CVarList VARS(rule, 0, 's', true); - if (NWindowProperties::intWindowProperties.find(VARS[0]) != NWindowProperties::intWindowProperties.end() || - NWindowProperties::boolWindowProperties.find(VARS[0]) != NWindowProperties::boolWindowProperties.end() || - NWindowProperties::floatWindowProperties.find(VARS[0]) != NWindowProperties::floatWindowProperties.end()) { + const bool ISPROP = NWindowProperties::intWindowProperties.contains(VARS[0]) || NWindowProperties::boolWindowProperties.contains(VARS[0]) || + NWindowProperties::floatWindowProperties.contains(VARS[0]); + if (ISPROP) { *const_cast<std::string*>(&m_rule) = "prop " + rule; m_ruleType = RULE_PROP; Debug::log(LOG, "CWindowRule: direct prop rule found, rewritten {} -> {}", rule, m_rule); |
