on xenial help sign in
rename signals, add some docu
fc18645Lukáš Tinkl
plugins/Utils/WindowInputMonitor.cpp+3−3
@@ -86,7 +86,7 @@ void WindowInputMonitor::update(QEvent *event)
86
86
87 m_activationTimer->stop();
87 m_activationTimer->stop();
88 m_windowBeingTouched = true;
88 m_windowBeingTouched = true;
89− Q_EMIT windowTouched();
89+ Q_EMIT touchBegun();
90
90
91 } else if (event->type() == QEvent::TouchEnd) {
91 } else if (event->type() == QEvent::TouchEnd) {
92
92
@@ -96,7 +96,7 @@ void WindowInputMonitor::update(QEvent *event)
96 QTouchEvent * touchEv = static_cast<QTouchEvent *>(event);
96 QTouchEvent * touchEv = static_cast<QTouchEvent *>(event);
97 if (touchEv && !touchEv->touchPoints().isEmpty()) {
97 if (touchEv && !touchEv->touchPoints().isEmpty()) {
98 const QPointF pos = touchEv->touchPoints().last().screenPos();
98 const QPointF pos = touchEv->touchPoints().last().screenPos();
99− Q_EMIT windowReleased(pos);
99+ Q_EMIT touchEnded(pos);
100 }
100 }
101 }
101 }
102}
102}
@@ -118,6 +118,6 @@ void WindowInputMonitor::emitActivatedIfNoTouchesAround()
118{
118{
119 if (!m_homeKeyPressed && !m_windowBeingTouched &&
119 if (!m_homeKeyPressed && !m_windowBeingTouched &&
120 (m_windowLastTouchedTimer->elapsed() > msecsWithoutTouches)) {
120 (m_windowLastTouchedTimer->elapsed() > msecsWithoutTouches)) {
121− Q_EMIT activated();
121+ Q_EMIT homeKeyActivated();
122 }
122 }
123}
123}
plugins/Utils/WindowInputMonitor.h+6−3
@@ -34,6 +34,9 @@
34 Rationale being that it's easy to accidentally hit the home key while performing
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
35 a swipe from a screen edge, for instance. That's particularly the case when the
36 home key is a capacitive key.
36 home key is a capacitive key.
37+
38+ Additionally, this class monitors for generic touch events on the screen, to
39+ help with hiding/revealing the mouse pointer.
37 */
40 */
38class WindowInputMonitor : public QQuickItem
41class WindowInputMonitor : public QQuickItem
39{
42{
@@ -57,10 +60,10 @@ public:
57
60
58Q_SIGNALS:
61Q_SIGNALS:
59 // Emitted when the home key has been intentionally tapped
62 // Emitted when the home key has been intentionally tapped
60− void activated();
63+ void homeKeyActivated();
61
64
62− void windowTouched();
65+ void touchBegun();
63− void windowReleased(const QPointF &pos);
66+ void touchEnded(const QPointF &pos);
64
67
65private Q_SLOTS:
68private Q_SLOTS:
66 void setupFilterOnWindow(QQuickWindow *window);
69 void setupFilterOnWindow(QQuickWindow *window);
qml/Shell.qml+5−5
@@ -144,7 +144,7 @@ Item {
144 function revealCursor() {
144 function revealCursor() {
145 if (touchDetected) {
145 if (touchDetected) {
146 touchDetected = false;
146 touchDetected = false;
147− Mir.cursorName = "";
147+ //Mir.cursorName = "";
148 shell.cursorVisible = true;
148 shell.cursorVisible = true;
149 }
149 }
150 }
150 }
@@ -196,10 +196,10 @@ Item {
196 }
196 }
197
197
198 WindowInputMonitor {
198 WindowInputMonitor {
199− onActivated: { launcher.fadeOut(); shell.showHome(); }
199+ onHomeKeyActivated: { launcher.fadeOut(); shell.showHome(); }
200− onWindowTouched: { cursorPriv.hideCursor(); }
200+ onTouchBegun: { cursorPriv.hideCursor(); }
201− onWindowReleased: {
201+ onTouchEnded: {
202− // store the last known touch position
202+ // move the (hidden) cursor to the last known touch position
203 cursor.x = pos.x;
203 cursor.x = pos.x;
204 cursor.y = pos.y;
204 cursor.y = pos.y;
205 }
205 }
tests/plugins/Utils/WindowInputMonitorTest.cpp+2−2
@@ -128,7 +128,7 @@ void WindowInputMonitorTest::touchTapTouch()
128 QFETCH(int, silenceAfterTap);
128 QFETCH(int, silenceAfterTap);
129 QFETCH(int, expectedActivatedCount);
129 QFETCH(int, expectedActivatedCount);
130 WindowInputMonitor homeKeyWatcher(m_fakeTimerFactory->create(), new FakeElapsedTimer);
130 WindowInputMonitor homeKeyWatcher(m_fakeTimerFactory->create(), new FakeElapsedTimer);
131− QSignalSpy activatedSpy(&homeKeyWatcher, &WindowInputMonitor::activated);
131+ QSignalSpy activatedSpy(&homeKeyWatcher, &WindowInputMonitor::homeKeyActivated);
132 QVERIFY(activatedSpy.isValid());
132 QVERIFY(activatedSpy.isValid());
133
133
134 {
134 {
@@ -189,7 +189,7 @@ void WindowInputMonitorTest::touchTapTouch()
189void WindowInputMonitorTest::tapWhileTouching()
189void WindowInputMonitorTest::tapWhileTouching()
190{
190{
191 WindowInputMonitor homeKeyWatcher(m_fakeTimerFactory->create(), new FakeElapsedTimer);
191 WindowInputMonitor homeKeyWatcher(m_fakeTimerFactory->create(), new FakeElapsedTimer);
192− QSignalSpy activatedSpy(&homeKeyWatcher, &WindowInputMonitor::activated);
192+ QSignalSpy activatedSpy(&homeKeyWatcher, &WindowInputMonitor::homeKeyActivated);
193 QVERIFY(activatedSpy.isValid());
193 QVERIFY(activatedSpy.isValid());
194
194
195 {
195 {