summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2026-01-01 21:49:57 +0100
committerGitHub <noreply@github.com>2026-01-01 21:49:57 +0100
commit31d3181e1ee91e338fb4fb8207d64b8d689310fc (patch)
tree71b00156665fe38d755f130712156e5537220ee5 /src
parent9b93d621b1019e8378b8a902edb7ba8dd8baf204 (diff)
dekstop/window: read static rules before guessing initial size if possible (#12783)
Diffstat (limited to 'src')
-rw-r--r--src/desktop/rule/matchEngine/WorkspaceMatchEngine.cpp2
-rw-r--r--src/desktop/rule/windowRule/WindowRuleApplicator.cpp5
-rw-r--r--src/desktop/rule/windowRule/WindowRuleApplicator.hpp3
-rw-r--r--src/desktop/view/Window.cpp3
4 files changed, 8 insertions, 5 deletions
diff --git a/src/desktop/rule/matchEngine/WorkspaceMatchEngine.cpp b/src/desktop/rule/matchEngine/WorkspaceMatchEngine.cpp
index abaa1657..fea5c384 100644
--- a/src/desktop/rule/matchEngine/WorkspaceMatchEngine.cpp
+++ b/src/desktop/rule/matchEngine/WorkspaceMatchEngine.cpp
@@ -8,5 +8,5 @@ CWorkspaceMatchEngine::CWorkspaceMatchEngine(const std::string& s) : m_value(s)
}
bool CWorkspaceMatchEngine::match(PHLWORKSPACE ws) {
- return ws->matchesStaticSelector(m_value);
+ return ws && ws->matchesStaticSelector(m_value);
}
diff --git a/src/desktop/rule/windowRule/WindowRuleApplicator.cpp b/src/desktop/rule/windowRule/WindowRuleApplicator.cpp
index 0b6cba0f..cb3a6f67 100644
--- a/src/desktop/rule/windowRule/WindowRuleApplicator.cpp
+++ b/src/desktop/rule/windowRule/WindowRuleApplicator.cpp
@@ -537,7 +537,7 @@ CWindowRuleApplicator::SRuleResult CWindowRuleApplicator::applyStaticRule(const
return SRuleResult{};
}
-void CWindowRuleApplicator::readStaticRules() {
+void CWindowRuleApplicator::readStaticRules(bool preRead) {
if (!m_window)
return;
@@ -592,7 +592,8 @@ void CWindowRuleApplicator::readStaticRules() {
for (const auto& wr : execRules) {
applyStaticRule(wr);
applyDynamicRule(wr);
- ruleEngine()->unregisterRule(wr);
+ if (!preRead)
+ ruleEngine()->unregisterRule(wr);
}
}
diff --git a/src/desktop/rule/windowRule/WindowRuleApplicator.hpp b/src/desktop/rule/windowRule/WindowRuleApplicator.hpp
index 121de727..5c1d4fd1 100644
--- a/src/desktop/rule/windowRule/WindowRuleApplicator.hpp
+++ b/src/desktop/rule/windowRule/WindowRuleApplicator.hpp
@@ -33,8 +33,7 @@ namespace Desktop::Rule {
void propertiesChanged(std::underlying_type_t<eRuleProperty> props);
std::unordered_set<CWindowRuleEffectContainer::storageType> resetProps(std::underlying_type_t<eRuleProperty> props,
Types::eOverridePriority prio = Types::PRIORITY_WINDOW_RULE);
- void readStaticRules();
- void applyStaticRules();
+ void readStaticRules(bool preRead = false);
// static props
struct {
diff --git a/src/desktop/view/Window.cpp b/src/desktop/view/Window.cpp
index 3031284c..a22f4a9d 100644
--- a/src/desktop/view/Window.cpp
+++ b/src/desktop/view/Window.cpp
@@ -2546,6 +2546,9 @@ void CWindow::unmapWindow() {
void CWindow::commitWindow() {
if (!m_isX11 && m_xdgSurface->m_initialCommit) {
+ // try to calculate static rules already for any floats
+ m_ruleApplicator->readStaticRules(true);
+
Vector2D predSize = g_pLayoutManager->getCurrentLayout()->predictSizeForNewWindow(m_self.lock());
Log::logger->log(Log::DEBUG, "Layout predicts size {} for {}", predSize, m_self.lock());