[kcm/kwinrules] Fix detection of wmclass property
Property `wmclass` of a window rule works in a special way, as it can have two meanings depending on `wmclasscomplete` flag: - false: only matches `resourceClass` - true: matches `resourceName` and `resourceClass` This MR fixes two subtle bugs when detecting the properties of a window: In the first case, `resourceName` was being wrongly set instead, which prevented window matching for windows where those two values differ. Also, the `wmclass` field was always set to `resourceName` independently of `wmclasscomplete` property. BUG: 423138 FIXED-IN: 5.19.3
This commit is contained in:
parent
ec5a0249e2
commit
3bfc750a79
1 changed files with 7 additions and 6 deletions
|
@ -233,7 +233,6 @@ QString RulesModel::warningMessage() const
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool RulesModel::wmclassWarning() const
|
bool RulesModel::wmclassWarning() const
|
||||||
{
|
{
|
||||||
const bool no_wmclass = !m_rules["wmclass"]->isEnabled()
|
const bool no_wmclass = !m_rules["wmclass"]->isEnabled()
|
||||||
|
@ -625,11 +624,6 @@ void RulesModel::populateRuleList()
|
||||||
const QHash<QString, QString> RulesModel::x11PropertyHash()
|
const QHash<QString, QString> RulesModel::x11PropertyHash()
|
||||||
{
|
{
|
||||||
static const auto propertyToRule = QHash<QString, QString> {
|
static const auto propertyToRule = QHash<QString, QString> {
|
||||||
/* The original detection dialog allows to choose depending on "Match complete window class":
|
|
||||||
* if Match Complete == false: wmclass = "resourceClass"
|
|
||||||
* if Match Complete == true: wmclass = "resourceName" + " " + "resourceClass"
|
|
||||||
*/
|
|
||||||
{ "resourceName", "wmclass" },
|
|
||||||
{ "caption", "title" },
|
{ "caption", "title" },
|
||||||
{ "role", "windowrole" },
|
{ "role", "windowrole" },
|
||||||
{ "clientMachine", "clientmachine" },
|
{ "clientMachine", "clientmachine" },
|
||||||
|
@ -668,6 +662,13 @@ void RulesModel::setWindowProperties(const QVariantMap &info, bool forceValue)
|
||||||
}
|
}
|
||||||
m_rules["types"]->setSuggestedValue(1 << window_type, forceValue);
|
m_rules["types"]->setSuggestedValue(1 << window_type, forceValue);
|
||||||
|
|
||||||
|
const QString wmsimpleclass = info.value("resourceClass").toString();
|
||||||
|
const QString wmcompleteclass = QStringLiteral("%1 %2").arg(info.value("resourceName").toString(),
|
||||||
|
info.value("resourceClass").toString());
|
||||||
|
const bool isComplete = m_rules.value("wmclasscomplete")->value().toBool();
|
||||||
|
|
||||||
|
m_rules["wmclass"]->setSuggestedValue(isComplete ? wmcompleteclass : wmsimpleclass, forceValue);
|
||||||
|
|
||||||
const auto ruleForProperty = x11PropertyHash();
|
const auto ruleForProperty = x11PropertyHash();
|
||||||
for (QString &property : info.keys()) {
|
for (QString &property : info.keys()) {
|
||||||
if (!ruleForProperty.contains(property)) {
|
if (!ruleForProperty.contains(property)) {
|
||||||
|
|
Loading…
Reference in a new issue