summaryrefslogtreecommitdiff
path: root/src/desktop/rule/windowRule/WindowRuleApplicator.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-11-27 21:14:24 +0000
committerGitHub <noreply@github.com>2025-11-27 21:14:24 +0000
commit68eecf61cd8149c7f830ccea8b5d88295b42d299 (patch)
treec04f0ece30ca96ffb5bd59625e5489e60568e878 /src/desktop/rule/windowRule/WindowRuleApplicator.cpp
parentf9742ab50156468c4a62dcc3895233b7d9c04e2b (diff)
desktop/windowRule: return reset props from resetProps and recheck them (#12458)
fixes #12457
Diffstat (limited to 'src/desktop/rule/windowRule/WindowRuleApplicator.cpp')
-rw-r--r--src/desktop/rule/windowRule/WindowRuleApplicator.cpp39
1 files changed, 11 insertions, 28 deletions
diff --git a/src/desktop/rule/windowRule/WindowRuleApplicator.cpp b/src/desktop/rule/windowRule/WindowRuleApplicator.cpp
index 202587cf..f28aa5a5 100644
--- a/src/desktop/rule/windowRule/WindowRuleApplicator.cpp
+++ b/src/desktop/rule/windowRule/WindowRuleApplicator.cpp
@@ -18,13 +18,17 @@ CWindowRuleApplicator::CWindowRuleApplicator(PHLWINDOW w) : m_window(w) {
;
}
-void CWindowRuleApplicator::resetProps(std::underlying_type_t<eRuleProperty> props, Types::eOverridePriority prio) {
+std::unordered_set<CWindowRuleEffectContainer::storageType> CWindowRuleApplicator::resetProps(std::underlying_type_t<eRuleProperty> props, Types::eOverridePriority prio) {
// TODO: fucking kill me, is there a better way to do this?
+ std::unordered_set<CWindowRuleEffectContainer::storageType> effectsNuked;
+
#define UNSET(x) \
if (m_##x.second & props) { \
- if (prio == Types::PRIORITY_WINDOW_RULE) \
+ if (prio == Types::PRIORITY_WINDOW_RULE) { \
+ effectsNuked.emplace(x##Effect()); \
m_##x.second &= ~props; \
+ } \
m_##x.first.unset(prio); \
}
@@ -81,6 +85,8 @@ void CWindowRuleApplicator::resetProps(std::underlying_type_t<eRuleProperty> pro
std::erase_if(m_otherProps.props, [props](const auto& el) { return !el.second || el.second->propMask & props; });
}
+
+ return effectsNuked;
}
CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyDynamicRule(const SP<CWindowRule>& rule) {
@@ -592,31 +598,8 @@ void CWindowRuleApplicator::propertiesChanged(std::underlying_type_t<eRuleProper
if (!m_window || !m_window->m_isMapped || m_window->isHidden())
return;
- resetProps(props);
-
- bool needsRelayout = false;
-
- std::unordered_set<CWindowRuleEffectContainer::storageType> effectsNeedingRecheck;
- std::unordered_set<SP<CWindowRule>> passedWrs;
-
- for (const auto& r : ruleEngine()->rules()) {
- if (r->type() != RULE_TYPE_WINDOW)
- continue;
-
- if (!(r->getPropertiesMask() & props))
- continue;
-
- auto wr = reinterpretPointerCast<CWindowRule>(r);
-
- if (!wr->matches(m_window.lock()))
- continue;
-
- for (const auto& [type, eff] : wr->effects()) {
- effectsNeedingRecheck.emplace(type);
- }
-
- passedWrs.emplace(std::move(wr));
- }
+ bool needsRelayout = false;
+ std::unordered_set<CWindowRuleEffectContainer::storageType> effectsNeedingRecheck = resetProps(props);
for (const auto& r : ruleEngine()->rules()) {
if (r->type() != RULE_TYPE_WINDOW)
@@ -627,7 +610,7 @@ void CWindowRuleApplicator::propertiesChanged(std::underlying_type_t<eRuleProper
if (!(WR->getPropertiesMask() & props) && !setsIntersect(WR->effectsSet(), effectsNeedingRecheck))
continue;
- if (!std::ranges::contains(passedWrs, WR) && !WR->matches(m_window.lock()))
+ if (!WR->matches(m_window.lock()))
continue;
const auto RES = applyDynamicRule(WR);