rules: Make wmclass matching case sensitive

WM_CLASS is case sensitive.
This commit is contained in:
Vlad Zahorodnii 2023-03-10 14:17:35 +02:00
parent 11eac9d431
commit 86e1305e80
2 changed files with 5 additions and 14 deletions

View file

@ -33,7 +33,6 @@ private Q_SLOTS:
void initTestCase();
void init();
void cleanup();
void testApplyInitialMaximizeVert_data();
void testApplyInitialMaximizeVert();
void testWindowClassChange();
};
@ -76,14 +75,6 @@ struct XcbConnectionDeleter
}
};
void WindowRuleTest::testApplyInitialMaximizeVert_data()
{
QTest::addColumn<QByteArray>("role");
QTest::newRow("lowercase") << QByteArrayLiteral("mainwindow");
QTest::newRow("CamelCase") << QByteArrayLiteral("MainWindow");
}
void WindowRuleTest::testApplyInitialMaximizeVert()
{
// this test creates the situation of BUG 367554: creates a window and initial apply maximize vertical
@ -113,7 +104,7 @@ void WindowRuleTest::testApplyInitialMaximizeVert()
xcb_icccm_set_wm_normal_hints(c.get(), windowId, &hints);
xcb_icccm_set_wm_class(c.get(), windowId, 9, "kpat\0kpat");
QFETCH(QByteArray, role);
const QByteArray role = QByteArrayLiteral("mainwindow");
xcb_change_property(c.get(), XCB_PROP_MODE_REPLACE, windowId, atoms->wm_window_role, XCB_ATOM_STRING, 8, role.length(), role.constData());
NETWinInfo info(c.get(), windowId, rootWindow(), NET::WMAllProperties, NET::WM2AllProperties);

View file

@ -326,10 +326,10 @@ bool Rules::matchWMClass(const QString &match_class, const QString &match_name)
if (wmclassmatch == RegExpMatch && !QRegularExpression(wmclass).match(cwmclass).hasMatch()) {
return false;
}
if (wmclassmatch == ExactMatch && cwmclass.compare(wmclass, Qt::CaseInsensitive) != 0) { // TODO Plasma 6: Make it case sensitive
if (wmclassmatch == ExactMatch && cwmclass != wmclass) {
return false;
}
if (wmclassmatch == SubstringMatch && !cwmclass.contains(wmclass, Qt::CaseInsensitive)) { // TODO Plasma 6: Make it case sensitive
if (wmclassmatch == SubstringMatch && !cwmclass.contains(wmclass)) {
return false;
}
}
@ -342,10 +342,10 @@ bool Rules::matchRole(const QString &match_role) const
if (windowrolematch == RegExpMatch && !QRegularExpression(windowrole).match(match_role).hasMatch()) {
return false;
}
if (windowrolematch == ExactMatch && match_role.compare(windowrole, Qt::CaseInsensitive) != 0) { // TODO Plasma 6: Make it case sensitive
if (windowrolematch == ExactMatch && match_role != windowrole) {
return false;
}
if (windowrolematch == SubstringMatch && !match_role.contains(windowrole, Qt::CaseInsensitive)) { // TODO Plasma 6: Make it case sensitive
if (windowrolematch == SubstringMatch && !match_role.contains(windowrole)) {
return false;
}
}