on xenial help sign in
reverted unnecessary fullscreen changes. better low chrome support
24b9982Nick Dedekind
qml/Shell.qml+3−2
@@ -254,7 +254,7 @@ Item {
254 }
254 }
255 }
255 }
256 onQmlComponentChanged: {
256 onQmlComponentChanged: {
257− if (item) item.saveWindowState();
257+ if (item) item.stageUnloaded();
258 source = qmlComponent;
258 source = qmlComponent;
259 }
259 }
260
260
@@ -537,7 +537,8 @@ Item {
537 }
537 }
538
538
539 readonly property bool topmostApplicationIsFullscreen:
539 readonly property bool topmostApplicationIsFullscreen:
540− applicationsDisplayLoader.item ? applicationsDisplayLoader.item.mainAppWindowIsFullscreen : false
540+ ApplicationManager.focusedApplicationId &&
541+ ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
541
542
542 fullscreenMode: (topmostApplicationIsFullscreen && !lightDM.greeter.active && launcher.progress == 0)
543 fullscreenMode: (topmostApplicationIsFullscreen && !lightDM.greeter.active && launcher.progress == 0)
543 || greeter.hasLockedApp
544 || greeter.hasLockedApp
qml/Stages/AbstractStage.qml+1−2
@@ -43,14 +43,13 @@ Rectangle {
43 // To be read from outside
43 // To be read from outside
44 property var mainApp: null
44 property var mainApp: null
45 property int mainAppWindowOrientationAngle
45 property int mainAppWindowOrientationAngle
46− property bool mainAppWindowIsFullscreen: false
47 property bool orientationChangesEnabled
46 property bool orientationChangesEnabled
48 property int supportedOrientations: Qt.PortraitOrientation
47 property int supportedOrientations: Qt.PortraitOrientation
49 | Qt.LandscapeOrientation
48 | Qt.LandscapeOrientation
50 | Qt.InvertedPortraitOrientation
49 | Qt.InvertedPortraitOrientation
51 | Qt.InvertedLandscapeOrientation
50 | Qt.InvertedLandscapeOrientation
52
51
53− signal saveWindowState
52+ signal stageUnloaded
54
53
55 // Shared code for use in stage implementations
54 // Shared code for use in stage implementations
56 GSettings {
55 GSettings {
qml/Stages/ApplicationWindow.qml+1
@@ -24,6 +24,7 @@ FocusScope {
24 implicitHeight: sessionContainer.implicitHeight
24 implicitHeight: sessionContainer.implicitHeight
25
25
26 // to be read from outside
26 // to be read from outside
27+ readonly property bool fullscreen: application ? application.fullscreen : false
27 property alias interactive: sessionContainer.interactive
28 property alias interactive: sessionContainer.interactive
28 property bool orientationChangesEnabled: d.supportsSurfaceResize ? d.surfaceOldEnoughToBeResized : true
29 property bool orientationChangesEnabled: d.supportsSurfaceResize ? d.surfaceOldEnoughToBeResized : true
29 readonly property string title: sessionContainer.surface && sessionContainer.surface.name !== "" ?
30 readonly property string title: sessionContainer.surface && sessionContainer.surface.name !== "" ?
qml/Stages/DecoratedWindow.qml+5−4
@@ -24,14 +24,15 @@ FocusScope {
24 id: root
24 id: root
25
25
26 width: applicationWindow.width
26 width: applicationWindow.width
27− height: (fullscreen ? 0 : decoration.height) + applicationWindow.height
27+ height: (decorationShown ? decoration.height : 0) + applicationWindow.height
28
28
29 property alias window: applicationWindow
29 property alias window: applicationWindow
30 property alias application: applicationWindow.application
30 property alias application: applicationWindow.application
31 property alias active: decoration.active
31 property alias active: decoration.active
32 property alias title: decoration.title
32 property alias title: decoration.title
33− property bool fullscreen: false
33+ property alias fullscreen: applicationWindow.fullscreen
34
34
35+ readonly property bool decorationShown: !fullscreen
35 property bool highlightShown: false
36 property bool highlightShown: false
36 property real shadowOpacity: 1
37 property real shadowOpacity: 1
37
38
@@ -72,7 +73,7 @@ FocusScope {
72 }
73 }
73 source: "graphics/dropshadow2gu.sci"
74 source: "graphics/dropshadow2gu.sci"
74 opacity: root.shadowOpacity * .3
75 opacity: root.shadowOpacity * .3
75− enabled: !fullscreen
76+ visible: root.decorationShown
76 }
77 }
77
78
78 WindowDecoration {
79 WindowDecoration {
@@ -97,7 +98,7 @@ FocusScope {
97 anchors.top: parent.top
98 anchors.top: parent.top
98 anchors.topMargin: decoration.height
99 anchors.topMargin: decoration.height
99 anchors.left: parent.left
100 anchors.left: parent.left
100− requestedHeight: root.requestedHeight - (fullscreen ? 0 : decoration.height)
101+ requestedHeight: root.requestedHeight - (root.decorationShown ? decoration.height : 0)
101 interactive: true
102 interactive: true
102 focus: true
103 focus: true
103 }
104 }
qml/Stages/DesktopFullscreenPolicy.qmlnew file+41
@@ -0,0 +1,41 @@
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+
17+import QtQuick 2.4
18+import Unity.Application 0.1
19+
20+Item {
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+}
41+
qml/Stages/DesktopStage.qml+6−20
@@ -467,12 +467,6 @@ AbstractStage {
467 value: ApplicationManager.count + 1
467 value: ApplicationManager.count + 1
468 when: index == spread.highlightedIndex && blurLayer.ready
468 when: index == spread.highlightedIndex && blurLayer.ready
469 }
469 }
470− Binding {
471− target: root
472− when: index == 0
473− property: "mainAppWindowIsFullscreen"
474− value: decoratedWindow.fullscreen
475− }
476
470
477 WindowResizeArea {
471 WindowResizeArea {
478 id: resizeArea
472 id: resizeArea
@@ -490,9 +484,10 @@ AbstractStage {
490 property bool saveStateOnDestruction: true
484 property bool saveStateOnDestruction: true
491 Connections {
485 Connections {
492 target: root
486 target: root
493− onSaveWindowState: {
487+ onStageUnloaded: {
494 resizeArea.saveWindowState();
488 resizeArea.saveWindowState();
495 resizeArea.saveStateOnDestruction = false;
489 resizeArea.saveStateOnDestruction = false;
490+ fullscreenPolicy.active = false;
496 }
491 }
497 }
492 }
498 Component.onDestruction: {
493 Component.onDestruction: {
@@ -510,7 +505,6 @@ AbstractStage {
510 application: ApplicationManager.get(index)
505 application: ApplicationManager.get(index)
511 active: ApplicationManager.focusedApplicationId === model.appId
506 active: ApplicationManager.focusedApplicationId === model.appId
512 focus: true
507 focus: true
513− fullscreen: application.fullscreen
514
508
515 requestedWidth: appDelegate.requestedWidth
509 requestedWidth: appDelegate.requestedWidth
516 requestedHeight: appDelegate.requestedHeight
510 requestedHeight: appDelegate.requestedHeight
@@ -522,18 +516,10 @@ AbstractStage {
522 onDecorationPressed: { ApplicationManager.focusApplication(model.appId) }
516 onDecorationPressed: { ApplicationManager.focusApplication(model.appId) }
523 }
517 }
524
518
525− property bool firstTimeSurface: true
519+ DesktopFullscreenPolicy {
526− property var lastSurface: decoratedWindow.application && decoratedWindow.application.session ?
520+ id: fullscreenPolicy
521+ active: true
527− decoratedWindow.application.session.lastSurface : null
522+ application: decoratedWindow.application
528− onLastSurfaceChanged: {
529− if (!lastSurface) return;
530− if (!firstTimeSurface) return;
531− firstTimeSurface = false;
532−
533− if (lastSurface.state === Mir.FullscreenState &&
534− lastSurface.shellChrome === Mir.LowChrome) {
535− lastSurface.state = Mir.RestoredState;
536− }
537 }
523 }
538 }
524 }
539 }
525 }
qml/Stages/PhoneFullscreenPolicy.qmlnew file+54
@@ -0,0 +1,54 @@
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+
17+import QtQuick 2.4
18+import Unity.Application 0.1
19+
20+Item {
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) {
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+}
54+
qml/Stages/PhoneStage.qml+7−15
@@ -574,12 +574,6 @@ AbstractStage {
574 property: "mainAppWindowOrientationAngle"
574 property: "mainAppWindowOrientationAngle"
575 value: appWindowOrientationAngle
575 value: appWindowOrientationAngle
576 }
576 }
577− Binding {
578− target: root
579− when: index == 0
580− property: "mainAppWindowIsFullscreen"
581− value: appDelegate.fullscreen
582− }
583 Binding {
577 Binding {
584 target: priv
578 target: priv
585 when: index == 0
579 when: index == 0
@@ -587,17 +581,15 @@ AbstractStage {
587 value: orientationChangesEnabled
581 value: orientationChangesEnabled
588 }
582 }
589
583
590− property var lastSurface: application && application.session ?
584+ PhoneFullscreenPolicy {
591− application.session.lastSurface : null
585+ id: fullscreenPolicy
592− Binding {
586+ application: appDelegate.application
587+
588+ Connections {
593− target: lastSurface
589+ target: root
594− when: lastSurface
590+ onStageUnloaded: fullscreenPolicy.active = false
595− property: "state"
596− value: {
597− lastSurface.shellChrome === Mir.LowChrome ? Mir.FullscreenState : Mir.RestoredState
598 }
591 }
599 }
592 }
600− fullscreen: application.fullscreen
601 }
593 }
602 }
594 }
603 }
595 }
qml/Stages/SpreadDelegate.qml+1−2
@@ -43,7 +43,6 @@ FocusScope {
43 property int shellOrientationAngle
43 property int shellOrientationAngle
44 property int shellOrientation
44 property int shellOrientation
45 property QtObject orientations
45 property QtObject orientations
46− property bool fullscreen: false
47
46
48 function matchShellOrientation() {
47 function matchShellOrientation() {
49 if (!root.application)
48 if (!root.application)
@@ -268,7 +267,7 @@ FocusScope {
268 focus: true
267 focus: true
269 anchors {
268 anchors {
270 fill: parent
269 fill: parent
271− topMargin: fullscreen || (application && application.rotatesWindowContents)
270+ topMargin: appWindow.fullscreen || (application && application.rotatesWindowContents)
272 ? 0 : maximizedAppTopMargin
271 ? 0 : maximizedAppTopMargin
273 }
272 }
274
273
qml/Stages/TabletStage.qml+7−15
@@ -730,12 +730,6 @@ AbstractStage {
730 property: "mainAppWindowOrientationAngle"
730 property: "mainAppWindowOrientationAngle"
731 value: appWindowOrientationAngle
731 value: appWindowOrientationAngle
732 }
732 }
733− Binding {
734− target: root
735− when: index == 0
736− property: "mainAppWindowIsFullscreen"
737− value: decoratedWindow.fullscreen
738− }
739 Binding {
733 Binding {
740 target: priv
734 target: priv
741 when: model.appId == priv.mainStageAppId
735 when: model.appId == priv.mainStageAppId
@@ -750,17 +744,15 @@ AbstractStage {
750 progress: spreadTile.progress - spreadView.positionMarker1
744 progress: spreadTile.progress - spreadView.positionMarker1
751 }
745 }
752
746
753− property var lastSurface: application && application.session ?
747+ PhoneFullscreenPolicy {
754− application.session.lastSurface : null
748+ id: fullscreenPolicy
755− Binding {
749+ application: spreadTile.application
750+
751+ Connections {
756− target: lastSurface
752+ target: root
757− when: lastSurface
753+ onStageUnloaded: fullscreenPolicy.active = false
758− property: "state"
759− value: {
760− lastSurface.shellChrome === Mir.LowChrome ? Mir.FullscreenState : Mir.RestoredState
761 }
754 }
762 }
755 }
763− fullscreen: application.fullscreen
764 }
756 }
765 }
757 }
766 }
758 }
tests/mocks/Unity/Application/MirSurface.cpp−1
@@ -71,7 +71,6 @@ void MirSurface::setState(Mir::State state)
71
71
72 m_state = state;
72 m_state = state;
73 Q_EMIT stateChanged(state);
73 Q_EMIT stateChanged(state);
74− qDebug() << "SETSTATE!" << state;
75}
74}
76
75
77bool MirSurface::live() const
76bool MirSurface::live() const
tests/mocks/Unity/Application/Session.cpp−2
@@ -74,8 +74,6 @@ void Session::release()
74
74
75void Session::updateFullscreenProperty()
75void Session::updateFullscreenProperty()
76{
76{
77− qDebug() << "updateFullscreenProperty!";
78−
79 if (m_surfaces.rowCount() > 0) {
77 if (m_surfaces.rowCount() > 0) {
80 // TODO: Figure out something better
78 // TODO: Figure out something better
81 setFullscreen(lastSurface()->state() == Mir::FullscreenState);
79 setFullscreen(lastSurface()->state() == Mir::FullscreenState);
tests/qmltests/tst_Shell.qml+11−3
@@ -245,6 +245,7 @@ Rectangle {
245 id: fullscreeAppCheck
245 id: fullscreeAppCheck
246
246
247 onTriggered: {
247 onTriggered: {
248+ if (!controls.focusedSurface) return;
248 if (controls.focusedSurface.state == Mir.FullscreenState) {
249 if (controls.focusedSurface.state == Mir.FullscreenState) {
249 controls.focusedSurface.state = Mir.RestoredState;
250 controls.focusedSurface.state = Mir.RestoredState;
250 } else {
251 } else {
@@ -254,9 +255,12 @@ Rectangle {
254
255
255 Binding {
256 Binding {
256 target: fullscreeAppCheck
257 target: fullscreeAppCheck
257− when: controls.focusedSurface !== null
258+ when: controls.focusedSurface
258 property: "checked"
259 property: "checked"
260+ value: {
261+ if (!controls.focusedSurface) return false;
259− value: controls.focusedSurface.state === Mir.FullscreenState
262+ controls.focusedSurface.state === Mir.FullscreenState
263+ }
260 }
264 }
261 }
265 }
262 Label {
266 Label {
@@ -269,6 +273,7 @@ Rectangle {
269 id: chromeAppCheck
273 id: chromeAppCheck
270
274
271 onTriggered: {
275 onTriggered: {
276+ if (!controls.focusedSurface) return;
272 if (controls.focusedSurface.shellChrome == Mir.LowChrome) {
277 if (controls.focusedSurface.shellChrome == Mir.LowChrome) {
273 controls.focusedSurface.setShellChrome(Mir.NormalChrome);
278 controls.focusedSurface.setShellChrome(Mir.NormalChrome);
274 } else {
279 } else {
@@ -280,7 +285,10 @@ Rectangle {
280 target: chromeAppCheck
285 target: chromeAppCheck
281 when: controls.focusedSurface !== null
286 when: controls.focusedSurface !== null
282 property: "checked"
287 property: "checked"
288+ value: {
289+ if (!controls.focusedSurface) return false;
283− value: controls.focusedSurface.shellChrome === Mir.LowChrome
290+ controls.focusedSurface.shellChrome === Mir.LowChrome
291+ }
284 }
292 }
285 }
293 }
286 Label {
294 Label {