DebugConsole window does not take keyboard input
Summary: In order to add more tabs which can further help monitoring how KWin handles some aspects the DebugConsole is changed to not take keyboard input. This means it can only be navigated using pointer device or touch screen. This is needed for adding a new tab to monitor clipboard changes. On Wayland sometimes windows don't get the clipboard, so it would be helpful to have a debug monitor to see when the clipboard changes. But for that debug console window may not take keyboard events. To support this DebugConsole sets the WA_ShowWithoutActivating attribute which gets honored by the InternalWindowEventFilter and does not forward key events to such windows. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D2620
This commit is contained in:
parent
9b32615ab4
commit
3a3d1b6b0d
3 changed files with 38 additions and 0 deletions
|
@ -54,6 +54,7 @@ private Q_SLOTS:
|
||||||
void testPointerAxis();
|
void testPointerAxis();
|
||||||
void testKeyboard_data();
|
void testKeyboard_data();
|
||||||
void testKeyboard();
|
void testKeyboard();
|
||||||
|
void testKeyboardShowWithoutActivating();
|
||||||
void testKeyboardTriggersLeave();
|
void testKeyboardTriggersLeave();
|
||||||
void testTouch();
|
void testTouch();
|
||||||
};
|
};
|
||||||
|
@ -333,6 +334,39 @@ void InternalWindowTest::testKeyboard()
|
||||||
QCOMPARE(pressSpy.count(), 1);
|
QCOMPARE(pressSpy.count(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InternalWindowTest::testKeyboardShowWithoutActivating()
|
||||||
|
{
|
||||||
|
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||||
|
QVERIFY(clientAddedSpy.isValid());
|
||||||
|
HelperWindow win;
|
||||||
|
win.setProperty("_q_showWithoutActivating", true);
|
||||||
|
win.setGeometry(0, 0, 100, 100);
|
||||||
|
win.show();
|
||||||
|
QSignalSpy pressSpy(&win, &HelperWindow::keyPressed);
|
||||||
|
QVERIFY(pressSpy.isValid());
|
||||||
|
QSignalSpy releaseSpy(&win, &HelperWindow::keyReleased);
|
||||||
|
QVERIFY(releaseSpy.isValid());
|
||||||
|
QVERIFY(clientAddedSpy.wait());
|
||||||
|
QCOMPARE(clientAddedSpy.count(), 1);
|
||||||
|
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
|
||||||
|
QVERIFY(internalClient);
|
||||||
|
QVERIFY(internalClient->isInternal());
|
||||||
|
QVERIFY(internalClient->readyForPainting());
|
||||||
|
|
||||||
|
quint32 timestamp = 1;
|
||||||
|
const QPoint cursorPos = QPoint(50, 50);
|
||||||
|
kwinApp()->platform()->pointerMotion(cursorPos, timestamp++);
|
||||||
|
|
||||||
|
kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++);
|
||||||
|
QCOMPARE(pressSpy.count(), 0);
|
||||||
|
QVERIFY(!pressSpy.wait(100));
|
||||||
|
QCOMPARE(releaseSpy.count(), 0);
|
||||||
|
kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++);
|
||||||
|
QCOMPARE(releaseSpy.count(), 0);
|
||||||
|
QVERIFY(!releaseSpy.wait(100));
|
||||||
|
QCOMPARE(pressSpy.count(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
void InternalWindowTest::testKeyboardTriggersLeave()
|
void InternalWindowTest::testKeyboardTriggersLeave()
|
||||||
{
|
{
|
||||||
// this test verifies that a leave event is sent to a client when an internal window
|
// this test verifies that a leave event is sent to a client when an internal window
|
||||||
|
|
|
@ -452,6 +452,7 @@ DebugConsole::DebugConsole()
|
||||||
: QWidget()
|
: QWidget()
|
||||||
, m_ui(new Ui::DebugConsole)
|
, m_ui(new Ui::DebugConsole)
|
||||||
{
|
{
|
||||||
|
setAttribute(Qt::WA_ShowWithoutActivating);
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_ui->windowsView->setItemDelegate(new DebugConsoleDelegate(this));
|
m_ui->windowsView->setItemDelegate(new DebugConsoleDelegate(this));
|
||||||
m_ui->windowsView->setModel(new DebugConsoleModel(this));
|
m_ui->windowsView->setModel(new DebugConsoleModel(this));
|
||||||
|
|
|
@ -498,6 +498,9 @@ class InternalWindowEventFilter : public InputEventFilter {
|
||||||
if (!screens()->geometry().contains(w->geometry())) {
|
if (!screens()->geometry().contains(w->geometry())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (w->property("_q_showWithoutActivating").toBool()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
found = w;
|
found = w;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue