on xenial help sign in
Desktop stage rotates only to follow screen orientation
commita73b099f360c42ed68da5c562ace102c61324466 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateThu 14 Jan 2016, 11:03 (11 years ago) parent6976414
5 files changed+24−7
qml/Shell.qml+3−3 qml/Stages/AbstractStage.qml+5−1 qml/Stages/DesktopStage.qml+6−1 qml/Stages/PhoneStage.qml+5−1 qml/Stages/TabletStage.qml+5−1
qml/Shell.qml+3−3
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013-2015 Canonical, Ltd.
2+ * Copyright (C) 2013-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -84,8 +84,8 @@ Item {
8484 return Qt.PrimaryOrientation;
8585 } else if (greeter && greeter.shown) {
8686 return Qt.PrimaryOrientation;
87− } else if (mainApp) {
88− return shell.orientations.map(mainApp.supportedOrientations);
87+ } else if (applicationsDisplayLoader.item) {
88+ return shell.orientations.map(applicationsDisplayLoader.item.supportedOrientations);
8989 } else {
9090 // we just don't care
9191 return Qt.PortraitOrientation
qml/Stages/AbstractStage.qml+5−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2015 Canonical, Ltd.
2+ * Copyright (C) 2015-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -44,6 +44,10 @@ Rectangle {
4444 property var mainApp: null
4545 property int mainAppWindowOrientationAngle
4646 property bool orientationChangesEnabled
47+ property int supportedOrientations: Qt.PortraitOrientation
48+ | Qt.LandscapeOrientation
49+ | Qt.InvertedPortraitOrientation
50+ | Qt.InvertedLandscapeOrientation
4751
4852 // Shared code for use in stage implementations
4953 GSettings {
qml/Stages/DesktopStage.qml+6−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2014-2015 Canonical, Ltd.
2+ * Copyright (C) 2014-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -40,6 +40,11 @@ AbstractStage {
4040 ? ApplicationManager.findApplication(ApplicationManager.focusedApplicationId)
4141 : null
4242
43+ // application windows never rotate independently
44+ mainAppWindowOrientationAngle: shellOrientationAngle
45+
46+ orientationChangesEnabled: true
47+
4348 Connections {
4449 target: ApplicationManager
4550 onApplicationAdded: {
qml/Stages/PhoneStage.qml+5−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2014-2015 Canonical, Ltd.
2+ * Copyright (C) 2014-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -83,6 +83,10 @@ AbstractStage {
8383 && !(priv.focusedAppDelegate && priv.focusedAppDelegate.xBehavior.running)
8484 && spreadView.phase === 0
8585
86+ supportedOrientations: mainApp ? mainApp.supportedOrientations
87+ : (Qt.PortraitOrientation | Qt.LandscapeOrientation
88+ | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation)
89+
8690 // How far left the stage has been dragged
8791 readonly property real dragProgress: spreadRepeater.count > 0 ? -spreadRepeater.itemAt(0).xTranslate : 0
8892
qml/Stages/TabletStage.qml+5−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2014-2015 Canonical, Ltd.
2+ * Copyright (C) 2014-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -72,6 +72,10 @@ AbstractStage {
7272
7373 orientationChangesEnabled: priv.mainAppOrientationChangesEnabled
7474
75+ supportedOrientations: mainApp ? mainApp.supportedOrientations
76+ : (Qt.PortraitOrientation | Qt.LandscapeOrientation
77+ | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation)
78+
7579 onWidthChanged: {
7680 spreadView.selectedIndex = -1;
7781 spreadView.phase = 0;