on xenial help sign in
We now resize and rotate app surfaces instead of letting then rotate themselves

TODO: Update app thumbnails to match the new approach

commit845d865657437b1a6dd92c0c0c4cf67e5a24cba1 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateMon 26 May 2014, 15:44 (12 years ago) parent67d9b8a
3 files changed+26−49
qml/Shell.qml+5−11 qml/Stages/PhoneStage.qml+2−3 qml/Stages/SpreadDelegate.qml+19−35
qml/Shell.qml+5−11
@@ -242,8 +242,8 @@ FocusScope {
242242 }
243243 Binding {
244244 target: applicationsDisplayLoader.item
245− property: "orientationAngleOfSurfaces"
246− value: shell.orientationAngle
245+ property: "maximizedAppTopMargin"
246+ value: panel.panelHeight
247247 }
248248 }
249249 }
@@ -445,15 +445,9 @@ FocusScope {
445445 contentEnabled: edgeDemo.panelContentEnabled
446446 }
447447
448− property bool topmostSurfaceIsFullscreen: {
449− if (SurfaceManager.empty) {
450− return false;
451− } else {
452− // TODO check the actual surface size to see if it fills the screen
453− // For now they're all fullscreen anyway, so this assumption will hold.
454− return true;
455− }
456− }
448+ property bool topmostSurfaceIsFullscreen:
449+ SurfaceManager.topmostSurface &&
450+ SurfaceManager.topmostSurface.state === MirSurfaceItem.Fullscreen
457451
458452 fullscreenMode: stages.roughlyFullyShown && topmostSurfaceIsFullscreen
459453 && !greeter.shown && !lockscreen.shown
qml/Stages/PhoneStage.qml+2−3
@@ -25,10 +25,9 @@ Rectangle {
2525 id: root
2626 color: "green"
2727
28− property int orientationAngleOfSurfaces
29−
3028 // Controls to be set from outside
3129 property int dragAreaWidth
30+ property real maximizedAppTopMargin
3231
3332 // FIXME: Should be registerd singleton type QAbstractItemModel.
3433 property var surfaces
@@ -240,7 +239,6 @@ Rectangle {
240239 delegate: TransformedSpreadDelegate {
241240 id: appDelegate
242241 objectName: "appDelegate" + index
243− orientationAngle: root.orientationAngleOfSurfaces
244242 startAngle: 45
245243 endAngle: 5
246244 startScale: 1.1
@@ -253,6 +251,7 @@ Rectangle {
253251 otherSelected: spreadView.selectedIndex >= 0 && !selected
254252 surface: model.surface
255253 interactive: !spreadView.interactive
254+ maximizedAppTopMargin: root.maximizedAppTopMargin
256255
257256 z: index
258257 x: index == 0 ? 0 : spreadView.width + (index - 1) * spreadView.tileDistance
qml/Stages/SpreadDelegate.qml+19−35
@@ -17,6 +17,7 @@
1717*/
1818
1919import QtQuick 2.0
20+import Mir.Application 0.1
2021
2122Item {
2223 id: root
@@ -24,7 +25,7 @@ Item {
2425 signal clicked()
2526 property real topMarginProgress
2627 property bool interactive: true
27− property int orientationAngle
28+ property real maximizedAppTopMargin
2829
2930 // FIXME: This really should be invisible to QML code.
3031 // e.g. Create a SurfaceItem {} in C++ which we just use without any imperative hacks.
@@ -34,22 +35,25 @@ Item {
3435 surface.parent = root;
3536 surface.enabled = root.interactive;
3637 surface.z = 1;
37−
38− // for the counter-rotation
39− surface.transformOrigin = Item.TopLeft;
4038 }
4139 }
4240
43− // Applications already rotate automatically. And so does the shell
44− // Therefore we have to counter-rotate the app item to undo the rotation applied to
45− // it by the shell
46− state: orientationAngle.toString()
41+ state: {
42+ if (surface) {
43+ if (surface.state === MirSurfaceItem.Fullscreen) {
44+ "fullscreen";
45+ } else {
46+ "maximized";
47+ }
48+ } else {
49+ return "empty"
50+ }
51+ }
4752 states: [
4853 State {
49− name: "0"
54+ name: "fullscreen"
5055 PropertyChanges {
5156 target: surface
52− rotation: 0
5357 x: 0
5458 y: 0
5559 width: root.width
@@ -57,37 +61,17 @@ Item {
5761 }
5862 },
5963 State {
60− name: "90"
64+ name: "maximized"
6165 PropertyChanges {
6266 target: surface
63− rotation: -90
6467 x: 0
65− y: root.height
66− width: root.height
67− height: root.width
68− }
69− },
70− State {
71− name: "180"
72− PropertyChanges {
73− target: surface
74− rotation: -180
75− x: root.width
76− y: root.height
68+ y: maximizedAppTopMargin
7769 width: root.width
78− height: root.height
70+ height: root.height - y
7971 }
8072 },
8173 State {
82− name: "270"
83− PropertyChanges {
84− target: surface
85− rotation: -270
86− x: root.width
87− y: 0
88− width: root.height
89− height: root.width
90− }
74+ name: "empty"
9175 }
9276 ]
9377
@@ -99,7 +83,7 @@ Item {
9983
10084 BorderImage {
10185 id: dropShadow
102− anchors.fill: root
86+ anchors.fill: surface
10387 anchors.margins: -units.gu(2)
10488 source: "graphics/dropshadow.png"
10589 opacity: .4