@@ -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