on xenial help sign in
make it work better when only side stage apps are around
commit45cd840fbe322b4b783fc6b556202be8acf57fb9 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 3 Jun 2014, 18:46 (12 years ago) parent28eaf6c
2 files changed+25−7
qml/Stages/TabletStage.qml+22−5 qml/Stages/TransformedTabletSpreadDelegate.qml+3−2
qml/Stages/TabletStage.qml+22−5
@@ -60,8 +60,8 @@ Item {
6060 priv.mainStageAppId = focusedAppId;
6161 }
6262
63− appId0 = ApplicationManager.get(0).appId;
64− appId1 = ApplicationManager.get(1).appId;
63+ appId0 = ApplicationManager.count >= 1 ? ApplicationManager.get(0).appId : "";
64+ appId1 = ApplicationManager.count > 1 ? ApplicationManager.get(1).appId : "";
6565 }
6666
6767 function indexOf(appId) {
@@ -173,16 +173,20 @@ Item {
173173 return 1;
174174 }
175175 return 0;
176+ case "overlay":
177+ print("foo", priv.appId0, priv.appId1)
178+ return 1;
176179 }
177180 print("unhandled nextInStack case!!!!!");
178181 return -1;
182+
179183 }
180184 property int nextZInStack: indexToZIndex(nextInStack)
181185 onNextInStackChanged: print("next in stack is", nextInStack)
182186
183187 states: [
184188 State {
185− name: "invalid" // temporary until Dash is an app and we always have a main stage app
189+ name: "invalid"
186190 },
187191 State {
188192 name: "main"
@@ -246,10 +250,21 @@ Item {
246250 // We don't want to really reorder them in the model because that allows us to keep track
247251 // of the last focused order.
248252 function indexToZIndex(index) {
253+ print("zIndex calc for index", index);
249254 var app = ApplicationManager.get(index);
255+ if (!app) {
256+ return index;
257+ }
258+
250259 var isActive = app.appId == priv.mainStageAppId || app.appId == priv.sideStageAppId;
260+ print("got app", app.appId, isActive)
251261 if (isActive && app.stage == ApplicationInfoInterface.MainStage) return 0;
252262 if (isActive && app.stage == ApplicationInfoInterface.SideStage) {
263+ if (!priv.mainStageAppId) {
264+ // only have SS apps running
265+ return 0;
266+ }
267+
253268 if (spreadView.nextInStack >= 0 && ApplicationManager.get(spreadView.nextInStack).stage == ApplicationInfoInterface.MainStage) {
254269 return Math.max(index, 2);
255270 } else {
@@ -260,7 +275,7 @@ Item {
260275 return priv.indexOf(priv.sideStageAppId) < index ? index - 1 : index;
261276 }
262277 if (index == spreadView.nextInStack && app.stage == ApplicationInfoInterface.SideStage) {
263− if (priv.sideStageAppId) {
278+ if (priv.sideStageAppId && priv.mainStageAppId) {
264279 return 2;
265280 }
266281 return 1;
@@ -406,7 +421,9 @@ Item {
406421 sideStageDragHandle.dragging = true;
407422 }
408423 onMouseXChanged: {
409− sideStageDragHandle.progress = Math.max(0, (-startX + mouseX) / spreadView.sideStageWidth)
424+ if (priv.mainStageAppId) {
425+ sideStageDragHandle.progress = Math.max(0, (-startX + mouseX) / spreadView.sideStageWidth)
426+ }
410427 gesturePoints.push(mouseX);
411428 }
412429 onReleased: {
qml/Stages/TransformedTabletSpreadDelegate.qml+3−2
@@ -129,6 +129,7 @@ SpreadDelegate {
129129 property real xTranslate: {
130130 var newTranslate = 0;
131131
132+ print("zIndex:", zIndex, "index", index)
132133 if (otherSelected) {
133134 return priv.selectedXTranslate
134135 }
@@ -144,7 +145,7 @@ SpreadDelegate {
144145
145146 // The tile should move a bit to the left if a new one comes on top of it, but not for the Side Stage and not
146147 // when we're only dragging the side stage in on top of a main stage app
147− var shouldMoveAway = priv.movedActive && model.stage === ApplicationInfoInterface.MainStage &&
148+ var shouldMoveAway = spreadView.nextInStack >= 0 && priv.movedActive && model.stage === ApplicationInfoInterface.MainStage &&
148149 ApplicationManager.get(spreadView.nextInStack).stage === ApplicationInfoInterface.MainStage
149150
150151 if (active) {
@@ -255,7 +256,7 @@ SpreadDelegate {
255256 }
256257
257258 // The tile should rotate a bit when another one comes on top, but not when only dragging the side stage in
258− var shouldMoveAway = movedActive && (ApplicationManager.get(spreadView.nextInStack).stage === ApplicationInfoInterface.MainStage || model.stage == ApplicationInfoInterface.SideStage)
259+ var shouldMoveAway = spreadView.nextInStack >= 0 && movedActive && (ApplicationManager.get(spreadView.nextInStack).stage === ApplicationInfoInterface.MainStage || model.stage == ApplicationInfoInterface.SideStage)
259260
260261 if (spreadView.phase == 0) {
261262 if (nextInStack) {