Report unavailable protocols and services; send combos as real keys

Diagnostics collects what this session doesn't allow, logs it, and lists
it in the settings panel (with a dot on the gear): KWin not launching
sloposk as its keyboard (detected by WAYLAND_SOCKET, since KWin offers the
input-method global to every client), fake input missing or too old,
org.kde.keyboard unreachable, and the D-Bus control name taken.

Modifier combos go through fake input even in text fields: KWin drops
the input method's modifier mask for most clients, so Ctrl+A typed "a".

The desktop file is generated with an absolute Exec, which KWin needs to
match it: one for the installed binary, one for the build's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 11:36:56 +02:00
co-authored by Claude Opus 5.5
parent 6164839886
commit 499e5ee76e
21 changed files with 362 additions and 104 deletions
+1
View File
@@ -16,6 +16,7 @@ sloposk_add_test(tst_textrules)
sloposk_add_test(tst_deadkeys)
sloposk_add_test(tst_keyrepeater)
sloposk_add_test(tst_visibility)
sloposk_add_test(tst_diagnostics)
# Needs the QML module itself, not just the C++ backing library.
sloposk_add_test(tst_keyboardsurface)
+46
View File
@@ -0,0 +1,46 @@
#include "diagnostics/Diagnostics.h"
#include <QSignalSpy>
#include <QTest>
class TestDiagnostics : public QObject
{
Q_OBJECT
private Q_SLOTS:
void reportsAndClears()
{
Diagnostics diagnostics;
QSignalSpy changed(&diagnostics, &Diagnostics::problemsChanged);
QTest::ignoreMessage(QtWarningMsg, "broken");
diagnostics.check(QStringLiteral("a"), false, QStringLiteral("broken"));
QCOMPARE(diagnostics.problems(), QStringList{QStringLiteral("broken")});
diagnostics.check(QStringLiteral("a"), true, QStringLiteral("broken"));
QVERIFY(diagnostics.problems().isEmpty());
QCOMPARE(changed.count(), 2);
}
void repeatsAreQuiet()
{
Diagnostics diagnostics;
QSignalSpy changed(&diagnostics, &Diagnostics::problemsChanged);
diagnostics.check(QStringLiteral("a"), true, QStringLiteral("fine"));
QTest::ignoreMessage(QtWarningMsg, "broken");
diagnostics.check(QStringLiteral("a"), false, QStringLiteral("broken"));
diagnostics.check(QStringLiteral("a"), false, QStringLiteral("broken")); // no second warning
QCOMPARE(changed.count(), 1);
}
void listsByIdNotArrival()
{
Diagnostics diagnostics;
QTest::ignoreMessage(QtWarningMsg, "second");
QTest::ignoreMessage(QtWarningMsg, "first");
diagnostics.check(QStringLiteral("b"), false, QStringLiteral("second"));
diagnostics.check(QStringLiteral("a"), false, QStringLiteral("first"));
QCOMPARE(diagnostics.problems(), (QStringList{QStringLiteral("first"), QStringLiteral("second")}));
}
};
QTEST_GUILESS_MAIN(TestDiagnostics)
#include "tst_diagnostics.moc"