on xenial help sign in
We now resize and rotate app surfaces instead of letting then rotate themselves
845d865Daniel d'Andrada
qml/Shell.qml+5−11
@@ -242,8 +242,8 @@ FocusScope {
242 }
242 }
243 Binding {
243 Binding {
244 target: applicationsDisplayLoader.item
244 target: applicationsDisplayLoader.item
245− property: "orientationAngleOfSurfaces"
245+ property: "maximizedAppTopMargin"
246− value: shell.orientationAngle
246+ value: panel.panelHeight
247 }
247 }
248 }
248 }
249 }
249 }
@@ -445,15 +445,9 @@ FocusScope {
445 contentEnabled: edgeDemo.panelContentEnabled
445 contentEnabled: edgeDemo.panelContentEnabled
446 }
446 }
447
447
448− property bool topmostSurfaceIsFullscreen: {
448+ property bool topmostSurfaceIsFullscreen:
449− if (SurfaceManager.empty) {
449+ SurfaceManager.topmostSurface &&
450− return false;
450+ SurfaceManager.topmostSurface.state === MirSurfaceItem.Fullscreen
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− }
457
451
458 fullscreenMode: stages.roughlyFullyShown && topmostSurfaceIsFullscreen
452 fullscreenMode: stages.roughlyFullyShown && topmostSurfaceIsFullscreen
459 && !greeter.shown && !lockscreen.shown
453 && !greeter.shown && !lockscreen.shown
qml/Stages/PhoneStage.qml+2−3
@@ -25,10 +25,9 @@ Rectangle {
25 id: root
25 id: root
26 color: "green"
26 color: "green"
27
27
28− property int orientationAngleOfSurfaces
29−
30 // Controls to be set from outside
28 // Controls to be set from outside
31 property int dragAreaWidth
29 property int dragAreaWidth
30+ property real maximizedAppTopMargin
32
31
33 // FIXME: Should be registerd singleton type QAbstractItemModel.
32 // FIXME: Should be registerd singleton type QAbstractItemModel.
34 property var surfaces
33 property var surfaces
@@ -240,7 +239,6 @@ Rectangle {
240 delegate: TransformedSpreadDelegate {
239 delegate: TransformedSpreadDelegate {
241 id: appDelegate
240 id: appDelegate
242 objectName: "appDelegate" + index
241 objectName: "appDelegate" + index
243− orientationAngle: root.orientationAngleOfSurfaces
244 startAngle: 45
242 startAngle: 45
245 endAngle: 5
243 endAngle: 5
246 startScale: 1.1
244 startScale: 1.1
@@ -253,6 +251,7 @@ Rectangle {
253 otherSelected: spreadView.selectedIndex >= 0 && !selected
251 otherSelected: spreadView.selectedIndex >= 0 && !selected
254 surface: model.surface
252 surface: model.surface
255 interactive: !spreadView.interactive
253 interactive: !spreadView.interactive
254+ maximizedAppTopMargin: root.maximizedAppTopMargin
256
255
257 z: index
256 z: index
258 x: index == 0 ? 0 : spreadView.width + (index - 1) * spreadView.tileDistance
257 x: index == 0 ? 0 : spreadView.width + (index - 1) * spreadView.tileDistance
qml/Stages/SpreadDelegate.qml+19−35
@@ -17,6 +17,7 @@
17*/
17*/
18
18
19import QtQuick 2.0
19import QtQuick 2.0
20+import Mir.Application 0.1
20
21
21Item {
22Item {
22 id: root
23 id: root
@@ -24,7 +25,7 @@ Item {
24 signal clicked()
25 signal clicked()
25 property real topMarginProgress
26 property real topMarginProgress
26 property bool interactive: true
27 property bool interactive: true
27− property int orientationAngle
28+ property real maximizedAppTopMargin
28
29
29 // FIXME: This really should be invisible to QML code.
30 // FIXME: This really should be invisible to QML code.
30 // e.g. Create a SurfaceItem {} in C++ which we just use without any imperative hacks.
31 // e.g. Create a SurfaceItem {} in C++ which we just use without any imperative hacks.
@@ -34,22 +35,25 @@ Item {
34 surface.parent = root;
35 surface.parent = root;
35 surface.enabled = root.interactive;
36 surface.enabled = root.interactive;
36 surface.z = 1;
37 surface.z = 1;
37−
38− // for the counter-rotation
39− surface.transformOrigin = Item.TopLeft;
40 }
38 }
41 }
39 }
42
40
43− // Applications already rotate automatically. And so does the shell
41+ state: {
44− // Therefore we have to counter-rotate the app item to undo the rotation applied to
42+ if (surface) {
45− // it by the shell
43+ if (surface.state === MirSurfaceItem.Fullscreen) {
46− state: orientationAngle.toString()
44+ "fullscreen";
45+ } else {
46+ "maximized";
47+ }
48+ } else {
49+ return "empty"
50+ }
51+ }
47 states: [
52 states: [
48 State {
53 State {
49− name: "0"
54+ name: "fullscreen"
50 PropertyChanges {
55 PropertyChanges {
51 target: surface
56 target: surface
52− rotation: 0
53 x: 0
57 x: 0
54 y: 0
58 y: 0
55 width: root.width
59 width: root.width
@@ -57,37 +61,17 @@ Item {
57 }
61 }
58 },
62 },
59 State {
63 State {
60− name: "90"
64+ name: "maximized"
61 PropertyChanges {
65 PropertyChanges {
62 target: surface
66 target: surface
63− rotation: -90
64 x: 0
67 x: 0
65− y: root.height
68+ y: maximizedAppTopMargin
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
77 width: root.width
69 width: root.width
78− height: root.height
70+ height: root.height - y
79 }
71 }
80 },
72 },
81 State {
73 State {
82− name: "270"
74+ name: "empty"
83− PropertyChanges {
84− target: surface
85− rotation: -270
86− x: root.width
87− y: 0
88− width: root.height
89− height: root.width
90− }
91 }
75 }
92 ]
76 ]
93
77
@@ -99,7 +83,7 @@ Item {
99
83
100 BorderImage {
84 BorderImage {
101 id: dropShadow
85 id: dropShadow
102− anchors.fill: root
86+ anchors.fill: surface
103 anchors.margins: -units.gu(2)
87 anchors.margins: -units.gu(2)
104 source: "graphics/dropshadow.png"
88 source: "graphics/dropshadow.png"
105 opacity: .4
89 opacity: .4