on xenial help sign in
rebased
83b859dNick Dedekind
qml/Dash/graphics/phone/screenshots/vkb_portrait.pngnew file

Binary file not shown.

qml/Stages/TabletStage.qml+2−2
@@ -342,7 +342,7 @@ Item {
342 id: sideStageBackground
342 id: sideStageBackground
343 color: "black"
343 color: "black"
344 anchors.fill: parent
344 anchors.fill: parent
345− anchors.leftMargin: spreadView.width - spreadView.sideStageWidth + spreadView.sideStageWidth * sideStageDragHandle.progress
345+ anchors.leftMargin: spreadView.width - (1 - sideStageDragHandle.progress) * spreadView.sideStageWidth
346 z: spreadView.indexToZIndex(priv.indexOf(priv.sideStageAppId))
346 z: spreadView.indexToZIndex(priv.indexOf(priv.sideStageAppId))
347 opacity: spreadView.phase == 0 ? 1 : 0
347 opacity: spreadView.phase == 0 ? 1 : 0
348 Behavior on opacity { UbuntuNumberAnimation {} }
348 Behavior on opacity { UbuntuNumberAnimation {} }
@@ -470,7 +470,7 @@ Item {
470 if (spreadView.phase == 0 && (spreadTile.active || spreadView.nextInStack == index)) {
470 if (spreadView.phase == 0 && (spreadTile.active || spreadView.nextInStack == index)) {
471 if (progress < spreadView.positionMarker1) {
471 if (progress < spreadView.positionMarker1) {
472 return progress;
472 return progress;
473− } else if (progress < spreadView.positionMarker1 + snappingCurve.period){
473+ } else if (progress < spreadView.positionMarker1 + snappingCurve.period) {
474 return spreadView.positionMarker1 + snappingCurve.value * 3;
474 return spreadView.positionMarker1 + snappingCurve.value * 3;
475 } else {
475 } else {
476 return spreadView.positionMarker2;
476 return spreadView.positionMarker2;
qml/Stages/TransformedSpreadDelegate.qml+8−6
@@ -23,7 +23,9 @@ import Ubuntu.Components 0.1
23SpreadDelegate {
23SpreadDelegate {
24 id: root
24 id: root
25
25
26+ // Set this to true when this tile is selected in the spread. The animation will change to bring the tile to front.
26 property bool selected: false
27 property bool selected: false
28+ // Set this to true when another tile in the spread is selected. The animation will change to fade this tile out.
27 property bool otherSelected: false
29 property bool otherSelected: false
28
30
29 // The progress animates the tiles. A value > 0 makes it appear from the right edge. At 1 it reaches the end position.
31 // The progress animates the tiles. A value > 0 makes it appear from the right edge. At 1 it reaches the end position.
@@ -129,7 +131,7 @@ SpreadDelegate {
129 // All tiles are kept in place and faded out to 0 opacity except
131 // All tiles are kept in place and faded out to 0 opacity except
130 // the selected tile, which is animated from the snapshotted position to be fullscreen.
132 // the selected tile, which is animated from the snapshotted position to be fullscreen.
131
133
132− property real xTranslate: {
134+ readonly property real xTranslate: {
133 if (otherSelected) {
135 if (otherSelected) {
134 if (spreadView.phase < 2 && index == 0) {
136 if (spreadView.phase < 2 && index == 0) {
135 return linearAnimation(selectedProgress, 0, selectedXTranslate,
137 return linearAnimation(selectedProgress, 0, selectedXTranslate,
@@ -175,12 +177,12 @@ SpreadDelegate {
175 // Fix it at the right edge...
177 // Fix it at the right edge...
176 var rightEdgeOffset = -((index - 1) * root.startDistance);
178 var rightEdgeOffset = -((index - 1) * root.startDistance);
177 // ...and use our easing to move them to the left. Stop a bit earlier for each tile
179 // ...and use our easing to move them to the left. Stop a bit earlier for each tile
178− var animatedEndDistance = linearAnimation(0, 2, root.endDistance, 0, root.progress)
180+ var animatedEndDistance = linearAnimation(0, 2, root.endDistance, 0, root.progress);
179 return -easingCurve.value * spreadView.width + (index * animatedEndDistance) + rightEdgeOffset;
181 return -easingCurve.value * spreadView.width + (index * animatedEndDistance) + rightEdgeOffset;
180
182
181 }
183 }
182
184
183− property real angle: {
185+ readonly property real angle: {
184 if (spreadView.focusChanging) {
186 if (spreadView.focusChanging) {
185 return 0;
187 return 0;
186 }
188 }
@@ -213,7 +215,7 @@ SpreadDelegate {
213 return root.startAngle - easingCurve.value * (root.startAngle - root.endAngle);
215 return root.startAngle - easingCurve.value * (root.startAngle - root.endAngle);
214 }
216 }
215
217
216− property real scale: {
218+ readonly property real scale: {
217 if (spreadView.focusChanging) {
219 if (spreadView.focusChanging) {
218 return 1;
220 return 1;
219 }
221 }
@@ -246,7 +248,7 @@ SpreadDelegate {
246 return root.startScale - easingCurve.value * (root.startScale - root.endScale);
248 return root.startScale - easingCurve.value * (root.startScale - root.endScale);
247 }
249 }
248
250
249− property real opacity: {
251+ readonly property real opacity: {
250 if (priv.otherSelected) {
252 if (priv.otherSelected) {
251 return linearAnimation (selectedProgress, Math.max(0, selectedProgress - .5),
253 return linearAnimation (selectedProgress, Math.max(0, selectedProgress - .5),
252 selectedOpacity, 0, root.progress);
254 selectedOpacity, 0, root.progress);
@@ -264,7 +266,7 @@ SpreadDelegate {
264 return 1;
266 return 1;
265 }
267 }
266
268
267− property real topMarginProgress: {
269+ readonly property real topMarginProgress: {
268 if (priv.isSelected) {
270 if (priv.isSelected) {
269 return linearAnimation(selectedProgress, 0, selectedTopMarginProgress, 0, root.progress);
271 return linearAnimation(selectedProgress, 0, selectedTopMarginProgress, 0, root.progress);
270 }
272 }
qml/Stages/TransformedTabletSpreadDelegate.qml+9−3
@@ -24,12 +24,16 @@ import Unity.Application 0.1
24SpreadDelegate {
24SpreadDelegate {
25 id: root
25 id: root
26
26
27+ // Set this to true when this tile is selected in the spread. The animation will change to bring the tile to front.
28+ property bool selected: false
29+ // Set this to true when another tile in the spread is selected. The animation will change to fade this tile out.
30+ property bool otherSelected: false
31+ // Set this to true when this tile a currently active on either the MS or the SS.
27 property bool active: false
32 property bool active: false
33+
28 property int zIndex
34 property int zIndex
29 property real progress: 0
35 property real progress: 0
30 property real animatedProgress: 0
36 property real animatedProgress: 0
31− property bool selected: false
32− property bool otherSelected: false
33
37
34 property real startDistance: units.gu(5)
38 property real startDistance: units.gu(5)
35 property real endDistance: units.gu(.5)
39 property real endDistance: units.gu(.5)
@@ -253,7 +257,9 @@ SpreadDelegate {
253 }
257 }
254
258
255 // The tile should rotate a bit when another one comes on top, but not when only dragging the side stage in
259 // The tile should rotate a bit when another one comes on top, but not when only dragging the side stage in
260+ var shouldMoveAway = spreadView.nextInStack >= 0 && movedActive &&
256− var shouldMoveAway = spreadView.nextInStack >= 0 && movedActive && (ApplicationManager.get(spreadView.nextInStack).stage === ApplicationInfoInterface.MainStage || model.stage == ApplicationInfoInterface.SideStage);
261+ (ApplicationManager.get(spreadView.nextInStack).stage === ApplicationInfoInterface.MainStage ||
262+ model.stage == ApplicationInfoInterface.SideStage);
257
263
258 if (spreadView.phase == 0) {
264 if (spreadView.phase == 0) {
259 if (nextInStack) {
265 if (nextInStack) {
tests/mocks/QMenuModel/unitymenumodel.cpp+7−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2013-2014 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
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
5 * it under the terms of the GNU General Public License as published by
@@ -14,6 +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 * Authors: Nick Dedekind <nick.dedekind@canonical.com>
16 * Authors: Nick Dedekind <nick.dedekind@canonical.com>
17+ * Daniel d'Andrada <daniel.dandrada@canonical.com>
17 */
18 */
18
19
19#include "unitymenumodel.h"
20#include "unitymenumodel.h"
@@ -240,3 +241,8 @@ void UnityMenuModel::registerAction(UnityMenuAction*)
240void UnityMenuModel::unregisterAction(UnityMenuAction*)
241void UnityMenuModel::unregisterAction(UnityMenuAction*)
241{
242{
242}
243}
244+
245+QByteArray UnityMenuModel::nameOwner() const
246+{
247+ return QByteArray();
248+}
tests/mocks/QMenuModel/unitymenumodel.h+6−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2013-2014 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
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
5 * it under the terms of the GNU General Public License as published by
@@ -14,6 +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 * Authors: Nick Dedekind <nick.dedekind@canonical.com>
16 * Authors: Nick Dedekind <nick.dedekind@canonical.com>
17+ * Daniel d'Andrada <daniel.dandrada@canonical.com>
17 */
18 */
18
19
19#ifndef MOCK_UNITYMENUMODEL_H
20#ifndef MOCK_UNITYMENUMODEL_H
@@ -29,6 +30,7 @@ class Q_DECL_EXPORT UnityMenuModel : public QAbstractListModel
29 Q_OBJECT
30 Q_OBJECT
30 Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData NOTIFY modelDataChanged)
31 Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData NOTIFY modelDataChanged)
31 Q_PROPERTY(QByteArray busName READ busName WRITE setBusName NOTIFY busNameChanged)
32 Q_PROPERTY(QByteArray busName READ busName WRITE setBusName NOTIFY busNameChanged)
33+ Q_PROPERTY(QByteArray nameOwner READ nameOwner NOTIFY nameOwnerChanged)
32 Q_PROPERTY(QVariantMap actions READ actions WRITE setActions NOTIFY actionsChanged)
34 Q_PROPERTY(QVariantMap actions READ actions WRITE setActions NOTIFY actionsChanged)
33 Q_PROPERTY(QByteArray menuObjectPath READ menuObjectPath WRITE setMenuObjectPath NOTIFY menuObjectPathChanged)
35 Q_PROPERTY(QByteArray menuObjectPath READ menuObjectPath WRITE setMenuObjectPath NOTIFY menuObjectPathChanged)
34 Q_PROPERTY(ActionStateParser* actionStateParser READ actionStateParser WRITE setActionStateParser NOTIFY actionStateParserChanged)
36 Q_PROPERTY(ActionStateParser* actionStateParser READ actionStateParser WRITE setActionStateParser NOTIFY actionStateParserChanged)
@@ -47,6 +49,8 @@ public:
47 QByteArray busName() const;
49 QByteArray busName() const;
48 void setBusName(const QByteArray &busName);
50 void setBusName(const QByteArray &busName);
49
51
52+ QByteArray nameOwner() const;
53+
50 QVariantMap actions() const;
54 QVariantMap actions() const;
51 void setActions(const QVariantMap &actions);
55 void setActions(const QVariantMap &actions);
52
56
@@ -75,6 +79,7 @@ public:
75
79
76Q_SIGNALS:
80Q_SIGNALS:
77 void busNameChanged();
81 void busNameChanged();
82+ void nameOwnerChanged(const QByteArray &owner);
78 void actionsChanged();
83 void actionsChanged();
79 void menuObjectPathChanged();
84 void menuObjectPathChanged();
80 void actionStateParserChanged();
85 void actionStateParserChanged();
tests/mocks/Unity/Application/ApplicationInfo.cpp+2
@@ -94,6 +94,7 @@ void ApplicationInfo::setSurface(MirSurfaceItem* surface)
94 if (m_surface) {
94 if (m_surface) {
95 m_surface->setApplication(nullptr);
95 m_surface->setApplication(nullptr);
96 m_surface->setParent(nullptr);
96 m_surface->setParent(nullptr);
97+ SurfaceManager::singleton()->unregisterSurface(m_surface);
97 }
98 }
98
99
99 m_surface = surface;
100 m_surface = surface;
@@ -101,6 +102,7 @@ void ApplicationInfo::setSurface(MirSurfaceItem* surface)
101 if (m_surface) {
102 if (m_surface) {
102 m_surface->setApplication(this);
103 m_surface->setApplication(this);
103 m_surface->setParent(this);
104 m_surface->setParent(this);
105+ SurfaceManager::singleton()->registerSurface(m_surface);
104 }
106 }
105
107
106 Q_EMIT surfaceChanged(m_surface);
108 Q_EMIT surfaceChanged(m_surface);
tests/mocks/Unity/Application/CMakeLists.txt+1
@@ -9,6 +9,7 @@ set(FakeUnityApplicationQml_SOURCES
9 ApplicationScreenshotProvider.cpp
9 ApplicationScreenshotProvider.cpp
10 MirSurfaceItem.cpp
10 MirSurfaceItem.cpp
11 SurfaceManager.cpp
11 SurfaceManager.cpp
12+ VirtualKeyboard.cpp
12 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationInfoInterface.h
13 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationInfoInterface.h
13 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationManagerInterface.h
14 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationManagerInterface.h
14)
15)
tests/mocks/Unity/Application/MirSurfaceItem.cpp+31−1
@@ -32,10 +32,16 @@ MirSurfaceItem::MirSurfaceItem(const QString& name,
32 , m_state(state)
32 , m_state(state)
33 , m_img(screenshot.isLocalFile() ? screenshot.toLocalFile() : screenshot.toString())
33 , m_img(screenshot.isLocalFile() ? screenshot.toLocalFile() : screenshot.toString())
34 , m_parentSurface(nullptr)
34 , m_parentSurface(nullptr)
35+ , m_haveInputMethod(false)
35{
36{
36 QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
37 QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
37
38
39+ // The virtual keyboard (input method) has a big transparent area so that
40+ // content behind it show through
38− setFillColor(Qt::white);
41+ setFillColor(Qt::transparent);
42+
43+ connect(this, &QQuickItem::focusChanged,
44+ this, &MirSurfaceItem::onFocusChanged);
39}
45}
40
46
41MirSurfaceItem::~MirSurfaceItem()
47MirSurfaceItem::~MirSurfaceItem()
@@ -120,3 +126,27 @@ QList<QObject*> MirSurfaceItem::childSurfaces() const
120 }
126 }
121 return children;
127 return children;
122}
128}
129+
130+void MirSurfaceItem::touchEvent(QTouchEvent * event)
131+{
132+ if (event->type() == QEvent::TouchBegin && hasFocus()) {
133+ Q_EMIT inputMethodRequested();
134+ m_haveInputMethod = true;
135+ }
136+}
137+
138+void MirSurfaceItem::onFocusChanged()
139+{
140+ if (!hasFocus() && m_haveInputMethod) {
141+ Q_EMIT inputMethodDismissed();
142+ m_haveInputMethod = false;
143+ }
144+}
145+
146+void MirSurfaceItem::setState(MirSurfaceItem::State newState)
147+{
148+ if (newState != m_state) {
149+ m_state = newState;
150+ Q_EMIT stateChanged(newState);
151+ }
152+}
tests/mocks/Unity/Application/MirSurfaceItem.h+16−4
@@ -70,12 +70,14 @@ public:
70 MirSurfaceItem* parentSurface() const { return m_parentSurface; }
70 MirSurfaceItem* parentSurface() const { return m_parentSurface; }
71 QList<QObject*> childSurfaces() const;
71 QList<QObject*> childSurfaces() const;
72
72
73+ void setState(State newState);
74+ void setApplication(ApplicationInfo* item);
75+ void setParentSurface(MirSurfaceItem* item);
76+
73 Q_INVOKABLE void release();
77 Q_INVOKABLE void release();
74
78
75 void paint(QPainter * painter) override;
79 void paint(QPainter * painter) override;
76−
80+ void touchEvent(QTouchEvent * event) override;
77− void setApplication(ApplicationInfo* item);
78− void setParentSurface(MirSurfaceItem* item);
79
81
80Q_SIGNALS:
82Q_SIGNALS:
81 void typeChanged(Type);
83 void typeChanged(Type);
@@ -86,6 +88,15 @@ Q_SIGNALS:
86
88
87 void removed();
89 void removed();
88
90
91+ void inputMethodRequested();
92+ void inputMethodDismissed();
93+
94+private Q_SLOTS:
95+ void onFocusChanged();
96+
97+protected:
98+ const QImage &screenshotImage() { return m_img; }
99+
89private:
100private:
90 void addChildSurface(MirSurfaceItem* surface);
101 void addChildSurface(MirSurfaceItem* surface);
91 void removeChildSurface(MirSurfaceItem* surface);
102 void removeChildSurface(MirSurfaceItem* surface);
@@ -93,11 +104,12 @@ private:
93 ApplicationInfo* m_application;
104 ApplicationInfo* m_application;
94 const QString m_name;
105 const QString m_name;
95 const Type m_type;
106 const Type m_type;
96− const State m_state;
107+ State m_state;
97 const QImage m_img;
108 const QImage m_img;
98
109
99 MirSurfaceItem* m_parentSurface;
110 MirSurfaceItem* m_parentSurface;
100 QList<MirSurfaceItem*> m_children;
111 QList<MirSurfaceItem*> m_children;
112+ bool m_haveInputMethod;
101};
113};
102
114
103Q_DECLARE_METATYPE(MirSurfaceItem*)
115Q_DECLARE_METATYPE(MirSurfaceItem*)
tests/mocks/Unity/Application/SurfaceManager.cpp+36
@@ -16,6 +16,10 @@
16
16
17#include "SurfaceManager.h"
17#include "SurfaceManager.h"
18
18
19+#include "MirSurfaceItem.h"
20+#include "VirtualKeyboard.h"
21+
22+
19SurfaceManager *SurfaceManager::the_surface_manager = nullptr;
23SurfaceManager *SurfaceManager::the_surface_manager = nullptr;
20
24
21SurfaceManager *SurfaceManager::singleton()
25SurfaceManager *SurfaceManager::singleton()
@@ -28,5 +32,37 @@ SurfaceManager *SurfaceManager::singleton()
28
32
29SurfaceManager::SurfaceManager(QObject *parent) :
33SurfaceManager::SurfaceManager(QObject *parent) :
30 QObject(parent)
34 QObject(parent)
35+ , m_virtualKeyboard(nullptr)
36+{
37+}
38+
39+void SurfaceManager::registerSurface(MirSurfaceItem *surface)
40+{
41+ connect(surface, &MirSurfaceItem::inputMethodRequested,
42+ this, &SurfaceManager::showInputMethod);
43+ connect(surface, &MirSurfaceItem::inputMethodDismissed,
44+ this, &SurfaceManager::hideInputMethod);
45+ Q_EMIT surfaceCreated(surface);
46+}
47+
48+void SurfaceManager::unregisterSurface(MirSurfaceItem *surface)
31{
49{
50+ disconnect(surface, 0, this, 0);
51+ Q_EMIT surfaceDestroyed(surface);
52+}
53+
54+void SurfaceManager::showInputMethod()
55+{
56+ if (!m_virtualKeyboard) {
57+ m_virtualKeyboard = new VirtualKeyboard(MirSurfaceItem::Minimized);
58+ Q_EMIT surfaceCreated(m_virtualKeyboard);
59+ }
60+ m_virtualKeyboard->setState(MirSurfaceItem::Restored);
61+}
62+
63+void SurfaceManager::hideInputMethod()
64+{
65+ if (m_virtualKeyboard) {
66+ m_virtualKeyboard->setState(MirSurfaceItem::Minimized);
67+ }
32}
68}
tests/mocks/Unity/Application/SurfaceManager.h+10−1
@@ -20,6 +20,7 @@
20#include <QObject>
20#include <QObject>
21
21
22class MirSurfaceItem;
22class MirSurfaceItem;
23+class VirtualKeyboard;
23
24
24class SurfaceManager : public QObject
25class SurfaceManager : public QObject
25{
26{
@@ -29,14 +30,22 @@ public:
29
30
30 static SurfaceManager *singleton();
31 static SurfaceManager *singleton();
31
32
33+ // Internal mock use
34+ void registerSurface(MirSurfaceItem *surface);
35+ void unregisterSurface(MirSurfaceItem *surface);
36+
32Q_SIGNALS:
37Q_SIGNALS:
33 void countChanged();
38 void countChanged();
34 void surfaceCreated(MirSurfaceItem *surface);
39 void surfaceCreated(MirSurfaceItem *surface);
35 void surfaceDestroyed(MirSurfaceItem *surface);
40 void surfaceDestroyed(MirSurfaceItem *surface);
36
41
42+private Q_SLOTS:
43+ void showInputMethod();
44+ void hideInputMethod();
45+
37private:
46private:
38 static SurfaceManager *the_surface_manager;
47 static SurfaceManager *the_surface_manager;
39−
48+ VirtualKeyboard *m_virtualKeyboard;
40};
49};
41
50
42#endif // SURFACEMANAGER_H
51#endif // SURFACEMANAGER_H
tests/mocks/Unity/Application/VirtualKeyboard.cppnew file+55
@@ -0,0 +1,55 @@
1+/*
2+ * Copyright (C) 2014 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+#include "VirtualKeyboard.h"
18+
19+#include <paths.h>
20+
21+VirtualKeyboard::VirtualKeyboard(State state, QQuickItem *parent)
22+ : MirSurfaceItem("input-method",
23+ MirSurfaceItem::InputMethod,
24+ state,
25+ QString("file://%1/Dash/graphics/phone/screenshots/vkb_portrait.png").arg(qmlDirectory()),
26+ parent)
27+{
28+}
29+
30+void VirtualKeyboard::touchEvent(QTouchEvent *event)
31+{
32+ if (event->type() == QEvent::TouchBegin && !hasTouchInsideKeyboard(event)) {
33+ event->ignore();
34+ }
35+}
36+
37+bool VirtualKeyboard::hasTouchInsideKeyboard(QTouchEvent *event)
38+{
39+ const QList<QTouchEvent::TouchPoint> &touchPoints = event->touchPoints();
40+ for (int i = 0; i < touchPoints.count(); ++i) {
41+ QPoint pos = touchPoints.at(i).pos().toPoint();
42+
43+ // Map to image coords
44+ int imageX = (int)( ( ((qreal)pos.x()) / width() ) * ((qreal)screenshotImage().size().width()) );
45+ int imageY = (int)( ( ((qreal)pos.y()) / height() ) * ((qreal)screenshotImage().size().height()) );
46+
47+ QRgb pixelHit = screenshotImage().pixel(imageX, imageY);
48+
49+ // The keyboard depicted in the image is in its opaque part.
50+ if (qAlpha(pixelHit) != 0) {
51+ return true;
52+ }
53+ }
54+ return false;
55+}
tests/mocks/Unity/Application/VirtualKeyboard.hnew file+35
@@ -0,0 +1,35 @@
1+/*
2+ * Copyright (C) 2014 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 VIRTUALKEYBOARD_H
18+#define VIRTUALKEYBOARD_H
19+
20+#include "MirSurfaceItem.h"
21+
22+class VirtualKeyboard : public MirSurfaceItem
23+{
24+ Q_OBJECT
25+public:
26+ VirtualKeyboard(State state,
27+ QQuickItem *parent = 0);
28+
29+ void touchEvent(QTouchEvent * event) override;
30+
31+private:
32+ bool hasTouchInsideKeyboard(QTouchEvent *event);
33+};
34+
35+#endif // VIRTUALKEYBOARD_H
tests/qmltests/Stages/tst_PhoneStage.qml+1−1
@@ -133,7 +133,7 @@ Item {
133 var startX = phoneStage.width;
133 var startX = phoneStage.width;
134 var startY = phoneStage.height / 2;
134 var startY = phoneStage.height / 2;
135 var endY = startY;
135 var endY = startY;
136− var endX = spreadView.width - (spreadView.width * spreadView[data.positionMarker]) - data.offset - phoneStage.dragAreaWidth;
136+ var endX = spreadView.width - (spreadView.width * spreadView[data.positionMarker]) - data.offset;
137
137
138 var oldFocusedApp = ApplicationManager.get(0);
138 var oldFocusedApp = ApplicationManager.get(0);
139 var newFocusedApp = ApplicationManager.get(data.newFocusedIndex);
139 var newFocusedApp = ApplicationManager.get(data.newFocusedIndex);