on xenial help sign in
Desktop stage: Support rotatesWindowContents
4eb4f74Albert Astals Cid
qml/Stages/DecoratedWindow.qml+6−2
@@ -36,8 +36,9 @@ FocusScope {
36 property bool highlightShown: false
36 property bool highlightShown: false
37 property real shadowOpacity: 1
37 property real shadowOpacity: 1
38
38
39− property alias requestedWidth: applicationWindow.requestedWidth
39+ property real requestedWidth
40 property real requestedHeight
40 property real requestedHeight
41+ property alias surfaceOrientationAngle: applicationWindow.surfaceOrientationAngle
41
42
42 property alias minimumWidth: applicationWindow.minimumWidth
43 property alias minimumWidth: applicationWindow.minimumWidth
43 readonly property int minimumHeight: (root.decorationShown ? decoration.height : 0) + applicationWindow.minimumHeight
44 readonly property int minimumHeight: (root.decorationShown ? decoration.height : 0) + applicationWindow.minimumHeight
@@ -98,7 +99,10 @@ FocusScope {
98 anchors.top: parent.top
99 anchors.top: parent.top
99 anchors.topMargin: decoration.height
100 anchors.topMargin: decoration.height
100 anchors.left: parent.left
101 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
102 interactive: true
106 interactive: true
103 focus: true
107 focus: true
104 }
108 }
qml/Stages/DesktopStage.qml+6−1
@@ -255,6 +255,9 @@ AbstractStage {
255 focus: appId === priv.focusedAppId
255 focus: appId === priv.focusedAppId
256 width: decoratedWindow.width
256 width: decoratedWindow.width
257 height: decoratedWindow.height
257 height: decoratedWindow.height
258+ rotation: decoratedWindow.application && decoratedWindow.application.rotatesWindowContents
259+ ? ((360 - shellOrientationAngle) % 360) : 0
260+
258 property alias requestedWidth: decoratedWindow.requestedWidth
261 property alias requestedWidth: decoratedWindow.requestedWidth
259 property alias requestedHeight: decoratedWindow.requestedHeight
262 property alias requestedHeight: decoratedWindow.requestedHeight
260 property alias minimumWidth: decoratedWindow.minimumWidth
263 property alias minimumWidth: decoratedWindow.minimumWidth
@@ -356,7 +359,8 @@ AbstractStage {
356 name: "fullscreen"; when: decoratedWindow.fullscreen
359 name: "fullscreen"; when: decoratedWindow.fullscreen
357 PropertyChanges {
360 PropertyChanges {
358 target: appDelegate;
361 target: appDelegate;
362+ x: rotation == 0 ? 0 : (parent.width - width) / 2 + (shellOrientationAngle == 90 ? -PanelState.panelHeight : PanelState.panelHeight)
359− x: 0; y: -PanelState.panelHeight
363+ y: rotation == 0 ? -PanelState.panelHeight : (parent.height - height) / 2
360 requestedWidth: appContainer.width; requestedHeight: appContainer.height;
364 requestedWidth: appContainer.width; requestedHeight: appContainer.height;
361 }
365 }
362 },
366 },
@@ -466,6 +470,7 @@ AbstractStage {
466 application: ApplicationManager.get(index)
470 application: ApplicationManager.get(index)
467 active: ApplicationManager.focusedApplicationId === model.appId
471 active: ApplicationManager.focusedApplicationId === model.appId
468 focus: true
472 focus: true
473+ surfaceOrientationAngle: application && application.rotatesWindowContents ? shellOrientationAngle : 0
469
474
470 onClose: ApplicationManager.stopApplication(model.appId)
475 onClose: ApplicationManager.stopApplication(model.appId)
471 onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
476 onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
tests/qmltests/tst_OrientedShell.qml+7
@@ -551,6 +551,7 @@ Rectangle {
551 function test_appRotatesWindowContents_data() {
551 function test_appRotatesWindowContents_data() {
552 return [
552 return [
553 {tag: "mako", deviceName: "mako", orientationAngleAfterRotation: 90},
553 {tag: "mako", deviceName: "mako", orientationAngleAfterRotation: 90},
554+ {tag: "mako_windowed", deviceName: "mako", orientationAngleAfterRotation: 90, windowed: true},
554 {tag: "manta", deviceName: "manta", orientationAngleAfterRotation: 90},
555 {tag: "manta", deviceName: "manta", orientationAngleAfterRotation: 90},
555 {tag: "flo", deviceName: "flo", orientationAngleAfterRotation: 180}
556 {tag: "flo", deviceName: "flo", orientationAngleAfterRotation: 180}
556 ];
557 ];
@@ -560,6 +561,12 @@ Rectangle {
560 var cameraApp = ApplicationManager.startApplication("camera-app");
561 var cameraApp = ApplicationManager.startApplication("camera-app");
561 verify(cameraApp);
562 verify(cameraApp);
562
563
564+ if (data.windowed) {
565+ usageModeSelector.selectWindowed();
566+ } else {
567+ usageModeSelector.selectStaged();
568+ }
569+
563 // ensure the mock camera-app is as we expect
570 // ensure the mock camera-app is as we expect
564 compare(cameraApp.fullscreen, true);
571 compare(cameraApp.fullscreen, true);
565 compare(cameraApp.rotatesWindowContents, true);
572 compare(cameraApp.rotatesWindowContents, true);