on xenial help sign in
fixes for the tablet stages

* Fix zIndex when closing apps from spread * fix fullscreen mode

commit0c779a68ed41ba126e3dd0e18d35febd709dff2e authorMichael Zanetti <michael.zanetti@canonical.com> dateMon 30 Jun 2014, 22:01 (12 years ago) parent09fb98c
3 files changed+29−12
qml/Stages/SpreadDelegate.qml+5−4 qml/Stages/TabletStage.qml+22−8 qml/Stages/TransformedTabletSpreadDelegate.qml+2
qml/Stages/SpreadDelegate.qml+5−4
@@ -48,7 +48,7 @@ Item {
4848
4949 surface.parent = surfaceContainer;
5050 surface.anchors.fill = surfaceContainer;
51− checkFullscreen(surface);
51+ surfaceContainer.checkFullscreen(surface);
5252 surface.z = 1;
5353 }
5454 }
@@ -80,7 +80,7 @@ Item {
8080
8181 Connections {
8282 target: surface
83− onStateChanged: checkFullscreen(surface);
83+ onStateChanged: surfaceContainer.checkFullscreen(surface);
8484 }
8585
8686 BorderImage {
@@ -147,12 +147,13 @@ Item {
147147 }
148148 }
149149
150− onDragEnd: {
150+ onClicked: {
151151 if (!moving) {
152152 root.clicked();
153− return;
154153 }
154+ }
155155
156+ onDragEnd: {
156157 if ((dragVelocity < -600 && distance < -units.gu(4)) || distance < -root.height / 2) {
157158 animation.animate("up")
158159 } else if ((dragVelocity > 600 && distance > units.gu(4)) || distance > root.height / 2) {
qml/Stages/TabletStage.qml+22−8
@@ -54,11 +54,13 @@ Item {
5454
5555 onFocusedAppIdChanged: {
5656 print("focused appid changed", priv.focusedAppId)
57− var focusedApp = ApplicationManager.findApplication(focusedAppId);
58− if (focusedApp.stage == ApplicationInfoInterface.SideStage) {
59− priv.sideStageAppId = focusedAppId;
60− } else {
61− priv.mainStageAppId = focusedAppId;
57+ if (priv.focusedAppId.length > 0) {
58+ var focusedApp = ApplicationManager.findApplication(focusedAppId);
59+ if (focusedApp.stage == ApplicationInfoInterface.SideStage) {
60+ priv.sideStageAppId = focusedAppId;
61+ } else {
62+ priv.mainStageAppId = focusedAppId;
63+ }
6264 }
6365
6466 appId0 = ApplicationManager.count >= 1 ? ApplicationManager.get(0).appId : "";
@@ -156,7 +158,6 @@ Item {
156158 property real snapPosition: 0.75
157159
158160 property int selectedIndex: -1
159− onSelectedIndexChanged: print("selected index changed", selectedIndex)
160161 property int draggedIndex: -1
161162 property int closingIndex: -1
162163
@@ -198,7 +199,6 @@ Item {
198199
199200 }
200201 property int nextZInStack: indexToZIndex(nextInStack)
201− onNextInStackChanged: print("next in stack is", nextInStack)
202202
203203 states: [
204204 State {
@@ -272,7 +272,9 @@ Item {
272272 }
273273
274274 var isActive = app.appId == priv.mainStageAppId || app.appId == priv.sideStageAppId;
275− if (isActive && app.stage == ApplicationInfoInterface.MainStage) return 0;
275+ if (isActive && app.stage == ApplicationInfoInterface.MainStage) {
276+ return 0;
277+ }
276278 if (isActive && app.stage == ApplicationInfoInterface.SideStage) {
277279 if (!priv.mainStageAppId) {
278280 // only have SS apps running
@@ -438,6 +440,18 @@ Item {
438440 UbuntuNumberAnimation {}
439441 }
440442
443+ // This is required because none of the bindings are triggered in some cases:
444+ // When an app is closed, it might happen that ApplicationManager.get(nextInStack)
445+ // returns a different app even though the nextInStackIndex and all the related
446+ // bindings (index, mainStageApp, sideStageApp, etc) don't change. Let's force a
447+ // binding update in that case.
448+ Connections {
449+ target: ApplicationManager
450+ onApplicationRemoved: spreadTile.z = Qt.binding(function() {
451+ return spreadView.indexToZIndex(index)
452+ })
453+ }
454+
441455 progress: {
442456 var tileProgress = (spreadView.contentX - behavioredZIndex * spreadView.tileDistance) / spreadView.width;
443457 // Some tiles (nextInStack, active) need to move directly from the beginning, normalize progress to immediately start at 0
qml/Stages/TransformedTabletSpreadDelegate.qml+2
@@ -78,7 +78,9 @@ SpreadDelegate {
7878 Item {
7979 id: priv
8080
81+ // true if this is the next tile on the stack that comes in when dragging from the right
8182 property bool nextInStack: spreadView.nextZInStack == zIndex
83+ // true if the next tile in the stack is the nextInStack one. This one will be moved a bit to the left
8284 property bool movedActive: spreadView.nextZInStack == zIndex + 1
8385 property real animatedEndDistance: linearAnimation(0, 2, root.endDistance, 0, root.progress)
8486