on xenial help sign in
reverted unnecessary fullscreen changes. better low chrome support
commit24b99826ecff12581d4bf0d62c042148475d2352 authorNick Dedekind <nick.dedekind@canonical.com> dateWed 17 Feb 2016, 12:51 (11 years ago) parentcf7a5e9
13 files changed+137−66
qml/Shell.qml+3−2 qml/Stages/AbstractStage.qml+1−2 qml/Stages/ApplicationWindow.qml+1 qml/Stages/DecoratedWindow.qml+5−4 qml/Stages/DesktopFullscreenPolicy.qml+41 qml/Stages/DesktopStage.qml+6−20 qml/Stages/PhoneFullscreenPolicy.qml+54 qml/Stages/PhoneStage.qml+7−15 qml/Stages/SpreadDelegate.qml+1−2 qml/Stages/TabletStage.qml+7−15 tests/mocks/Unity/Application/MirSurface.cpp−1 tests/mocks/Unity/Application/Session.cpp−2 tests/qmltests/tst_Shell.qml+11−3
qml/Shell.qml+3−2
@@ -254,7 +254,7 @@ Item {
254254 }
255255 }
256256 onQmlComponentChanged: {
257− if (item) item.saveWindowState();
257+ if (item) item.stageUnloaded();
258258 source = qmlComponent;
259259 }
260260
@@ -537,7 +537,8 @@ Item {
537537 }
538538
539539 readonly property bool topmostApplicationIsFullscreen:
540− applicationsDisplayLoader.item ? applicationsDisplayLoader.item.mainAppWindowIsFullscreen : false
540+ ApplicationManager.focusedApplicationId &&
541+ ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
541542
542543 fullscreenMode: (topmostApplicationIsFullscreen && !lightDM.greeter.active && launcher.progress == 0)
543544 || greeter.hasLockedApp
qml/Stages/AbstractStage.qml+1−2
@@ -43,14 +43,13 @@ Rectangle {
4343 // To be read from outside
4444 property var mainApp: null
4545 property int mainAppWindowOrientationAngle
46− property bool mainAppWindowIsFullscreen: false
4746 property bool orientationChangesEnabled
4847 property int supportedOrientations: Qt.PortraitOrientation
4948 | Qt.LandscapeOrientation
5049 | Qt.InvertedPortraitOrientation
5150 | Qt.InvertedLandscapeOrientation
5251
53− signal saveWindowState
52+ signal stageUnloaded
5453
5554 // Shared code for use in stage implementations
5655 GSettings {
qml/Stages/ApplicationWindow.qml+1
@@ -24,6 +24,7 @@ FocusScope {
2424 implicitHeight: sessionContainer.implicitHeight
2525
2626 // to be read from outside
27+ readonly property bool fullscreen: application ? application.fullscreen : false
2728 property alias interactive: sessionContainer.interactive
2829 property bool orientationChangesEnabled: d.supportsSurfaceResize ? d.surfaceOldEnoughToBeResized : true
2930 readonly property string title: sessionContainer.surface && sessionContainer.surface.name !== "" ?
qml/Stages/DecoratedWindow.qml+5−4
@@ -24,14 +24,15 @@ FocusScope {
2424 id: root
2525
2626 width: applicationWindow.width
27− height: (fullscreen ? 0 : decoration.height) + applicationWindow.height
27+ height: (decorationShown ? decoration.height : 0) + applicationWindow.height
2828
2929 property alias window: applicationWindow
3030 property alias application: applicationWindow.application
3131 property alias active: decoration.active
3232 property alias title: decoration.title
33− property bool fullscreen: false
33+ property alias fullscreen: applicationWindow.fullscreen
3434
35+ readonly property bool decorationShown: !fullscreen
3536 property bool highlightShown: false
3637 property real shadowOpacity: 1
3738
@@ -72,7 +73,7 @@ FocusScope {
7273 }
7374 source: "graphics/dropshadow2gu.sci"
7475 opacity: root.shadowOpacity * .3
75− enabled: !fullscreen
76+ visible: root.decorationShown
7677 }
7778
7879 WindowDecoration {
@@ -97,7 +98,7 @@ FocusScope {
9798 anchors.top: parent.top
9899 anchors.topMargin: decoration.height
99100 anchors.left: parent.left
100− requestedHeight: root.requestedHeight - (fullscreen ? 0 : decoration.height)
101+ requestedHeight: root.requestedHeight - (root.decorationShown ? decoration.height : 0)
101102 interactive: true
102103 focus: true
103104 }
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 {
467467 value: ApplicationManager.count + 1
468468 when: index == spread.highlightedIndex && blurLayer.ready
469469 }
470− Binding {
471− target: root
472− when: index == 0
473− property: "mainAppWindowIsFullscreen"
474− value: decoratedWindow.fullscreen
475− }
476470
477471 WindowResizeArea {
478472 id: resizeArea
@@ -490,9 +484,10 @@ AbstractStage {
490484 property bool saveStateOnDestruction: true
491485 Connections {
492486 target: root
493− onSaveWindowState: {
487+ onStageUnloaded: {
494488 resizeArea.saveWindowState();
495489 resizeArea.saveStateOnDestruction = false;
490+ fullscreenPolicy.active = false;
496491 }
497492 }
498493 Component.onDestruction: {
@@ -510,7 +505,6 @@ AbstractStage {
510505 application: ApplicationManager.get(index)
511506 active: ApplicationManager.focusedApplicationId === model.appId
512507 focus: true
513− fullscreen: application.fullscreen
514508
515509 requestedWidth: appDelegate.requestedWidth
516510 requestedHeight: appDelegate.requestedHeight
@@ -522,18 +516,10 @@ AbstractStage {
522516 onDecorationPressed: { ApplicationManager.focusApplication(model.appId) }
523517 }
524518
525− property bool firstTimeSurface: true
526− property var lastSurface: decoratedWindow.application && decoratedWindow.application.session ?
527− decoratedWindow.application.session.lastSurface : null
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− }
519+ DesktopFullscreenPolicy {
520+ id: fullscreenPolicy
521+ active: true
522+ application: decoratedWindow.application
537523 }
538524 }
539525 }
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 {
574574 property: "mainAppWindowOrientationAngle"
575575 value: appWindowOrientationAngle
576576 }
577− Binding {
578− target: root
579− when: index == 0
580− property: "mainAppWindowIsFullscreen"
581− value: appDelegate.fullscreen
582− }
583577 Binding {
584578 target: priv
585579 when: index == 0
@@ -587,17 +581,15 @@ AbstractStage {
587581 value: orientationChangesEnabled
588582 }
589583
590− property var lastSurface: application && application.session ?
591− application.session.lastSurface : null
592− Binding {
593− target: lastSurface
594− when: lastSurface
595− property: "state"
596− value: {
597− lastSurface.shellChrome === Mir.LowChrome ? Mir.FullscreenState : Mir.RestoredState
584+ PhoneFullscreenPolicy {
585+ id: fullscreenPolicy
586+ application: appDelegate.application
587+
588+ Connections {
589+ target: root
590+ onStageUnloaded: fullscreenPolicy.active = false
598591 }
599592 }
600− fullscreen: application.fullscreen
601593 }
602594 }
603595 }
qml/Stages/SpreadDelegate.qml+1−2
@@ -43,7 +43,6 @@ FocusScope {
4343 property int shellOrientationAngle
4444 property int shellOrientation
4545 property QtObject orientations
46− property bool fullscreen: false
4746
4847 function matchShellOrientation() {
4948 if (!root.application)
@@ -268,7 +267,7 @@ FocusScope {
268267 focus: true
269268 anchors {
270269 fill: parent
271− topMargin: fullscreen || (application && application.rotatesWindowContents)
270+ topMargin: appWindow.fullscreen || (application && application.rotatesWindowContents)
272271 ? 0 : maximizedAppTopMargin
273272 }
274273
qml/Stages/TabletStage.qml+7−15
@@ -730,12 +730,6 @@ AbstractStage {
730730 property: "mainAppWindowOrientationAngle"
731731 value: appWindowOrientationAngle
732732 }
733− Binding {
734− target: root
735− when: index == 0
736− property: "mainAppWindowIsFullscreen"
737− value: decoratedWindow.fullscreen
738− }
739733 Binding {
740734 target: priv
741735 when: model.appId == priv.mainStageAppId
@@ -750,17 +744,15 @@ AbstractStage {
750744 progress: spreadTile.progress - spreadView.positionMarker1
751745 }
752746
753− property var lastSurface: application && application.session ?
754− application.session.lastSurface : null
755− Binding {
756− target: lastSurface
757− when: lastSurface
758− property: "state"
759− value: {
760− lastSurface.shellChrome === Mir.LowChrome ? Mir.FullscreenState : Mir.RestoredState
747+ PhoneFullscreenPolicy {
748+ id: fullscreenPolicy
749+ application: spreadTile.application
750+
751+ Connections {
752+ target: root
753+ onStageUnloaded: fullscreenPolicy.active = false
761754 }
762755 }
763− fullscreen: application.fullscreen
764756 }
765757 }
766758 }
tests/mocks/Unity/Application/MirSurface.cpp−1
@@ -71,7 +71,6 @@ void MirSurface::setState(Mir::State state)
7171
7272 m_state = state;
7373 Q_EMIT stateChanged(state);
74− qDebug() << "SETSTATE!" << state;
7574}
7675
7776bool MirSurface::live() const
tests/mocks/Unity/Application/Session.cpp−2
@@ -74,8 +74,6 @@ void Session::release()
7474
7575void Session::updateFullscreenProperty()
7676{
77− qDebug() << "updateFullscreenProperty!";
78−
7977 if (m_surfaces.rowCount() > 0) {
8078 // TODO: Figure out something better
8179 setFullscreen(lastSurface()->state() == Mir::FullscreenState);
tests/qmltests/tst_Shell.qml+11−3
@@ -245,6 +245,7 @@ Rectangle {
245245 id: fullscreeAppCheck
246246
247247 onTriggered: {
248+ if (!controls.focusedSurface) return;
248249 if (controls.focusedSurface.state == Mir.FullscreenState) {
249250 controls.focusedSurface.state = Mir.RestoredState;
250251 } else {
@@ -254,9 +255,12 @@ Rectangle {
254255
255256 Binding {
256257 target: fullscreeAppCheck
257− when: controls.focusedSurface !== null
258+ when: controls.focusedSurface
258259 property: "checked"
259− value: controls.focusedSurface.state === Mir.FullscreenState
260+ value: {
261+ if (!controls.focusedSurface) return false;
262+ controls.focusedSurface.state === Mir.FullscreenState
263+ }
260264 }
261265 }
262266 Label {
@@ -269,6 +273,7 @@ Rectangle {
269273 id: chromeAppCheck
270274
271275 onTriggered: {
276+ if (!controls.focusedSurface) return;
272277 if (controls.focusedSurface.shellChrome == Mir.LowChrome) {
273278 controls.focusedSurface.setShellChrome(Mir.NormalChrome);
274279 } else {
@@ -280,7 +285,10 @@ Rectangle {
280285 target: chromeAppCheck
281286 when: controls.focusedSurface !== null
282287 property: "checked"
283− value: controls.focusedSurface.shellChrome === Mir.LowChrome
288+ value: {
289+ if (!controls.focusedSurface) return false;
290+ controls.focusedSurface.shellChrome === Mir.LowChrome
291+ }
284292 }
285293 }
286294 Label {