on xenial help sign in
fix side stage coming in/out on rotation
0cf7d15Michael Zanetti
qml/Stage/Stage.qml+34−4
@@ -85,7 +85,7 @@ AbstractStage {
85 GlobalShortcut {
85 GlobalShortcut {
86 id: showSpreadShortcut
86 id: showSpreadShortcut
87 shortcut: Qt.MetaModifier|Qt.Key_W
87 shortcut: Qt.MetaModifier|Qt.Key_W
88− onTriggered: state = "altTab"
88+ onTriggered: priv.goneToSpread = true
89 }
89 }
90
90
91 GlobalShortcut {
91 GlobalShortcut {
@@ -183,6 +183,9 @@ AbstractStage {
183 }
183 }
184 }
184 }
185
185
186+ readonly property bool sideStageEnabled: root.shellOrientation == Qt.LandscapeOrientation ||
187+ root.shellOrientation == Qt.InvertedLandscapeOrientation
188+
186 property var mainStageDelegate: null
189 property var mainStageDelegate: null
187 property var sideStageDelegate: null
190 property var sideStageDelegate: null
188 property int mainStageItemId: 0
191 property int mainStageItemId: 0
@@ -431,7 +434,7 @@ AbstractStage {
431 id: appContainer
434 id: appContainer
432 objectName: "appContainer"
435 objectName: "appContainer"
433 anchors.fill: parent
436 anchors.fill: parent
434− focus: root.state !== "altTab"
437+ focus: root.state !== "spread"
435
438
436 CrossFadeImage {
439 CrossFadeImage {
437 id: wallpaper
440 id: wallpaper
@@ -618,8 +621,8 @@ AbstractStage {
618 angleDiff = (360 + angleDiff) % 360;
621 angleDiff = (360 + angleDiff) % 360;
619 if (angleDiff === 90 || angleDiff === 270) {
622 if (angleDiff === 90 || angleDiff === 270) {
620 var aux = decoratedWindow.requestedHeight;
623 var aux = decoratedWindow.requestedHeight;
621− decoratedWindow.requestedHeight = decoratedWindow.requestedWidth + decoratedWindow.visibleDecorationHeight;
624+ decoratedWindow.requestedHeight = decoratedWindow.requestedWidth + decoratedWindow.decorationHeight;
622− decoratedWindow.requestedWidth = aux - decoratedWindow.visibleDecorationHeight;
625+ decoratedWindow.requestedWidth = aux - decoratedWindow.decorationHeight;
623 }
626 }
624 }
627 }
625 decoratedWindow.surfaceOrientationAngle = shellOrientationAngle;
628 decoratedWindow.surfaceOrientationAngle = shellOrientationAngle;
@@ -628,6 +631,10 @@ AbstractStage {
628 }
631 }
629 }
632 }
630 }
633 }
634+ Connections {
635+ target: priv
636+ onSideStageEnabledChanged: refreshStage()
637+ }
631
638
632 readonly property alias application: decoratedWindow.application
639 readonly property alias application: decoratedWindow.application
633 readonly property alias minimumWidth: decoratedWindow.minimumWidth
640 readonly property alias minimumWidth: decoratedWindow.minimumWidth
@@ -728,6 +735,9 @@ AbstractStage {
728 print("focusing because of creation")
735 print("focusing because of creation")
729 focus = true;
736 focus = true;
730 }
737 }
738+
739+ refreshStage();
740+ _constructing = false;
731 }
741 }
732 Component.onDestruction: {
742 Component.onDestruction: {
733 if (!root.parent) {
743 if (!root.parent) {
@@ -754,6 +764,7 @@ AbstractStage {
754
764
755 onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
765 onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
756
766
767+ property bool _constructing: true;
757 onStageChanged: {
768 onStageChanged: {
758 if (!_constructing) {
769 if (!_constructing) {
759 priv.updateMainAndSideStageIndexes();
770 priv.updateMainAndSideStageIndexes();
@@ -843,6 +854,25 @@ AbstractStage {
843 }
854 }
844 }
855 }
845
856
857+ function refreshStage() {
858+ var newStage = ApplicationInfoInterface.MainStage;
859+ if (priv.sideStageEnabled) { // we're in lanscape rotation.
860+ if (!isDash && application && application.supportedOrientations & (Qt.PortraitOrientation|Qt.InvertedPortraitOrientation)) {
861+ var defaultStage = ApplicationInfoInterface.SideStage; // if application supports portrait, it defaults to sidestage.
862+ if (application.supportedOrientations & (Qt.LandscapeOrientation|Qt.InvertedLandscapeOrientation)) {
863+ // if it supports lanscape, it defaults to mainstage.
864+ defaultStage = ApplicationInfoInterface.MainStage;
865+ }
866+ newStage = WindowStateStorage.getStage(application.appId, defaultStage);
867+ }
868+ }
869+
870+ stage = newStage;
871+ if (focus && stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
872+ sideStage.show();
873+ }
874+ }
875+
846 UbuntuNumberAnimation {
876 UbuntuNumberAnimation {
847 id: focusAnimation
877 id: focusAnimation
848 target: appDelegate
878 target: appDelegate