@@ -54,11 +54,13 @@ Item {
55 onFocusedAppIdChanged: {
55 onFocusedAppIdChanged: {
56 print("focused appid changed", priv.focusedAppId)
56 print("focused appid changed", priv.focusedAppId)
57+ if (priv.focusedAppId.length > 0) {
57− var focusedApp = ApplicationManager.findApplication(focusedAppId);
58+ var focusedApp = ApplicationManager.findApplication(focusedAppId);
58− if (focusedApp.stage == ApplicationInfoInterface.SideStage) {
59+ if (focusedApp.stage == ApplicationInfoInterface.SideStage) {
59− priv.sideStageAppId = focusedAppId;
60+ priv.sideStageAppId = focusedAppId;
61− priv.mainStageAppId = focusedAppId;
62+ priv.mainStageAppId = focusedAppId;
64 appId0 = ApplicationManager.count >= 1 ? ApplicationManager.get(0).appId : "";
66 appId0 = ApplicationManager.count >= 1 ? ApplicationManager.get(0).appId : "";
@@ -156,7 +158,6 @@ Item {
156 property real snapPosition: 0.75
158 property real snapPosition: 0.75
158 property int selectedIndex: -1
160 property int selectedIndex: -1
159− onSelectedIndexChanged: print("selected index changed", selectedIndex)
160 property int draggedIndex: -1
161 property int draggedIndex: -1
161 property int closingIndex: -1
162 property int closingIndex: -1
@@ -198,7 +199,6 @@ Item {
200 property int nextZInStack: indexToZIndex(nextInStack)
201 property int nextZInStack: indexToZIndex(nextInStack)
201− onNextInStackChanged: print("next in stack is", nextInStack)
203 states: [
203 states: [
@@ -272,7 +272,9 @@ Item {
274 var isActive = app.appId == priv.mainStageAppId || app.appId == priv.sideStageAppId;
274 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 if (isActive && app.stage == ApplicationInfoInterface.SideStage) {
278 if (isActive && app.stage == ApplicationInfoInterface.SideStage) {
277 if (!priv.mainStageAppId) {
279 if (!priv.mainStageAppId) {
278 // only have SS apps running
280 // only have SS apps running
@@ -438,6 +440,18 @@ Item {
438 UbuntuNumberAnimation {}
440 UbuntuNumberAnimation {}
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.
449+ target: ApplicationManager
450+ onApplicationRemoved: spreadTile.z = Qt.binding(function() {
451+ return spreadView.indexToZIndex(index)
441 progress: {
455 progress: {
442 var tileProgress = (spreadView.contentX - behavioredZIndex * spreadView.tileDistance) / spreadView.width;
456 var tileProgress = (spreadView.contentX - behavioredZIndex * spreadView.tileDistance) / spreadView.width;
443 // Some tiles (nextInStack, active) need to move directly from the beginning, normalize progress to immediately start at 0
457 // Some tiles (nextInStack, active) need to move directly from the beginning, normalize progress to immediately start at 0