[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kwin/Plasma/5.13] /: Ensure the QToolTip on the deocration does not steal key events
From: Martin_Flöser <null () kde ! org>
Date: 2018-05-19 7:01:53
Message-ID: E1fJvsH-0001yI-KM () code ! kde ! org
[Download RAW message or body]
Git commit 08455f297df9e208227481cb6b0d6efbaf6fd614 by Martin Flöser.
Committed on 19/05/2018 at 07:01.
Pushed by graesslin into branch 'Plasma/5.13'.
Ensure the QToolTip on the deocration does not steal key events
Summary:
BUG: 393253
FIXED-IN: 5.13.0
Test Plan: manual testing and new unit test
Reviewers: #kwin, #plasma
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D12633
M +52 -0 autotests/integration/decoration_input_test.cpp
M +3 -0 input.cpp
https://commits.kde.org/kwin/08455f297df9e208227481cb6b0d6efbaf6fd614
diff --git a/autotests/integration/decoration_input_test.cpp \
b/autotests/integration/decoration_input_test.cpp index 584d371ee..cc07934e5 100644
--- a/autotests/integration/decoration_input_test.cpp
+++ b/autotests/integration/decoration_input_test.cpp
@@ -33,6 +33,7 @@ along with this program. If not, see \
<http://www.gnu.org/licenses/>.
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/compositor.h>
+#include <KWayland/Client/keyboard.h>
#include <KWayland/Client/pointer.h>
#include <KWayland/Client/server_decoration.h>
#include <KWayland/Client/shell.h>
@@ -78,6 +79,8 @@ private Q_SLOTS:
void testModifierScrollOpacity();
void testTouchEvents_data();
void testTouchEvents();
+ void testTooltipDoesntEatKeyEvents_data();
+ void testTooltipDoesntEatKeyEvents();
private:
AbstractClient *showWindow(Test::ShellSurfaceType type);
@@ -834,6 +837,55 @@ void DecorationInputTest::testTouchEvents()
QCOMPARE(hoverLeaveSpy.count(), 1);
}
+void DecorationInputTest::testTooltipDoesntEatKeyEvents_data()
+{
+ QTest::addColumn<Test::ShellSurfaceType>("type");
+
+ QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell;
+ QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6;
+}
+
+void DecorationInputTest::testTooltipDoesntEatKeyEvents()
+{
+ // this test verifies that a tooltip on the decoration does not steal key events
+ // BUG: 393253
+
+ // first create a keyboard
+ auto keyboard = Test::waylandSeat()->createKeyboard(Test::waylandSeat());
+ QVERIFY(keyboard);
+ QSignalSpy enteredSpy(keyboard, &KWayland::Client::Keyboard::entered);
+ QVERIFY(enteredSpy.isValid());
+
+ QFETCH(Test::ShellSurfaceType, type);
+ AbstractClient *c = showWindow(type);
+ QVERIFY(c);
+ QVERIFY(c->isDecorated());
+ QVERIFY(!c->noBorder());
+ QTRY_COMPARE(enteredSpy.count(), 1);
+
+ QSignalSpy keyEvent(keyboard, &KWayland::Client::Keyboard::keyChanged);
+ QVERIFY(keyEvent.isValid());
+
+ QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
+ QVERIFY(clientAddedSpy.isValid());
+ c->decoratedClient()->requestShowToolTip(QStringLiteral("test"));
+ // now we should get an internal window
+ QVERIFY(clientAddedSpy.wait());
+ ShellClient *internal = clientAddedSpy.first().first().value<ShellClient*>();
+ QVERIFY(internal->isInternal());
+ QVERIFY(internal->internalWindow()->flags().testFlag(Qt::ToolTip));
+
+ // now send a key
+ quint32 timestamp = 0;
+ kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++);
+ QVERIFY(keyEvent.wait());
+ kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++);
+ QVERIFY(keyEvent.wait());
+
+ c->decoratedClient()->requestHideToolTip();
+ Test::waitForWindowDestroyed(internal);
+}
+
}
WAYLANDTEST_MAIN(KWin::DecorationInputTest)
diff --git a/input.cpp b/input.cpp
index 1dd07992d..34fd62e71 100644
--- a/input.cpp
+++ b/input.cpp
@@ -910,6 +910,9 @@ class InternalWindowEventFilter : public InputEventFilter {
if (w->property("outputOnly").toBool()) {
continue;
}
+ if (w->flags().testFlag(Qt::ToolTip)) {
+ continue;
+ }
found = w;
break;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic