on xenial help sign in
Hide/reveal the mouse pointer on touch/mouse events
0b10661Lukáš Tinkl
plugins/Cursor/MousePointer.cpp+4
@@ -42,6 +42,10 @@ void MousePointer::handleMouseEvent(ulong timestamp, QPointF movement, Qt::Mouse
42 return;
42 return;
43 }
43 }
44
44
45+ if (!movement.isNull()) {
46+ Q_EMIT mouseMoved();
47+ }
48+
45 qreal newX = x() + movement.x();
49 qreal newX = x() + movement.x();
46 if (newX < 0) {
50 if (newX < 0) {
47 Q_EMIT pushedLeftBoundary(qAbs(newX), buttons);
51 Q_EMIT pushedLeftBoundary(qAbs(newX), buttons);
plugins/Cursor/MousePointer.h+1
@@ -48,6 +48,7 @@ public Q_SLOTS:
48Q_SIGNALS:
48Q_SIGNALS:
49 void pushedLeftBoundary(qreal amount, Qt::MouseButtons buttons);
49 void pushedLeftBoundary(qreal amount, Qt::MouseButtons buttons);
50 void pushedRightBoundary(qreal amount, Qt::MouseButtons buttons);
50 void pushedRightBoundary(qreal amount, Qt::MouseButtons buttons);
51+ void mouseMoved();
51
52
52protected:
53protected:
53 void itemChange(ItemChange change, const ItemChangeData &value) override;
54 void itemChange(ItemChange change, const ItemChangeData &value) override;
plugins/Utils/CMakeLists.txt+1−1
@@ -13,7 +13,7 @@ set(QMLPLUGIN_SRC
13 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationManagerInterface.h
13 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationManagerInterface.h
14 applicationsfiltermodel.cpp
14 applicationsfiltermodel.cpp
15 constants.cpp
15 constants.cpp
16− HomeKeyWatcher.cpp
16+ WindowInputMonitor.cpp
17 inputwatcher.cpp
17 inputwatcher.cpp
18 qlimitproxymodelqml.cpp
18 qlimitproxymodelqml.cpp
19 unitysortfilterproxymodelqml.cpp
19 unitysortfilterproxymodelqml.cpp
plugins/Utils/HomeKeyWatcher.hdeleted−74
@@ -1,74 +0,0 @@
1−/*
2− * Copyright (C) 2015 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#ifndef UNITY_HOMEKEYWATCHER_H
18−#define UNITY_HOMEKEYWATCHER_H
19−
20−#include <QQuickItem>
21−#include <QPointer>
22−
23−#include "Timer.h"
24−#include "ElapsedTimer.h"
25−
26−/*
27− Signals when the home key seems to be have been intentionally tapped.
28−
29− It only says the home key has been activated if it has been tapped in isolation,
30− that is, without being accompanied by touches on the screen. Home key taps that
31− happen along with (or immediately after, or immediately before) touches on the
32− screen are considered to have happened unintentionally and are thus ignored.
33−
34− Rationale being that it's easy to accidentally hit the home key while performing
35− a swipe from a screen edge, for instance. That's particularly the case when the
36− home key is a capacitive key.
37− */
38−class HomeKeyWatcher : public QQuickItem
39−{
40− Q_OBJECT
41−public:
42−
43− HomeKeyWatcher(QQuickItem *parent = 0);
44−
45− // for testing
46− HomeKeyWatcher(UnityUtil::AbstractTimer *timer,
47− UnityUtil::AbstractElapsedTimer *elapsedTimer,
48− QQuickItem *parent = 0);
49−
50− virtual ~HomeKeyWatcher();
51−
52− bool eventFilter(QObject *watched, QEvent *event) override;
53−
54− void update(QEvent *event);
55−
56− const qint64 msecsWithoutTouches = 150;
57−
58−Q_SIGNALS:
59− // Emitted when the home key has been intentionally tapped
60− void activated();
61−
62−private Q_SLOTS:
63− void setupFilterOnWindow(QQuickWindow *window);
64− void emitActivatedIfNoTouchesAround();
65−
66−private:
67− QPointer<QQuickWindow> m_filteredWindow;
68− bool m_windowBeingTouched;
69− bool m_homeKeyPressed;
70− UnityUtil::AbstractElapsedTimer *m_windowLastTouchedTimer;
71− UnityUtil::AbstractTimer *m_activationTimer;
72−};
73−
74−#endif // UNITY_HOMEKEYWATCHER_H
plugins/Utils/HomeKeyWatcher.cpp → plugins/Utils/WindowInputMonitor.cpprenamed+19−12
@@ -14,18 +14,18 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−#include "HomeKeyWatcher.h"
17+#include "WindowInputMonitor.h"
18
18
19#include <QQuickWindow>
19#include <QQuickWindow>
20
20
21using namespace UnityUtil;
21using namespace UnityUtil;
22
22
23−HomeKeyWatcher::HomeKeyWatcher(QQuickItem *parent)
23+WindowInputMonitor::WindowInputMonitor(QQuickItem *parent)
24− : HomeKeyWatcher(new Timer, new ElapsedTimer, parent)
24+ : WindowInputMonitor(new Timer, new ElapsedTimer, parent)
25{
25{
26}
26}
27
27
28−HomeKeyWatcher::HomeKeyWatcher(UnityUtil::AbstractTimer *timer,
28+WindowInputMonitor::WindowInputMonitor(UnityUtil::AbstractTimer *timer,
29 UnityUtil::AbstractElapsedTimer *elapsedTimer,
29 UnityUtil::AbstractElapsedTimer *elapsedTimer,
30 QQuickItem *parent)
30 QQuickItem *parent)
31 : QQuickItem(parent)
31 : QQuickItem(parent)
@@ -37,20 +37,20 @@ HomeKeyWatcher::HomeKeyWatcher(UnityUtil::AbstractTimer *timer,
37 m_windowLastTouchedTimer->start();
37 m_windowLastTouchedTimer->start();
38
38
39 connect(this, &QQuickItem::windowChanged,
39 connect(this, &QQuickItem::windowChanged,
40− this, &HomeKeyWatcher::setupFilterOnWindow);
40+ this, &WindowInputMonitor::setupFilterOnWindow);
41
41
42 connect(m_activationTimer, &UnityUtil::AbstractTimer::timeout,
42 connect(m_activationTimer, &UnityUtil::AbstractTimer::timeout,
43− this, &HomeKeyWatcher::emitActivatedIfNoTouchesAround);
43+ this, &WindowInputMonitor::emitActivatedIfNoTouchesAround);
44 m_activationTimer->setInterval(msecsWithoutTouches);
44 m_activationTimer->setInterval(msecsWithoutTouches);
45}
45}
46
46
47−HomeKeyWatcher::~HomeKeyWatcher()
47+WindowInputMonitor::~WindowInputMonitor()
48{
48{
49 delete m_windowLastTouchedTimer;
49 delete m_windowLastTouchedTimer;
50 delete m_activationTimer;
50 delete m_activationTimer;
51}
51}
52
52
53−bool HomeKeyWatcher::eventFilter(QObject *watched, QEvent *event)
53+bool WindowInputMonitor::eventFilter(QObject *watched, QEvent *event)
54{
54{
55 Q_ASSERT(!m_filteredWindow.isNull());
55 Q_ASSERT(!m_filteredWindow.isNull());
56 Q_ASSERT(watched == static_cast<QObject*>(m_filteredWindow.data()));
56 Q_ASSERT(watched == static_cast<QObject*>(m_filteredWindow.data()));
@@ -62,7 +62,7 @@ bool HomeKeyWatcher::eventFilter(QObject *watched, QEvent *event)
62 return false;
62 return false;
63}
63}
64
64
65−void HomeKeyWatcher::update(QEvent *event)
65+void WindowInputMonitor::update(QEvent *event)
66{
66{
67 if (event->type() == QEvent::KeyPress) {
67 if (event->type() == QEvent::KeyPress) {
68 QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
68 QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
@@ -86,15 +86,22 @@ void HomeKeyWatcher::update(QEvent *event)
86
86
87 m_activationTimer->stop();
87 m_activationTimer->stop();
88 m_windowBeingTouched = true;
88 m_windowBeingTouched = true;
89+ Q_EMIT touchBegun();
89
90
90 } else if (event->type() == QEvent::TouchEnd) {
91 } else if (event->type() == QEvent::TouchEnd) {
91
92
92 m_windowBeingTouched = false;
93 m_windowBeingTouched = false;
93 m_windowLastTouchedTimer->start();
94 m_windowLastTouchedTimer->start();
95+
96+ QTouchEvent * touchEv = static_cast<QTouchEvent *>(event);
97+ if (touchEv && !touchEv->touchPoints().isEmpty()) {
98+ const QPointF pos = touchEv->touchPoints().last().screenPos();
99+ Q_EMIT touchEnded(pos);
100+ }
94 }
101 }
95}
102}
96
103
97−void HomeKeyWatcher::setupFilterOnWindow(QQuickWindow *window)
104+void WindowInputMonitor::setupFilterOnWindow(QQuickWindow *window)
98{
105{
99 if (!m_filteredWindow.isNull()) {
106 if (!m_filteredWindow.isNull()) {
100 m_filteredWindow->removeEventFilter(this);
107 m_filteredWindow->removeEventFilter(this);
@@ -107,10 +114,10 @@ void HomeKeyWatcher::setupFilterOnWindow(QQuickWindow *window)
107 }
114 }
108}
115}
109
116
110−void HomeKeyWatcher::emitActivatedIfNoTouchesAround()
117+void WindowInputMonitor::emitActivatedIfNoTouchesAround()
111{
118{
112 if (!m_homeKeyPressed && !m_windowBeingTouched &&
119 if (!m_homeKeyPressed && !m_windowBeingTouched &&
113 (m_windowLastTouchedTimer->elapsed() > msecsWithoutTouches)) {
120 (m_windowLastTouchedTimer->elapsed() > msecsWithoutTouches)) {
114− Q_EMIT activated();
121+ Q_EMIT homeKeyActivated();
115 }
122 }
116}
123}
plugins/Utils/WindowInputMonitor.hnew file+91
@@ -0,0 +1,91 @@
1+/*
2+ * Copyright (C) 2015 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#ifndef UNITY_WINDOWINPUTMONITOR_H
18+#define UNITY_WINDOWINPUTMONITOR_H
19+
20+#include <QQuickItem>
21+#include <QPointer>
22+
23+#include "Timer.h"
24+#include "ElapsedTimer.h"
25+
26+/**
27+ * Monitors input events received by the window holding this item and the Home (Win aka Super_L)
28+ * key presses.
29+ *
30+ * Additionally, this class monitors for generic touch events on the screen, to
31+ * help with hiding/revealing the mouse pointer.
32+ */
33+class WindowInputMonitor : public QQuickItem
34+{
35+ Q_OBJECT
36+public:
37+
38+ WindowInputMonitor(QQuickItem *parent = 0);
39+
40+ // for testing
41+ WindowInputMonitor(UnityUtil::AbstractTimer *timer,
42+ UnityUtil::AbstractElapsedTimer *elapsedTimer,
43+ QQuickItem *parent = 0);
44+
45+ virtual ~WindowInputMonitor();
46+
47+ bool eventFilter(QObject *watched, QEvent *event) override;
48+
49+ void update(QEvent *event);
50+
51+ const qint64 msecsWithoutTouches = 150;
52+
53+Q_SIGNALS:
54+ /**
55+ * Emitted when the home key has been intentionally tapped
56+ *
57+ * It only says the home key has been activated if it has been tapped in isolation,
58+ * that is, without being accompanied by touches on the screen. Home key taps that
59+ * happen along with (or immediately after, or immediately before) touches on the
60+ * screen are considered to have happened unintentionally and are thus ignored.
61+ *
62+ * Rationale being that it's easy to accidentally hit the home key while performing
63+ * a swipe from a screen edge, for instance. That's particularly the case when the
64+ * home key is a capacitive key.
65+ */
66+ void homeKeyActivated();
67+
68+ /**
69+ * Emitted when a touch begin event is detected
70+ */
71+ void touchBegun();
72+
73+ /**
74+ * Emitted when a touch end event is detected
75+ * @param pos the position in screen coordinates
76+ */
77+ void touchEnded(const QPointF &pos);
78+
79+private Q_SLOTS:
80+ void setupFilterOnWindow(QQuickWindow *window);
81+ void emitActivatedIfNoTouchesAround();
82+
83+private:
84+ QPointer<QQuickWindow> m_filteredWindow;
85+ bool m_windowBeingTouched;
86+ bool m_homeKeyPressed;
87+ UnityUtil::AbstractElapsedTimer *m_windowLastTouchedTimer;
88+ UnityUtil::AbstractTimer *m_activationTimer;
89+};
90+
91+#endif // UNITY_WINDOWINPUTMONITOR_H
plugins/Utils/plugin.cpp+2−2
@@ -25,7 +25,7 @@
25// local
25// local
26#include "activefocuslogger.h"
26#include "activefocuslogger.h"
27#include "easingcurve.h"
27#include "easingcurve.h"
28−#include "HomeKeyWatcher.h"
28+#include "WindowInputMonitor.h"
29#include "inputwatcher.h"
29#include "inputwatcher.h"
30#include "qlimitproxymodelqml.h"
30#include "qlimitproxymodelqml.h"
31#include "unitysortfilterproxymodelqml.h"
31#include "unitysortfilterproxymodelqml.h"
@@ -54,7 +54,7 @@ static QObject *createConstants(QQmlEngine *engine, QJSEngine *scriptEngine)
54void UtilsPlugin::registerTypes(const char *uri)
54void UtilsPlugin::registerTypes(const char *uri)
55{
55{
56 Q_ASSERT(uri == QLatin1String("Utils"));
56 Q_ASSERT(uri == QLatin1String("Utils"));
57− qmlRegisterType<HomeKeyWatcher>(uri, 0, 1, "HomeKeyWatcher");
57+ qmlRegisterType<WindowInputMonitor>(uri, 0, 1, "WindowInputMonitor");
58 qmlRegisterType<QAbstractItemModel>();
58 qmlRegisterType<QAbstractItemModel>();
59 qmlRegisterType<QLimitProxyModelQML>(uri, 0, 1, "LimitProxyModel");
59 qmlRegisterType<QLimitProxyModelQML>(uri, 0, 1, "LimitProxyModel");
60 qmlRegisterType<UnitySortFilterProxyModelQML>(uri, 0, 1, "UnitySortFilterProxyModel");
60 qmlRegisterType<UnitySortFilterProxyModelQML>(uri, 0, 1, "UnitySortFilterProxyModel");
qml/Shell.qml+11−3
@@ -56,7 +56,6 @@ Item {
56 property bool beingResized
56 property bool beingResized
57 property string usageScenario: "phone" // supported values: "phone", "tablet" or "desktop"
57 property string usageScenario: "phone" // supported values: "phone", "tablet" or "desktop"
58 property string mode: "full-greeter"
58 property string mode: "full-greeter"
59− property bool cursorVisible: false
60 property alias oskEnabled: inputMethod.enabled
59 property alias oskEnabled: inputMethod.enabled
61 function updateFocusedAppOrientation() {
60 function updateFocusedAppOrientation() {
62 applicationsDisplayLoader.item.updateFocusedAppOrientation();
61 applicationsDisplayLoader.item.updateFocusedAppOrientation();
@@ -177,8 +176,15 @@ Item {
177 Keys.onReleased: physicalKeysMapper.onKeyReleased(event, currentEventTimestamp);
176 Keys.onReleased: physicalKeysMapper.onKeyReleased(event, currentEventTimestamp);
178 }
177 }
179
178
180− HomeKeyWatcher {
179+ WindowInputMonitor {
181− onActivated: { launcher.fadeOut(); shell.showHome(); }
180+ onHomeKeyActivated: { launcher.fadeOut(); shell.showHome(); }
181+ onTouchBegun: { cursor.opacity = 0; }
182+ onTouchEnded: {
183+ // move the (hidden) cursor to the last known touch position
184+ var mappedCoords = mapFromItem(null, pos.x, pos.y);
185+ cursor.x = mappedCoords.x;
186+ cursor.y = mappedCoords.y;
187+ }
182 }
188 }
183
189
184 Item {
190 Item {
@@ -677,6 +683,8 @@ Item {
677 applicationsDisplayLoader.item.pushRightEdge(amount);
683 applicationsDisplayLoader.item.pushRightEdge(amount);
678 }
684 }
679 }
685 }
686+
687+ onMouseMoved: { cursor.opacity = 1; }
680 }
688 }
681
689
682 Rectangle {
690 Rectangle {
tests/mocks/Cursor/Cursor.qml+1
@@ -19,4 +19,5 @@ import QtQuick 2.4
19Item {
19Item {
20 signal pushedLeftBoundary(real amount, int buttons)
20 signal pushedLeftBoundary(real amount, int buttons)
21 signal pushedRightBoundary(real amount, int buttons)
21 signal pushedRightBoundary(real amount, int buttons)
22+ signal mouseMoved()
22}
23}
tests/mocks/Utils/HomeKeyWatcher.qml → tests/mocks/Utils/WindowInputMonitor.qmlrenamed+3−1
@@ -17,5 +17,7 @@
17import QtQuick 2.4
17import QtQuick 2.4
18
18
19QtObject {
19QtObject {
20− signal activated()
20+ signal homeKeyActivated()
21+ signal touchBegun()
22+ signal touchEnded(point pos)
21}
23}
tests/mocks/Utils/qmldir+1−1
@@ -2,5 +2,5 @@ module Utils
2plugin FakeUtils-qml
2plugin FakeUtils-qml
3typeinfo Utils.qmltypes
3typeinfo Utils.qmltypes
4Style 0.1 Style.js
4Style 0.1 Style.js
5−HomeKeyWatcher 0.1 HomeKeyWatcher.qml
5+WindowInputMonitor 0.1 WindowInputMonitor.qml
6singleton EdgeBarrierSettings 0.1 EdgeBarrierSettings.qml
6singleton EdgeBarrierSettings 0.1 EdgeBarrierSettings.qml
tests/plugins/Utils/CMakeLists.txt+1−1
@@ -7,7 +7,7 @@ include_directories(
7foreach(util_test
7foreach(util_test
8 QLimitProxyModel
8 QLimitProxyModel
9 UnitySortFilterProxyModel
9 UnitySortFilterProxyModel
10− HomeKeyWatcher
10+ WindowInputMonitor
11)
11)
12 add_executable(${util_test}TestExec ${util_test}Test.cpp ModelTest.cpp)
12 add_executable(${util_test}TestExec ${util_test}Test.cpp ModelTest.cpp)
13 qt5_use_modules(${util_test}TestExec Test Core Qml)
13 qt5_use_modules(${util_test}TestExec Test Core Qml)
tests/plugins/Utils/HomeKeyWatcherTest.cpp → tests/plugins/Utils/WindowInputMonitorTest.cpprenamed+14−14
@@ -14,7 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−#include "HomeKeyWatcher.h"
17+#include "WindowInputMonitor.h"
18
18
19#include <QTest>
19#include <QTest>
20#include <QSignalSpy>
20#include <QSignalSpy>
@@ -71,7 +71,7 @@ public:
71
71
72using namespace UnityUtil;
72using namespace UnityUtil;
73
73
74−class HomeKeyWatcherTest : public QObject {
74+class WindowInputMonitorTest : public QObject {
75 Q_OBJECT
75 Q_OBJECT
76private Q_SLOTS:
76private Q_SLOTS:
77 void init(); // called right before each and every test function is executed
77 void init(); // called right before each and every test function is executed
@@ -88,25 +88,25 @@ private:
88 FakeTimerFactory *m_fakeTimerFactory;
88 FakeTimerFactory *m_fakeTimerFactory;
89};
89};
90
90
91−void HomeKeyWatcherTest::init()
91+void WindowInputMonitorTest::init()
92{
92{
93 m_fakeTimerFactory = new FakeTimerFactory;
93 m_fakeTimerFactory = new FakeTimerFactory;
94}
94}
95
95
96−void HomeKeyWatcherTest::cleanup()
96+void WindowInputMonitorTest::cleanup()
97{
97{
98 delete m_fakeTimerFactory;
98 delete m_fakeTimerFactory;
99 m_fakeTimerFactory = nullptr;
99 m_fakeTimerFactory = nullptr;
100}
100}
101
101
102
102
103−void HomeKeyWatcherTest::passTime(qint64 timeSpanMs)
103+void WindowInputMonitorTest::passTime(qint64 timeSpanMs)
104{
104{
105 qint64 finalTime = FakeElapsedTimer::msecsSinceEpoch + timeSpanMs;
105 qint64 finalTime = FakeElapsedTimer::msecsSinceEpoch + timeSpanMs;
106 m_fakeTimerFactory->updateTime(finalTime);
106 m_fakeTimerFactory->updateTime(finalTime);
107}
107}
108
108
109−void HomeKeyWatcherTest::touchTapTouch_data()
109+void WindowInputMonitorTest::touchTapTouch_data()
110{
110{
111 QTest::addColumn<int>("silenceBeforeTap");
111 QTest::addColumn<int>("silenceBeforeTap");
112 QTest::addColumn<int>("tapDuration");
112 QTest::addColumn<int>("tapDuration");
@@ -121,14 +121,14 @@ void HomeKeyWatcherTest::touchTapTouch_data()
121 QTest::newRow("isolated long press") << 1000 << 200 << 1000 << 0;
121 QTest::newRow("isolated long press") << 1000 << 200 << 1000 << 0;
122}
122}
123
123
124−void HomeKeyWatcherTest::touchTapTouch()
124+void WindowInputMonitorTest::touchTapTouch()
125{
125{
126 QFETCH(int, silenceBeforeTap);
126 QFETCH(int, silenceBeforeTap);
127 QFETCH(int, tapDuration);
127 QFETCH(int, tapDuration);
128 QFETCH(int, silenceAfterTap);
128 QFETCH(int, silenceAfterTap);
129 QFETCH(int, expectedActivatedCount);
129 QFETCH(int, expectedActivatedCount);
130− HomeKeyWatcher homeKeyWatcher(m_fakeTimerFactory->create(), new FakeElapsedTimer);
130+ WindowInputMonitor homeKeyWatcher(m_fakeTimerFactory->create(), new FakeElapsedTimer);
131− QSignalSpy activatedSpy(&homeKeyWatcher, &HomeKeyWatcher::activated);
131+ QSignalSpy activatedSpy(&homeKeyWatcher, &WindowInputMonitor::homeKeyActivated);
132 QVERIFY(activatedSpy.isValid());
132 QVERIFY(activatedSpy.isValid());
133
133
134 {
134 {
@@ -186,10 +186,10 @@ void HomeKeyWatcherTest::touchTapTouch()
186 QCOMPARE(activatedSpy.count(), expectedActivatedCount);
186 QCOMPARE(activatedSpy.count(), expectedActivatedCount);
187}
187}
188
188
189−void HomeKeyWatcherTest::tapWhileTouching()
189+void WindowInputMonitorTest::tapWhileTouching()
190{
190{
191− HomeKeyWatcher homeKeyWatcher(m_fakeTimerFactory->create(), new FakeElapsedTimer);
191+ WindowInputMonitor homeKeyWatcher(m_fakeTimerFactory->create(), new FakeElapsedTimer);
192− QSignalSpy activatedSpy(&homeKeyWatcher, &HomeKeyWatcher::activated);
192+ QSignalSpy activatedSpy(&homeKeyWatcher, &WindowInputMonitor::homeKeyActivated);
193 QVERIFY(activatedSpy.isValid());
193 QVERIFY(activatedSpy.isValid());
194
194
195 {
195 {
@@ -318,6 +318,6 @@ AbstractTimer *FakeTimerFactory::create(QObject *parent)
318 return fakeTimer;
318 return fakeTimer;
319}
319}
320
320
321−QTEST_GUILESS_MAIN(HomeKeyWatcherTest)
321+QTEST_GUILESS_MAIN(WindowInputMonitorTest)
322
322
323−#include "HomeKeyWatcherTest.moc"
323+#include "WindowInputMonitorTest.moc"