Merge lp:~nick-dedekind/unity8/shell_chrome into lp:unity8

Proposed by Nick Dedekind
Status: Superseded
Proposed branch: lp:~nick-dedekind/unity8/shell_chrome
Merge into: lp:unity8
Diff against target: 835 lines (+341/-27)
20 files modified
CMakeLists.txt (+1/-1)
debian/control (+3/-3)
qml/Shell.qml (+5/-1)
qml/Stages/AbstractStage.qml (+2/-0)
qml/Stages/DesktopFullscreenPolicy.qml (+40/-0)
qml/Stages/DesktopStage.qml (+61/-9)
qml/Stages/PhoneFullscreenPolicy.qml (+53/-0)
qml/Stages/PhoneStage.qml (+10/-0)
qml/Stages/TabletStage.qml (+10/-0)
qml/Stages/WindowResizeArea.qml (+1/-1)
tests/mocks/Unity/Application/ApplicationInfo.cpp (+21/-3)
tests/mocks/Unity/Application/ApplicationInfo.h (+5/-1)
tests/mocks/Unity/Application/ApplicationManager.cpp (+3/-4)
tests/mocks/Unity/Application/MirSurface.cpp (+16/-0)
tests/mocks/Unity/Application/MirSurface.h (+5/-3)
tests/mocks/Unity/Application/MirSurfaceItem.cpp (+9/-0)
tests/mocks/Unity/Application/MirSurfaceItem.h (+1/-0)
tests/mocks/Unity/Application/Session.cpp (+26/-1)
tests/mocks/Unity/Application/Session.h (+7/-0)
tests/qmltests/tst_Shell.qml (+62/-0)
To merge this branch: bzr merge lp:~nick-dedekind/unity8/shell_chrome
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity8 CI Bot continuous-integration Needs Fixing
Unity Team Pending
Review via email: mp+286306@code.launchpad.net

This proposal has been superseded by a proposal from 2016-02-17.

Commit message

Add support for low shell chrome.

Description of the change

* Are there any related MPs required for this MP to build/function as expected? Please list.
https://code.launchpad.net/~nick-dedekind/unity-api/shell_chrome/+merge/286309
https://code.launchpad.net/~nick-dedekind/qtmir/shell_chrome/+merge/286307
https://code.launchpad.net/~nick-dedekind/qtubuntu/shell_chrome/+merge/286308

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * Did you make sure that your branch does not contain spurious tags?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
No

To post a comment you must log in.
2208. By Nick Dedekind

whitespace

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

+++ qml/Shell.qml
+ property string qmlComponent: {
could be readonly.

+++ qml/Stages/AbstractStage.qml
+ signal stageUnloaded
Why can you not depend on the already-existing Component.onDestruction signal? Is it happening too late?

Also when this is fired, the stage as not yet been unloaded. stageAboutToBeUnloaded would be a more accurate name :)

So I see you use it here:
+ property bool saveStateOnDestruction: true
+ Connections {
+ target: root
+ onStageUnloaded: {
+ resizeArea.saveWindowState();
+ resizeArea.saveStateOnDestruction = false;
+ fullscreenPolicy.active = false;
+ }
+ }
+ Component.onDestruction: {
+ if (saveStateOnDestruction) {
+ saveWindowState();
+ }
+ }
this is strange code. It looks like you are waiting for 2 events to save the windowState, and save on the first event. This is really strange looking, you need to justify it, and why Component.onDestruction is not enough. I do know that object destruction order is not guaranteed, is that it? If so, then why use it at all?

+++ qml/Stages/DesktopFullscreenPolicy.qml
this doesn't need to be an item, it doesn't contain anything visual. This can just be a single QtObject. You might be able to import QtQml instead of QtQuick too. lastSurface can be readonly too. Indent of the 'if" statement not clear.

I don't understand why it doesn't apply on the first surface. Could you also write a comment to explain the policy?

+++ qml/Stages/PhoneFullscreenPolicy.qml
I also suspect this could be a QtObject (am not sure if Connections will work inside QtObject though). It is odd to see "PhoneFullscreenPolicy" mentioned in TabletStage - would there be a better name? I'd also like a textual comment explaining what the policy is doing.

Why does this not have the first surface branch the Desktop policy has?

=== modified file 'qml/Stages/DesktopStage.qml'
- property alias requestedWidth: decoratedWindow.requestedWidth
- property alias requestedHeight: decoratedWindow.requestedHeight
+ property int requestedWidth: -1
+ property int requestedHeight: -1
why? You overriding the requested width/height? Or just because you animate them?

+++ tests/qmltests/tst_Shell.qml
just to confirm you mean to return the bool result of the comparison:
+ controls.focusedSurface.state === Mir.FullscreenState
Do we all know that JS returns the result of the last statement, if nothing is explicitly returned?

Revision history for this message
Gerry Boland (gerboland) wrote :

I still need to test on devices

Unmerged revisions

2200. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2016-02-12 00:12:30 +0000
+++ CMakeLists.txt 2016-02-17 14:46:08 +0000
@@ -57,7 +57,7 @@
57find_package(Qt5Concurrent 5.4 REQUIRED)57find_package(Qt5Concurrent 5.4 REQUIRED)
58find_package(Qt5Sql 5.4 REQUIRED)58find_package(Qt5Sql 5.4 REQUIRED)
5959
60pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=13)60pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=14)
61pkg_check_modules(GIO REQUIRED gio-2.0>=2.32)61pkg_check_modules(GIO REQUIRED gio-2.0>=2.32)
62pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32)62pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32)
63pkg_check_modules(QMENUMODEL REQUIRED qmenumodel)63pkg_check_modules(QMENUMODEL REQUIRED qmenumodel)
6464
=== modified file 'debian/control'
--- debian/control 2016-02-12 00:12:30 +0000
+++ debian/control 2016-02-17 14:46:08 +0000
@@ -29,7 +29,7 @@
29 libqt5xmlpatterns5-dev,29 libqt5xmlpatterns5-dev,
30 libsystemsettings-dev,30 libsystemsettings-dev,
31 libudev-dev,31 libudev-dev,
32 libunity-api-dev (>= 7.106),32 libunity-api-dev (>= 7.107),
33 libusermetricsoutput1-dev,33 libusermetricsoutput1-dev,
34# Need those X11 libs touch emulation from mouse events in manual QML tests on a X11 desktop34# Need those X11 libs touch emulation from mouse events in manual QML tests on a X11 desktop
35 libx11-dev[!armhf],35 libx11-dev[!armhf],
@@ -131,7 +131,7 @@
131 qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 1.3.1627) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 1.3.1627),131 qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 1.3.1627) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 1.3.1627),
132 qtdeclarative5-unity-notifications-plugin (>= 0.1.2) | unity-notifications-impl,132 qtdeclarative5-unity-notifications-plugin (>= 0.1.2) | unity-notifications-impl,
133 ubuntu-thumbnailer-impl-0,133 ubuntu-thumbnailer-impl-0,
134 unity-application-impl-13,134 unity-application-impl-14,
135 unity-notifications-impl-3,135 unity-notifications-impl-3,
136 unity-plugin-scopes | unity-scopes-impl,136 unity-plugin-scopes | unity-scopes-impl,
137 unity-scopes-impl-9,137 unity-scopes-impl-9,
@@ -177,7 +177,7 @@
177Depends: ${misc:Depends},177Depends: ${misc:Depends},
178 ${shlibs:Depends},178 ${shlibs:Depends},
179Provides: unity-application-impl,179Provides: unity-application-impl,
180 unity-application-impl-13,180 unity-application-impl-14,
181Replaces: unity8-autopilot (<< 8.02+15.04.20150422-0ubuntu1)181Replaces: unity8-autopilot (<< 8.02+15.04.20150422-0ubuntu1)
182Description: Fake environment for running Unity 8 shell182Description: Fake environment for running Unity 8 shell
183 Provides fake implementations of some QML modules used by Unity 8 shell183 Provides fake implementations of some QML modules used by Unity 8 shell
184184
=== modified file 'qml/Shell.qml'
--- qml/Shell.qml 2016-01-28 18:25:14 +0000
+++ qml/Shell.qml 2016-02-17 14:46:08 +0000
@@ -242,7 +242,7 @@
242 property string usageScenario: shell.usageScenario === "phone" || greeter.hasLockedApp242 property string usageScenario: shell.usageScenario === "phone" || greeter.hasLockedApp
243 ? "phone"243 ? "phone"
244 : shell.usageScenario244 : shell.usageScenario
245 source: {245 property string qmlComponent: {
246 if(shell.mode === "greeter") {246 if(shell.mode === "greeter") {
247 return "Stages/ShimStage.qml"247 return "Stages/ShimStage.qml"
248 } else if (applicationsDisplayLoader.usageScenario === "phone") {248 } else if (applicationsDisplayLoader.usageScenario === "phone") {
@@ -253,6 +253,10 @@
253 return "Stages/DesktopStage.qml";253 return "Stages/DesktopStage.qml";
254 }254 }
255 }255 }
256 onQmlComponentChanged: {
257 if (item) item.stageUnloaded();
258 source = qmlComponent;
259 }
256260
257 property bool interactive: tutorial.spreadEnabled261 property bool interactive: tutorial.spreadEnabled
258 && (!greeter || !greeter.shown)262 && (!greeter || !greeter.shown)
259263
=== modified file 'qml/Stages/AbstractStage.qml'
--- qml/Stages/AbstractStage.qml 2016-01-14 13:03:20 +0000
+++ qml/Stages/AbstractStage.qml 2016-02-17 14:46:08 +0000
@@ -49,6 +49,8 @@
49 | Qt.InvertedPortraitOrientation49 | Qt.InvertedPortraitOrientation
50 | Qt.InvertedLandscapeOrientation50 | Qt.InvertedLandscapeOrientation
5151
52 signal stageUnloaded
53
52 // Shared code for use in stage implementations54 // Shared code for use in stage implementations
53 GSettings {55 GSettings {
54 id: lifecycleExceptions56 id: lifecycleExceptions
5557
=== added file 'qml/Stages/DesktopFullscreenPolicy.qml'
--- qml/Stages/DesktopFullscreenPolicy.qml 1970-01-01 00:00:00 +0000
+++ qml/Stages/DesktopFullscreenPolicy.qml 2016-02-17 14:46:08 +0000
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import Unity.Application 0.1
19
20Item {
21 property bool active: true
22 property QtObject application: null
23
24 QtObject {
25 id: priv
26 property bool firstTimeSurface: true
27 property var lastSurface: application && application.session ?
28 application.session.lastSurface : null
29 onLastSurfaceChanged: {
30 if (!active || !lastSurface) return;
31 if (!firstTimeSurface) return;
32 firstTimeSurface = false;
33
34 if (lastSurface.state === Mir.FullscreenState &&
35 lastSurface.shellChrome === Mir.LowChrome) {
36 lastSurface.state = Mir.RestoredState;
37 }
38 }
39 }
40}
041
=== modified file 'qml/Stages/DesktopStage.qml'
--- qml/Stages/DesktopStage.qml 2016-02-03 14:00:47 +0000
+++ qml/Stages/DesktopStage.qml 2016-02-17 14:46:08 +0000
@@ -254,8 +254,8 @@
254 focus: appId === priv.focusedAppId254 focus: appId === priv.focusedAppId
255 width: decoratedWindow.width255 width: decoratedWindow.width
256 height: decoratedWindow.height256 height: decoratedWindow.height
257 property alias requestedWidth: decoratedWindow.requestedWidth257 property int requestedWidth: -1
258 property alias requestedHeight: decoratedWindow.requestedHeight258 property int requestedHeight: -1
259 property alias minimumWidth: decoratedWindow.minimumWidth259 property alias minimumWidth: decoratedWindow.minimumWidth
260 property alias minimumHeight: decoratedWindow.minimumHeight260 property alias minimumHeight: decoratedWindow.minimumHeight
261 property alias maximumWidth: decoratedWindow.maximumWidth261 property alias maximumWidth: decoratedWindow.maximumWidth
@@ -372,20 +372,40 @@
372 PropertyChanges {372 PropertyChanges {
373 target: appDelegate;373 target: appDelegate;
374 x: 0; y: 0;374 x: 0; y: 0;
375 requestedWidth: root.width; requestedHeight: root.height;
376 visuallyMinimized: false;375 visuallyMinimized: false;
377 visuallyMaximized: true376 visuallyMaximized: true
378 }377 }
378 PropertyChanges {
379 target: decoratedWindow
380 requestedWidth: root.width;
381 requestedHeight: root.height;
382 }
379 },383 },
380 State {384 State {
381 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized385 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
382 PropertyChanges { target: appDelegate; x: 0; y: PanelState.panelHeight;386 PropertyChanges {
383 requestedWidth: root.width/2; requestedHeight: root.height - PanelState.panelHeight }387 target: appDelegate;
388 x: 0;
389 y: PanelState.panelHeight;
390 }
391 PropertyChanges {
392 target: decoratedWindow
393 requestedWidth: root.width/2
394 requestedHeight: root.height - PanelState.panelHeight
395 }
384 },396 },
385 State {397 State {
386 name: "maximizedRight"; when: appDelegate.maximizedRight && !appDelegate.minimized398 name: "maximizedRight"; when: appDelegate.maximizedRight && !appDelegate.minimized
387 PropertyChanges { target: appDelegate; x: root.width/2; y: PanelState.panelHeight;399 PropertyChanges {
388 requestedWidth: root.width/2; requestedHeight: root.height - PanelState.panelHeight }400 target: appDelegate;
401 x: root.width/2;
402 y: PanelState.panelHeight
403 }
404 PropertyChanges {
405 target: decoratedWindow
406 requestedWidth: root.width/2;
407 requestedHeight: root.height - PanelState.panelHeight
408 }
389 },409 },
390 State {410 State {
391 name: "minimized"; when: appDelegate.minimized411 name: "minimized"; when: appDelegate.minimized
@@ -405,13 +425,17 @@
405 enabled: appDelegate.animationsEnabled425 enabled: appDelegate.animationsEnabled
406 PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }426 PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }
407 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }427 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }
428 UbuntuNumberAnimation { target: decoratedWindow; properties: "requestedWidth,requestedHeight"; duration: UbuntuAnimation.FastDuration }
408 },429 },
409 Transition {430 Transition {
410 to: "minimized"431 to: "minimized"
411 enabled: appDelegate.animationsEnabled432 enabled: appDelegate.animationsEnabled
412 PropertyAction { target: appDelegate; property: "visuallyMaximized" }433 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
413 SequentialAnimation {434 SequentialAnimation {
414 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }435 ParallelAnimation {
436 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,scale"; duration: UbuntuAnimation.FastDuration }
437 UbuntuNumberAnimation { target: decoratedWindow; properties: "requestedWidth,requestedHeight"; duration: UbuntuAnimation.FastDuration }
438 }
415 PropertyAction { target: appDelegate; property: "visuallyMinimized" }439 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
416 ScriptAction {440 ScriptAction {
417 script: {441 script: {
@@ -427,7 +451,10 @@
427 enabled: appDelegate.animationsEnabled451 enabled: appDelegate.animationsEnabled
428 PropertyAction { target: appDelegate; property: "visuallyMinimized" }452 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
429 SequentialAnimation {453 SequentialAnimation {
430 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }454 ParallelAnimation {
455 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,scale"; duration: UbuntuAnimation.FastDuration }
456 UbuntuNumberAnimation { target: decoratedWindow; properties: "requestedWidth,requestedHeight"; duration: UbuntuAnimation.FastDuration }
457 }
431 PropertyAction { target: appDelegate; property: "visuallyMaximized" }458 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
432 }459 }
433 }460 }
@@ -442,6 +469,7 @@
442 }469 }
443470
444 WindowResizeArea {471 WindowResizeArea {
472 id: resizeArea
445 objectName: "windowResizeArea"473 objectName: "windowResizeArea"
446 target: appDelegate474 target: appDelegate
447 minWidth: units.gu(10)475 minWidth: units.gu(10)
@@ -452,6 +480,21 @@
452 screenHeight: root.height480 screenHeight: root.height
453481
454 onPressed: { ApplicationManager.focusApplication(model.appId) }482 onPressed: { ApplicationManager.focusApplication(model.appId) }
483
484 property bool saveStateOnDestruction: true
485 Connections {
486 target: root
487 onStageUnloaded: {
488 resizeArea.saveWindowState();
489 resizeArea.saveStateOnDestruction = false;
490 fullscreenPolicy.active = false;
491 }
492 }
493 Component.onDestruction: {
494 if (saveStateOnDestruction) {
495 saveWindowState();
496 }
497 }
455 }498 }
456499
457 DecoratedWindow {500 DecoratedWindow {
@@ -463,12 +506,21 @@
463 active: ApplicationManager.focusedApplicationId === model.appId506 active: ApplicationManager.focusedApplicationId === model.appId
464 focus: true507 focus: true
465508
509 requestedWidth: appDelegate.requestedWidth
510 requestedHeight: appDelegate.requestedHeight
511
466 onClose: ApplicationManager.stopApplication(model.appId)512 onClose: ApplicationManager.stopApplication(model.appId)
467 onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight513 onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
468 ? appDelegate.restoreFromMaximized() : appDelegate.maximize()514 ? appDelegate.restoreFromMaximized() : appDelegate.maximize()
469 onMinimize: appDelegate.minimize()515 onMinimize: appDelegate.minimize()
470 onDecorationPressed: { ApplicationManager.focusApplication(model.appId) }516 onDecorationPressed: { ApplicationManager.focusApplication(model.appId) }
471 }517 }
518
519 DesktopFullscreenPolicy {
520 id: fullscreenPolicy
521 active: true
522 application: decoratedWindow.application
523 }
472 }524 }
473 }525 }
474 }526 }
475527
=== added file 'qml/Stages/PhoneFullscreenPolicy.qml'
--- qml/Stages/PhoneFullscreenPolicy.qml 1970-01-01 00:00:00 +0000
+++ qml/Stages/PhoneFullscreenPolicy.qml 2016-02-17 14:46:08 +0000
@@ -0,0 +1,53 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import Unity.Application 0.1
19
20Item {
21 property bool active: true
22 property QtObject application: null
23
24 QtObject {
25 id: priv
26 property var lastSurface: application && application.session ?
27 application.session.lastSurface : null
28 onLastSurfaceChanged: {
29 if (!active || !lastSurface) return;
30 if (lastSurface.shellChrome === Mir.LowChrome) {
31 lastSurface.state = Mir.FullscreenState;
32 }
33 }
34 }
35
36 Connections {
37 target: priv.lastSurface
38 onShellChromeChanged: {
39 if (!active || !priv.lastSurface) return;
40 if (priv.lastSurface.shellChrome === Mir.LowChrome || priv.lastSurface.state == Mir.FullscreenState) {
41 priv.lastSurface.state = Mir.FullscreenState;
42 } else {
43 priv.lastSurface.state = Mir.RestoredState;
44 }
45 }
46 onStateChanged: {
47 if (!active) return;
48 if (priv.lastSurface.state === Mir.RestoredState && priv.lastSurface.shellChrome === Mir.LowChrome) {
49 priv.lastSurface.state = Mir.FullscreenState;
50 }
51 }
52 }
53}
054
=== modified file 'qml/Stages/PhoneStage.qml'
--- qml/Stages/PhoneStage.qml 2016-01-14 13:03:20 +0000
+++ qml/Stages/PhoneStage.qml 2016-02-17 14:46:08 +0000
@@ -580,6 +580,16 @@
580 property: "focusedAppOrientationChangesEnabled"580 property: "focusedAppOrientationChangesEnabled"
581 value: orientationChangesEnabled581 value: orientationChangesEnabled
582 }582 }
583
584 PhoneFullscreenPolicy {
585 id: fullscreenPolicy
586 application: appDelegate.application
587
588 Connections {
589 target: root
590 onStageUnloaded: fullscreenPolicy.active = false
591 }
592 }
583 }593 }
584 }594 }
585 }595 }
586596
=== modified file 'qml/Stages/TabletStage.qml'
--- qml/Stages/TabletStage.qml 2016-01-14 13:03:20 +0000
+++ qml/Stages/TabletStage.qml 2016-02-17 14:46:08 +0000
@@ -743,6 +743,16 @@
743 period: (spreadView.positionMarker2 - spreadView.positionMarker1) / 3743 period: (spreadView.positionMarker2 - spreadView.positionMarker1) / 3
744 progress: spreadTile.progress - spreadView.positionMarker1744 progress: spreadTile.progress - spreadView.positionMarker1
745 }745 }
746
747 PhoneFullscreenPolicy {
748 id: fullscreenPolicy
749 application: spreadTile.application
750
751 Connections {
752 target: root
753 onStageUnloaded: fullscreenPolicy.active = false
754 }
755 }
746 }756 }
747 }757 }
748 }758 }
749759
=== modified file 'qml/Stages/WindowResizeArea.qml'
--- qml/Stages/WindowResizeArea.qml 2016-02-03 14:00:47 +0000
+++ qml/Stages/WindowResizeArea.qml 2016-02-17 14:46:08 +0000
@@ -84,7 +84,7 @@
84 priv.updateNormalGeometry();84 priv.updateNormalGeometry();
85 }85 }
8686
87 Component.onDestruction: {87 function saveWindowState() {
88 windowStateStorage.saveState(root.windowId, target.state == "maximized" ? WindowStateStorage.WindowStateMaximized : WindowStateStorage.WindowStateNormal)88 windowStateStorage.saveState(root.windowId, target.state == "maximized" ? WindowStateStorage.WindowStateMaximized : WindowStateStorage.WindowStateNormal)
89 windowStateStorage.saveGeometry(root.windowId, Qt.rect(priv.normalX, priv.normalY, priv.normalWidth, priv.normalHeight))89 windowStateStorage.saveGeometry(root.windowId, Qt.rect(priv.normalX, priv.normalY, priv.normalWidth, priv.normalHeight))
90 }90 }
9191
=== modified file 'tests/mocks/Unity/Application/ApplicationInfo.cpp'
--- tests/mocks/Unity/Application/ApplicationInfo.cpp 2016-01-22 19:44:56 +0000
+++ tests/mocks/Unity/Application/ApplicationInfo.cpp 2016-02-17 14:46:08 +0000
@@ -44,6 +44,7 @@
44 , m_isTouchApp(true)44 , m_isTouchApp(true)
45 , m_exemptFromLifecycle(false)45 , m_exemptFromLifecycle(false)
46 , m_manualSurfaceCreation(false)46 , m_manualSurfaceCreation(false)
47 , m_shellChrome(Mir::NormalChrome)
47{48{
48}49}
4950
@@ -63,6 +64,7 @@
63 , m_isTouchApp(true)64 , m_isTouchApp(true)
64 , m_exemptFromLifecycle(false)65 , m_exemptFromLifecycle(false)
65 , m_manualSurfaceCreation(false)66 , m_manualSurfaceCreation(false)
67 , m_shellChrome(Mir::NormalChrome)
66{68{
67}69}
6870
@@ -102,9 +104,11 @@
102 if (m_session) {104 if (m_session) {
103 m_session->setApplication(this);105 m_session->setApplication(this);
104 m_session->setParent(this);106 m_session->setParent(this);
107 m_session->setFullscreen(m_fullscreen);
105 SessionManager::singleton()->registerSession(m_session);108 SessionManager::singleton()->registerSession(m_session);
106 connect(m_session, &Session::surfaceAdded,109 connect(m_session, &Session::surfaceAdded,
107 this, &ApplicationInfo::onSessionSurfaceAdded);110 this, &ApplicationInfo::onSessionSurfaceAdded);
111 connect(m_session, &Session::fullscreenChanged, this, &ApplicationInfo::fullscreenChanged);
108112
109 if (!m_manualSurfaceCreation) {113 if (!m_manualSurfaceCreation) {
110 QTimer::singleShot(500, m_session, &Session::createSurface);114 QTimer::singleShot(500, m_session, &Session::createSurface);
@@ -191,12 +195,17 @@
191195
192void ApplicationInfo::setFullscreen(bool value)196void ApplicationInfo::setFullscreen(bool value)
193{197{
194 if (value != m_fullscreen) {198 m_fullscreen = value;
195 m_fullscreen = value;199 if (m_session) {
196 Q_EMIT fullscreenChanged(value);200 m_session->setFullscreen(value);
197 }201 }
198}202}
199203
204bool ApplicationInfo::fullscreen() const
205{
206 return m_session ? m_session->fullscreen() : false;
207}
208
200void ApplicationInfo::setManualSurfaceCreation(bool value)209void ApplicationInfo::setManualSurfaceCreation(bool value)
201{210{
202 if (value != m_manualSurfaceCreation) {211 if (value != m_manualSurfaceCreation) {
@@ -262,6 +271,7 @@
262 } else {271 } else {
263 setState(Suspended);272 setState(Suspended);
264 }273 }
274 surface->setShellChrome(m_shellChrome);
265 }275 }
266}276}
267277
@@ -291,3 +301,11 @@
291 Q_EMIT initialSurfaceSizeChanged(m_initialSurfaceSize);301 Q_EMIT initialSurfaceSizeChanged(m_initialSurfaceSize);
292 }302 }
293}303}
304
305void ApplicationInfo::setShellChrome(Mir::ShellChrome shellChrome)
306{
307 m_shellChrome = shellChrome;
308 if (m_session && m_session->lastSurface()) {
309 m_session->lastSurface()->setShellChrome(shellChrome);
310 }
311}
294312
=== modified file 'tests/mocks/Unity/Application/ApplicationInfo.h'
--- tests/mocks/Unity/Application/ApplicationInfo.h 2016-01-19 21:41:34 +0000
+++ tests/mocks/Unity/Application/ApplicationInfo.h 2016-02-17 14:46:08 +0000
@@ -24,6 +24,7 @@
2424
25// unity-api25// unity-api
26#include <unity/shell/application/ApplicationInfoInterface.h>26#include <unity/shell/application/ApplicationInfoInterface.h>
27#include <unity/shell/application/Mir.h>
2728
28using namespace unity::shell::application;29using namespace unity::shell::application;
2930
@@ -78,7 +79,7 @@
78 QString screenshot() const { return m_screenshotFileName; }79 QString screenshot() const { return m_screenshotFileName; }
7980
80 void setFullscreen(bool value);81 void setFullscreen(bool value);
81 bool fullscreen() const { return m_fullscreen; }82 bool fullscreen() const;
8283
83 Qt::ScreenOrientations supportedOrientations() const override;84 Qt::ScreenOrientations supportedOrientations() const override;
84 void setSupportedOrientations(Qt::ScreenOrientations orientations);85 void setSupportedOrientations(Qt::ScreenOrientations orientations);
@@ -97,6 +98,8 @@
9798
98 QSize initialSurfaceSize() const override;99 QSize initialSurfaceSize() const override;
99 void setInitialSurfaceSize(const QSize &size) override;100 void setInitialSurfaceSize(const QSize &size) override;
101
102 Q_INVOKABLE void setShellChrome(Mir::ShellChrome shellChrome);
100public:103public:
101 void setSession(Session* session);104 void setSession(Session* session);
102 Session* session() const { return m_session; }105 Session* session() const { return m_session; }
@@ -134,6 +137,7 @@
134 QSize m_initialSurfaceSize;137 QSize m_initialSurfaceSize;
135138
136 bool m_manualSurfaceCreation;139 bool m_manualSurfaceCreation;
140 Mir::ShellChrome m_shellChrome;
137};141};
138142
139Q_DECLARE_METATYPE(ApplicationInfo*)143Q_DECLARE_METATYPE(ApplicationInfo*)
140144
=== modified file 'tests/mocks/Unity/Application/ApplicationManager.cpp'
--- tests/mocks/Unity/Application/ApplicationManager.cpp 2015-12-03 18:10:39 +0000
+++ tests/mocks/Unity/Application/ApplicationManager.cpp 2016-02-17 14:46:08 +0000
@@ -336,6 +336,7 @@
336 application->setName("Camera");336 application->setName("Camera");
337 application->setScreenshotId("camera");337 application->setScreenshotId("camera");
338 application->setIconId("camera");338 application->setIconId("camera");
339 application->setShellChrome(Mir::LowChrome);
339 application->setFullscreen(true);340 application->setFullscreen(true);
340 application->setSupportedOrientations(Qt::PortraitOrientation341 application->setSupportedOrientations(Qt::PortraitOrientation
341 | Qt::LandscapeOrientation342 | Qt::LandscapeOrientation
@@ -349,7 +350,7 @@
349 application->setName("Gallery");350 application->setName("Gallery");
350 application->setScreenshotId("gallery");351 application->setScreenshotId("gallery");
351 application->setIconId("gallery");352 application->setIconId("gallery");
352 application->setFullscreen(true);353 application->setShellChrome(Mir::LowChrome);
353 application->setStage(ApplicationInfo::MainStage);354 application->setStage(ApplicationInfo::MainStage);
354 m_availableApplications.append(application);355 m_availableApplications.append(application);
355356
@@ -363,7 +364,7 @@
363364
364 application = new ApplicationInfo(this);365 application = new ApplicationInfo(this);
365 application->setAppId("webbrowser-app");366 application->setAppId("webbrowser-app");
366 application->setFullscreen(true);367 application->setShellChrome(Mir::LowChrome);
367 application->setName("Browser");368 application->setName("Browser");
368 application->setScreenshotId("browser");369 application->setScreenshotId("browser");
369 application->setIconId("browser");370 application->setIconId("browser");
@@ -389,7 +390,6 @@
389 application->setName("GMail");390 application->setName("GMail");
390 application->setIconId("gmail");391 application->setIconId("gmail");
391 application->setScreenshotId("gmail-webapp.svg");392 application->setScreenshotId("gmail-webapp.svg");
392 application->setFullscreen(false);
393 application->setStage(ApplicationInfo::MainStage);393 application->setStage(ApplicationInfo::MainStage);
394 application->setSupportedOrientations(Qt::PortraitOrientation394 application->setSupportedOrientations(Qt::PortraitOrientation
395 | Qt::LandscapeOrientation395 | Qt::LandscapeOrientation
@@ -402,7 +402,6 @@
402 application->setName("Music");402 application->setName("Music");
403 application->setIconId("soundcloud");403 application->setIconId("soundcloud");
404 application->setScreenshotId("music");404 application->setScreenshotId("music");
405 application->setFullscreen(false);
406 application->setStage(ApplicationInfo::MainStage);405 application->setStage(ApplicationInfo::MainStage);
407 application->setSupportedOrientations(Qt::PortraitOrientation406 application->setSupportedOrientations(Qt::PortraitOrientation
408 | Qt::LandscapeOrientation407 | Qt::LandscapeOrientation
409408
=== modified file 'tests/mocks/Unity/Application/MirSurface.cpp'
--- tests/mocks/Unity/Application/MirSurface.cpp 2015-11-30 18:25:47 +0000
+++ tests/mocks/Unity/Application/MirSurface.cpp 2016-02-17 14:46:08 +0000
@@ -36,6 +36,7 @@
36 , m_width(-1)36 , m_width(-1)
37 , m_height(-1)37 , m_height(-1)
38 , m_slowToResize(false)38 , m_slowToResize(false)
39 , m_shellChrome(Mir::NormalChrome)
39{40{
40// qDebug() << "MirSurface::MirSurface() " << name;41// qDebug() << "MirSurface::MirSurface() " << name;
41 m_delayedResizeTimer.setInterval(600);42 m_delayedResizeTimer.setInterval(600);
@@ -130,6 +131,21 @@
130}131}
131132
132133
134Mir::ShellChrome MirSurface::shellChrome() const
135{
136 return m_shellChrome;
137}
138
139void MirSurface::setShellChrome(Mir::ShellChrome shellChrome)
140{
141 if (shellChrome == m_shellChrome)
142 return;
143
144 m_shellChrome = shellChrome;
145 Q_EMIT shellChromeChanged(shellChrome);
146}
147
148
133149
134void MirSurface::registerView(qintptr viewId)150void MirSurface::registerView(qintptr viewId)
135{151{
136152
=== modified file 'tests/mocks/Unity/Application/MirSurface.h'
--- tests/mocks/Unity/Application/MirSurface.h 2015-11-30 18:25:47 +0000
+++ tests/mocks/Unity/Application/MirSurface.h 2016-02-17 14:46:08 +0000
@@ -73,10 +73,13 @@
73 int widthIncrement() const override { return m_widthIncrement; }73 int widthIncrement() const override { return m_widthIncrement; }
74 int heightIncrement() const override { return m_heightIncrement; }74 int heightIncrement() const override { return m_heightIncrement; }
7575
76 Mir::ShellChrome shellChrome() const override;
77
76 ////78 ////
77 // API for tests79 // API for tests
7880
79 Q_INVOKABLE void setLive(bool live);81 Q_INVOKABLE void setLive(bool live);
82 Q_INVOKABLE void setShellChrome(Mir::ShellChrome shellChrome);
8083
81 void registerView(qintptr viewId);84 void registerView(qintptr viewId);
82 void unregisterView(qintptr viewId);85 void unregisterView(qintptr viewId);
@@ -108,9 +111,6 @@
108 void setActiveFocus(bool);111 void setActiveFocus(bool);
109112
110Q_SIGNALS:113Q_SIGNALS:
111 void stateChanged(Mir::State);
112 void liveChanged(bool live);
113 void orientationAngleChanged(Mir::OrientationAngle angle);
114 void widthChanged();114 void widthChanged();
115 void heightChanged();115 void heightChanged();
116 void slowToResizeChanged();116 void slowToResizeChanged();
@@ -151,6 +151,8 @@
151 QSize m_delayedResize;151 QSize m_delayedResize;
152 QSize m_pendingResize;152 QSize m_pendingResize;
153153
154 Mir::ShellChrome m_shellChrome;
155
154 struct View {156 struct View {
155 bool visible;157 bool visible;
156 };158 };
157159
=== modified file 'tests/mocks/Unity/Application/MirSurfaceItem.cpp'
--- tests/mocks/Unity/Application/MirSurfaceItem.cpp 2016-01-25 15:00:31 +0000
+++ tests/mocks/Unity/Application/MirSurfaceItem.cpp 2016-02-17 14:46:08 +0000
@@ -100,6 +100,15 @@
100 }100 }
101}101}
102102
103Mir::ShellChrome MirSurfaceItem::shellChrome() const
104{
105 if (m_qmlSurface) {
106 return m_qmlSurface->shellChrome();
107 } else {
108 return Mir::NormalChrome;
109 }
110}
111
103Mir::OrientationAngle MirSurfaceItem::orientationAngle() const112Mir::OrientationAngle MirSurfaceItem::orientationAngle() const
104{113{
105 if (m_qmlSurface) {114 if (m_qmlSurface) {
106115
=== modified file 'tests/mocks/Unity/Application/MirSurfaceItem.h'
--- tests/mocks/Unity/Application/MirSurfaceItem.h 2016-01-25 15:00:31 +0000
+++ tests/mocks/Unity/Application/MirSurfaceItem.h 2016-02-17 14:46:08 +0000
@@ -47,6 +47,7 @@
47 Mir::Type type() const override;47 Mir::Type type() const override;
48 QString name() const override;48 QString name() const override;
49 bool live() const override;49 bool live() const override;
50 Mir::ShellChrome shellChrome() const override;
5051
51 Mir::State surfaceState() const override;52 Mir::State surfaceState() const override;
52 void setSurfaceState(Mir::State) override {}53 void setSurfaceState(Mir::State) override {}
5354
=== modified file 'tests/mocks/Unity/Application/Session.cpp'
--- tests/mocks/Unity/Application/Session.cpp 2015-12-01 12:17:24 +0000
+++ tests/mocks/Unity/Application/Session.cpp 2016-02-17 14:46:08 +0000
@@ -34,6 +34,7 @@
34 , m_surface(nullptr)34 , m_surface(nullptr)
35 , m_parentSession(nullptr)35 , m_parentSession(nullptr)
36 , m_children(new SessionModel(this))36 , m_children(new SessionModel(this))
37 , m_fullscreen(false)
37{38{
38// qDebug() << "Session::Session() " << this->name();39// qDebug() << "Session::Session() " << this->name();
3940
@@ -71,6 +72,25 @@
71 deleteLater();72 deleteLater();
72}73}
7374
75void Session::updateFullscreenProperty()
76{
77 if (m_surfaces.rowCount() > 0) {
78 // TODO: Figure out something better
79 setFullscreen(lastSurface()->state() == Mir::FullscreenState);
80 } else {
81 // Keep the current value of the fullscreen property until we get a new
82 // surface
83 }
84}
85
86void Session::setFullscreen(bool fullscreen)
87{
88 if (m_fullscreen != fullscreen) {
89 m_fullscreen = fullscreen;
90 Q_EMIT fullscreenChanged(m_fullscreen);
91 }
92}
93
74void Session::setApplication(ApplicationInfo* application)94void Session::setApplication(ApplicationInfo* application)
75{95{
76 if (m_application == application)96 if (m_application == application)
@@ -82,15 +102,18 @@
82102
83void Session::appendSurface(MirSurface* surface)103void Session::appendSurface(MirSurface* surface)
84{104{
85 // qDebug() << "Session::appendSurface - session=" << name() << "surface=" << surface;105 qDebug() << "Session::appendSurface - session=" << name() << "surface=" << surface;
86106
87 m_surfaces.insert(m_surfaces.rowCount(), surface);107 m_surfaces.insert(m_surfaces.rowCount(), surface);
88108
109 connect(surface, &MirSurfaceInterface::stateChanged, this, &Session::updateFullscreenProperty);
89 connect(surface, &QObject::destroyed,110 connect(surface, &QObject::destroyed,
90 this, [this, surface]() { this->removeSurface(surface); });111 this, [this, surface]() { this->removeSurface(surface); });
91112
92 Q_EMIT lastSurfaceChanged(surface);113 Q_EMIT lastSurfaceChanged(surface);
93 Q_EMIT surfaceAdded(surface);114 Q_EMIT surfaceAdded(surface);
115
116 updateFullscreenProperty();
94}117}
95118
96void Session::removeSurface(MirSurface* surface)119void Session::removeSurface(MirSurface* surface)
@@ -99,6 +122,8 @@
99 if (m_surfaces.contains(surface)) {122 if (m_surfaces.contains(surface)) {
100 m_surfaces.remove(surface);123 m_surfaces.remove(surface);
101 }124 }
125
126 updateFullscreenProperty();
102}127}
103128
104void Session::setScreenshot(const QUrl& screenshot)129void Session::setScreenshot(const QUrl& screenshot)
105130
=== modified file 'tests/mocks/Unity/Application/Session.h'
--- tests/mocks/Unity/Application/Session.h 2015-12-01 12:17:24 +0000
+++ tests/mocks/Unity/Application/Session.h 2016-02-17 14:46:08 +0000
@@ -47,6 +47,7 @@
47 //getters47 //getters
48 QString name() const { return m_name; }48 QString name() const { return m_name; }
49 bool live() const { return m_live; }49 bool live() const { return m_live; }
50 bool fullscreen() const { return m_fullscreen; }
50 ApplicationInfo* application() const { return m_application; }51 ApplicationInfo* application() const { return m_application; }
51 MirSurface *lastSurface() const;52 MirSurface *lastSurface() const;
52 ObjectListModel<MirSurface>* surfaces() const;53 ObjectListModel<MirSurface>* surfaces() const;
@@ -57,6 +58,7 @@
57 void removeSurface(MirSurface* surface);58 void removeSurface(MirSurface* surface);
58 void setScreenshot(const QUrl& m_screenshot);59 void setScreenshot(const QUrl& m_screenshot);
59 void setLive(bool live);60 void setLive(bool live);
61 void setFullscreen(bool fullscreen);
6062
61 Q_INVOKABLE void addChildSession(Session* session);63 Q_INVOKABLE void addChildSession(Session* session);
62 void insertChildSession(uint index, Session* session);64 void insertChildSession(uint index, Session* session);
@@ -68,6 +70,7 @@
68 void liveChanged(bool live);70 void liveChanged(bool live);
69 void surfaceAdded(MirSurface *surface);71 void surfaceAdded(MirSurface *surface);
70 void lastSurfaceChanged(MirSurface *surface);72 void lastSurfaceChanged(MirSurface *surface);
73 void fullscreenChanged(bool fullscreen);
7174
72 // internal mock use75 // internal mock use
73 void deregister();76 void deregister();
@@ -75,6 +78,9 @@
75public Q_SLOTS:78public Q_SLOTS:
76 Q_INVOKABLE void createSurface();79 Q_INVOKABLE void createSurface();
7780
81private Q_SLOTS:
82 void updateFullscreenProperty();
83
78private:84private:
79 SessionModel* childSessions() const;85 SessionModel* childSessions() const;
80 void setParentSession(Session* session);86 void setParentSession(Session* session);
@@ -87,6 +93,7 @@
87 Session* m_parentSession;93 Session* m_parentSession;
88 SessionModel* m_children;94 SessionModel* m_children;
89 ObjectListModel<MirSurface> m_surfaces;95 ObjectListModel<MirSurface> m_surfaces;
96 bool m_fullscreen;
9097
91 friend class ApplicationTestInterface;98 friend class ApplicationTestInterface;
92};99};
93100
=== modified file 'tests/qmltests/tst_Shell.qml'
--- tests/qmltests/tst_Shell.qml 2016-02-12 00:11:28 +0000
+++ tests/qmltests/tst_Shell.qml 2016-02-17 14:46:08 +0000
@@ -139,6 +139,9 @@
139 anchors.right: root.right139 anchors.right: root.right
140 width: units.gu(30)140 width: units.gu(30)
141141
142 property var focusedApp: ApplicationManager.findApplication(ApplicationManager.focusedApplicationId)
143 property var focusedSurface: focusedApp && focusedApp.session ? focusedApp.session.lastSurface : null
144
142 Rectangle {145 Rectangle {
143 id: controlRect146 id: controlRect
144 anchors { left: parent.left; right: parent.right }147 anchors { left: parent.left; right: parent.right }
@@ -234,6 +237,65 @@
234 appId: modelData237 appId: modelData
235 }238 }
236 }239 }
240
241 Label { text: "Focused Application"; font.bold: true }
242
243 Row {
244 CheckBox {
245 id: fullscreeAppCheck
246
247 onTriggered: {
248 if (!controls.focusedSurface) return;
249 if (controls.focusedSurface.state == Mir.FullscreenState) {
250 controls.focusedSurface.state = Mir.RestoredState;
251 } else {
252 controls.focusedSurface.state = Mir.FullscreenState;
253 }
254 }
255
256 Binding {
257 target: fullscreeAppCheck
258 when: controls.focusedSurface
259 property: "checked"
260 value: {
261 if (!controls.focusedSurface) return false;
262 controls.focusedSurface.state === Mir.FullscreenState
263 }
264 }
265 }
266 Label {
267 text: "Fullscreen"
268 }
269 }
270
271 Row {
272 CheckBox {
273 id: chromeAppCheck
274
275 onTriggered: {
276 if (!controls.focusedSurface) return;
277 if (controls.focusedSurface.shellChrome == Mir.LowChrome) {
278 controls.focusedSurface.setShellChrome(Mir.NormalChrome);
279 } else {
280 controls.focusedSurface.setShellChrome(Mir.LowChrome);
281 }
282 }
283
284 Binding {
285 target: chromeAppCheck
286 when: controls.focusedSurface !== null
287 property: "checked"
288 value: {
289 if (!controls.focusedSurface) return false;
290 controls.focusedSurface.shellChrome === Mir.LowChrome
291 }
292 }
293 }
294 Label {
295 text: "Low Chrome"
296 }
297 }
298
237 }299 }
238 }300 }
239 }301 }

Subscribers

People subscribed via source and target branches