diff options
| author | ItsOhen <TNordfeldt@gmail.com> | 2026-03-15 20:32:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-15 14:32:05 -0500 |
| commit | 94bd4123c6e8fd3162e245b0d568c9d6dfd75780 (patch) | |
| tree | 764d69857d566a44939394960b05731c709ae973 /src/desktop/rule/windowRule/WindowRuleApplicator.cpp | |
| parent | 3fd2a95475d9a954305eeede59fe2b345a4d8098 (diff) | |
desktop/rules: fix static rules and content type. (#13725)
Hopefully for the last time in a while. Also a lot easier to add in new
static types with the recheck done in window map instead of the rule.
Diffstat (limited to 'src/desktop/rule/windowRule/WindowRuleApplicator.cpp')
| -rw-r--r-- | src/desktop/rule/windowRule/WindowRuleApplicator.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/desktop/rule/windowRule/WindowRuleApplicator.cpp b/src/desktop/rule/windowRule/WindowRuleApplicator.cpp index 07cb5f64..dd0e7fb8 100644 --- a/src/desktop/rule/windowRule/WindowRuleApplicator.cpp +++ b/src/desktop/rule/windowRule/WindowRuleApplicator.cpp @@ -547,9 +547,10 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyStaticRule(const return SRuleResult{}; } -void CWindowRuleApplicator::readStaticRules(bool preRead) { +// +bool CWindowRuleApplicator::readStaticRules(bool preRead) { if (!m_window) - return; + return false; static_ = {}; @@ -575,35 +576,35 @@ void CWindowRuleApplicator::readStaticRules(bool preRead) { tagsWereChanged = tagsWereChanged || RES.tagsChanged; } - // recheck some props people might wanna use for static rules. - std::underlying_type_t<eRuleProperty> propsToRecheck = RULE_PROP_NONE; + // set a recheck for some props people might wanna use for static rules. if (tagsWereChanged) propsToRecheck |= RULE_PROP_TAG; if (static_.content != NContentType::CONTENT_TYPE_NONE) propsToRecheck |= RULE_PROP_CONTENT; - if (propsToRecheck != RULE_PROP_NONE) { - for (const auto& r : ruleEngine()->rules()) { - if (r->type() != RULE_TYPE_WINDOW) - continue; + for (const auto& wr : execRules) { + applyStaticRule(wr); + applyDynamicRule(wr); + if (!preRead) + ruleEngine()->unregisterRule(wr); + } + return (propsToRecheck != RULE_PROP_NONE); +} - if (!(r->getPropertiesMask() & propsToRecheck)) - continue; +void CWindowRuleApplicator::recheckStaticRules() { + for (const auto& r : ruleEngine()->rules()) { + if (r->type() != RULE_TYPE_WINDOW) + continue; - auto wr = reinterpretPointerCast<CWindowRule>(r); + if (!(r->getPropertiesMask() & propsToRecheck)) + continue; - if (!wr->matches(m_window.lock(), true)) - continue; + auto wr = reinterpretPointerCast<CWindowRule>(r); - applyStaticRule(wr); - } - } + if (!wr->matches(m_window.lock(), true)) + continue; - for (const auto& wr : execRules) { applyStaticRule(wr); - applyDynamicRule(wr); - if (!preRead) - ruleEngine()->unregisterRule(wr); } } |
