re-evaluate rules on title change
If a rule minus the title match matches, the captionChanged signal is bound to re-evaluate the rules for that client, ie. the tracking overhead only exists for those clients where title matching is relevant and costs rematching all rules when such client changes its title (yes, the partial matching rules could be stored for faster re-check, but that would make the patch bigger and is probably not worth it; just some string comparisms) additional tracking of wm_class or wm_role (what is iirc a netwm violation anyway) would require to monitor the resp. property for changes (not done atm.) BUG: 220227 FIXED-IN: 5.5 REVIEW: 125427
This commit is contained in:
parent
3b71411112
commit
b2755bcaa7
3 changed files with 15 additions and 2 deletions
|
@ -1520,6 +1520,12 @@ void Client::updateCaption()
|
||||||
setCaption(cap_normal, true);
|
setCaption(cap_normal, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::evaluateWindowRules()
|
||||||
|
{
|
||||||
|
setupWindowRules(true);
|
||||||
|
applyWindowRules();
|
||||||
|
}
|
||||||
|
|
||||||
void Client::fetchIconicName()
|
void Client::fetchIconicName()
|
||||||
{
|
{
|
||||||
QString s;
|
QString s;
|
||||||
|
|
1
client.h
1
client.h
|
@ -410,6 +410,7 @@ public:
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void closeWindow() override;
|
void closeWindow() override;
|
||||||
void updateCaption();
|
void updateCaption();
|
||||||
|
void evaluateWindowRules();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void shadeHover();
|
void shadeHover();
|
||||||
|
|
10
rules.cpp
10
rules.cpp
|
@ -449,10 +449,15 @@ bool Rules::match(const Client* c) const
|
||||||
return false;
|
return false;
|
||||||
if (!matchRole(c->windowRole()))
|
if (!matchRole(c->windowRole()))
|
||||||
return false;
|
return false;
|
||||||
if (!matchTitle(c->caption(false)))
|
|
||||||
return false;
|
|
||||||
if (!matchClientMachine(c->clientMachine()->hostName(), c->clientMachine()->isLocal()))
|
if (!matchClientMachine(c->clientMachine()->hostName(), c->clientMachine()->isLocal()))
|
||||||
return false;
|
return false;
|
||||||
|
if (titlematch != UnimportantMatch) // track title changes to rematch rules
|
||||||
|
QObject::connect(c, &Client::captionChanged, c, &Client::evaluateWindowRules,
|
||||||
|
// QueuedConnection, because title may change before
|
||||||
|
// the client is ready (could segfault!)
|
||||||
|
static_cast<Qt::ConnectionType>(Qt::QueuedConnection|Qt::UniqueConnection));
|
||||||
|
if (!matchTitle(c->caption(false)))
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -862,6 +867,7 @@ CHECK_FORCE_RULE(DisableGlobalShortcuts, bool)
|
||||||
|
|
||||||
void Client::setupWindowRules(bool ignore_temporary)
|
void Client::setupWindowRules(bool ignore_temporary)
|
||||||
{
|
{
|
||||||
|
disconnect(this, &Client::captionChanged, this, &Client::evaluateWindowRules);
|
||||||
client_rules = RuleBook::self()->find(this, ignore_temporary);
|
client_rules = RuleBook::self()->find(this, ignore_temporary);
|
||||||
// check only after getting the rules, because there may be a rule forcing window type
|
// check only after getting the rules, because there may be a rule forcing window type
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue