dekstop/window: read static rules before guessing initial size if possible (#12783)
This commit is contained in:
parent
9b93d621b1
commit
31d3181e1e
6 changed files with 45 additions and 8 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue