diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-12-02 00:47:59 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-01 16:47:59 +0000 |
| commit | f82a8630d7a51dab4cc70924f500bf70e723db12 (patch) | |
| tree | 960c7cd8738c2451f71500615fe97d03f90404f7 /src/desktop/rule/windowRule/WindowRuleApplicator.cpp | |
| parent | bb963fb00263bac78a0c633d1d0d02ae4763222c (diff) | |
desktop/rules: tag static rule being ignored (#12514)
* chore: apply exec rules after removal and use CWindowRule
* refactor: unregister exec rules after applying them
Remove the unused toRemove vector and defer unregistering exec rules
until after applyStaticRule/applyDynamicRule so exec rules are applied
before being removed from the rule engine.
Diffstat (limited to 'src/desktop/rule/windowRule/WindowRuleApplicator.cpp')
| -rw-r--r-- | src/desktop/rule/windowRule/WindowRuleApplicator.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/desktop/rule/windowRule/WindowRuleApplicator.cpp b/src/desktop/rule/windowRule/WindowRuleApplicator.cpp index f28aa5a5..3474f240 100644 --- a/src/desktop/rule/windowRule/WindowRuleApplicator.cpp +++ b/src/desktop/rule/windowRule/WindowRuleApplicator.cpp @@ -545,8 +545,8 @@ void CWindowRuleApplicator::readStaticRules() { static_ = {}; - std::vector<SP<IRule>> toRemove; - bool tagsWereChanged = false; + std::vector<SP<CWindowRule>> execRules; + bool tagsWereChanged = false; for (const auto& r : ruleEngine()->rules()) { if (r->type() != RULE_TYPE_WINDOW) @@ -557,16 +557,14 @@ void CWindowRuleApplicator::readStaticRules() { if (!wr->matches(m_window.lock(), true)) continue; + if (wr->isExecRule()) { + execRules.emplace_back(wr); + continue; + } + applyStaticRule(wr); - const auto RES = applyDynamicRule(wr); // also apply dynamic, because we won't recheck it before layout gets data + const auto RES = applyDynamicRule(wr); tagsWereChanged = tagsWereChanged || RES.tagsChanged; - - if (wr->isExecRule()) - toRemove.emplace_back(wr); - } - - for (const auto& wr : toRemove) { - ruleEngine()->unregisterRule(wr); } // recheck some props people might wanna use for static rules. @@ -592,6 +590,12 @@ void CWindowRuleApplicator::readStaticRules() { applyStaticRule(wr); } } + + for (const auto& wr : execRules) { + applyStaticRule(wr); + applyDynamicRule(wr); + ruleEngine()->unregisterRule(wr); + } } void CWindowRuleApplicator::propertiesChanged(std::underlying_type_t<eRuleProperty> props) { |
