Merge lp:~unity-team/unity8/silo0 into lp:unity8

Proposed by Gerry Boland
Status: Work in progress
Proposed branch: lp:~unity-team/unity8/silo0
Merge into: lp:unity8
Diff against target: 3037 lines (+1195/-623)
45 files modified
CMakeLists.txt (+1/-1)
debian/changelog (+6/-0)
debian/control (+2/-1)
plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp (+2/-11)
qml/Components/InputMethod.qml (+26/-21)
qml/DeviceConfiguration.qml (+2/-0)
qml/Greeter/Greeter.qml (+1/-1)
qml/Launcher/Launcher.qml (+1/-0)
qml/OrientedShell.qml (+10/-1)
qml/Panel/Panel.qml (+1/-0)
qml/Rotation/RotationStates.qml (+4/-1)
qml/Shell.qml (+8/-21)
qml/Stages/ApplicationWindow.qml (+2/-1)
qml/Stages/DecoratedWindow.qml (+6/-3)
qml/Stages/DesktopStage.qml (+6/-11)
qml/Stages/ResizeArea.qml (+142/-0)
qml/Stages/SurfaceContainer.qml (+38/-21)
qml/Stages/WindowDecoration.qml (+31/-4)
qml/Stages/WindowResizeArea.qml (+96/-63)
tests/mocks/Unity/Application/ApplicationInfo.cpp (+11/-3)
tests/mocks/Unity/Application/ApplicationInfo.h (+4/-6)
tests/mocks/Unity/Application/ApplicationTestInterface.cpp (+3/-3)
tests/mocks/Unity/Application/ApplicationTestInterface.h (+3/-3)
tests/mocks/Unity/Application/CMakeLists.txt (+4/-1)
tests/mocks/Unity/Application/Cursor.qml (+20/-0)
tests/mocks/Unity/Application/MirSurface.cpp (+182/-0)
tests/mocks/Unity/Application/MirSurface.h (+111/-0)
tests/mocks/Unity/Application/MirSurfaceItem.cpp (+193/-100)
tests/mocks/Unity/Application/MirSurfaceItem.h (+41/-76)
tests/mocks/Unity/Application/MirSurfaceItem.qml (+2/-0)
tests/mocks/Unity/Application/MirSurfaceItemModel.h (+0/-35)
tests/mocks/Unity/Application/Session.cpp (+47/-37)
tests/mocks/Unity/Application/Session.h (+14/-7)
tests/mocks/Unity/Application/SurfaceManager.cpp (+14/-17)
tests/mocks/Unity/Application/SurfaceManager.h (+8/-11)
tests/mocks/Unity/Application/VirtualKeyboard.cpp (+7/-6)
tests/mocks/Unity/Application/VirtualKeyboard.h (+6/-9)
tests/mocks/Unity/Application/plugin.cpp (+11/-8)
tests/mocks/Unity/Application/qmldir (+1/-0)
tests/qmltests/CMakeLists.txt (+1/-1)
tests/qmltests/Stages/tst_ApplicationWindow.qml (+39/-29)
tests/qmltests/Stages/tst_SurfaceContainer.qml (+26/-32)
tests/qmltests/Stages/tst_WindowResizeArea.qml (+6/-34)
tests/qmltests/tst_OrientedShell.qml (+32/-20)
tests/qmltests/tst_Shell.qml (+24/-24)
To merge this branch: bzr merge lp:~unity-team/unity8/silo0
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+264171@code.launchpad.net

Commit message

DO NOT MERGE! Extras for pocket desktop demo in silo0.

To post a comment you must log in.
lp:~unity-team/unity8/silo0 updated
1850. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

1851. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

1852. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

1853. By Daniel d'Andrada

Dismiss the apps spread if greeter gets shown

Enables Shell to rotate itself back into place while greeter is shown because PhoneStage doesn't allow rotations while the apps spread is open Fixes: #1471609
Approved by: Michael Zanetti

1854. By Albert Astals Cid

Revert Session Screenshotter Fixes: #1473476
Approved by: Michael Zanetti

1855. By CI Train Bot Account

Releasing 8.10+15.10.20150713-0ubuntu1

1856. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

1857. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

1858. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

1859. By Josh Arenson

Add a basic autopilot test for the SettingsWizard
Approved by: Albert Astals Cid, Richard Huddie

1860. By Daniel d'Andrada

Update tst_ShellWithPin

Spread is no longer enabled while the greeter is being shown.
Approved by: Albert Astals Cid

1861. By Albert Astals Cid

Fix build with ninja
Approved by: Pete Woods, Michael Zanetti

1862. By Nick Dedekind

Fixed qml warnings in 'make tryShell'
Approved by: Mirco Müller

1863. By Albert Astals Cid

Ensure tutorial doesn't let user drag the launcher past screen edge.

This was because the bouncing animation on the left added a bit of extra offset to the launcher. So I just made sure that offset doesn't go past the screen edge as the user drags the launcher out.

And added a test. Fixes: #1454882
Approved by: Albert Astals Cid

1864. By Lukáš Tinkl

Avoid sync DBUS calls
Approved by: Michael Zanetti

1865. By Michael Zanetti

Add PreviewSocialComment
Approved by: Albert Astals Cid, Josh Arenson

1866. By Marcus Tomlinson

Handle TERM, HUP, and INT signals in unity-scope-tool Fixes: #1470464
Approved by: Albert Astals Cid, Michi Henning

1867. By CI Train Bot Account

Releasing 8.10+15.10.20150717-0ubuntu1

1868. By CI Train Bot Account

Resync trunk.

1869. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

1870. By Josh Arenson

Add handling for the location page to the autopilot settings wizard test
Approved by: Albert Astals Cid

1871. By Albert Astals Cid

Update state of indicators bar only when the user is actively dragging himself

Fixes race with timer causing bug 1457044 Fixes: #1457044
Approved by: Nick Dedekind

1872. By Albert Astals Cid

PreviewExpandable should be not expanded on startup

Approved by: Andrea Cimitan

1873. By Albert Astals Cid

icon-actions preview widget

Approved by: Andrea Cimitan

1874. By Albert Astals Cid

Fix warning when doing make try*
Approved by: Andrea Cimitan

1875. By handsome_feng

Added touch state on navigation. Fixes: #1383213
Approved by: Mirco Müller

1876. By Albert Astals Cid

make testPageHeader more stable

Approved by: Andrea Cimitan

1877. By Albert Astals Cid

Fix i18n in scope tool

It had half of it but not completely, this is the counterpart for scope tool from r1247 Fixes: #1317541
Approved by: Andrea Cimitan

1878. By Albert Astals Cid

New phone background provided by design

Removes a 1 px bright line on its right edge Fixes: #1364537
Approved by: Andrea Cimitan

1879. By Michael Zanetti

allow opening the manage dash area by clicking with a mouse on the arrow label

This is meant to be temporary and will be replaced with the upcoming bottom edge
component in the UITK.
Approved by: Albert Astals Cid

1880. By Albert Astals Cid

Add context for "Please re-enter"

Translators need to know we're asking the user to reenter the passphrase Fixes: #1377195
Approved by: Andrea Cimitan

1881. By CI Train Bot Account

Releasing 8.10+15.10.20150721-0ubuntu1

1882. By CI Train Bot Account

Resync trunk.

1883. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

1884. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

1885. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

1886. By Gerry Boland

Bump version

1887. By Gerry Boland

Specify multimonitor orientation per device, change orientation even for desktop state when necessary

1888. By Gerry Boland

Merge mirSurface

1889. By Gerry Boland

Merge MousePointer

1890. By Gerry Boland

unity-api dep too high

1891. By Gerry Boland

Fuk you whitespace test

1892. By Gerry Boland

Merge trunk

1893. By Gerry Boland

update changelog

1894. By Gerry Boland

Merge trunk

1895. By Gerry Boland

Merge lp:~dandrader/unity8/multiSurfaceApp

1896. By Gerry Boland

Fix apps surfaces appearing

Unmerged revisions

1896. By Gerry Boland

Fix apps surfaces appearing

1895. By Gerry Boland

Merge lp:~dandrader/unity8/multiSurfaceApp

1894. By Gerry Boland

Merge trunk

1893. By Gerry Boland

update changelog

1892. By Gerry Boland

Merge trunk

1891. By Gerry Boland

Fuk you whitespace test

1890. By Gerry Boland

unity-api dep too high

1889. By Gerry Boland

Merge MousePointer

1888. By Gerry Boland

Merge mirSurface

1887. By Gerry Boland

Specify multimonitor orientation per device, change orientation even for desktop state when necessary

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-06-23 12:19:15 +0000
3+++ CMakeLists.txt 2015-08-14 11:40:06 +0000
4@@ -56,7 +56,7 @@
5 find_package(Qt5Concurrent 5.2 REQUIRED)
6 find_package(Qt5Sql 5.2 REQUIRED)
7
8-pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=7)
9+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=8)
10
11 # Standard install paths
12 include(GNUInstallDirs)
13
14=== modified file 'debian/changelog'
15--- debian/changelog 2015-08-12 08:41:24 +0000
16+++ debian/changelog 2015-08-14 11:40:06 +0000
17@@ -1,3 +1,9 @@
18+unity8 (8.12) UNRELEASED; urgency=medium
19+
20+ * Silo0 special build
21+
22+ -- Gerry Boland <gerry.boland@canonical.com> Wed, 12 Aug 2015 17:14:03 +0100
23+
24 unity8 (8.11+15.04.20150812-0ubuntu1) vivid; urgency=medium
25
26 [ Albert Astals Cid ]
27
28=== modified file 'debian/control'
29--- debian/control 2015-08-11 14:45:07 +0000
30+++ debian/control 2015-08-14 11:40:06 +0000
31@@ -87,7 +87,8 @@
32 Package: unity8
33 Architecture: any
34 Provides: indicator-renderer,
35-Depends: gsettings-desktop-schemas,
36+Depends: dmz-cursor-theme,
37+ gsettings-desktop-schemas,
38 libcap2-bin,
39 libglib2.0-bin,
40 qmenumodel-qml (>= 0.2.9),
41
42=== modified file 'plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp'
43--- plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp 2015-05-05 11:19:15 +0000
44+++ plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp 2015-08-14 11:40:06 +0000
45@@ -101,8 +101,6 @@
46 if (!iDevice)
47 continue;
48
49- qDebug() << "*** ADDING DEVICE" << eventPath;
50-
51 iDevice->setTypes(getInputTypes(dev));
52
53 if (iDevice->switches().count() > 0 && iDevice->buttons().count() == 0)
54@@ -125,12 +123,6 @@
55
56 QInputDeviceInfo::InputTypes QInputDeviceInfoPrivate::getInputTypes( struct udev_device *dev)
57 {
58- qDebug() << "******* have input type Keyboard" << udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD");
59- qDebug() << "******* have input type Mouse" << udev_device_get_property_value(dev, "ID_INPUT_MOUSE");
60- qDebug() << "******* have input type Touchpad" << udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD");
61- qDebug() << "******* have input type Touchscreen" << udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN");
62- qDebug() << "******* have input type Tablet" << udev_device_get_property_value(dev, "ID_INPUT_TABLET");
63- qDebug() << "******* have input type joystick" << udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK");
64 QInputDeviceInfo::InputTypes types = QInputDeviceInfo::Unknown;
65 if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"), "1") == 0 )
66 types |= QInputDeviceInfo::Keyboard;
67@@ -151,6 +143,7 @@
68 QInputDevice *QInputDeviceInfoPrivate::addDevice(const QString &path)
69 {
70 QInputDevice *inputDevice = new QInputDevice(this);
71+ inputDevice->setDevicePath(path);
72
73 struct libevdev *dev = NULL;
74 int fd;
75@@ -158,17 +151,15 @@
76 fd = open(path.toLatin1(), O_RDONLY|O_NONBLOCK);
77
78 if (fd == -1) {
79- qDebug() << "Failed to open";
80 return inputDevice;
81 }
82 rc = libevdev_new_from_fd(fd, &dev);
83 if (rc < 0) {
84- qDebug() << "Failed to init libevdev ("<< strerror(-rc) << ")";
85+ qWarning() << "Failed to init libevdev ("<< strerror(-rc) << ")";
86 return inputDevice;
87 }
88
89 inputDevice->setName(QString::fromLatin1(libevdev_get_name(dev)));
90- inputDevice->setDevicePath(path);
91 for (int i = 0; i < EV_MAX; i++) {
92 if (i == EV_KEY || i == EV_SW || i == EV_REL
93 || i == EV_REL || i == EV_ABS) {
94
95=== modified file 'qml/Components/InputMethod.qml'
96--- qml/Components/InputMethod.qml 2014-10-01 13:20:32 +0000
97+++ qml/Components/InputMethod.qml 2015-08-14 11:40:06 +0000
98@@ -1,5 +1,5 @@
99 /*
100- * Copyright (C) 2014 Canonical, Ltd.
101+ * Copyright (C) 2014,2015 Canonical, Ltd.
102 *
103 * This program is free software; you can redistribute it and/or modify
104 * it under the terms of the GNU General Public License as published by
105@@ -22,24 +22,44 @@
106 Item {
107 id: root
108
109- property var surface: null
110+ Connections {
111+ target: SurfaceManager
112+ onSurfaceCreated: {
113+ if (surface.type == Mir.InputMethodType) {
114+ surfaceItem.surface = surface;
115+ }
116+ }
117+ }
118
119 property int transitionDuration: UbuntuAnimation.FastDuration
120
121- Binding { target: surface; property: "z"; value: 0 }
122+ MirSurfaceItem {
123+ id: surfaceItem
124+ anchors.fill: parent
125+
126+ consumesInput: true
127+
128+ surfaceWidth: width
129+ surfaceHeight: height
130+
131+ onLiveChanged: {
132+ if (surface !== null && !live) {
133+ surface = null;
134+ }
135+ }
136+ }
137
138 TouchGate {
139 x: UbuntuKeyboardInfo.x
140 y: UbuntuKeyboardInfo.y
141- z: 1
142 width: UbuntuKeyboardInfo.width
143 height: UbuntuKeyboardInfo.height
144
145- targetItem: root.surface
146+ targetItem: surfaceItem
147 }
148
149 state: {
150- if (surface && surface.state != MirSurfaceItem.Minimized) {
151+ if (surfaceItem.surface && surfaceItem.surfaceState != Mir.MinimizedState) {
152 return "shown";
153 } else {
154 return "hidden";
155@@ -74,19 +94,4 @@
156 UbuntuNumberAnimation { property: "y"; duration: transitionDuration }
157 }
158 ]
159-
160- onSurfaceChanged: {
161- if (surface) {
162- surface.parent = root;
163- surface.anchors.fill = root;
164- }
165- }
166-
167- Component.onDestruction: {
168- if (surface) {
169- surface.parent = null;
170- surface.release();
171- surface = null;
172- }
173- }
174 }
175
176=== modified file 'qml/DeviceConfiguration.qml'
177--- qml/DeviceConfiguration.qml 2015-07-01 17:52:34 +0000
178+++ qml/DeviceConfiguration.qml 2015-08-14 11:40:06 +0000
179@@ -28,6 +28,7 @@
180 | Qt.LandscapeOrientation
181 | Qt.InvertedLandscapeOrientation
182
183+ property int multiMonitorOrientation: Qt.InvertedLandscapeOrientation
184 // Supported values so far:
185 // "phone", "tablet" or "desktop"
186 property string category: "phone"
187@@ -86,6 +87,7 @@
188 PropertyChanges {
189 target: root
190 category: "desktop"
191+ multiMonitorOrientation: Qt.PortraitOrientation
192 }
193 }
194 ]
195
196=== modified file 'qml/Greeter/Greeter.qml'
197--- qml/Greeter/Greeter.qml 2015-06-12 16:07:43 +0000
198+++ qml/Greeter/Greeter.qml 2015-08-14 11:40:06 +0000
199@@ -212,7 +212,7 @@
200
201 // event eater
202 // Nothing should leak to items behind the greeter
203- MouseArea { anchors.fill: parent }
204+ MouseArea { anchors.fill: parent; hoverEnabled: true }
205
206 Loader {
207 id: loader
208
209=== modified file 'qml/Launcher/Launcher.qml'
210--- qml/Launcher/Launcher.qml 2015-07-23 07:30:25 +0000
211+++ qml/Launcher/Launcher.qml 2015-08-14 11:40:06 +0000
212@@ -187,6 +187,7 @@
213 bottom: parent.bottom
214 }
215 enabled: root.shadeBackground && root.state == "visible"
216+ visible: enabled // otherwise it will get in the way of cursor selection for some reason
217 onPressed: {
218 root.state = ""
219 }
220
221=== modified file 'qml/OrientedShell.qml'
222--- qml/OrientedShell.qml 2015-08-12 08:40:34 +0000
223+++ qml/OrientedShell.qml 2015-08-14 11:40:06 +0000
224@@ -16,6 +16,7 @@
225
226 import QtQuick 2.0
227 import QtQuick.Window 2.0
228+import Unity.Screens 0.1
229 import Unity.Session 0.1
230 import GSettings 1.0
231 import "Components"
232@@ -39,6 +40,9 @@
233 deviceConfiguration.primaryOrientation == deviceConfiguration.useNativeOrientation
234 ? nativeOrientation : deviceConfiguration.primaryOrientation
235
236+ Screens { id: screens }
237+ readonly property bool multiMonitor: screens.count > 1
238+
239 DeviceConfiguration {
240 id: deviceConfiguration
241 name: applicationArguments.deviceName
242@@ -91,6 +95,10 @@
243 readonly property int supportedOrientations: shell.supportedOrientations
244 & deviceConfiguration.supportedOrientations
245 property int acceptedOrientationAngle: {
246+ if (multiMonitor) {
247+ return Screen.angleBetween(nativeOrientation, deviceConfiguration.multiMonitorOrientation);
248+ }
249+
250 if (orientation & supportedOrientations) {
251 return Screen.angleBetween(nativeOrientation, orientation);
252 } else if (shell.orientation & supportedOrientations) {
253@@ -159,11 +167,12 @@
254 nativeWidth: root.width
255 nativeHeight: root.height
256 mode: applicationArguments.mode
257+ cursorVisible: UnityInputInfo.mice > deviceConfiguration.ignoredMice
258
259 // TODO: Factor in the connected input devices (eg: physical keyboard, mouse, touchscreen),
260 // what's the output device (eg: big TV, desktop monitor, phone display), etc.
261 usageScenario: {
262- if (root.unity8Settings.usageMode === "Windowed") {
263+ if (root.unity8Settings.usageMode === "Windowed" || multiMonitor) {
264 return "desktop";
265 } else if (root.unity8Settings.usageMode === "Staged") {
266 if (deviceConfiguration.category === "phone") {
267
268=== modified file 'qml/Panel/Panel.qml'
269--- qml/Panel/Panel.qml 2015-06-29 03:58:22 +0000
270+++ qml/Panel/Panel.qml 2015-08-14 11:40:06 +0000
271@@ -48,6 +48,7 @@
272 MouseArea {
273 anchors.fill: parent
274 onClicked: if (indicators.fullyOpened) indicators.hide();
275+ hoverEnabled: true // should also eat hover events, otherwise they will pass through
276 }
277 }
278
279
280=== modified file 'qml/Rotation/RotationStates.qml'
281--- qml/Rotation/RotationStates.qml 2015-05-11 14:36:03 +0000
282+++ qml/Rotation/RotationStates.qml 2015-08-14 11:40:06 +0000
283@@ -83,9 +83,11 @@
284 }
285
286 function tryUpdateState() {
287- if (d.transitioning || (!d.startingUp && !root.shell.orientationChangesEnabled)) {
288+ if (d.transitioning || (!d.startingUp && !root.shell.orientationChangesEnabled
289+ && d.cachedMultiMonitorState === root.orientedShell.multiMonitor)) {
290 return;
291 }
292+ d.cachedMultiMonitorState = root.orientedShell.multiMonitor
293
294 var requestedState = d.requestedOrientationAngle.toString();
295 if (requestedState !== root.state) {
296@@ -110,6 +112,7 @@
297 readonly property int fullAnimation: 0
298 readonly property int indicatorsBarAnimation: 1
299 readonly property int noAnimation: 2
300+ property bool cachedMultiMonitorState: false
301
302 property int animationType
303
304
305=== modified file 'qml/Shell.qml'
306--- qml/Shell.qml 2015-08-03 13:47:44 +0000
307+++ qml/Shell.qml 2015-08-14 11:40:06 +0000
308@@ -56,6 +56,7 @@
309 property bool beingResized
310 property string usageScenario: "phone" // supported values: "phone", "tablet" or "desktop"
311 property string mode: "full-greeter"
312+ property bool cursorVisible: false
313 function updateFocusedAppOrientation() {
314 applicationsDisplayLoader.item.updateFocusedAppOrientation();
315 }
316@@ -188,7 +189,6 @@
317
318 ScreenGrabber {
319 id: screenGrabber
320- z: dialogs.z + 10
321 }
322
323 WindowKeysFilter {
324@@ -397,25 +397,6 @@
325 }
326
327 Connections {
328- target: SurfaceManager
329- onSurfaceCreated: {
330- if (surface.type == MirSurfaceItem.InputMethod) {
331- inputMethod.surface = surface;
332- }
333- }
334-
335- onSurfaceDestroyed: {
336- if (inputMethod.surface == surface) {
337- inputMethod.surface = null;
338- surface.parent = null;
339- }
340- if (!surface.parent) {
341- // there's no one displaying it. delete it right away
342- surface.release();
343- }
344- }
345- }
346- Connections {
347 target: SessionManager
348 onSessionStopping: {
349 if (!session.parentSession && !session.application) {
350@@ -691,9 +672,15 @@
351 onShowHome: showHome()
352 }
353
354+ Cursor {
355+ id: cursor
356+ visible: shell.cursorVisible
357+ z: dialogs.z + 1
358+ }
359+
360 Rectangle {
361 id: shutdownFadeOutRectangle
362- z: screenGrabber.z + 10
363+ z: cursor.z + 1
364 enabled: false
365 visible: false
366 color: "black"
367
368=== modified file 'qml/Stages/ApplicationWindow.qml'
369--- qml/Stages/ApplicationWindow.qml 2015-07-14 08:09:58 +0000
370+++ qml/Stages/ApplicationWindow.qml 2015-08-14 11:40:06 +0000
371@@ -50,7 +50,8 @@
372 property bool hadSurface: sessionContainer.surfaceContainer.hadSurface
373
374 property bool needToTakeScreenshot:
375- sessionContainer.surface && d.surfaceInitialized && screenshotImage.status === Image.Null
376+ ((sessionContainer.surface && d.surfaceInitialized) || d.hadSurface)
377+ && screenshotImage.status === Image.Null
378 && d.applicationState === ApplicationInfoInterface.Stopped
379 onNeedToTakeScreenshotChanged: {
380 if (needToTakeScreenshot) {
381
382=== modified file 'qml/Stages/DecoratedWindow.qml'
383--- qml/Stages/DecoratedWindow.qml 2015-06-11 09:50:55 +0000
384+++ qml/Stages/DecoratedWindow.qml 2015-08-14 11:40:06 +0000
385@@ -34,9 +34,10 @@
386 property int windowWidth: width
387 property int windowHeight: height
388
389- signal close();
390- signal maximize();
391- signal minimize();
392+ signal close()
393+ signal maximize()
394+ signal minimize()
395+ signal decorationPressed()
396
397 state: "normal"
398 states: [
399@@ -88,6 +89,7 @@
400
401 WindowDecoration {
402 id: decoration
403+ target: root.parent
404 objectName: application ? "appWindowDecoration_" + application.appId : "appWindowDecoration_null"
405 anchors { left: parent.left; top: parent.top; right: parent.right }
406 height: units.gu(3)
407@@ -95,6 +97,7 @@
408 onClose: root.close();
409 onMaximize: root.maximize();
410 onMinimize: root.minimize();
411+ onPressed: root.decorationPressed();
412 visible: decorationShown
413 }
414
415
416=== modified file 'qml/Stages/DesktopStage.qml'
417--- qml/Stages/DesktopStage.qml 2015-08-03 13:47:44 +0000
418+++ qml/Stages/DesktopStage.qml 2015-08-14 11:40:06 +0000
419@@ -208,12 +208,6 @@
420 onFocusChanged: {
421 if (focus && ApplicationManager.focusedApplicationId !== model.appId) {
422 ApplicationManager.requestFocusApplication(model.appId);
423- decoratedWindow.forceActiveFocus();
424- }
425- }
426- Component.onCompleted: {
427- if (ApplicationManager.focusedApplicationId == model.appId) {
428- decoratedWindow.forceActiveFocus();
429 }
430 }
431
432@@ -292,7 +286,7 @@
433 enabled: true
434 }
435 PropertyChanges {
436- target: windowMoveResizeArea
437+ target: windowResizeArea
438 enabled: false
439 }
440 }
441@@ -318,12 +312,12 @@
442 itemHeight: appDelegate.height
443 }
444
445- WindowMoveResizeArea {
446- id: windowMoveResizeArea
447+ WindowResizeArea {
448+ id: windowResizeArea
449 target: appDelegate
450 minWidth: appDelegate.minWidth
451 minHeight: appDelegate.minHeight
452- resizeHandleWidth: units.gu(2)
453+ borderThickness: units.gu(2)
454 windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
455
456 onPressed: appDelegate.focus = true;
457@@ -338,11 +332,12 @@
458 windowHeight: appDelegate.height
459 application: ApplicationManager.get(index)
460 active: ApplicationManager.focusedApplicationId === model.appId
461- focus: false
462+ focus: true
463
464 onClose: ApplicationManager.stopApplication(model.appId)
465 onMaximize: appDelegate.maximize()
466 onMinimize: appDelegate.minimize()
467+ onDecorationPressed: appDelegate.focus = true;
468
469 transform: [
470 Scale {
471
472=== added file 'qml/Stages/ResizeArea.qml'
473--- qml/Stages/ResizeArea.qml 1970-01-01 00:00:00 +0000
474+++ qml/Stages/ResizeArea.qml 2015-08-14 11:40:06 +0000
475@@ -0,0 +1,142 @@
476+/*
477+ * Copyright (C) 2015 Canonical, Ltd.
478+ *
479+ * This program is free software; you can redistribute it and/or modify
480+ * it under the terms of the GNU General Public License as published by
481+ * the Free Software Foundation; version 3.
482+ *
483+ * This program is distributed in the hope that it will be useful,
484+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
485+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
486+ * GNU General Public License for more details.
487+ *
488+ * You should have received a copy of the GNU General Public License
489+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
490+ */
491+
492+import QtQuick 2.4
493+import Unity.Application 0.1
494+
495+MouseArea {
496+ id: root
497+
498+ // to be set from outside
499+ property Item target
500+ property bool leftBorder: false
501+ property bool rightBorder: false
502+ property bool topBorder: false
503+ property bool bottomBorder: false
504+
505+ property bool dragging: false
506+ property real startX
507+ property real startY
508+ property real startWidth
509+ property real startHeight
510+
511+ hoverEnabled: true
512+
513+ property string cursorName: {
514+ if (leftBorder && !topBorder && !bottomBorder) {
515+ return "left_side";
516+ } else if (rightBorder && !topBorder && !bottomBorder) {
517+ return "right_side";
518+ } else if (topBorder && !leftBorder && !rightBorder) {
519+ return "top_side";
520+ } else if (bottomBorder && !leftBorder && !rightBorder) {
521+ return "bottom_side";
522+ } else if (leftBorder && topBorder) {
523+ return "top_left_corner";
524+ } else if (leftBorder && bottomBorder) {
525+ return "bottom_left_corner";
526+ } else if (rightBorder && topBorder) {
527+ return "top_right_corner";
528+ } else if (rightBorder && bottomBorder) {
529+ return "bottom_right_corner";
530+ }
531+ }
532+
533+ function updateCursorName() {
534+ if (containsMouse || pressed) {
535+ Mir.cursorName = root.cursorName;
536+ } else {
537+ Mir.cursorName = "";
538+ }
539+ }
540+
541+ onContainsMouseChanged: {
542+ updateCursorName();
543+ }
544+
545+ onPressedChanged: {
546+ updateCursorName();
547+ if (pressed) {
548+ var pos = mapToItem(target.parent, mouseX, mouseY);
549+ startX = pos.x;
550+ startY = pos.y;
551+ startWidth = target.width;
552+ startHeight = target.height;
553+ dragging = true;
554+ } else {
555+ dragging = false;
556+ }
557+ }
558+
559+ onMouseXChanged: {
560+ if (!pressed || !dragging) {
561+ return;
562+ }
563+
564+ var pos = mapToItem(target.parent, mouseX, mouseY);
565+
566+ if (leftBorder) {
567+ if (startX + startWidth > pos.x + target.minWidth) {
568+ target.x = pos.x;
569+ target.width = startX + startWidth - target.x;
570+ startX = target.x;
571+ startWidth = target.width;
572+ } else if (startX + startWidth < pos.x + target.minWidth) {
573+ // don't let it get thinner than minWidth
574+ target.x = startX + startWidth - target.minWidth;
575+ target.width = target.minWidth;
576+ }
577+
578+ } else if (rightBorder) {
579+ var deltaX = pos.x - startX;
580+ if (startWidth + deltaX >= target.minWidth) {
581+ target.width = startWidth + deltaX;
582+ } else {
583+ target.width = target.minWidth;
584+ }
585+ }
586+ }
587+
588+ onMouseYChanged: {
589+ if (!pressed || !dragging) {
590+ return;
591+ }
592+
593+ var pos = mapToItem(target.parent, mouseX, mouseY);
594+
595+ if (topBorder) {
596+
597+ if (startY + startHeight > pos.y + target.minHeight) {
598+ target.y = pos.y;
599+ target.height = startY + startHeight - target.y;
600+ startY = target.y;
601+ startHeight = target.height;
602+ } else if (startY + startHeight < pos.y + target.minHeight) {
603+ // don't let it get shorter than minHeight
604+ target.y = startY + startHeight - target.minHeight;
605+ target.height = target.minHeight;
606+ }
607+
608+ } else if (bottomBorder) {
609+ var deltaY = pos.y - startY;
610+ if (startHeight + deltaY >= target.minHeight) {
611+ target.height = startHeight + deltaY;
612+ } else {
613+ target.height = target.minHeight;
614+ }
615+ }
616+ }
617+}
618
619=== modified file 'qml/Stages/SurfaceContainer.qml'
620--- qml/Stages/SurfaceContainer.qml 2015-04-15 11:37:00 +0000
621+++ qml/Stages/SurfaceContainer.qml 2015-08-14 11:40:06 +0000
622@@ -18,34 +18,26 @@
623 import Ubuntu.Components 1.1
624 import Ubuntu.Gestures 0.1 // For TouchGate
625 import Utils 0.1 // for InputWatcher
626+import Unity.Application 0.1 // for MirSurfaceItem
627
628 FocusScope {
629 id: root
630 objectName: "surfaceContainer"
631- property Item surface: null
632+
633+ property var surface: null
634 property bool hadSurface: false
635 property bool interactive
636 property int surfaceOrientationAngle: 0
637
638 onSurfaceChanged: {
639 if (surface) {
640- // Set the surface focus *after* it is added to the scene to
641- // ensure an update to the scene's active focus.
642- surface.focus = false;
643- surface.parent = root;
644- surface.focus = true;
645- } else {
646- hadSurface = true;
647+ surfaceItem.surface = surface;
648+ root.hadSurface = false;
649 }
650 }
651- Binding { target: surface; property: "anchors.fill"; value: root }
652- Binding { target: surface; property: "z"; value: 1 }
653- Binding { target: surface; property: "enabled"; value: root.interactive; when: surface }
654- Binding { target: surface; property: "antialiasing"; value: !root.interactive; when: surface }
655- Binding { target: surface; property: "orientationAngle"; value: root.surfaceOrientationAngle; when: surface }
656
657 InputWatcher {
658- target: root.surface
659+ target: surfaceItem
660 onTargetPressedChanged: {
661 if (targetPressed && root.interactive) {
662 root.focus = true;
663@@ -54,28 +46,53 @@
664 }
665 }
666
667+ MirSurfaceItem {
668+ id: surfaceItem
669+ objectName: "surfaceItem"
670+
671+ consumesInput: true
672+
673+ surfaceWidth: width
674+ surfaceHeight: height
675+
676+ anchors.fill: root
677+ enabled: root.interactive
678+ focus: true
679+ antialiasing: !root.interactive
680+ orientationAngle: root.surfaceOrientationAngle
681+ }
682+
683 TouchGate {
684- targetItem: surface
685+ targetItem: surfaceItem
686 anchors.fill: root
687- enabled: root.surface ? root.surface.enabled : false
688- z: 2
689+ enabled: surfaceItem.enabled
690 }
691
692 states: [
693 State {
694 name: "zombie"
695- when: surface && !surface.live
696+ when: surfaceItem.surface && !surfaceItem.live
697 }
698 ]
699 transitions: [
700 Transition {
701 from: ""; to: "zombie"
702 SequentialAnimation {
703- UbuntuNumberAnimation { target: surface; property: "opacity"; to: 0.0
704+ UbuntuNumberAnimation { target: surfaceItem; property: "opacity"; to: 0.0
705 duration: UbuntuAnimation.BriskDuration }
706- PropertyAction { target: surface; property: "visible"; value: false }
707- ScriptAction { script: { if (root.surface) { root.surface.release(); } } }
708+ PropertyAction { target: surfaceItem; property: "visible"; value: false }
709+ ScriptAction { script: {
710+ surfaceItem.surface = null;
711+ root.hadSurface = true;
712+ } }
713 }
714+ },
715+ Transition {
716+ from: "zombie"; to: ""
717+ ScriptAction { script: {
718+ surfaceItem.opacity = 1.0;
719+ surfaceItem.visible = true;
720+ } }
721 }
722 ]
723 }
724
725=== modified file 'qml/Stages/WindowDecoration.qml'
726--- qml/Stages/WindowDecoration.qml 2015-03-13 19:18:35 +0000
727+++ qml/Stages/WindowDecoration.qml 2015-08-14 11:40:06 +0000
728@@ -1,5 +1,5 @@
729 /*
730- * Copyright (C) 2014 Canonical, Ltd.
731+ * Copyright (C) 2014-2015 Canonical, Ltd.
732 *
733 * This program is free software; you can redistribute it and/or modify
734 * it under the terms of the GNU General Public License as published by
735@@ -12,18 +12,18 @@
736 *
737 * You should have received a copy of the GNU General Public License
738 * along with this program. If not, see <http://www.gnu.org/licenses/>.
739- *
740- * Authors: Michael Zanetti <michael.zanetti@canonical.com>
741 */
742
743 import QtQuick 2.3
744+import Unity.Application 0.1 // For Mir singleton
745 import Ubuntu.Components 1.1
746 import "../Components"
747
748-Item {
749+MouseArea {
750 id: root
751 clip: true
752
753+ property Item target
754 property alias title: titleLabel.text
755 property bool active: false
756
757@@ -31,6 +31,33 @@
758 signal minimize()
759 signal maximize()
760
761+ QtObject {
762+ id: priv
763+ property real distanceX
764+ property real distanceY
765+ property bool dragging
766+ }
767+
768+ onPressedChanged: {
769+ if (pressed) {
770+ var pos = mapToItem(root.target, mouseX, mouseY);
771+ priv.distanceX = pos.x;
772+ priv.distanceY = pos.y;
773+ priv.dragging = true;
774+ Mir.cursorName = "grabbing";
775+ } else {
776+ priv.dragging = false;
777+ Mir.cursorName = "";
778+ }
779+ }
780+ onMouseXChanged: {
781+ if (priv.dragging) {
782+ var pos = mapToItem(root.target.parent, mouseX, mouseY);
783+ root.target.x = pos.x - priv.distanceX;
784+ root.target.y = pos.y - priv.distanceY;
785+ }
786+ }
787+
788 Rectangle {
789 anchors.fill: parent
790 anchors.bottomMargin: -radius
791
792=== renamed file 'qml/Stages/WindowMoveResizeArea.qml' => 'qml/Stages/WindowResizeArea.qml'
793--- qml/Stages/WindowMoveResizeArea.qml 2015-03-13 19:01:32 +0000
794+++ qml/Stages/WindowResizeArea.qml 2015-08-14 11:40:06 +0000
795@@ -12,18 +12,18 @@
796 *
797 * You should have received a copy of the GNU General Public License
798 * along with this program. If not, see <http://www.gnu.org/licenses/>.
799- *
800- * Authors: Michael Zanetti <michael.zanetti@canonical.com>
801 */
802
803 import QtQuick 2.3
804 import Ubuntu.Components 1.1
805 import Utils 0.1
806
807-MouseArea {
808+Item {
809 id: root
810 anchors.fill: target
811- anchors.margins: -resizeHandleWidth
812+ anchors.margins: -borderThickness
813+
814+ signal pressed()
815
816 property var windowStateStorage: WindowStateStorage
817
818@@ -31,24 +31,10 @@
819 // The area will anchor to it and manage move and resize events
820 property Item target: null
821 property string windowId: ""
822- property int resizeHandleWidth: 0
823+ property int borderThickness: 0
824 property int minWidth: 0
825 property int minHeight: 0
826
827- QtObject {
828- id: priv
829- readonly property int windowWidth: root.width - root.resizeHandleWidth * 2
830- readonly property int windowHeight: root.height - resizeHandleWidth * 2
831-
832- property var startPoint
833-
834- property bool resizeTop: false
835- property bool resizeBottom: false
836- property bool resizeLeft: false
837- property bool resizeRight: false
838-
839- }
840-
841 Component.onCompleted: {
842 var windowState = windowStateStorage.getGeometry(root.windowId, Qt.rect(target.x, target.y, target.width, target.height))
843 if (windowState !== undefined) {
844@@ -59,51 +45,98 @@
845 }
846 }
847
848- onPressed: {
849- priv.startPoint = Qt.point(mouse.x, mouse.y);
850- priv.resizeTop = mouseY < root.resizeHandleWidth;
851- priv.resizeBottom = mouseY > (root.height - root.resizeHandleWidth);
852- priv.resizeLeft = mouseX < root.resizeHandleWidth;
853- priv.resizeRight = mouseX > (root.width - root.resizeHandleWidth);
854- }
855-
856- onPositionChanged: {
857- var currentPoint = Qt.point(mouse.x, mouse.y);
858- var mouseDiff = Qt.point(currentPoint.x - priv.startPoint.x, currentPoint.y - priv.startPoint.y);
859- var moveDiff = Qt.point(0, 0);
860- var sizeDiff = Qt.point(0, 0);
861- var maxSizeDiff = Qt.point(root.minWidth - root.target.width, root.minHeight - root.target.height)
862-
863- if (priv.resizeTop || priv.resizeBottom || priv.resizeLeft || priv.resizeRight) {
864- if (priv.resizeTop) {
865- sizeDiff.y = Math.max(maxSizeDiff.y, -currentPoint.y + priv.startPoint.y)
866- moveDiff.y = -sizeDiff.y
867- }
868- if (priv.resizeBottom) {
869- sizeDiff.y = Math.max(maxSizeDiff.y, currentPoint.y - priv.startPoint.y)
870- priv.startPoint.y += sizeDiff.y
871- }
872- if (priv.resizeLeft) {
873- sizeDiff.x = Math.max(maxSizeDiff.x, -currentPoint.x + priv.startPoint.x)
874- moveDiff.x = -sizeDiff.x
875- }
876- if (priv.resizeRight) {
877- sizeDiff.x = Math.max(maxSizeDiff.x, currentPoint.x - priv.startPoint.x)
878- priv.startPoint.x += sizeDiff.x
879- }
880-
881- target.x += moveDiff.x;
882- target.y += moveDiff.y;
883- target.width += sizeDiff.x;
884- target.height += sizeDiff.y;
885- } else {
886- target.x += mouseDiff.x;
887- target.y += mouseDiff.y;
888- }
889-
890- }
891-
892 Component.onDestruction: {
893 windowStateStorage.saveGeometry(root.windowId, Qt.rect(target.x, target.y, target.width, target.height))
894 }
895+
896+ ResizeArea {
897+ anchors.top: root.top
898+ anchors.bottom: root.bottom
899+ anchors.margins: root.borderThickness
900+ width: root.borderThickness
901+
902+ leftBorder: true
903+ target: root.target
904+ onPressed: { root.pressed(); }
905+ }
906+ ResizeArea {
907+ anchors.right: root.right
908+ anchors.top: root.top
909+ anchors.topMargin: root.borderThickness
910+ anchors.bottom: root.bottom
911+ anchors.bottomMargin: root.borderThickness
912+ width: root.borderThickness
913+
914+ rightBorder: true
915+ target: root.target
916+ onPressed: { root.pressed(); }
917+ }
918+ ResizeArea {
919+ anchors.left: root.left
920+ anchors.leftMargin: root.borderThickness
921+ anchors.right: root.right
922+ anchors.rightMargin: root.borderThickness
923+ anchors.top: root.top
924+ height: root.borderThickness
925+
926+ topBorder: true
927+ target: root.target
928+ onPressed: { root.pressed(); }
929+ }
930+ ResizeArea {
931+ anchors.left: root.left
932+ anchors.leftMargin: root.borderThickness
933+ anchors.right: root.right
934+ anchors.rightMargin: root.borderThickness
935+ anchors.bottom: root.bottom
936+ height: root.borderThickness
937+
938+ bottomBorder: true
939+ target: root.target
940+ onPressed: { root.pressed(); }
941+ }
942+ ResizeArea {
943+ anchors.left: root.left
944+ anchors.top: root.top
945+ width: root.borderThickness
946+ height: root.borderThickness
947+
948+ topBorder: true
949+ leftBorder: true
950+ target: root.target
951+ onPressed: { root.pressed(); }
952+ }
953+ ResizeArea {
954+ anchors.left: root.left
955+ anchors.bottom: root.bottom
956+ width: root.borderThickness
957+ height: root.borderThickness
958+
959+ bottomBorder: true
960+ leftBorder: true
961+ target: root.target
962+ onPressed: { root.pressed(); }
963+ }
964+ ResizeArea {
965+ anchors.right: root.right
966+ anchors.top: root.top
967+ width: root.borderThickness
968+ height: root.borderThickness
969+
970+ topBorder: true
971+ rightBorder: true
972+ target: root.target
973+ onPressed: { root.pressed(); }
974+ }
975+ ResizeArea {
976+ anchors.right: root.right
977+ anchors.bottom: root.bottom
978+ width: root.borderThickness
979+ height: root.borderThickness
980+
981+ bottomBorder: true
982+ rightBorder: true
983+ target: root.target
984+ onPressed: { root.pressed(); }
985+ }
986 }
987
988=== modified file 'tests/mocks/Unity/Application/ApplicationInfo.cpp'
989--- tests/mocks/Unity/Application/ApplicationInfo.cpp 2015-06-19 18:19:33 +0000
990+++ tests/mocks/Unity/Application/ApplicationInfo.cpp 2015-08-14 11:40:06 +0000
991@@ -15,6 +15,7 @@
992 */
993
994 #include "ApplicationInfo.h"
995+#include "MirSurface.h"
996 #include "Session.h"
997 #include "SessionManager.h"
998
999@@ -74,6 +75,13 @@
1000 setSession(SessionManager::singleton()->createSession(appId(), screenshotUrl));
1001 }
1002
1003+void ApplicationInfo::destroySession()
1004+{
1005+ Session *session = this->session();
1006+ setSession(nullptr);
1007+ delete session;
1008+}
1009+
1010 void ApplicationInfo::setSession(Session* session)
1011 {
1012 if (m_session == session)
1013@@ -92,8 +100,8 @@
1014 m_session->setApplication(this);
1015 m_session->setParent(this);
1016 SessionManager::singleton()->registerSession(m_session);
1017- connect(m_session, &Session::surfaceChanged,
1018- this, &ApplicationInfo::onSessionSurfaceChanged);
1019+ connect(m_session, &Session::surfaceAdded,
1020+ this, &ApplicationInfo::onSessionSurfaceAdded);
1021
1022 if (!m_manualSurfaceCreation) {
1023 QTimer::singleShot(500, m_session, SLOT(createSurface()));
1024@@ -237,7 +245,7 @@
1025 }
1026 }
1027
1028-void ApplicationInfo::onSessionSurfaceChanged(MirSurfaceItem* surface)
1029+void ApplicationInfo::onSessionSurfaceAdded(MirSurface* surface)
1030 {
1031 if (surface != nullptr && m_state == Starting) {
1032 if (m_requestedState == RequestedRunning) {
1033
1034=== modified file 'tests/mocks/Unity/Application/ApplicationInfo.h'
1035--- tests/mocks/Unity/Application/ApplicationInfo.h 2015-06-19 18:19:33 +0000
1036+++ tests/mocks/Unity/Application/ApplicationInfo.h 2015-08-14 11:40:06 +0000
1037@@ -17,13 +17,10 @@
1038 #ifndef APPLICATION_H
1039 #define APPLICATION_H
1040
1041-#include "SurfaceManager.h"
1042-#include "MirSurfaceItemModel.h"
1043-
1044 #include <QObject>
1045
1046-class QQuickItem;
1047-class MirSurfaceItem;
1048+class MirSurface;
1049+class Session;
1050
1051 // unity-api
1052 #include <unity/shell/application/ApplicationInfoInterface.h>
1053@@ -103,9 +100,10 @@
1054
1055 public Q_SLOTS:
1056 Q_INVOKABLE void createSession();
1057+ Q_INVOKABLE void destroySession();
1058
1059 private Q_SLOTS:
1060- void onSessionSurfaceChanged(MirSurfaceItem*);
1061+ void onSessionSurfaceAdded(MirSurface*);
1062
1063 private:
1064 void setIcon(const QUrl &value);
1065
1066=== modified file 'tests/mocks/Unity/Application/ApplicationTestInterface.cpp'
1067--- tests/mocks/Unity/Application/ApplicationTestInterface.cpp 2014-08-29 14:50:49 +0000
1068+++ tests/mocks/Unity/Application/ApplicationTestInterface.cpp 2015-08-14 11:40:06 +0000
1069@@ -1,5 +1,5 @@
1070 /*
1071- * Copyright (C) 2014 Canonical, Ltd.
1072+ * Copyright (C) 2014,2015 Canonical, Ltd.
1073 *
1074 * This program is free software; you can redistribute it and/or modify
1075 * it under the terms of the GNU General Public License as published by
1076@@ -20,7 +20,7 @@
1077 #include "SessionManager.h"
1078 #include "SurfaceManager.h"
1079 #include "Session.h"
1080-#include "MirSurfaceItem.h"
1081+#include "MirSurface.h"
1082
1083 #include <paths.h>
1084
1085@@ -62,7 +62,7 @@
1086 existingSession->setLive(false);
1087 }
1088
1089-void ApplicationTestInterface::removeSurface(MirSurfaceItem* existingSurface)
1090+void ApplicationTestInterface::removeSurface(MirSurface* existingSurface)
1091 {
1092 qDebug() << "ApplicationTestInterface::removeSurface - " << existingSurface;
1093
1094
1095=== modified file 'tests/mocks/Unity/Application/ApplicationTestInterface.h'
1096--- tests/mocks/Unity/Application/ApplicationTestInterface.h 2014-08-29 14:50:49 +0000
1097+++ tests/mocks/Unity/Application/ApplicationTestInterface.h 2015-08-14 11:40:06 +0000
1098@@ -1,5 +1,5 @@
1099 /*
1100- * Copyright (C) 2014 Canonical, Ltd.
1101+ * Copyright (C) 2014,2015 Canonical, Ltd.
1102 *
1103 * This program is free software; you can redistribute it and/or modify
1104 * it under the terms of the GNU General Public License as published by
1105@@ -21,7 +21,7 @@
1106
1107 class ApplicationManager;
1108 class Session;
1109-class MirSurfaceItem;
1110+class MirSurface;
1111
1112 class ApplicationTestInterface : public QDBusAbstractAdaptor
1113 {
1114@@ -32,7 +32,7 @@
1115
1116 Q_INVOKABLE Session* addChildSession(Session* existingSession, const QString& surfaceImage);
1117 Q_INVOKABLE void removeSession(Session* existingSession);
1118- Q_INVOKABLE void removeSurface(MirSurfaceItem* existingSurface);
1119+ Q_INVOKABLE void removeSurface(MirSurface* existingSurface);
1120
1121 public Q_SLOTS:
1122 quint32 addChildSession(const QString& appId, quint32 existingSessionId, const QString& surfaceImage);
1123
1124=== modified file 'tests/mocks/Unity/Application/CMakeLists.txt'
1125--- tests/mocks/Unity/Application/CMakeLists.txt 2015-06-12 16:07:43 +0000
1126+++ tests/mocks/Unity/Application/CMakeLists.txt 2015-08-14 11:40:06 +0000
1127@@ -4,8 +4,8 @@
1128 ApplicationManager.cpp
1129 ApplicationScreenshotProvider.cpp
1130 ApplicationTestInterface.cpp
1131+ MirSurface.cpp
1132 MirSurfaceItem.cpp
1133- MirSurfaceItemModel.h
1134 ObjectListModel.h
1135 Session.cpp
1136 SessionManager.cpp
1137@@ -15,6 +15,9 @@
1138 VirtualKeyboard.cpp
1139 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationInfoInterface.h
1140 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationManagerInterface.h
1141+ ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/Mir.h
1142+ ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirSurfaceInterface.h
1143+ ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirSurfaceItemInterface.h
1144 )
1145
1146 add_library(FakeUnityApplicationQml MODULE ${FakeUnityApplicationQml_SOURCES})
1147
1148=== added file 'tests/mocks/Unity/Application/Cursor.qml'
1149--- tests/mocks/Unity/Application/Cursor.qml 1970-01-01 00:00:00 +0000
1150+++ tests/mocks/Unity/Application/Cursor.qml 2015-08-14 11:40:06 +0000
1151@@ -0,0 +1,20 @@
1152+/*
1153+ * Copyright (C) 2015 Canonical, Ltd.
1154+ *
1155+ * This program is free software; you can redistribute it and/or modify
1156+ * it under the terms of the GNU General Public License as published by
1157+ * the Free Software Foundation; version 3.
1158+ *
1159+ * This program is distributed in the hope that it will be useful,
1160+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1161+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1162+ * GNU General Public License for more details.
1163+ *
1164+ * You should have received a copy of the GNU General Public License
1165+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1166+ */
1167+
1168+import QtQuick 2.4
1169+
1170+Item {
1171+}
1172
1173=== added file 'tests/mocks/Unity/Application/MirSurface.cpp'
1174--- tests/mocks/Unity/Application/MirSurface.cpp 1970-01-01 00:00:00 +0000
1175+++ tests/mocks/Unity/Application/MirSurface.cpp 2015-08-14 11:40:06 +0000
1176@@ -0,0 +1,182 @@
1177+/*
1178+ * Copyright (C) 2015 Canonical, Ltd.
1179+ *
1180+ * This program is free software; you can redistribute it and/or modify
1181+ * it under the terms of the GNU General Public License as published by
1182+ * the Free Software Foundation; version 3.
1183+ *
1184+ * This program is distributed in the hope that it will be useful,
1185+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1186+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1187+ * GNU General Public License for more details.
1188+ *
1189+ * You should have received a copy of the GNU General Public License
1190+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1191+ */
1192+
1193+#include "MirSurface.h"
1194+
1195+#include <QDebug>
1196+
1197+MirSurface::MirSurface(const QString& name,
1198+ Mir::Type type,
1199+ Mir::State state,
1200+ const QUrl& screenshot,
1201+ const QString &qmlFilePath)
1202+ : unity::shell::application::MirSurfaceInterface(nullptr)
1203+ , m_name(name)
1204+ , m_type(type)
1205+ , m_state(state)
1206+ , m_orientationAngle(Mir::Angle0)
1207+ , m_screenshotUrl(screenshot)
1208+ , m_qmlFilePath(qmlFilePath)
1209+ , m_live(true)
1210+ , m_viewCount(0)
1211+ , m_activeFocus(false)
1212+ , m_width(-1)
1213+ , m_height(-1)
1214+{
1215+ qDebug() << "MirSurface::MirSurface() " << name;
1216+}
1217+
1218+MirSurface::~MirSurface()
1219+{
1220+ qDebug() << "MirSurface::~MirSurface() " << name();
1221+}
1222+
1223+QString MirSurface::name() const
1224+{
1225+ return m_name;
1226+}
1227+
1228+Mir::Type MirSurface::type() const
1229+{
1230+ return m_type;
1231+}
1232+
1233+Mir::State MirSurface::state() const
1234+{
1235+ return m_state;
1236+}
1237+
1238+void MirSurface::setState(Mir::State state)
1239+{
1240+ if (state == m_state)
1241+ return;
1242+
1243+ m_state = state;
1244+ Q_EMIT stateChanged(state);
1245+}
1246+
1247+bool MirSurface::live() const
1248+{
1249+ return m_live;
1250+}
1251+
1252+void MirSurface::setLive(bool live)
1253+{
1254+ qDebug().nospace() << "MirSurface::setLive("<<live<<") " << name();
1255+ if (live == m_live)
1256+ return;
1257+
1258+ m_live = live;
1259+ Q_EMIT liveChanged(live);
1260+
1261+ if (!m_live && m_viewCount == 0) {
1262+ deleteLater();
1263+ }
1264+}
1265+
1266+QString MirSurface::qmlFilePath() const
1267+{
1268+ return m_qmlFilePath;
1269+}
1270+
1271+QUrl MirSurface::screenshotUrl() const
1272+{
1273+ return m_screenshotUrl;
1274+}
1275+
1276+void MirSurface::setScreenshotUrl(QUrl screenshotUrl)
1277+{
1278+ if (screenshotUrl == m_screenshotUrl)
1279+ return;
1280+
1281+ m_screenshotUrl = screenshotUrl;
1282+ Q_EMIT screenshotUrlChanged(screenshotUrl);
1283+}
1284+
1285+Mir::OrientationAngle MirSurface::orientationAngle() const
1286+{
1287+ return m_orientationAngle;
1288+}
1289+
1290+void MirSurface::setOrientationAngle(Mir::OrientationAngle angle)
1291+{
1292+ if (angle == m_orientationAngle)
1293+ return;
1294+
1295+ m_orientationAngle = angle;
1296+ Q_EMIT orientationAngleChanged(angle);
1297+}
1298+
1299+void MirSurface::incrementViewCount()
1300+{
1301+ ++m_viewCount;
1302+ qDebug().nospace() << "MirSurface::incrementViewCount() viewCount(after)=" << m_viewCount << " " << name();
1303+}
1304+
1305+void MirSurface::decrementViewCount()
1306+{
1307+ --m_viewCount;
1308+ qDebug().nospace() << "MirSurface::decrementViewCount() viewCount(after)=" << m_viewCount << " " << name();
1309+
1310+ Q_ASSERT(m_viewCount >= 0);
1311+
1312+ if (!m_live && m_viewCount == 0) {
1313+ deleteLater();
1314+ }
1315+}
1316+
1317+int MirSurface::viewCount() const
1318+{
1319+ return m_viewCount;
1320+}
1321+
1322+bool MirSurface::activeFocus() const
1323+{
1324+ return m_activeFocus;
1325+}
1326+
1327+void MirSurface::setActiveFocus(bool value)
1328+{
1329+ if (m_activeFocus == value)
1330+ return;
1331+
1332+ m_activeFocus = value;
1333+
1334+ Q_EMIT activeFocusChanged(value);
1335+}
1336+
1337+int MirSurface::width() const
1338+{
1339+ return m_width;
1340+}
1341+
1342+int MirSurface::height() const
1343+{
1344+ return m_height;
1345+}
1346+
1347+void MirSurface::resize(int width, int height)
1348+{
1349+ if (width != m_width) {
1350+ m_width = width;
1351+ Q_EMIT widthChanged();
1352+ }
1353+
1354+ if (m_height != height) {
1355+ m_height = height;
1356+ Q_EMIT heightChanged();
1357+ }
1358+}
1359
1360=== added file 'tests/mocks/Unity/Application/MirSurface.h'
1361--- tests/mocks/Unity/Application/MirSurface.h 1970-01-01 00:00:00 +0000
1362+++ tests/mocks/Unity/Application/MirSurface.h 2015-08-14 11:40:06 +0000
1363@@ -0,0 +1,111 @@
1364+/*
1365+ * Copyright (C) 2015 Canonical, Ltd.
1366+ *
1367+ * This program is free software; you can redistribute it and/or modify
1368+ * it under the terms of the GNU General Public License as published by
1369+ * the Free Software Foundation; version 3.
1370+ *
1371+ * This program is distributed in the hope that it will be useful,
1372+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1373+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1374+ * GNU General Public License for more details.
1375+ *
1376+ * You should have received a copy of the GNU General Public License
1377+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1378+ */
1379+
1380+#ifndef MOCK_MIR_SURFACE_H
1381+#define MOCK_MIR_SURFACE_H
1382+
1383+#include <QObject>
1384+#include <QUrl>
1385+
1386+// unity-api
1387+#include <unity/shell/application/MirSurfaceInterface.h>
1388+
1389+class MirSurface : public unity::shell::application::MirSurfaceInterface
1390+{
1391+ Q_OBJECT
1392+
1393+ ////
1394+ // for use in qml tests
1395+ Q_PROPERTY(int width READ width NOTIFY widthChanged)
1396+ Q_PROPERTY(int height READ height NOTIFY heightChanged)
1397+ Q_PROPERTY(bool activeFocus READ activeFocus NOTIFY activeFocusChanged)
1398+
1399+public:
1400+ MirSurface(const QString& name,
1401+ Mir::Type type,
1402+ Mir::State state,
1403+ const QUrl& screenshot,
1404+ const QString &qmlFilePath = QString());
1405+ virtual ~MirSurface();
1406+
1407+ ////
1408+ // unity.shell.application.MirSurface
1409+
1410+ Mir::Type type() const override;
1411+
1412+ QString name() const override;
1413+
1414+ QSize size() const override { return QSize(width(),height()); }
1415+ void resize(int width, int height) override;
1416+
1417+ Mir::State state() const override;
1418+ void setState(Mir::State) override;
1419+
1420+ bool live() const override;
1421+
1422+ Mir::OrientationAngle orientationAngle() const override;
1423+ void setOrientationAngle(Mir::OrientationAngle) override;
1424+
1425+ ////
1426+ // API for tests
1427+
1428+ Q_INVOKABLE void setLive(bool live);
1429+
1430+ void incrementViewCount();
1431+ void decrementViewCount();
1432+ int viewCount() const;
1433+
1434+ int width() const;
1435+ int height() const;
1436+
1437+ /////
1438+ // internal mock stuff
1439+
1440+ QString qmlFilePath() const;
1441+
1442+ QUrl screenshotUrl() const;
1443+ void setScreenshotUrl(QUrl);
1444+
1445+ bool activeFocus() const;
1446+ void setActiveFocus(bool);
1447+
1448+Q_SIGNALS:
1449+ void stateChanged(Mir::State);
1450+ void liveChanged(bool live);
1451+ void orientationAngleChanged(Mir::OrientationAngle angle);
1452+ void widthChanged();
1453+ void heightChanged();
1454+
1455+ ////
1456+ // internal mock stuff
1457+ void screenshotUrlChanged(QUrl);
1458+ void activeFocusChanged(bool);
1459+
1460+private:
1461+ const QString m_name;
1462+ const Mir::Type m_type;
1463+ Mir::State m_state;
1464+ Mir::OrientationAngle m_orientationAngle;
1465+ QUrl m_screenshotUrl;
1466+ QString m_qmlFilePath;
1467+ bool m_live;
1468+ int m_viewCount;
1469+ bool m_activeFocus;
1470+ int m_width;
1471+ int m_height;
1472+};
1473+
1474+#endif // MOCK_MIR_SURFACE_H
1475
1476=== modified file 'tests/mocks/Unity/Application/MirSurfaceItem.cpp'
1477--- tests/mocks/Unity/Application/MirSurfaceItem.cpp 2015-04-23 16:18:25 +0000
1478+++ tests/mocks/Unity/Application/MirSurfaceItem.cpp 2015-08-14 11:40:06 +0000
1479@@ -15,7 +15,6 @@
1480 */
1481
1482 #include "MirSurfaceItem.h"
1483-#include "Session.h"
1484
1485 #include <paths.h>
1486
1487@@ -27,69 +26,30 @@
1488
1489 #include <QDebug>
1490
1491-MirSurfaceItem::MirSurfaceItem(const QString& name,
1492- MirSurfaceItem::Type type,
1493- MirSurfaceItem::State state,
1494- const QUrl& screenshot,
1495- const QString &qmlFilePath,
1496- QQuickItem *parent)
1497- : QQuickItem(parent)
1498- , m_session(nullptr)
1499- , m_name(name)
1500- , m_type(type)
1501- , m_state(state)
1502- , m_live(true)
1503- , m_orientationAngle(Angle0)
1504+using namespace unity::shell::application;
1505+
1506+MirSurfaceItem::MirSurfaceItem(QQuickItem *parent)
1507+ : MirSurfaceItemInterface(parent)
1508+ , m_qmlSurface(nullptr)
1509 , m_qmlItem(nullptr)
1510- , m_screenshotUrl(screenshot)
1511+ , m_consumesInput(false)
1512+ , m_surfaceWidth(0)
1513+ , m_surfaceHeight(0)
1514 , m_touchPressCount(0)
1515 , m_touchReleaseCount(0)
1516 {
1517+ qDebug() << "MirSurfaceItem::MirSurfaceItem() " << (void*)(this) << name();
1518 setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton | Qt::RightButton |
1519 Qt::ExtraButton1 | Qt::ExtraButton2 | Qt::ExtraButton3 | Qt::ExtraButton4 |
1520 Qt::ExtraButton5 | Qt::ExtraButton6 | Qt::ExtraButton7 | Qt::ExtraButton8 |
1521 Qt::ExtraButton9 | Qt::ExtraButton10 | Qt::ExtraButton11 |
1522 Qt::ExtraButton12 | Qt::ExtraButton13);
1523-
1524- QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
1525-
1526- // The assumptions I make here really should hold.
1527- QQuickView *quickView =
1528- qobject_cast<QQuickView*>(QGuiApplication::topLevelWindows()[0]);
1529-
1530- QString qmlComponentFilePath;
1531- if (!qmlFilePath.isEmpty()) {
1532- qmlComponentFilePath.append(qmlFilePath);
1533- } else {
1534- qmlComponentFilePath = QString("%1/Unity/Application/MirSurfaceItem.qml")
1535- .arg(mockPluginsDir());
1536- }
1537-
1538- m_qmlContentComponent = new QQmlComponent(quickView->engine(), qmlComponentFilePath);
1539-
1540- switch (m_qmlContentComponent->status()) {
1541- case QQmlComponent::Ready:
1542- createQmlContentItem();
1543- break;
1544- case QQmlComponent::Loading:
1545- connect(m_qmlContentComponent, &QQmlComponent::statusChanged,
1546- this, &MirSurfaceItem::onComponentStatusChanged);
1547- break;
1548- case QQmlComponent::Error:
1549- printComponentErrors();
1550- qFatal("MirSurfaceItem: failed to create content component.");
1551- break;
1552- default:
1553- qFatal("MirSurfaceItem: Unhandled component status");
1554- }
1555 }
1556
1557 MirSurfaceItem::~MirSurfaceItem()
1558 {
1559- qDebug() << "MirSurfaceItem::~MirSurfaceItem() " << name();
1560- if (m_session) {
1561- m_session->setSurface(nullptr);
1562- }
1563+ qDebug() << "MirSurfaceItem::~MirSurfaceItem() " << (void*)(this) << name();
1564+ setSurface(nullptr);
1565 }
1566
1567 void MirSurfaceItem::printComponentErrors()
1568@@ -100,58 +60,70 @@
1569 }
1570 }
1571
1572-void MirSurfaceItem::release()
1573-{
1574- qDebug() << "MirSurfaceItem::release " << name();
1575-
1576- if (m_session) {
1577- m_session->setSurface(nullptr);
1578- }
1579- if (!parent()) {
1580- deleteLater();
1581- }
1582-}
1583-
1584-void MirSurfaceItem::setOrientationAngle(OrientationAngle angle)
1585-{
1586- if (m_orientationAngle == angle)
1587- return;
1588-
1589- m_orientationAngle = angle;
1590+Mir::Type MirSurfaceItem::type() const
1591+{
1592+ if (m_qmlSurface) {
1593+ return m_qmlSurface->type();
1594+ } else {
1595+ return Mir::UnknownType;
1596+ }
1597+}
1598+
1599+Mir::State MirSurfaceItem::surfaceState() const
1600+{
1601+ if (m_qmlSurface) {
1602+ return m_qmlSurface->state();
1603+ } else {
1604+ return Mir::UnknownState;
1605+ }
1606+}
1607+
1608+QString MirSurfaceItem::name() const
1609+{
1610+ if (m_qmlSurface) {
1611+ return m_qmlSurface->name();
1612+ } else {
1613+ return QString();
1614+ }
1615+}
1616+
1617+bool MirSurfaceItem::live() const
1618+{
1619+ if (m_qmlSurface) {
1620+ return m_qmlSurface->live();
1621+ } else {
1622+ return false;
1623+ }
1624+}
1625+
1626+Mir::OrientationAngle MirSurfaceItem::orientationAngle() const
1627+{
1628+ if (m_qmlSurface) {
1629+ return m_qmlSurface->orientationAngle();
1630+ } else {
1631+ return Mir::Angle0;
1632+ }
1633+}
1634+
1635+void MirSurfaceItem::setOrientationAngle(Mir::OrientationAngle angle)
1636+{
1637+ if (!m_qmlSurface)
1638+ return;
1639+
1640+ if (m_qmlSurface->orientationAngle() == angle)
1641+ return;
1642+
1643+ m_qmlSurface->setOrientationAngle(angle);
1644
1645 QQmlProperty orientationProp(m_qmlItem, "orientationAngle");
1646- orientationProp.write(QVariant::fromValue(m_orientationAngle));
1647-
1648- Q_EMIT orientationAngleChanged(m_orientationAngle);
1649-}
1650-
1651-void MirSurfaceItem::setSession(Session* session)
1652-{
1653- m_session = session;
1654-}
1655-
1656-void MirSurfaceItem::setScreenshot(const QUrl& screenshot)
1657-{
1658- m_screenshotUrl = screenshot;
1659+ orientationProp.write(QVariant::fromValue(m_qmlSurface->orientationAngle()));
1660+}
1661+
1662+void MirSurfaceItem::updateScreenshot(QUrl screenshotUrl)
1663+{
1664 if (m_qmlItem) {
1665 QQmlProperty screenshotSource(m_qmlItem, "screenshotSource");
1666- screenshotSource.write(QVariant::fromValue(m_screenshotUrl));
1667- }
1668-}
1669-
1670-void MirSurfaceItem::setLive(bool live)
1671-{
1672- if (m_live != live) {
1673- m_live = live;
1674- Q_EMIT liveChanged(m_live);
1675- }
1676-}
1677-
1678-void MirSurfaceItem::setState(MirSurfaceItem::State newState)
1679-{
1680- if (newState != m_state) {
1681- m_state = newState;
1682- Q_EMIT stateChanged(newState);
1683+ screenshotSource.write(QVariant::fromValue(screenshotUrl));
1684 }
1685 }
1686
1687@@ -174,7 +146,7 @@
1688
1689 {
1690 QQmlProperty screenshotSource(m_qmlItem, "screenshotSource");
1691- screenshotSource.write(QVariant::fromValue(m_screenshotUrl));
1692+ screenshotSource.write(QVariant::fromValue(m_qmlSurface->screenshotUrl()));
1693 }
1694 }
1695
1696@@ -188,3 +160,124 @@
1697 Q_EMIT touchReleaseCountChanged(m_touchReleaseCount);
1698 }
1699 }
1700+
1701+void MirSurfaceItem::setSurface(MirSurfaceInterface* surface)
1702+{
1703+ qDebug().nospace() << "MirSurfaceItem::setSurface() this=" << (void*)(this)
1704+ << " name=" << name()
1705+ << " surface=" << surface;
1706+
1707+ if (m_qmlSurface == surface) {
1708+ return;
1709+ }
1710+
1711+ if (m_qmlSurface) {
1712+ delete m_qmlItem;
1713+ m_qmlItem = nullptr;
1714+
1715+ delete m_qmlContentComponent;
1716+ m_qmlContentComponent = nullptr;
1717+
1718+ disconnect(m_qmlSurface, nullptr, this, nullptr);
1719+ m_qmlSurface->decrementViewCount();
1720+ }
1721+
1722+ m_qmlSurface = static_cast<MirSurface*>(surface);
1723+
1724+ if (m_qmlSurface) {
1725+ m_qmlSurface->incrementViewCount();
1726+
1727+ m_qmlSurface->setActiveFocus(hasActiveFocus());
1728+
1729+ updateSurfaceSize();
1730+
1731+ connect(m_qmlSurface, &MirSurface::orientationAngleChanged, this, &MirSurfaceItem::orientationAngleChanged);
1732+ connect(m_qmlSurface, &MirSurface::screenshotUrlChanged, this, &MirSurfaceItem::updateScreenshot);
1733+ connect(m_qmlSurface, &MirSurface::liveChanged, this, &MirSurfaceItem::liveChanged);
1734+ connect(m_qmlSurface, &MirSurface::stateChanged, this, &MirSurfaceItem::surfaceStateChanged);
1735+
1736+ // The assumptions I make here really should hold.
1737+ QQuickView *quickView =
1738+ qobject_cast<QQuickView*>(QGuiApplication::topLevelWindows()[0]);
1739+
1740+ QString qmlComponentFilePath;
1741+ if (!m_qmlSurface->qmlFilePath().isEmpty()) {
1742+ qmlComponentFilePath.append(m_qmlSurface->qmlFilePath());
1743+ } else {
1744+ qmlComponentFilePath = QString("%1/Unity/Application/MirSurfaceItem.qml")
1745+ .arg(mockPluginsDir());
1746+ }
1747+
1748+ m_qmlContentComponent = new QQmlComponent(quickView->engine(), qmlComponentFilePath);
1749+
1750+ switch (m_qmlContentComponent->status()) {
1751+ case QQmlComponent::Ready:
1752+ createQmlContentItem();
1753+ break;
1754+ case QQmlComponent::Loading:
1755+ connect(m_qmlContentComponent, &QQmlComponent::statusChanged,
1756+ this, &MirSurfaceItem::onComponentStatusChanged);
1757+ break;
1758+ case QQmlComponent::Error:
1759+ printComponentErrors();
1760+ qFatal("MirSurfaceItem: failed to create content component.");
1761+ break;
1762+ default:
1763+ qFatal("MirSurfaceItem: Unhandled component status");
1764+ }
1765+ }
1766+
1767+ Q_EMIT surfaceChanged(m_qmlSurface);
1768+}
1769+
1770+void MirSurfaceItem::itemChange(ItemChange change, const ItemChangeData & value)
1771+{
1772+ if (change == QQuickItem::ItemActiveFocusHasChanged) {
1773+ if (m_qmlSurface) {
1774+ m_qmlSurface->setActiveFocus(value.boolValue);
1775+ }
1776+ }
1777+}
1778+
1779+void MirSurfaceItem::setConsumesInput(bool value)
1780+{
1781+ if (m_consumesInput != value) {
1782+ m_consumesInput = value;
1783+ Q_EMIT consumesInputChanged(value);
1784+ }
1785+}
1786+
1787+int MirSurfaceItem::surfaceWidth() const
1788+{
1789+ return m_surfaceWidth;
1790+}
1791+
1792+void MirSurfaceItem::setSurfaceWidth(int value)
1793+{
1794+ if (m_surfaceWidth != value) {
1795+ m_surfaceWidth = value;
1796+ Q_EMIT surfaceWidthChanged(m_surfaceWidth);
1797+ updateSurfaceSize();
1798+ }
1799+}
1800+
1801+int MirSurfaceItem::surfaceHeight() const
1802+{
1803+ return m_surfaceHeight;
1804+}
1805+
1806+void MirSurfaceItem::setSurfaceHeight(int value)
1807+{
1808+ if (m_surfaceHeight != value) {
1809+ m_surfaceHeight = value;
1810+ Q_EMIT surfaceHeightChanged(m_surfaceHeight);
1811+ updateSurfaceSize();
1812+ }
1813+}
1814+
1815+void MirSurfaceItem::updateSurfaceSize()
1816+{
1817+ if (m_qmlSurface && m_surfaceWidth > 0 && m_surfaceHeight > 0) {
1818+ m_qmlSurface->resize(m_surfaceWidth, m_surfaceHeight);
1819+ }
1820+}
1821
1822=== modified file 'tests/mocks/Unity/Application/MirSurfaceItem.h'
1823--- tests/mocks/Unity/Application/MirSurfaceItem.h 2015-04-23 16:18:25 +0000
1824+++ tests/mocks/Unity/Application/MirSurfaceItem.h 2015-08-14 11:40:06 +0000
1825@@ -17,73 +17,54 @@
1826 #ifndef MIRSURFACEITEM_H
1827 #define MIRSURFACEITEM_H
1828
1829-#include "MirSurfaceItemModel.h"
1830+#include "MirSurface.h"
1831
1832 #include <QQuickItem>
1833 #include <QUrl>
1834
1835-class Session;
1836+// unity-api
1837+#include <unity/shell/application/MirSurfaceItemInterface.h>
1838
1839-class MirSurfaceItem : public QQuickItem
1840+class MirSurfaceItem : public unity::shell::application::MirSurfaceItemInterface
1841 {
1842 Q_OBJECT
1843- Q_ENUMS(Type)
1844- Q_ENUMS(State)
1845- Q_ENUMS(OrientationAngle)
1846
1847- Q_PROPERTY(Type type READ type NOTIFY typeChanged)
1848- Q_PROPERTY(State state READ state NOTIFY stateChanged)
1849- Q_PROPERTY(QString name READ name CONSTANT)
1850- Q_PROPERTY(bool live READ live NOTIFY liveChanged)
1851- Q_PROPERTY(OrientationAngle orientationAngle READ orientationAngle WRITE setOrientationAngle
1852- NOTIFY orientationAngleChanged DESIGNABLE false)
1853+ ////
1854+ // for use in qml tests
1855 Q_PROPERTY(int touchPressCount READ touchPressCount WRITE setTouchPressCount
1856 NOTIFY touchPressCountChanged DESIGNABLE false)
1857 Q_PROPERTY(int touchReleaseCount READ touchReleaseCount WRITE setTouchReleaseCount
1858 NOTIFY touchReleaseCountChanged DESIGNABLE false)
1859
1860 public:
1861- enum Type {
1862- Normal,
1863- Utility,
1864- Dialog,
1865- Overlay,
1866- Freestyle,
1867- Popover,
1868- InputMethod,
1869- };
1870-
1871- enum State {
1872- Unknown,
1873- Restored,
1874- Minimized,
1875- Maximized,
1876- VertMaximized,
1877- /* SemiMaximized, */
1878- Fullscreen,
1879- };
1880-
1881- enum OrientationAngle {
1882- Angle0 = 0,
1883- Angle90 = 90,
1884- Angle180 = 180,
1885- Angle270 = 270
1886- };
1887-
1888+ explicit MirSurfaceItem(QQuickItem *parent = 0);
1889 ~MirSurfaceItem();
1890
1891- //getters
1892- Session* session() const { return m_session; }
1893- Type type() const { return m_type; }
1894- State state() const { return m_state; }
1895- QString name() const { return m_name; }
1896- bool live() const { return m_live; }
1897- OrientationAngle orientationAngle() const { return m_orientationAngle; }
1898-
1899- void setOrientationAngle(OrientationAngle angle);
1900-
1901- void setSession(Session* item);
1902- void setScreenshot(const QUrl& screenshot);
1903+ Mir::Type type() const override;
1904+ QString name() const override;
1905+ bool live() const override;
1906+
1907+ Mir::State surfaceState() const override;
1908+ void setSurfaceState(Mir::State) override {}
1909+
1910+ Mir::OrientationAngle orientationAngle() const override;
1911+ void setOrientationAngle(Mir::OrientationAngle angle) override;
1912+
1913+ unity::shell::application::MirSurfaceInterface* surface() const override { return m_qmlSurface; }
1914+ void setSurface(unity::shell::application::MirSurfaceInterface*) override;
1915+
1916+ bool consumesInput() const override { return m_consumesInput; }
1917+ void setConsumesInput(bool value) override;
1918+
1919+ int surfaceWidth() const override;
1920+ void setSurfaceWidth(int value) override;
1921+
1922+ int surfaceHeight() const override;
1923+ void setSurfaceHeight(int value) override;
1924+
1925+ /////
1926+ // For use in qml tests
1927+
1928 void setLive(bool live);
1929
1930 int touchPressCount() const { return m_touchPressCount; }
1931@@ -92,47 +73,32 @@
1932 int touchReleaseCount() const { return m_touchReleaseCount; }
1933 void setTouchReleaseCount(int count) { m_touchReleaseCount = count; Q_EMIT touchReleaseCountChanged(count); }
1934
1935- Q_INVOKABLE void setState(State newState);
1936- Q_INVOKABLE void release();
1937-
1938 Q_SIGNALS:
1939- void typeChanged(Type);
1940- void stateChanged(State);
1941- void liveChanged(bool live);
1942- void orientationAngleChanged(OrientationAngle angle);
1943 void touchPressCountChanged(int count);
1944 void touchReleaseCountChanged(int count);
1945
1946- // internal mock use
1947- void deregister();
1948-
1949 protected:
1950- explicit MirSurfaceItem(const QString& name,
1951- Type type,
1952- State state,
1953- const QUrl& screenshot,
1954- const QString &qmlFilePath = QString(),
1955- QQuickItem *parent = 0);
1956-
1957 void touchEvent(QTouchEvent * event) override;
1958+ void itemChange(ItemChange change, const ItemChangeData & value) override;
1959
1960 private Q_SLOTS:
1961 void onComponentStatusChanged(QQmlComponent::Status status);
1962+ void updateScreenshot(QUrl screenshot);
1963
1964 private:
1965 void createQmlContentItem();
1966 void printComponentErrors();
1967+ void updateSurfaceSize();
1968
1969- Session* m_session;
1970- const QString m_name;
1971- const Type m_type;
1972- State m_state;
1973- bool m_live;
1974- OrientationAngle m_orientationAngle;
1975+ MirSurface* m_qmlSurface;
1976
1977 QQmlComponent *m_qmlContentComponent;
1978 QQuickItem *m_qmlItem;
1979- QUrl m_screenshotUrl;
1980+
1981+ bool m_consumesInput;
1982+
1983+ int m_surfaceWidth;
1984+ int m_surfaceHeight;
1985
1986 int m_touchPressCount;
1987 int m_touchReleaseCount;
1988@@ -142,6 +108,5 @@
1989
1990 Q_DECLARE_METATYPE(MirSurfaceItem*)
1991 Q_DECLARE_METATYPE(QList<MirSurfaceItem*>)
1992-Q_DECLARE_METATYPE(MirSurfaceItem::OrientationAngle)
1993
1994 #endif // MIRSURFACEITEM_H
1995
1996=== modified file 'tests/mocks/Unity/Application/MirSurfaceItem.qml'
1997--- tests/mocks/Unity/Application/MirSurfaceItem.qml 2015-06-24 11:41:09 +0000
1998+++ tests/mocks/Unity/Application/MirSurfaceItem.qml 2015-08-14 11:40:06 +0000
1999@@ -47,6 +47,7 @@
2000 y: surfaceText.y
2001 width: surfaceText.width
2002 height: surfaceText.height
2003+ clip: true
2004
2005 transform: Translate { x: -2; y: -2 }
2006 }
2007@@ -58,6 +59,7 @@
2008 fontSizeMode: Text.Fit
2009 minimumPixelSize: 10; font.pixelSize: 200
2010 verticalAlignment: Text.AlignVCenter
2011+ clip: true
2012
2013 rotation: root.orientationAngle
2014 x: (parent.width - width) / 2
2015
2016=== removed file 'tests/mocks/Unity/Application/MirSurfaceItemModel.h'
2017--- tests/mocks/Unity/Application/MirSurfaceItemModel.h 2014-08-29 11:22:48 +0000
2018+++ tests/mocks/Unity/Application/MirSurfaceItemModel.h 1970-01-01 00:00:00 +0000
2019@@ -1,35 +0,0 @@
2020-/*
2021- * Copyright (C) 2014 Canonical, Ltd.
2022- *
2023- * This program is free software: you can redistribute it and/or modify it under
2024- * the terms of the GNU Lesser General Public License version 3, as published by
2025- * the Free Software Foundation.
2026- *
2027- * This program is distributed in the hope that it will be useful, but WITHOUT
2028- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
2029- * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2030- * Lesser General Public License for more details.
2031- *
2032- * You should have received a copy of the GNU Lesser General Public License
2033- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2034- */
2035-
2036-#ifndef MIRSURFACEITEMMODEL_H
2037-#define MIRSURFACEITEMMODEL_H
2038-
2039-// Local
2040-#include "ObjectListModel.h"
2041-
2042-class MirSurfaceItem;
2043-class MirSurfaceItemModel: public ObjectListModel<MirSurfaceItem>
2044-{
2045- Q_OBJECT
2046-public:
2047- MirSurfaceItemModel(QObject *parent = 0): ObjectListModel(parent) {}
2048-
2049- Q_INVOKABLE int count() const { return rowCount(); }
2050-};
2051-
2052-Q_DECLARE_METATYPE(MirSurfaceItemModel*)
2053-
2054-#endif // MIRSURFACEITEMMODEL_H
2055
2056=== modified file 'tests/mocks/Unity/Application/Session.cpp'
2057--- tests/mocks/Unity/Application/Session.cpp 2014-09-01 16:07:55 +0000
2058+++ tests/mocks/Unity/Application/Session.cpp 2015-08-14 11:40:06 +0000
2059@@ -54,23 +54,21 @@
2060 if (m_application) {
2061 m_application->setSession(nullptr);
2062 }
2063- delete m_surface;
2064 delete m_children;
2065+
2066+ if (m_surface) {
2067+ if (m_surface->viewCount() == 0) {
2068+ delete m_surface;
2069+ } else {
2070+ m_surface->setLive(false);
2071+ }
2072+ }
2073 }
2074
2075 void Session::release()
2076 {
2077 qDebug() << "Session::release " << name();
2078-
2079- if (m_parentSession) {
2080- m_parentSession->removeChildSession(this);
2081- }
2082- if (m_application) {
2083- m_application->setSession(nullptr);
2084- }
2085- if (!parent()) {
2086- deleteLater();
2087- }
2088+ deleteLater();
2089 }
2090
2091 void Session::setApplication(ApplicationInfo* application)
2092@@ -82,27 +80,25 @@
2093 Q_EMIT applicationChanged(application);
2094 }
2095
2096-void Session::setSurface(MirSurfaceItem* surface)
2097-{
2098- qDebug() << "Session::setSurface - session=" << name() << "surface=" << surface;
2099- if (m_surface == surface)
2100- return;
2101-
2102- if (m_surface) {
2103- m_surface->setSession(nullptr);
2104- m_surface->setParent(nullptr);
2105- Q_EMIT m_surface->deregister();
2106- }
2107-
2108- m_surface = surface;
2109-
2110- if (m_surface) {
2111- m_surface->setSession(this);
2112- m_surface->setParent(this);
2113- SurfaceManager::singleton()->registerSurface(m_surface);
2114- }
2115-
2116- Q_EMIT surfaceChanged(m_surface);
2117+void Session::appendSurface(MirSurface* surface)
2118+{
2119+ qDebug() << "Session::appendSurface - session=" << name() << "surface=" << surface;
2120+
2121+ m_surfaces.insert(m_surfaces.rowCount(), surface);
2122+
2123+ connect(surface, &QObject::destroyed,
2124+ this, [this, surface]() { this->removeSurface(surface); });
2125+
2126+ Q_EMIT lastSurfaceChanged(surface);
2127+ Q_EMIT surfaceAdded(surface);
2128+}
2129+
2130+void Session::removeSurface(MirSurface* surface)
2131+{
2132+ disconnect(surface, nullptr, this, nullptr);
2133+ if (m_surfaces.contains(surface)) {
2134+ m_surfaces.remove(surface);
2135+ }
2136 }
2137
2138 void Session::setScreenshot(const QUrl& screenshot)
2139@@ -110,7 +106,7 @@
2140 if (screenshot != m_screenshot) {
2141 m_screenshot = screenshot;
2142 if (m_surface) {
2143- m_surface->setScreenshot(m_screenshot);
2144+ m_surface->setScreenshotUrl(m_screenshot);
2145 }
2146 }
2147 }
2148@@ -136,10 +132,10 @@
2149 {
2150 if (m_surface) return;
2151
2152- setSurface(SurfaceManager::singleton()->createSurface(name(),
2153- MirSurfaceItem::Normal,
2154- m_application && m_application->fullscreen() ? MirSurfaceItem::Fullscreen :
2155- MirSurfaceItem::Maximized,
2156+ appendSurface(SurfaceManager::singleton()->createSurface(name(),
2157+ Mir::NormalType,
2158+ m_application && m_application->fullscreen() ? Mir::FullscreenState :
2159+ Mir::MaximizedState,
2160 m_screenshot));
2161 }
2162
2163@@ -172,3 +168,17 @@
2164 {
2165 return m_children;
2166 }
2167+
2168+ObjectListModel<MirSurface>* Session::surfaces() const
2169+{
2170+ return const_cast<ObjectListModel<MirSurface>*>(&m_surfaces);
2171+}
2172+
2173+MirSurface *Session::lastSurface() const
2174+{
2175+ if (m_surfaces.rowCount() > 0) {
2176+ return m_surfaces.list().last();
2177+ } else {
2178+ return nullptr;
2179+ }
2180+}
2181
2182=== modified file 'tests/mocks/Unity/Application/Session.h'
2183--- tests/mocks/Unity/Application/Session.h 2014-10-23 14:15:17 +0000
2184+++ tests/mocks/Unity/Application/Session.h 2015-08-14 11:40:06 +0000
2185@@ -1,5 +1,5 @@
2186 /*
2187- * Copyright (C) 2014 Canonical, Ltd.
2188+ * Copyright (C) 2014,2015 Canonical, Ltd.
2189 *
2190 * This program is free software; you can redistribute it and/or modify
2191 * it under the terms of the GNU General Public License as published by
2192@@ -17,18 +17,20 @@
2193 #ifndef SESSION_H
2194 #define SESSION_H
2195
2196+#include "ObjectListModel.h"
2197 #include "SessionModel.h"
2198
2199 #include <QQuickItem>
2200
2201 class ApplicationInfo;
2202-class MirSurfaceItem;
2203+class MirSurface;
2204
2205 class Session : public QObject
2206 {
2207 Q_OBJECT
2208 Q_PROPERTY(QString name READ name CONSTANT)
2209- Q_PROPERTY(MirSurfaceItem* surface READ surface NOTIFY surfaceChanged)
2210+ Q_PROPERTY(MirSurface* lastSurface READ lastSurface NOTIFY lastSurfaceChanged)
2211+ Q_PROPERTY(ObjectListModel<MirSurface>* surfaces READ surfaces CONSTANT)
2212 Q_PROPERTY(ApplicationInfo* application READ application NOTIFY applicationChanged)
2213 Q_PROPERTY(Session* parentSession READ parentSession NOTIFY parentSessionChanged DESIGNABLE false)
2214 Q_PROPERTY(SessionModel* childSessions READ childSessions DESIGNABLE false CONSTANT)
2215@@ -46,11 +48,13 @@
2216 QString name() const { return m_name; }
2217 bool live() const { return m_live; }
2218 ApplicationInfo* application() const { return m_application; }
2219- MirSurfaceItem* surface() const { return m_surface; }
2220+ MirSurface *lastSurface() const;
2221+ ObjectListModel<MirSurface>* surfaces() const;
2222 Session* parentSession() const { return m_parentSession; }
2223
2224 void setApplication(ApplicationInfo* item);
2225- void setSurface(MirSurfaceItem* surface);
2226+ void appendSurface(MirSurface* surface);
2227+ void removeSurface(MirSurface* surface);
2228 void setScreenshot(const QUrl& m_screenshot);
2229 void setLive(bool live);
2230
2231@@ -60,9 +64,10 @@
2232
2233 Q_SIGNALS:
2234 void applicationChanged(ApplicationInfo*);
2235- void surfaceChanged(MirSurfaceItem*);
2236 void parentSessionChanged(Session*);
2237 void liveChanged(bool live);
2238+ void surfaceAdded(MirSurface *surface);
2239+ void lastSurfaceChanged(MirSurface *surface);
2240
2241 // internal mock use
2242 void deregister();
2243@@ -78,13 +83,15 @@
2244 bool m_live;
2245 QUrl m_screenshot;
2246 ApplicationInfo* m_application;
2247- MirSurfaceItem* m_surface;
2248+ MirSurface* m_surface;
2249 Session* m_parentSession;
2250 SessionModel* m_children;
2251+ ObjectListModel<MirSurface> m_surfaces;
2252
2253 friend class ApplicationTestInterface;
2254 };
2255
2256 Q_DECLARE_METATYPE(Session*)
2257+Q_DECLARE_METATYPE(ObjectListModel<MirSurface>*)
2258
2259 #endif // SESSION_H
2260
2261=== modified file 'tests/mocks/Unity/Application/SurfaceManager.cpp'
2262--- tests/mocks/Unity/Application/SurfaceManager.cpp 2015-03-19 15:18:45 +0000
2263+++ tests/mocks/Unity/Application/SurfaceManager.cpp 2015-08-14 11:40:06 +0000
2264@@ -1,5 +1,5 @@
2265 /*
2266- * Copyright (C) 2014 Canonical, Ltd.
2267+ * Copyright (C) 2014-2015 Canonical, Ltd.
2268 *
2269 * This program is free software; you can redistribute it and/or modify
2270 * it under the terms of the GNU General Public License as published by
2271@@ -36,31 +36,28 @@
2272 {
2273 }
2274
2275-MirSurfaceItem *SurfaceManager::createSurface(const QString& name,
2276- MirSurfaceItem::Type type,
2277- MirSurfaceItem::State state,
2278+MirSurface *SurfaceManager::createSurface(const QString& name,
2279+ Mir::Type type,
2280+ Mir::State state,
2281 const QUrl& screenshot)
2282 {
2283- MirSurfaceItem* surface = new MirSurfaceItem(name, type, state, screenshot);
2284+ MirSurface* surface = new MirSurface(name, type, state, screenshot);
2285+ connect(surface, &QObject::destroyed, this, [this](QObject *obj) {
2286+ MirSurface* surface = qobject_cast<MirSurface*>(obj);
2287+ Q_EMIT surfaceDestroyed(surface);
2288+ });
2289 Q_EMIT surfaceCreated(surface);
2290 return surface;
2291 }
2292
2293-void SurfaceManager::registerSurface(MirSurfaceItem *surface)
2294-{
2295- connect(surface, &MirSurfaceItem::deregister, this, [this] {
2296- MirSurfaceItem* surface = qobject_cast<MirSurfaceItem*>(sender());
2297- disconnect(surface, 0, this, 0);
2298-
2299- surface->setLive(false);
2300- Q_EMIT surfaceDestroyed(surface);
2301- });
2302-}
2303-
2304-MirSurfaceItem *SurfaceManager::inputMethodSurface()
2305+MirSurface *SurfaceManager::inputMethodSurface()
2306 {
2307 if (!m_virtualKeyboard) {
2308 m_virtualKeyboard = new VirtualKeyboard;
2309+ connect(m_virtualKeyboard, &QObject::destroyed, this, [this](QObject *obj) {
2310+ MirSurface* surface = qobject_cast<MirSurface*>(obj);
2311+ Q_EMIT surfaceDestroyed(surface);
2312+ });
2313 Q_EMIT surfaceCreated(m_virtualKeyboard);
2314 }
2315 return m_virtualKeyboard;
2316
2317=== modified file 'tests/mocks/Unity/Application/SurfaceManager.h'
2318--- tests/mocks/Unity/Application/SurfaceManager.h 2015-03-11 22:50:30 +0000
2319+++ tests/mocks/Unity/Application/SurfaceManager.h 2015-08-14 11:40:06 +0000
2320@@ -1,5 +1,5 @@
2321 /*
2322- * Copyright (C) 2014 Canonical, Ltd.
2323+ * Copyright (C) 2014-2015 Canonical, Ltd.
2324 *
2325 * This program is free software; you can redistribute it and/or modify
2326 * it under the terms of the GNU General Public License as published by
2327@@ -19,7 +19,7 @@
2328
2329 #include <QObject>
2330
2331-#include "MirSurfaceItem.h"
2332+#include "MirSurface.h"
2333 #include "VirtualKeyboard.h"
2334
2335 class SurfaceManager : public QObject
2336@@ -30,21 +30,18 @@
2337
2338 static SurfaceManager *singleton();
2339
2340- Q_INVOKABLE MirSurfaceItem *createSurface(const QString& name,
2341- MirSurfaceItem::Type type,
2342- MirSurfaceItem::State state,
2343+ Q_INVOKABLE MirSurface* createSurface(const QString& name,
2344+ Mir::Type type,
2345+ Mir::State state,
2346 const QUrl& screenshot);
2347
2348- // Internal mock use
2349- void registerSurface(MirSurfaceItem *surface);
2350-
2351 // To be used in the tests
2352- Q_INVOKABLE MirSurfaceItem *inputMethodSurface();
2353+ Q_INVOKABLE MirSurface* inputMethodSurface();
2354
2355 Q_SIGNALS:
2356 void countChanged();
2357- void surfaceCreated(MirSurfaceItem *surface);
2358- void surfaceDestroyed(MirSurfaceItem *surface);
2359+ void surfaceCreated(MirSurface *surface);
2360+ void surfaceDestroyed(MirSurface*surface);
2361
2362 private:
2363 static SurfaceManager *the_surface_manager;
2364
2365=== modified file 'tests/mocks/Unity/Application/VirtualKeyboard.cpp'
2366--- tests/mocks/Unity/Application/VirtualKeyboard.cpp 2015-03-04 13:23:34 +0000
2367+++ tests/mocks/Unity/Application/VirtualKeyboard.cpp 2015-08-14 11:40:06 +0000
2368@@ -22,15 +22,14 @@
2369
2370 #include <QDebug>
2371
2372-VirtualKeyboard::VirtualKeyboard(QQuickItem *parent)
2373- : MirSurfaceItem("input-method",
2374- MirSurfaceItem::InputMethod,
2375- MirSurfaceItem::Minimized,
2376+VirtualKeyboard::VirtualKeyboard()
2377+ : MirSurface("input-method",
2378+ Mir::InputMethodType,
2379+ Mir::MinimizedState,
2380 QString("file://%1/Dash/graphics/phone/screenshots/vkb_portrait.png")
2381 .arg(qmlDirectory()),
2382 QString("%1/Unity/Application/VirtualKeyboard.qml")
2383- .arg(mockPluginsDir()),
2384- parent)
2385+ .arg(mockPluginsDir()))
2386 {
2387 }
2388
2389@@ -38,7 +37,9 @@
2390 {
2391 }
2392
2393+/*
2394 void VirtualKeyboard::touchEvent(QTouchEvent *event)
2395 {
2396 event->setAccepted(false);
2397 }
2398+*/
2399
2400=== modified file 'tests/mocks/Unity/Application/VirtualKeyboard.h'
2401--- tests/mocks/Unity/Application/VirtualKeyboard.h 2015-03-04 13:23:34 +0000
2402+++ tests/mocks/Unity/Application/VirtualKeyboard.h 2015-08-14 11:40:06 +0000
2403@@ -17,26 +17,23 @@
2404 #ifndef VIRTUALKEYBOARD_H
2405 #define VIRTUALKEYBOARD_H
2406
2407-#include "MirSurfaceItem.h"
2408-#include "MirSurfaceItemModel.h"
2409+#include "MirSurface.h"
2410
2411 #include <QQuickItem>
2412-#include <QUrl>
2413-
2414-class Session;
2415-
2416-class VirtualKeyboard : public MirSurfaceItem
2417+
2418+class VirtualKeyboard : public MirSurface
2419 {
2420 Q_OBJECT
2421 public:
2422- explicit VirtualKeyboard(QQuickItem *parent = 0);
2423+ explicit VirtualKeyboard();
2424 ~VirtualKeyboard();
2425
2426+/*
2427 protected:
2428 void touchEvent(QTouchEvent * event) override;
2429+*/
2430 };
2431
2432 Q_DECLARE_METATYPE(VirtualKeyboard*)
2433-Q_DECLARE_METATYPE(QList<VirtualKeyboard*>)
2434
2435 #endif // VIRTUALKEYBOARD_H
2436
2437=== modified file 'tests/mocks/Unity/Application/plugin.cpp'
2438--- tests/mocks/Unity/Application/plugin.cpp 2014-10-02 08:50:52 +0000
2439+++ tests/mocks/Unity/Application/plugin.cpp 2015-08-14 11:40:06 +0000
2440@@ -1,5 +1,5 @@
2441 /*
2442- * Copyright (C) 2013-2014 Canonical, Ltd.
2443+ * Copyright (C) 2013-2015 Canonical, Ltd.
2444 *
2445 * This program is free software; you can redistribute it and/or modify
2446 * it under the terms of the GNU General Public License as published by
2447@@ -20,12 +20,14 @@
2448 #include "ApplicationScreenshotProvider.h"
2449 #include "Session.h"
2450 #include "MirSurfaceItem.h"
2451-#include "MirSurfaceItemModel.h"
2452 #include "SurfaceManager.h"
2453 #include "SessionManager.h"
2454 #include "ApplicationTestInterface.h"
2455 #include "UbuntuKeyboardInfo.h"
2456
2457+// unity-api
2458+#include <unity/shell/application/Mir.h>
2459+
2460 #include <qqml.h>
2461 #include <QQmlEngine>
2462
2463@@ -67,14 +69,16 @@
2464 {
2465 qRegisterMetaType<Session*>("Session*");
2466 qRegisterMetaType<ApplicationInfo*>("ApplicationInfo*");
2467- qRegisterMetaType<MirSurfaceItemModel*>("SessionModel*");
2468- qRegisterMetaType<MirSurfaceItem*>("MirSurfaceItem*");
2469- qRegisterMetaType<MirSurfaceItemModel*>("MirSurfaceItemModel*");
2470+ qRegisterMetaType<SessionModel*>("SessionModel*");
2471+ qRegisterMetaType<unity::shell::application::MirSurfaceInterface*>("unity::shell::application::MirSurfaceInterface*");
2472+ qRegisterMetaType<Mir::Type>("Mir::Type");
2473+ qRegisterMetaType<Mir::State>("Mir::State");
2474
2475 qmlRegisterUncreatableType<unity::shell::application::ApplicationManagerInterface>(uri, 0, 1, "ApplicationManagerInterface", "Abstract interface. Cannot be created in QML");
2476 qmlRegisterUncreatableType<unity::shell::application::ApplicationInfoInterface>(uri, 0, 1, "ApplicationInfoInterface", "Abstract interface. Cannot be created in QML");
2477 qmlRegisterUncreatableType<Session>(uri, 0, 1, "Session", "Session can't be instantiated from QML");
2478- qmlRegisterUncreatableType<MirSurfaceItem>(uri, 0, 1, "MirSurfaceItem", "MirSurfaceItem can't be instantiated from QML");
2479+ qmlRegisterUncreatableType<MirSurface>(uri, 0, 1, "MirSurface", "MirSurface can't be instantiated from QML");
2480+ qmlRegisterType<MirSurfaceItem>(uri, 0, 1, "MirSurfaceItem");
2481
2482 qmlRegisterType<ApplicationInfo>(uri, 0, 1, "ApplicationInfo");
2483
2484@@ -84,8 +88,7 @@
2485 qmlRegisterSingletonType<ApplicationTestInterface>(uri, 0, 1, "ApplicationTest", applicationTestInterface);
2486 qmlRegisterSingletonType<UbuntuKeyboardInfo>(uri, 0, 1, "UbuntuKeyboardInfo", ubuntuKeyboardInfoSingleton);
2487
2488- qRegisterMetaType<MirSurfaceItem::Type>("MirSurfaceItem::Type");
2489- qRegisterMetaType<MirSurfaceItem::State>("MirSurfaceItem::State");
2490+ qmlRegisterUncreatableType<Mir>(uri, 0, 1, "Mir", "Mir provides enum values, it can't be instantiated");
2491 }
2492
2493 void FakeUnityApplicationQmlPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
2494
2495=== modified file 'tests/mocks/Unity/Application/qmldir'
2496--- tests/mocks/Unity/Application/qmldir 2014-08-08 11:23:57 +0000
2497+++ tests/mocks/Unity/Application/qmldir 2015-08-14 11:40:06 +0000
2498@@ -1,3 +1,4 @@
2499 module Unity.Application
2500 plugin FakeUnityApplicationQml
2501 typeinfo Application.qmltypes
2502+Cursor 0.1 Cursor.qml
2503
2504=== modified file 'tests/qmltests/CMakeLists.txt'
2505--- tests/qmltests/CMakeLists.txt 2015-07-29 12:38:53 +0000
2506+++ tests/qmltests/CMakeLists.txt 2015-08-14 11:40:06 +0000
2507@@ -76,7 +76,7 @@
2508 add_unity8_qmltest(Stages SurfaceContainer)
2509 add_unity8_qmltest(Stages SessionContainer)
2510 add_unity8_qmltest(Stages TabletStage)
2511-add_unity8_qmltest(Stages WindowMoveResizeArea)
2512+add_unity8_qmltest(Stages WindowResizeArea)
2513 add_unity8_qmltest(Stages Splash)
2514 add_unity8_qmltest(Tutorial Tutorial LIGHTDM)
2515 add_unity8_qmltest(Wizard Wizard ENVIRONMENT "OXIDE_NO_SANDBOX=1")
2516
2517=== modified file 'tests/qmltests/Stages/tst_ApplicationWindow.qml'
2518--- tests/qmltests/Stages/tst_ApplicationWindow.qml 2015-07-10 15:55:50 +0000
2519+++ tests/qmltests/Stages/tst_ApplicationWindow.qml 2015-08-14 11:40:06 +0000
2520@@ -45,16 +45,6 @@
2521 }
2522 }
2523
2524- Component {
2525- id: applicationWindowComponent
2526- ApplicationWindow {
2527- anchors.fill: parent
2528- application: fakeApplication
2529- surfaceOrientationAngle: 0
2530- interactive: true
2531- focus: true
2532- }
2533- }
2534 Loader {
2535 id: applicationWindowLoader
2536 focus: true
2537@@ -64,7 +54,19 @@
2538 left: parent.left
2539 }
2540 width: units.gu(40)
2541- sourceComponent: applicationWindowComponent
2542+ property bool itemDestroyed: false
2543+ sourceComponent: Component {
2544+ ApplicationWindow {
2545+ anchors.fill: parent
2546+ application: fakeApplication
2547+ surfaceOrientationAngle: 0
2548+ interactive: true
2549+ focus: true
2550+ Component.onDestruction: {
2551+ applicationWindowLoader.itemDestroyed = true;
2552+ }
2553+ }
2554+ }
2555 }
2556
2557 Rectangle {
2558@@ -87,13 +89,10 @@
2559 id: sessionCheckbox; checked: false
2560 activeFocusOnPress: false
2561 onCheckedChanged: {
2562- if (applicationWindowLoader.status !== Loader.Ready)
2563- return;
2564-
2565 if (checked && !fakeApplication.session) {
2566 fakeApplication.createSession();
2567 } else if (!checked && fakeApplication.session) {
2568- fakeApplication.session.release();
2569+ fakeApplication.destroySession();
2570 }
2571 }
2572 }
2573@@ -218,21 +217,29 @@
2574 sessionCheckbox.checked = true;
2575 sessionControl.surfaceCheckbox.checked = true;
2576 }
2577- function cleanupSession() {
2578- sessionCheckbox.checked = false;
2579- }
2580
2581 function cleanup() {
2582 forgetApplicationWindowChildren();
2583
2584+ applicationWindowLoader.itemDestroyed = false;
2585+
2586 // reload our test subject to get it in a fresh state once again
2587 applicationWindowLoader.active = false;
2588
2589+ tryCompare(applicationWindowLoader, "status", Loader.Null);
2590+ tryCompare(applicationWindowLoader, "item", null);
2591+ // Loader.status might be Loader.Null and Loader.item might be null but the Loader
2592+ // item might still be alive. So if we set Loader.active back to true
2593+ // again right now we will get the very same ApplicationWindow instance back. So no reload
2594+ // actually took place. Likely because Loader waits until the next event loop
2595+ // iteration to do its work. So to ensure the reload, we will wait until the
2596+ // ApplicationWindow instance gets destroyed.
2597+ // Another thing that happens is that we do get a new object but the old one doesn't get
2598+ // deleted, so you end up with two instances in memory.
2599+ tryCompare(applicationWindowLoader, "itemDestroyed", true);
2600+
2601 appStateSelector.selectedIndex = 0;
2602- cleanupSession();
2603-
2604- if (fakeApplication.session)
2605- fakeApplication.session.release();
2606+ sessionCheckbox.checked = false;
2607
2608 applicationWindowLoader.active = true;
2609 }
2610@@ -372,15 +379,18 @@
2611
2612 waitUntilTransitionsEnd(stateGroup);
2613
2614- var fakeSurface = fakeSession.surface;
2615- fakeSurface.touchPressCount = 0;
2616- fakeSurface.touchReleaseCount = 0;
2617+ var surfaceItem = findChild(applicationWindowLoader.item, "surfaceItem");
2618+ verify(surfaceItem);
2619+ verify(surfaceItem.surface === fakeSession.surface);
2620+
2621+ surfaceItem.touchPressCount = 0;
2622+ surfaceItem.touchReleaseCount = 0;
2623
2624 tap(applicationWindowLoader.item,
2625 applicationWindowLoader.item.width / 2, applicationWindowLoader.item.height / 2);
2626
2627- verify(fakeSurface.touchPressCount === 1);
2628- verify(fakeSurface.touchReleaseCount === 1);
2629+ verify(surfaceItem.touchPressCount === 1);
2630+ verify(surfaceItem.touchReleaseCount === 1);
2631 }
2632
2633 function test_showNothingOnSuddenSurfaceLoss() {
2634@@ -389,9 +399,9 @@
2635 tryCompare(stateGroup, "state", "surface");
2636 waitUntilTransitionsEnd(stateGroup);
2637
2638- cleanupSession();
2639+ sessionControl.surfaceCheckbox.checked = false;
2640
2641- verify(stateGroup.state === "void");
2642+ tryCompare(stateGroup, "state", "void");
2643 }
2644
2645 function test_surfaceActiveFocusFollowsAppWindowInterative() {
2646
2647=== modified file 'tests/qmltests/Stages/tst_SurfaceContainer.qml'
2648--- tests/qmltests/Stages/tst_SurfaceContainer.qml 2015-06-25 19:24:41 +0000
2649+++ tests/qmltests/Stages/tst_SurfaceContainer.qml 2015-08-14 11:40:06 +0000
2650@@ -70,12 +70,12 @@
2651
2652 if (checked) {
2653 var fakeSurface = SurfaceManager.createSurface("fake-surface",
2654- MirSurfaceItem.Normal,
2655- MirSurfaceItem.Restored,
2656+ Mir.NormalType,
2657+ Mir.RestoredState,
2658 Qt.resolvedUrl("../Dash/artwork/music-player-design.png"));
2659 surfaceContainerLoader.item.surface = fakeSurface;
2660 } else {
2661- ApplicationTest.removeSurface(surfaceContainerLoader.item.surface);
2662+ surfaceContainerLoader.item.surface.setLive(false);
2663 }
2664 }
2665 }
2666@@ -121,70 +121,64 @@
2667 interactiveCheckbox.checked = true;
2668 }
2669
2670- /*
2671- Add a first surface. Then remove it. Then add a second surface.
2672- That second surface should be properly sized.
2673-
2674- Regression test for https://bugs.launchpad.net/ubuntu/+source/qtmir/+bug/1359819
2675- */
2676- function test_resetSurfaceGetsProperlySized() {
2677- surfaceCheckbox.checked = true;
2678- surfaceCheckbox.checked = false;
2679- surfaceCheckbox.checked = true;
2680- var fakeSurface = surfaceContainerLoader.item.surface;
2681- compare(fakeSurface.width, surfaceContainerLoader.item.width);
2682- compare(fakeSurface.height, surfaceContainerLoader.item.height);
2683- }
2684-
2685 function test_animateRemoval() {
2686 surfaceCheckbox.checked = true;
2687
2688 verify(surfaceContainer.surface !== null);
2689
2690- ApplicationTest.removeSurface(surfaceContainer.surface);
2691+ surfaceContainer.surface.setLive(false);
2692
2693 compare(surfaceContainer.state, "zombie");
2694 tryCompare(surfaceContainer, "surface", null);
2695 }
2696
2697- function test_surfaceGetsNoTouchesWhenContainerNotInteractive() {
2698+ function test_surfaceItemGetsNoTouchesWhenContainerNotInteractive() {
2699 surfaceCheckbox.checked = true;
2700 verify(surfaceContainer.surface !== null);
2701
2702- surfaceContainer.surface.touchPressCount = 0;
2703- surfaceContainer.surface.touchReleaseCount = 0;
2704+ var surfaceItem = findChild(surfaceContainer, "surfaceItem");
2705+ verify(surfaceItem !== null);
2706+
2707+ surfaceItem.touchPressCount = 0;
2708+ surfaceItem.touchReleaseCount = 0;
2709
2710 tap(surfaceContainer, surfaceContainer.width / 2, surfaceContainer.height / 2);
2711
2712 // surface got touches as the surfaceContainer is interactive
2713- compare(surfaceContainer.surface.touchPressCount, 1)
2714- compare(surfaceContainer.surface.touchReleaseCount, 1);
2715+ compare(surfaceItem.touchPressCount, 1)
2716+ compare(surfaceItem.touchReleaseCount, 1);
2717
2718 interactiveCheckbox.checked = false;
2719 tap(surfaceContainer, surfaceContainer.width / 2, surfaceContainer.height / 2);
2720
2721 // surface shouldn't get the touches from the second tap as the surfaceContainer
2722 // was *not* interactive when it happened.
2723- compare(surfaceContainer.surface.touchPressCount, 1)
2724- compare(surfaceContainer.surface.touchReleaseCount, 1);
2725+ compare(surfaceItem.touchPressCount, 1)
2726+ compare(surfaceItem.touchReleaseCount, 1);
2727 }
2728
2729- function test_surfaceGetsActiveFocusOnMousePress() {
2730+ function test_surfaceItemGetsActiveFocusOnMousePress() {
2731 surfaceCheckbox.checked = true;
2732 verify(surfaceContainer.surface !== null);
2733
2734- compare(surfaceContainer.surface.activeFocus, false);
2735+ var surfaceItem = findChild(surfaceContainer, "surfaceItem");
2736+ verify(surfaceItem !== null);
2737+
2738+ compare(surfaceItem.activeFocus, false);
2739 mouseClick(surfaceContainer);
2740- compare(surfaceContainer.surface.activeFocus, true);
2741+ compare(surfaceItem.activeFocus, true);
2742 }
2743
2744- function test_surfaceGetsActiveFocusOnTap() {
2745+ function test_surfaceItemGetsActiveFocusOnTap() {
2746 surfaceCheckbox.checked = true;
2747 verify(surfaceContainer.surface !== null);
2748
2749- compare(surfaceContainer.surface.activeFocus, false);
2750+ var surfaceItem = findChild(surfaceContainer, "surfaceItem");
2751+ verify(surfaceItem !== null);
2752+
2753+ compare(surfaceItem.activeFocus, false);
2754 tap(surfaceContainer);
2755- compare(surfaceContainer.surface.activeFocus, true);
2756+ compare(surfaceItem.activeFocus, true);
2757 }
2758 }
2759 }
2760
2761=== renamed file 'tests/qmltests/Stages/tst_WindowMoveResizeArea.qml' => 'tests/qmltests/Stages/tst_WindowResizeArea.qml'
2762--- tests/qmltests/Stages/tst_WindowMoveResizeArea.qml 2015-05-01 10:24:08 +0000
2763+++ tests/qmltests/Stages/tst_WindowResizeArea.qml 2015-08-14 11:40:06 +0000
2764@@ -36,24 +36,24 @@
2765
2766 Item {
2767 id: fakeWindow
2768- property alias minWidth: moveResizeArea.minWidth
2769- property alias minHeight: moveResizeArea.minHeight
2770+ property alias minWidth: windowResizeArea.minWidth
2771+ property alias minHeight: windowResizeArea.minHeight
2772 x: units.gu(20)
2773 y: units.gu(20)
2774 height: units.gu(20)
2775 width: units.gu(20)
2776
2777- WindowMoveResizeArea {
2778- id: moveResizeArea
2779+ WindowResizeArea {
2780+ id: windowResizeArea
2781 target: fakeWindow
2782- resizeHandleWidth: units.gu(0.5)
2783+ borderThickness: units.gu(0.5)
2784 minWidth: units.gu(15)
2785 minHeight: units.gu(10)
2786 windowId: "test-window-id"
2787 }
2788
2789 Rectangle {
2790- anchors.fill: moveResizeArea
2791+ anchors.fill: windowResizeArea
2792 color: "red"
2793 }
2794
2795@@ -80,34 +80,6 @@
2796 fakeWindow.height = units.gu(20)
2797 }
2798
2799- function test_dragWindow_data() {
2800- return [
2801- { tag: "up", dx: 0, dy: units.gu(-10) },
2802- { tag: "down", dx: 0, dy: units.gu(10) },
2803- { tag: "left", dx: units.gu(-10), dy: 0 },
2804- { tag: "right", dx: units.gu(10), dy: 0 },
2805- { tag: "right/down", dx: units.gu(10), dy: units.gu(10) },
2806- { tag: "left/down", dx: units.gu(-10), dy: units.gu(10) }
2807- ]
2808- }
2809-
2810- function test_dragWindow(data) {
2811- var initialWindowX = fakeWindow.x;
2812- var initialWindowY = fakeWindow.y;
2813- var initialWindowWidth = fakeWindow.width
2814- var initialWindowHeight = fakeWindow.height
2815-
2816- var startDragX = initialWindowX + fakeWindow.width / 2;
2817- var startDragY = initialWindowY + fakeWindow.height / 2;
2818- mouseFlick(root, startDragX, startDragY, startDragX + data.dx, startDragY + data.dy, true, true, units.gu(.5), 10)
2819-
2820- tryCompare(fakeWindow, "x", initialWindowX + data.dx)
2821- tryCompare(fakeWindow, "y", initialWindowX + data.dy)
2822-
2823- compare(fakeWindow.height, initialWindowHeight);
2824- compare(fakeWindow.width, initialWindowWidth);
2825- }
2826-
2827 function test_resizeWindowRightBottom_data() {
2828 return [
2829 { tag: "width", dx: units.gu(10), dy: 0 },
2830
2831=== modified file 'tests/qmltests/tst_OrientedShell.qml'
2832--- tests/qmltests/tst_OrientedShell.qml 2015-07-14 13:23:49 +0000
2833+++ tests/qmltests/tst_OrientedShell.qml 2015-08-14 11:40:06 +0000
2834@@ -264,6 +264,10 @@
2835 text: "Usage Mode"
2836 model: ["Staged", "Windowed", "Automatic"]
2837 }
2838+ MouseTouchEmulationCheckbox {
2839+ checked: true
2840+ color: "white"
2841+ }
2842 Button {
2843 text: "Switch fullscreen"
2844 activeFocusOnPress: false
2845@@ -280,9 +284,9 @@
2846 onCheckedChanged: {
2847 var surface = SurfaceManager.inputMethodSurface();
2848 if (checked) {
2849- surface.setState(MirSurfaceItem.Restored);
2850+ surface.setState(Mir.RestoredState);
2851 } else {
2852- surface.setState(MirSurfaceItem.Minimized);
2853+ surface.setState(Mir.MinimizedState);
2854 }
2855 }
2856 }
2857@@ -415,22 +419,22 @@
2858 compare(dashApp.stage, ApplicationInfoInterface.MainStage);
2859
2860 tryCompareFunction(function(){return dashApp.session.surface != null;}, true);
2861- verify(checkAppSurfaceOrientation(dashApp, root.primaryOrientationAngle));
2862+ verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
2863
2864 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
2865 rotateTo(90);
2866
2867- verify(checkAppSurfaceOrientation(dashApp, root.primaryOrientationAngle));
2868+ verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
2869 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
2870
2871 rotateTo(180);
2872
2873- verify(checkAppSurfaceOrientation(dashApp, root.primaryOrientationAngle));
2874+ verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
2875 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
2876
2877 rotateTo(270);
2878
2879- verify(checkAppSurfaceOrientation(dashApp, root.primaryOrientationAngle));
2880+ verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
2881 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
2882 }
2883
2884@@ -1200,18 +1204,13 @@
2885 }
2886
2887 // expectedAngle is in orientedShell's coordinate system
2888- function checkAppSurfaceOrientation(app, expectedAngle) {
2889+ function checkAppSurfaceOrientation(item, app, expectedAngle) {
2890 var surface = app.session.surface;
2891 if (!surface) {
2892 console.warn("no surface");
2893 return false;
2894 }
2895
2896- if (!itemIsChildOfOrientedShell(surface)) {
2897- console.warn("surface not a child of OrientedShell");
2898- return false;
2899- }
2900-
2901 var topMargin = 0.;
2902 if (!app.fullscreen) {
2903 var appsDisplayLoader = findChild(shell, "applicationsDisplayLoader");
2904@@ -1221,7 +1220,12 @@
2905 topMargin = appsDisplayLoader.item.maximizedAppTopMargin;
2906 }
2907
2908- var point = surface.mapToItem(orientedShell, 0, 0);
2909+ var surfaceItem = findSurfaceItem(item, surface);
2910+ if (!surfaceItem) {
2911+ console.warn("no surfaceItem rendering app surface");
2912+ return false;
2913+ }
2914+ var point = surfaceItem.mapToItem(orientedShell, 0, 0);
2915
2916 switch (expectedAngle) {
2917 case 0:
2918@@ -1235,14 +1239,22 @@
2919 }
2920 }
2921
2922- function itemIsChildOfOrientedShell(item) {
2923- var parent = item.parent;
2924- var found = false;
2925- while (parent && !found) {
2926- found = parent === orientedShell;
2927- parent = parent.parent;
2928+ function findSurfaceItem(obj, surface) {
2929+ var childs = new Array(0);
2930+ childs.push(obj)
2931+ while (childs.length > 0) {
2932+ console.log("Checking " + childs[0].objectName);
2933+ if (childs[0].objectName === "surfaceItem"
2934+ && childs[0].surface !== undefined
2935+ && childs[0].surface === surface) {
2936+ return childs[0];
2937+ }
2938+ for (var i in childs[0].children) {
2939+ childs.push(childs[0].children[i])
2940+ }
2941+ childs.splice(0, 1);
2942 }
2943- return found;
2944+ return null;
2945 }
2946 }
2947 }
2948
2949=== modified file 'tests/qmltests/tst_Shell.qml'
2950--- tests/qmltests/tst_Shell.qml 2015-08-12 08:41:17 +0000
2951+++ tests/qmltests/tst_Shell.qml 2015-08-14 11:40:06 +0000
2952@@ -726,19 +726,19 @@
2953 var item = findChild(shell, "inputMethod");
2954 var surface = SurfaceManager.inputMethodSurface();
2955
2956- surface.setState(MirSurfaceItem.Minimized);
2957- tryCompare(item, "visible", false);
2958-
2959- surface.setState(MirSurfaceItem.Restored);
2960- tryCompare(item, "visible", true);
2961-
2962- surface.setState(MirSurfaceItem.Minimized);
2963- tryCompare(item, "visible", false);
2964-
2965- surface.setState(MirSurfaceItem.Maximized);
2966- tryCompare(item, "visible", true);
2967-
2968- surface.setState(MirSurfaceItem.Minimized);
2969+ surface.setState(Mir.MinimizedState);
2970+ tryCompare(item, "visible", false);
2971+
2972+ surface.setState(Mir.RestoredState);
2973+ tryCompare(item, "visible", true);
2974+
2975+ surface.setState(Mir.MinimizedState);
2976+ tryCompare(item, "visible", false);
2977+
2978+ surface.setState(Mir.MaximizedState);
2979+ tryCompare(item, "visible", true);
2980+
2981+ surface.setState(Mir.MinimizedState);
2982 tryCompare(item, "visible", false);
2983 }
2984
2985@@ -1112,20 +1112,20 @@
2986
2987 waitUntilFocusedApplicationIsShowingItsSurface();
2988
2989- var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;
2990- verify(topmostSurface);
2991+ var topmostSurfaceItem = findChild(topmostSpreadDelegate, "surfaceItem");
2992+ verify(topmostSurfaceItem);
2993
2994 var rightEdgeDragArea = findChild(shell, "spreadDragArea");
2995- topmostSurface.touchPressCount = 0;
2996- topmostSurface.touchReleaseCount = 0;
2997+ topmostSurfaceItem.touchPressCount = 0;
2998+ topmostSurfaceItem.touchReleaseCount = 0;
2999
3000 var tapPoint = rightEdgeDragArea.mapToItem(shell, rightEdgeDragArea.width / 2,
3001 rightEdgeDragArea.height / 2);
3002
3003 tap(shell, tapPoint.x, tapPoint.y);
3004
3005- tryCompare(topmostSurface, "touchPressCount", 1);
3006- tryCompare(topmostSurface, "touchReleaseCount", 1);
3007+ tryCompare(topmostSurfaceItem, "touchPressCount", 1);
3008+ tryCompare(topmostSurfaceItem, "touchReleaseCount", 1);
3009 }
3010
3011 /*
3012@@ -1137,11 +1137,11 @@
3013 loadShell("phone");
3014 swipeAwayGreeter();
3015 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
3016- var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;
3017+ var topmostSurfaceItem = findChild(topmostSpreadDelegate, "surfaceItem");
3018 var rightEdgeDragArea = findChild(shell, "spreadDragArea");
3019
3020- topmostSurface.touchPressCount = 0;
3021- topmostSurface.touchReleaseCount = 0;
3022+ topmostSurfaceItem.touchPressCount = 0;
3023+ topmostSurfaceItem.touchReleaseCount = 0;
3024
3025 var gestureStartPoint = rightEdgeDragArea.mapToItem(shell, rightEdgeDragArea.width / 2,
3026 rightEdgeDragArea.height / 2);
3027@@ -1150,8 +1150,8 @@
3028 gestureStartPoint.x /* fromX */, gestureStartPoint.y /* fromY */,
3029 units.gu(1) /* toX */, gestureStartPoint.y /* toY */);
3030
3031- tryCompare(topmostSurface, "touchPressCount", 0);
3032- tryCompare(topmostSurface, "touchReleaseCount", 0);
3033+ tryCompare(topmostSurfaceItem, "touchPressCount", 0);
3034+ tryCompare(topmostSurfaceItem, "touchReleaseCount", 0);
3035 }
3036
3037 function waitUntilFocusedApplicationIsShowingItsSurface()

Subscribers

People subscribed via source and target branches