on xenial help sign in
per shell panel state
commit795acac113bfd04ce9f5d3f4f7dcba2cf53e5a57 authorNick Dedekind <nick.dedekind@canonical.com> dateThu 12 Jan 2017, 15:53 (10 years ago) parent389a48b
15 files changed+118−90
qml/Components/PanelState/PanelState.qml−1 qml/Components/PanelState/qmldir+1−1 qml/Greeter/SecondaryGreeter.qml+2−2 qml/Panel/Panel.qml+11−10 qml/Shell.qml+8 qml/Stage/DecoratedWindow.qml+4 qml/Stage/FakeMaximizeDelegate.qml+12−11 qml/Stage/MoveHandler.qml+8−7 qml/Stage/Stage.qml+26−24 qml/Stage/WindowControlsOverlay.qml+2 tests/qmltests/Panel/tst_Panel.qml+9−8 tests/qmltests/Stage/tst_DesktopStage.qml+8−3 tests/qmltests/Stage/tst_WindowResizeArea.qml+1−8 tests/qmltests/tst_OrientedShell.qml+13−5 tests/qmltests/tst_Shell.qml+13−10
qml/Components/PanelState/PanelState.qml−1
@@ -14,7 +14,6 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−pragma Singleton
1817import QtQuick 2.4
1918
2019QtObject {
qml/Components/PanelState/qmldir+1−1
@@ -1 +1 @@
1−singleton PanelState 1.0 PanelState.qml
1+PanelState 1.0 PanelState.qml
qml/Greeter/SecondaryGreeter.qml+2−2
@@ -33,8 +33,8 @@ Showable {
3333 property string lockedApp: ""
3434
3535 function forceShow() { show(); }
36− property var notifyAboutToFocusApp: (function(appId) { return; })
37− property var notifyAppFocused: (function(appId) { return; })
36+ property var notifyAppFocusRequested: (function(appId) { return; })
37+ property var notifyUserRequestedApp: (function(appId) { return; })
3838 property var notifyShowingDashFromDrag: (function(appId) { return false; })
3939
4040 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
qml/Panel/Panel.qml+11−10
@@ -29,6 +29,7 @@ Item {
2929 property bool fullscreenMode: false
3030 property real indicatorAreaShowProgress: 1.0
3131 property bool locked: false
32+ property PanelState panelState
3233
3334 MouseArea {
3435 anchors.fill: parent
@@ -40,7 +41,7 @@ Item {
4041 }
4142
4243 Binding {
43− target: PanelState
44+ target: panelState
4445 property: "panelHeight"
4546 value: indicators.minimizedPanelHeight
4647 }
@@ -74,7 +75,7 @@ Item {
7475 fill: indicatorAreaBackground
7576 bottomMargin: -units.gu(1)
7677 }
77− visible: PanelState.dropShadow && !callHint.visible
78+ visible: panelState.dropShadow && !callHint.visible
7879 source: "graphics/rectangular_dropshadow.sci"
7980 }
8081
@@ -120,14 +121,14 @@ Item {
120121 }
121122 height: indicators.minimizedPanelHeight
122123
123− visible: ((PanelState.buttonsVisible && parent.containsMouse) || PanelState.buttonsAlwaysVisible)
124+ visible: ((panelState.buttonsVisible && parent.containsMouse) || panelState.buttonsAlwaysVisible)
124125 && !root.locked && !callHint.visible
125− active: PanelState.buttonsVisible || PanelState.buttonsAlwaysVisible
126+ active: panelState.buttonsVisible || panelState.buttonsAlwaysVisible
126127 windowIsMaximized: true
127− onCloseClicked: PanelState.closeClicked()
128− onMinimizeClicked: PanelState.minimizeClicked()
129− onMaximizeClicked: PanelState.restoreClicked()
130− closeButtonShown: PanelState.closeButtonShown
128+ onCloseClicked: panelState.closeClicked()
129+ onMinimizeClicked: panelState.minimizeClicked()
130+ onMaximizeClicked: panelState.restoreClicked()
131+ closeButtonShown: panelState.closeButtonShown
131132 }
132133 }
133134
@@ -181,8 +182,8 @@ Item {
181182 visible: opacity != 0
182183 verticalAlignment: Text.AlignVCenter
183184 fontSize: "medium"
184− font.weight: PanelState.buttonsVisible ? Font.Light : Font.Medium
185− text: PanelState.title
185+ font.weight: panelState.buttonsVisible ? Font.Light : Font.Medium
186+ text: panelState.title
186187 elide: Text.ElideRight
187188 maximumLineCount: 1
188189 Behavior on opacity { UbuntuNumberAnimation {} }
qml/Shell.qml+8
@@ -38,6 +38,7 @@ import "Notifications"
3838import "Stage"
3939import "Tutorial"
4040import "Wizard"
41+import "Components/PanelState"
4142import Unity.Notifications 1.0 as NotificationBackend
4243import Unity.Session 0.1
4344import Unity.DashCommunicator 0.1
@@ -257,6 +258,11 @@ StyledItem {
257258 schema.id: "com.canonical.Unity8"
258259 }
259260
261+ PanelState {
262+ id: panelState
263+ objectName: "panelState"
264+ }
265+
260266 Item {
261267 id: stages
262268 objectName: "stages"
@@ -312,6 +318,7 @@ StyledItem {
312318 altTabPressed: physicalKeysMapper.altTabPressed
313319 oskEnabled: shell.oskEnabled
314320 spreadEnabled: tutorial.spreadEnabled && (!greeter || (!greeter.hasLockedApp && !greeter.shown))
321+ panelState: panelState
315322 }
316323 }
317324
@@ -490,6 +497,7 @@ StyledItem {
490497 fullscreenMode: (focusedSurfaceIsFullscreen && !LightDMService.greeter.active && launcher.progress == 0)
491498 || greeter.hasLockedApp
492499 locked: greeter && greeter.active
500+ panelState: panelState
493501 }
494502
495503 Launcher {
qml/Stage/DecoratedWindow.qml+4
@@ -18,6 +18,7 @@ import QtQuick 2.4
1818import Ubuntu.Components 1.3
1919import Unity.Application 0.1
2020import "Spread/MathUtils.js" as MathUtils
21+import "../Components/PanelState"
2122
2223FocusScope {
2324 id: root
@@ -70,6 +71,8 @@ FocusScope {
7071
7172 readonly property Item clientAreaItem: applicationWindow
7273
74+ property PanelState panelState
75+
7376 signal closeClicked()
7477 signal maximizeClicked()
7578 signal maximizeHorizontallyClicked()
@@ -179,6 +182,7 @@ FocusScope {
179182 objectName: "moveHandler"
180183 target: root.parent
181184 buttonsWidth: decoration.buttonsWidth
185+ panelState: root.panelState
182186 }
183187
184188 ApplicationWindow {
qml/Stage/FakeMaximizeDelegate.qml+12−11
@@ -35,6 +35,7 @@ Rectangle {
3535 property int leftMargin
3636 property real appContainerWidth
3737 property real appContainerHeight
38+ property PanelState panelState
3839
3940 readonly property real hintThreshold: 0.1
4041
@@ -178,7 +179,7 @@ Rectangle {
178179 ParallelAnimation {
179180 id: fakeMaximizeAnimation
180181 UbuntuNumberAnimation { target: fakeRectangle; properties: "x"; duration: UbuntuAnimation.BriskDuration; to: leftMargin }
181− UbuntuNumberAnimation { target: fakeRectangle; properties: "y"; duration: UbuntuAnimation.BriskDuration; to: PanelState.panelHeight }
182+ UbuntuNumberAnimation { target: fakeRectangle; properties: "y"; duration: UbuntuAnimation.BriskDuration; to: panelState.panelHeight }
182183 UbuntuNumberAnimation { target: fakeRectangle; properties: "width"; duration: UbuntuAnimation.BriskDuration; to: appContainerWidth - leftMargin }
183184 UbuntuNumberAnimation { target: fakeRectangle; properties: "height"; duration: UbuntuAnimation.BriskDuration; to: appContainerHeight }
184185 }
@@ -186,39 +187,39 @@ Rectangle {
186187 ParallelAnimation {
187188 id: fakeMaximizeLeftAnimation
188189 UbuntuNumberAnimation { target: fakeRectangle; properties: "x"; duration: UbuntuAnimation.BriskDuration; to: leftMargin }
189− UbuntuNumberAnimation { target: fakeRectangle; properties: "y"; duration: UbuntuAnimation.BriskDuration; to: PanelState.panelHeight }
190+ UbuntuNumberAnimation { target: fakeRectangle; properties: "y"; duration: UbuntuAnimation.BriskDuration; to: panelState.panelHeight }
190191 UbuntuNumberAnimation { target: fakeRectangle; properties: "width"; duration: UbuntuAnimation.BriskDuration; to: (appContainerWidth - leftMargin)/2 }
191− UbuntuNumberAnimation { target: fakeRectangle; properties: "height"; duration: UbuntuAnimation.BriskDuration; to: appContainerHeight - PanelState.panelHeight }
192+ UbuntuNumberAnimation { target: fakeRectangle; properties: "height"; duration: UbuntuAnimation.BriskDuration; to: appContainerHeight - panelState.panelHeight }
192193 }
193194
194195 ParallelAnimation {
195196 id: fakeMaximizeRightAnimation
196197 UbuntuNumberAnimation { target: fakeRectangle; properties: "x"; duration: UbuntuAnimation.BriskDuration; to: (appContainerWidth + leftMargin)/2 }
197− UbuntuNumberAnimation { target: fakeRectangle; properties: "y"; duration: UbuntuAnimation.BriskDuration; to: PanelState.panelHeight }
198+ UbuntuNumberAnimation { target: fakeRectangle; properties: "y"; duration: UbuntuAnimation.BriskDuration; to: panelState.panelHeight }
198199 UbuntuNumberAnimation { target: fakeRectangle; properties: "width"; duration: UbuntuAnimation.BriskDuration; to: (appContainerWidth - leftMargin)/2 }
199− UbuntuNumberAnimation { target: fakeRectangle; properties: "height"; duration: UbuntuAnimation.BriskDuration; to: appContainerHeight - PanelState.panelHeight }
200+ UbuntuNumberAnimation { target: fakeRectangle; properties: "height"; duration: UbuntuAnimation.BriskDuration; to: appContainerHeight - panelState.panelHeight }
200201 }
201202
202203 ParallelAnimation {
203204 id: fakeMaximizeTopLeftAnimation
204205 UbuntuNumberAnimation { target: fakeRectangle; properties: "x"; duration: UbuntuAnimation.BriskDuration; to: leftMargin }
205− UbuntuNumberAnimation { target: fakeRectangle; properties: "y"; duration: UbuntuAnimation.BriskDuration; to: PanelState.panelHeight }
206+ UbuntuNumberAnimation { target: fakeRectangle; properties: "y"; duration: UbuntuAnimation.BriskDuration; to: panelState.panelHeight }
206207 UbuntuNumberAnimation { target: fakeRectangle; properties: "width"; duration: UbuntuAnimation.BriskDuration; to: (appContainerWidth - leftMargin)/2 }
207− UbuntuNumberAnimation { target: fakeRectangle; properties: "height"; duration: UbuntuAnimation.BriskDuration; to: (appContainerHeight - PanelState.panelHeight)/2 }
208+ UbuntuNumberAnimation { target: fakeRectangle; properties: "height"; duration: UbuntuAnimation.BriskDuration; to: (appContainerHeight - panelState.panelHeight)/2 }
208209 }
209210
210211 ParallelAnimation {
211212 id: fakeMaximizeTopRightAnimation
212213 UbuntuNumberAnimation { target: fakeRectangle; properties: "x"; duration: UbuntuAnimation.BriskDuration; to: (appContainerWidth + leftMargin)/2 }
213− UbuntuNumberAnimation { target: fakeRectangle; properties: "y"; duration: UbuntuAnimation.BriskDuration; to: PanelState.panelHeight }
214+ UbuntuNumberAnimation { target: fakeRectangle; properties: "y"; duration: UbuntuAnimation.BriskDuration; to: panelState.panelHeight }
214215 UbuntuNumberAnimation { target: fakeRectangle; properties: "width"; duration: UbuntuAnimation.BriskDuration; to: (appContainerWidth - leftMargin)/2 }
215− UbuntuNumberAnimation { target: fakeRectangle; properties: "height"; duration: UbuntuAnimation.BriskDuration; to: (appContainerHeight - PanelState.panelHeight)/2 }
216+ UbuntuNumberAnimation { target: fakeRectangle; properties: "height"; duration: UbuntuAnimation.BriskDuration; to: (appContainerHeight - panelState.panelHeight)/2 }
216217 }
217218
218219 ParallelAnimation {
219220 id: fakeMaximizeBottomLeftAnimation
220221 UbuntuNumberAnimation { target: fakeRectangle; properties: "x"; duration: UbuntuAnimation.BriskDuration; to: leftMargin }
221− UbuntuNumberAnimation { target: fakeRectangle; properties: "y"; duration: UbuntuAnimation.BriskDuration; to: (appContainerHeight + PanelState.panelHeight)/2 }
222+ UbuntuNumberAnimation { target: fakeRectangle; properties: "y"; duration: UbuntuAnimation.BriskDuration; to: (appContainerHeight + panelState.panelHeight)/2 }
222223 UbuntuNumberAnimation { target: fakeRectangle; properties: "width"; duration: UbuntuAnimation.BriskDuration; to: (appContainerWidth - leftMargin)/2 }
223224 UbuntuNumberAnimation { target: fakeRectangle; properties: "height"; duration: UbuntuAnimation.BriskDuration; to: appContainerHeight/2 }
224225 }
@@ -226,7 +227,7 @@ Rectangle {
226227 ParallelAnimation {
227228 id: fakeMaximizeBottomRightAnimation
228229 UbuntuNumberAnimation { target: fakeRectangle; properties: "x"; duration: UbuntuAnimation.BriskDuration; to: (appContainerWidth + leftMargin)/2 }
229− UbuntuNumberAnimation { target: fakeRectangle; properties: "y"; duration: UbuntuAnimation.BriskDuration; to: (appContainerHeight + PanelState.panelHeight)/2 }
230+ UbuntuNumberAnimation { target: fakeRectangle; properties: "y"; duration: UbuntuAnimation.BriskDuration; to: (appContainerHeight + panelState.panelHeight)/2 }
230231 UbuntuNumberAnimation { target: fakeRectangle; properties: "width"; duration: UbuntuAnimation.BriskDuration; to: (appContainerWidth - leftMargin)/2 }
231232 UbuntuNumberAnimation { target: fakeRectangle; properties: "height"; duration: UbuntuAnimation.BriskDuration; to: appContainerHeight/2 }
232233 }
qml/Stage/MoveHandler.qml+8−7
@@ -28,6 +28,7 @@ QtObject {
2828 property int stageWidth
2929 property int stageHeight
3030 property real buttonsWidth: 0
31+ property PanelState panelState
3132
3233 readonly property bool dragging: priv.dragging
3334
@@ -122,18 +123,18 @@ QtObject {
122123 // position. Mouse movement could have subpixel precision, yielding a fractional
123124 // mouse position.
124125 target.windowedX = Math.round(pos.x - priv.distanceX);
125− target.windowedY = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
126+ target.windowedY = Math.round(Math.max(pos.y - priv.distanceY, panelState.panelHeight));
126127
127128 if (sensingPoints) { // edge/corner detection when dragging via the touch overlay
128− if (sensingPoints.topLeft.x < priv.triggerArea && sensingPoints.topLeft.y < PanelState.panelHeight + priv.triggerArea
129+ if (sensingPoints.topLeft.x < priv.triggerArea && sensingPoints.topLeft.y < panelState.panelHeight + priv.triggerArea
129130 && target.canBeCornerMaximized) { // top left
130− priv.progress = priv.progressInCorner(0, PanelState.panelHeight, sensingPoints.topLeft.x, sensingPoints.topLeft.y);
131+ priv.progress = priv.progressInCorner(0, panelState.panelHeight, sensingPoints.topLeft.x, sensingPoints.topLeft.y);
131132 priv.resetEdges();
132133 priv.nearTopLeftCorner = true;
133134 root.fakeMaximizeTopLeftAnimationRequested(priv.progress);
134− } else if (sensingPoints.topRight.x > stageWidth - priv.triggerArea && sensingPoints.topRight.y < PanelState.panelHeight + priv.triggerArea
135+ } else if (sensingPoints.topRight.x > stageWidth - priv.triggerArea && sensingPoints.topRight.y < panelState.panelHeight + priv.triggerArea
135136 && target.canBeCornerMaximized) { // top right
136− priv.progress = priv.progressInCorner(stageWidth, PanelState.panelHeight, sensingPoints.topRight.x, sensingPoints.topRight.y);
137+ priv.progress = priv.progressInCorner(stageWidth, panelState.panelHeight, sensingPoints.topRight.x, sensingPoints.topRight.y);
137138 priv.resetEdges();
138139 priv.nearTopRightCorner = true;
139140 root.fakeMaximizeTopRightAnimationRequested(priv.progress);
@@ -159,8 +160,8 @@ QtObject {
159160 priv.resetEdges();
160161 priv.nearRightEdge = true;
161162 root.fakeMaximizeRightAnimationRequested(priv.progress);
162− } else if (sensingPoints.top.y < PanelState.panelHeight + priv.triggerArea && target.canBeMaximized) { // top
163− priv.progress = MathUtils.clampAndProject(sensingPoints.top.y, PanelState.panelHeight + priv.triggerArea, 0, 0, 1);
163+ } else if (sensingPoints.top.y < panelState.panelHeight + priv.triggerArea && target.canBeMaximized) { // top
164+ priv.progress = MathUtils.clampAndProject(sensingPoints.top.y, panelState.panelHeight + priv.triggerArea, 0, 0, 1);
164165 priv.resetEdges();
165166 priv.nearTopEdge = true;
166167 root.fakeMaximizeAnimationRequested(priv.progress);
qml/Stage/Stage.qml+26−24
@@ -46,6 +46,7 @@ FocusScope {
4646 property int leftMargin: 0
4747 property bool oskEnabled: false
4848 property rect inputMethodRect
49+ property PanelState panelState
4950
5051 // Configuration
5152 property string mode: "staged"
@@ -348,20 +349,20 @@ FocusScope {
348349 Component.onCompleted: priv.updateMainAndSideStageIndexes();
349350
350351 Connections {
351− target: PanelState
352+ target: panelState
352353 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
353354 onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
354355 onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
355356 }
356357
357358 Binding {
358− target: PanelState
359+ target: panelState
359360 property: "buttonsVisible"
360361 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.maximized // FIXME for Locally integrated menus
361362 }
362363
363364 Binding {
364− target: PanelState
365+ target: panelState
365366 property: "title"
366367 value: {
367368 if (priv.focusedAppDelegate !== null) {
@@ -376,21 +377,21 @@ FocusScope {
376377 }
377378
378379 Binding {
379− target: PanelState
380+ target: panelState
380381 property: "dropShadow"
381382 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null && mode == "windowed"
382383 }
383384
384385 Binding {
385− target: PanelState
386+ target: panelState
386387 property: "closeButtonShown"
387388 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !priv.focusedAppDelegate.isDash
388389 }
389390
390391 Component.onDestruction: {
391− PanelState.title = "";
392− PanelState.buttonsVisible = false;
393− PanelState.dropShadow = false;
392+ panelState.title = "";
393+ panelState.buttonsVisible = false;
394+ panelState.dropShadow = false;
394395 }
395396
396397 Instantiator {
@@ -739,7 +740,7 @@ FocusScope {
739740 target: appDelegate
740741 property: "y"
741742 value: appDelegate.requestedY -
742− Math.min(appDelegate.requestedY - PanelState.panelHeight,
743+ Math.min(appDelegate.requestedY - panelState.panelHeight,
743744 Math.max(0, priv.virtualKeyboardHeight - (appContainer.height - (appDelegate.requestedY + appDelegate.height))))
744745 when: root.oskEnabled && appDelegate.focus && (appDelegate.state == "normal" || appDelegate.state == "restored")
745746 && root.inputMethodRect.height > 0
@@ -876,7 +877,7 @@ FocusScope {
876877 screenWidth: appContainer.width
877878 screenHeight: appContainer.height
878879 leftMargin: root.leftMargin
879− minimumY: PanelState.panelHeight
880+ minimumY: panelState.panelHeight
880881 }
881882
882883 Connections {
@@ -1116,7 +1117,7 @@ FocusScope {
11161117 progress: 0
11171118 targetHeight: spreadItem.stackHeight
11181119 targetX: spreadMaths.targetX
1119− startY: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1120+ startY: appDelegate.fullscreen ? 0 : panelState.panelHeight
11201121 targetY: spreadMaths.targetY
11211122 targetAngle: spreadMaths.targetAngle
11221123 targetScale: spreadMaths.targetScale
@@ -1235,9 +1236,9 @@ FocusScope {
12351236 PropertyChanges {
12361237 target: appDelegate
12371238 x: stageMaths.itemX
1238− y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1239+ y: appDelegate.fullscreen ? 0 : panelState.panelHeight
12391240 requestedWidth: appContainer.width
1240− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
1241+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
12411242 visuallyMaximized: true
12421243 visible: appDelegate.x < root.width
12431244 }
@@ -1263,10 +1264,10 @@ FocusScope {
12631264 PropertyChanges {
12641265 target: appDelegate
12651266 x: stageMaths.itemX
1266− y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1267+ y: appDelegate.fullscreen ? 0 : panelState.panelHeight
12671268 z: stageMaths.itemZ
12681269 requestedWidth: stageMaths.itemWidth
1269− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
1270+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
12701271 visuallyMaximized: true
12711272 visible: appDelegate.x < root.width
12721273 }
@@ -1331,9 +1332,9 @@ FocusScope {
13311332 PropertyChanges {
13321333 target: appDelegate
13331334 windowedX: root.leftMargin
1334− windowedY: PanelState.panelHeight
1335+ windowedY: panelState.panelHeight
13351336 windowedWidth: (appContainer.width - root.leftMargin)/2
1336− windowedHeight: appContainer.height - PanelState.panelHeight
1337+ windowedHeight: appContainer.height - panelState.panelHeight
13371338 }
13381339 },
13391340 State {
@@ -1350,9 +1351,9 @@ FocusScope {
13501351 PropertyChanges {
13511352 target: appDelegate
13521353 windowedX: root.leftMargin
1353− windowedY: PanelState.panelHeight
1354+ windowedY: panelState.panelHeight
13541355 windowedWidth: (appContainer.width - root.leftMargin)/2
1355− windowedHeight: (appContainer.height - PanelState.panelHeight)/2
1356+ windowedHeight: (appContainer.height - panelState.panelHeight)/2
13561357 }
13571358 },
13581359 State {
@@ -1369,7 +1370,7 @@ FocusScope {
13691370 PropertyChanges {
13701371 target: appDelegate
13711372 windowedX: root.leftMargin
1372− windowedY: (appContainer.height + PanelState.panelHeight)/2
1373+ windowedY: (appContainer.height + panelState.panelHeight)/2
13731374 windowedWidth: (appContainer.width - root.leftMargin)/2
13741375 windowedHeight: appContainer.height/2
13751376 }
@@ -1391,8 +1392,8 @@ FocusScope {
13911392 State {
13921393 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
13931394 extend: "normal"
1394− PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: PanelState.panelHeight;
1395− windowedWidth: windowedWidth; windowedHeight: appContainer.height - PanelState.panelHeight }
1395+ PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: panelState.panelHeight;
1396+ windowedWidth: windowedWidth; windowedHeight: appContainer.height - panelState.panelHeight }
13961397 },
13971398 State {
13981399 name: "minimized"; when: appDelegate.minimized
@@ -1491,7 +1492,7 @@ FocusScope {
14911492 ]
14921493
14931494 Binding {
1494− target: PanelState
1495+ target: panelState
14951496 property: "buttonsAlwaysVisible"
14961497 value: appDelegate && appDelegate.maximized && touchControls.overlayShown
14971498 }
@@ -1506,7 +1507,7 @@ FocusScope {
15061507 anchors.margins: touchControls.overlayShown ? borderThickness/2 : -borderThickness
15071508
15081509 target: appDelegate
1509− minimumY: PanelState.panelHeight // disallow resizing up past Panel
1510+ minimumY: panelState.panelHeight // disallow resizing up past Panel
15101511 minWidth: units.gu(10)
15111512 minHeight: units.gu(10)
15121513 borderThickness: units.gu(2)
@@ -1699,6 +1700,7 @@ FocusScope {
16991700 leftMargin: root.leftMargin
17001701 appContainerWidth: appContainer.width
17011702 appContainerHeight: appContainer.height
1703+ panelState: root.panelState
17021704 }
17031705
17041706 EdgeBarrier {
qml/Stage/WindowControlsOverlay.qml+2
@@ -27,6 +27,7 @@ Item {
2727
2828 // to be set from outside
2929 property Item target // appDelegate
30+ property PanelState panelState
3031 property alias stageWidth: moveHandler.stageWidth
3132 property alias stageHeight: moveHandler.stageHeight
3233
@@ -161,6 +162,7 @@ Item {
161162 id: moveHandler
162163 objectName: "moveHandler"
163164 target: root.target
165+ panelState: root.panelState
164166
165167 onFakeMaximizeAnimationRequested: root.fakeMaximizeAnimationRequested(amount)
166168 onFakeMaximizeLeftAnimationRequested: root.fakeMaximizeLeftAnimationRequested(amount)
tests/qmltests/Panel/tst_Panel.qml+9−8
@@ -23,7 +23,6 @@ import Unity.Application 0.1
2323import Unity.Indicators 0.1 as Indicators
2424import Ubuntu.Telephony 0.1 as Telephony
2525import "../../../qml/Panel"
26−import "../../../qml/Components/PanelState"
2726
2827IndicatorTest {
2928 id: root
@@ -33,6 +32,8 @@ IndicatorTest {
3332
3433 Component.onCompleted: theme.name = "Ubuntu.Components.Themes.SuruDark"
3534
35+ readonly property alias panelState: panel.panelState
36+
3637 SurfaceManager {}
3738
3839 Binding {
@@ -109,7 +110,7 @@ IndicatorTest {
109110 Layout.fillWidth: true
110111 CheckBox {
111112 id: windowControlsCB
112− onClicked: PanelState.buttonsVisible = checked
113+ onClicked: panelState.buttonsVisible = checked
113114 }
114115 Label {
115116 text: "Show window controls"
@@ -121,9 +122,9 @@ IndicatorTest {
121122 CheckBox {
122123 onClicked: {
123124 if (checked)
124− PanelState.title = "Fake window title"
125+ panelState.title = "Fake window title"
125126 else
126− PanelState.title = ""
127+ panelState.title = ""
127128 }
128129 }
129130 Label {
@@ -186,7 +187,7 @@ IndicatorTest {
186187
187188 SignalSpy {
188189 id: windowControlButtonsSpy
189− target: PanelState
190+ target: panelState
190191 signalName: "closeClicked"
191192 }
192193
@@ -510,13 +511,13 @@ IndicatorTest {
510511
511512 // https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1611959
512513 function test_windowControlButtonsFittsLaw() {
513− var buttonsVisible = PanelState.buttonsVisible;
514− PanelState.buttonsVisible = true;
514+ var buttonsVisible = panelState.buttonsVisible;
515+ panelState.buttonsVisible = true;
515516 // click in very topleft corner and verify the close button got clicked too
516517 mouseMove(panel, 0, 0);
517518 mouseClick(panel, 0, 0, undefined /*button*/, undefined /*modifiers*/, 100 /*short delay*/);
518519 compare(windowControlButtonsSpy.count, 1);
519− PanelState.buttonsVisible = buttonsVisible;
520+ panelState.buttonsVisible = buttonsVisible;
520521 }
521522 }
522523}
tests/qmltests/Stage/tst_DesktopStage.qml+8−3
@@ -41,6 +41,10 @@ Item {
4141 value: false
4242 }
4343
44+ PanelState {
45+ id: panelState
46+ }
47+
4448 Component.onCompleted: {
4549 theme.name = "Ubuntu.Components.Themes.SuruDark";
4650 resetGeometry();
@@ -92,6 +96,7 @@ Item {
9296 topLevelSurfaceList: topSurfaceList
9397 interactive: true
9498 mode: "windowed"
99+ panelState: panelState
95100 }
96101 }
97102
@@ -624,19 +629,19 @@ Item {
624629 maximizeDelegate(facebookAppDelegate);
625630
626631 // verify the drop shadow is still not visible
627− verify(PanelState.dropShadow == false);
632+ verify(panelState.dropShadow == false);
628633
629634 // start a foreground app, not maximized
630635 var dialerAppDelegate = startApplication("dialer-app");
631636
632637 // verify the drop shadow becomes visible
633− verify(PanelState.dropShadow == true);
638+ verify(panelState.dropShadow == true);
634639
635640 // close the maximized app
636641 ApplicationManager.stopApplication("facebook-webapp");
637642
638643 // verify the drop shadow is gone
639− tryCompare(PanelState, "dropShadow", false);
644+ tryCompare(panelState, "dropShadow", false);
640645 }
641646
642647 function test_threeFingerTapShowsWindowControls_data() {
tests/qmltests/Stage/tst_WindowResizeArea.qml+1−8
@@ -19,7 +19,6 @@ import QtQuick.Layouts 1.1
1919import QtTest 1.0
2020import Unity.Test 0.1
2121import ".."
22−import "../../../qml/Components/PanelState"
2322import "../../../qml/Stage"
2423import Ubuntu.Components 1.3
2524import Ubuntu.Components.ListItems 1.3 as ListItem
@@ -31,12 +30,6 @@ Item {
3130 height: units.gu(60)
3231 width: units.gu(85)
3332
34− Binding {
35− target: PanelState
36− property: "panelHeight"
37− value: units.gu(3)
38− }
39−
4033 Component {
4134 id: fakeWindowComponent
4235
@@ -352,7 +345,7 @@ Item {
352345
353346 // Make sure it's again where we left it in normal state before destroying
354347 compare(fakeWindow.requestedX >= 0, true)
355− compare(fakeWindow.requestedY >= PanelState.panelHeight, true)
348+ compare(fakeWindow.requestedY >= 0, true)
356349 compare(fakeWindow.requestedX + fakeWindow.width <= root.width, true)
357350 compare(fakeWindow.requestedY + fakeWindow.height <= root.height, true)
358351
tests/qmltests/tst_OrientedShell.qml+13−5
@@ -29,7 +29,6 @@ import Utils 0.1
2929
3030import "../../qml"
3131import "../../qml/Components"
32−import "../../qml/Components/PanelState"
3332import "Stage"
3433
3534Rectangle {
@@ -439,6 +438,15 @@ Rectangle {
439438 property Item orientedShell: orientedShellLoader.status === Loader.Ready ? orientedShellLoader.item : null
440439 property Item shell
441440 property QtObject topLevelSurfaceList
441+ property var panelState: undefined
442+
443+ onOrientedShellChanged: {
444+ if (orientedShell) {
445+ panelState = findInvisibleChild(shell, "panelState");
446+ } else {
447+ panelState = undefined;
448+ }
449+ }
442450
443451 SignalSpy { id: signalSpy }
444452 SignalSpy { id: signalSpy2 }
@@ -1507,13 +1515,13 @@ Rectangle {
15071515 print("exptectedAngle", expectedAngle, point.x, point.y)
15081516 switch (expectedAngle) {
15091517 case 0:
1510− return point.x === 0 && point.y === PanelState.panelHeight;
1518+ return point.x === 0 && point.y === panelState.panelHeight;
15111519 case 90:
1512− return point.x === orientedShell.width - PanelState.panelHeight && point.y === 0;
1520+ return point.x === orientedShell.width - panelState.panelHeight && point.y === 0;
15131521 case 180:
1514− return point.x === orientedShell.width && point.y === orientedShell.height - PanelState.panelHeight;
1522+ return point.x === orientedShell.width && point.y === orientedShell.height - panelState.panelHeight;
15151523 default: // 270
1516− return point.x === PanelState.panelHeight && point.y === orientedShell.height;
1524+ return point.x === panelState.panelHeight && point.y === orientedShell.height;
15171525 }
15181526 }
15191527
tests/qmltests/tst_Shell.qml+13−10
@@ -55,12 +55,15 @@ Rectangle {
5555 onShellChanged: {
5656 if (shell) {
5757 topLevelSurfaceList = testCase.findInvisibleChild(shell, "topLevelSurfaceList");
58+ panelState = testCase.findInvisibleChild(shell, "panelState");
5859 } else {
5960 topLevelSurfaceList = null;
61+ panelState = undefined;
6062 }
6163 }
6264
6365 property var topLevelSurfaceList: null
66+ property var panelState: undefined
6467
6568 Item {
6669 id: shellContainer
@@ -1878,21 +1881,21 @@ Rectangle {
18781881 var maximizeButton = findChild(appDelegate, "maximizeWindowButton");
18791882
18801883 tryCompare(appDelegate, "state", "normal");
1881− tryCompare(PanelState, "buttonsVisible", false)
1884+ tryCompare(panelState, "buttonsVisible", false)
18821885
18831886 mouseClick(maximizeButton, maximizeButton.width / 2, maximizeButton.height / 2);
18841887 tryCompare(appDelegate, "state", "maximized");
1885− tryCompare(PanelState, "buttonsVisible", true)
1888+ tryCompare(panelState, "buttonsVisible", true)
18861889
18871890 ApplicationManager.stopApplication(application.appId);
1888− tryCompare(PanelState, "buttonsVisible", false)
1891+ tryCompare(panelState, "buttonsVisible", false)
18891892
18901893 // wait until all zombie surfaces are gone. As MirSurfaceItems hold references over them.
18911894 // They won't be gone until those surface items are destroyed.
18921895 tryCompareFunction(function() { return application.surfaceList.count }, 0);
18931896
18941897 ApplicationManager.startApplication(application.appId);
1895− tryCompare(PanelState, "buttonsVisible", true)
1898+ tryCompare(panelState, "buttonsVisible", true)
18961899 }
18971900
18981901 function test_newAppHasValidGeometry() {
@@ -1948,7 +1951,7 @@ Rectangle {
19481951 mousePress(appDelegate, appDelegate.width / 2, units.gu(1))
19491952 mouseMove(appDelegate, appDelegate.width / 2, -units.gu(100))
19501953
1951− compare(appDelegate.y >= PanelState.panelHeight, true);
1954+ compare(appDelegate.y >= panelState.panelHeight, true);
19521955 }
19531956
19541957 function test_cantResizeWindowUnderPanel() {
@@ -1976,7 +1979,7 @@ Rectangle {
19761979 mouseMove(decoration, decoration.width/2, -units.gu(100));
19771980
19781981 // verify we don't go past the panel
1979− compare(appDelegate.y >= PanelState.panelHeight, true);
1982+ compare(appDelegate.y >= panelState.panelHeight, true);
19801983 }
19811984
19821985 function test_restoreWindowStateFixesIfUnderPanel() {
@@ -2000,7 +2003,7 @@ Rectangle {
20002003 tryCompareFunction(function () { return topLevelSurfaceList.applicationAt(0).appId; }, application.appId);
20012004
20022005 appDelegate = appRepeater.itemAt(0);
2003− compare(appDelegate.y >= PanelState.panelHeight, true);
2006+ compare(appDelegate.y >= panelState.panelHeight, true);
20042007 }
20052008
20062009 function test_lifecyclePolicyForNonTouchApp_data() {
@@ -2601,7 +2604,7 @@ Rectangle {
26012604 function test_oskDisplacesWindow_data() {
26022605 return [
26032606 {tag: "no need to displace", windowHeight: units.gu(10), windowY: units.gu(5), targetDisplacement: units.gu(5), oskEnabled: true},
2604− {tag: "displace to top", windowHeight: units.gu(50), windowY: units.gu(10), targetDisplacement: PanelState.panelHeight, oskEnabled: true},
2607+ {tag: "displace to top", windowHeight: units.gu(50), windowY: units.gu(10), targetDisplacement: panelState.panelHeight, oskEnabled: true},
26052608 {tag: "osk not on this screen", windowHeight: units.gu(40), windowY: units.gu(10), targetDisplacement: units.gu(10), oskEnabled: false},
26062609 ]
26072610 }
@@ -2624,8 +2627,8 @@ Rectangle {
26242627 dashAppDelegate.windowedY = data.windowY;
26252628 topLevelSurfaceList.inputMethodSurface.setInputBounds(Qt.rect(0, 0, 0, 0));
26262629 var initialY = dashAppDelegate.y;
2627− print("intial", initialY, "panel", PanelState.panelHeight);
2628− verify(initialY > PanelState.panelHeight);
2630+ print("intial", initialY, "panel", panelState.panelHeight);
2631+ verify(initialY > panelState.panelHeight);
26292632
26302633 topLevelSurfaceList.inputMethodSurface.setInputBounds(Qt.rect(0, root.height / 2, root.width, root.height / 2));
26312634 tryCompare(dashAppDelegate, "y", data.targetDisplacement);