on xenial help sign in
Desktop stage: Support rotatesWindowContents
commit4eb4f7474768fced7f17dcb0ea94f6e1e7c6aa22 authorAlbert Astals Cid <albert.astals@canonical.com> dateThu 10 Mar 2016, 14:34 (11 years ago) parent8824bd1
3 files changed+19−3
qml/Stages/DecoratedWindow.qml+6−2 qml/Stages/DesktopStage.qml+6−1 tests/qmltests/tst_OrientedShell.qml+7
qml/Stages/DecoratedWindow.qml+6−2
@@ -36,8 +36,9 @@ FocusScope {
3636 property bool highlightShown: false
3737 property real shadowOpacity: 1
3838
39− property alias requestedWidth: applicationWindow.requestedWidth
39+ property real requestedWidth
4040 property real requestedHeight
41+ property alias surfaceOrientationAngle: applicationWindow.surfaceOrientationAngle
4142
4243 property alias minimumWidth: applicationWindow.minimumWidth
4344 readonly property int minimumHeight: (root.decorationShown ? decoration.height : 0) + applicationWindow.minimumHeight
@@ -98,7 +99,10 @@ FocusScope {
9899 anchors.top: parent.top
99100 anchors.topMargin: decoration.height
100101 anchors.left: parent.left
101− requestedHeight: root.requestedHeight - (root.decorationShown ? decoration.height : 0)
102+ readonly property real requestedHeightMinusDecoration: root.requestedHeight - (root.decorationShown ? decoration.height : 0)
103+ readonly property bool counterRotate: surfaceOrientationAngle != 0 && surfaceOrientationAngle != 180
104+ requestedHeight: !counterRotate ? requestedHeightMinusDecoration : root.requestedWidth
105+ requestedWidth: !counterRotate ? root.requestedWidth : requestedHeightMinusDecoration
102106 interactive: true
103107 focus: true
104108 }
qml/Stages/DesktopStage.qml+6−1
@@ -255,6 +255,9 @@ AbstractStage {
255255 focus: appId === priv.focusedAppId
256256 width: decoratedWindow.width
257257 height: decoratedWindow.height
258+ rotation: decoratedWindow.application && decoratedWindow.application.rotatesWindowContents
259+ ? ((360 - shellOrientationAngle) % 360) : 0
260+
258261 property alias requestedWidth: decoratedWindow.requestedWidth
259262 property alias requestedHeight: decoratedWindow.requestedHeight
260263 property alias minimumWidth: decoratedWindow.minimumWidth
@@ -356,7 +359,8 @@ AbstractStage {
356359 name: "fullscreen"; when: decoratedWindow.fullscreen
357360 PropertyChanges {
358361 target: appDelegate;
359− x: 0; y: -PanelState.panelHeight
362+ x: rotation == 0 ? 0 : (parent.width - width) / 2 + (shellOrientationAngle == 90 ? -PanelState.panelHeight : PanelState.panelHeight)
363+ y: rotation == 0 ? -PanelState.panelHeight : (parent.height - height) / 2
360364 requestedWidth: appContainer.width; requestedHeight: appContainer.height;
361365 }
362366 },
@@ -466,6 +470,7 @@ AbstractStage {
466470 application: ApplicationManager.get(index)
467471 active: ApplicationManager.focusedApplicationId === model.appId
468472 focus: true
473+ surfaceOrientationAngle: application && application.rotatesWindowContents ? shellOrientationAngle : 0
469474
470475 onClose: ApplicationManager.stopApplication(model.appId)
471476 onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
tests/qmltests/tst_OrientedShell.qml+7
@@ -551,6 +551,7 @@ Rectangle {
551551 function test_appRotatesWindowContents_data() {
552552 return [
553553 {tag: "mako", deviceName: "mako", orientationAngleAfterRotation: 90},
554+ {tag: "mako_windowed", deviceName: "mako", orientationAngleAfterRotation: 90, windowed: true},
554555 {tag: "manta", deviceName: "manta", orientationAngleAfterRotation: 90},
555556 {tag: "flo", deviceName: "flo", orientationAngleAfterRotation: 180}
556557 ];
@@ -560,6 +561,12 @@ Rectangle {
560561 var cameraApp = ApplicationManager.startApplication("camera-app");
561562 verify(cameraApp);
562563
564+ if (data.windowed) {
565+ usageModeSelector.selectWindowed();
566+ } else {
567+ usageModeSelector.selectStaged();
568+ }
569+
563570 // ensure the mock camera-app is as we expect
564571 compare(cameraApp.fullscreen, true);
565572 compare(cameraApp.rotatesWindowContents, true);