on xenial help sign in
make it work better when only side stage apps are around
45cd840Michael Zanetti
qml/Stages/TabletStage.qml+22−5
@@ -60,8 +60,8 @@ Item {
60 priv.mainStageAppId = focusedAppId;
60 priv.mainStageAppId = focusedAppId;
61 }
61 }
62
62
63− appId0 = ApplicationManager.get(0).appId;
63+ appId0 = ApplicationManager.count >= 1 ? ApplicationManager.get(0).appId : "";
64− appId1 = ApplicationManager.get(1).appId;
64+ appId1 = ApplicationManager.count > 1 ? ApplicationManager.get(1).appId : "";
65 }
65 }
66
66
67 function indexOf(appId) {
67 function indexOf(appId) {
@@ -173,16 +173,20 @@ Item {
173 return 1;
173 return 1;
174 }
174 }
175 return 0;
175 return 0;
176+ case "overlay":
177+ print("foo", priv.appId0, priv.appId1)
178+ return 1;
176 }
179 }
177 print("unhandled nextInStack case!!!!!");
180 print("unhandled nextInStack case!!!!!");
178 return -1;
181 return -1;
182+
179 }
183 }
180 property int nextZInStack: indexToZIndex(nextInStack)
184 property int nextZInStack: indexToZIndex(nextInStack)
181 onNextInStackChanged: print("next in stack is", nextInStack)
185 onNextInStackChanged: print("next in stack is", nextInStack)
182
186
183 states: [
187 states: [
184 State {
188 State {
185− name: "invalid" // temporary until Dash is an app and we always have a main stage app
189+ name: "invalid"
186 },
190 },
187 State {
191 State {
188 name: "main"
192 name: "main"
@@ -246,10 +250,21 @@ Item {
246 // We don't want to really reorder them in the model because that allows us to keep track
250 // We don't want to really reorder them in the model because that allows us to keep track
247 // of the last focused order.
251 // of the last focused order.
248 function indexToZIndex(index) {
252 function indexToZIndex(index) {
253+ print("zIndex calc for index", index);
249 var app = ApplicationManager.get(index);
254 var app = ApplicationManager.get(index);
255+ if (!app) {
256+ return index;
257+ }
258+
250 var isActive = app.appId == priv.mainStageAppId || app.appId == priv.sideStageAppId;
259 var isActive = app.appId == priv.mainStageAppId || app.appId == priv.sideStageAppId;
260+ print("got app", app.appId, isActive)
251 if (isActive && app.stage == ApplicationInfoInterface.MainStage) return 0;
261 if (isActive && app.stage == ApplicationInfoInterface.MainStage) return 0;
252 if (isActive && app.stage == ApplicationInfoInterface.SideStage) {
262 if (isActive && app.stage == ApplicationInfoInterface.SideStage) {
263+ if (!priv.mainStageAppId) {
264+ // only have SS apps running
265+ return 0;
266+ }
267+
253 if (spreadView.nextInStack >= 0 && ApplicationManager.get(spreadView.nextInStack).stage == ApplicationInfoInterface.MainStage) {
268 if (spreadView.nextInStack >= 0 && ApplicationManager.get(spreadView.nextInStack).stage == ApplicationInfoInterface.MainStage) {
254 return Math.max(index, 2);
269 return Math.max(index, 2);
255 } else {
270 } else {
@@ -260,7 +275,7 @@ Item {
260 return priv.indexOf(priv.sideStageAppId) < index ? index - 1 : index;
275 return priv.indexOf(priv.sideStageAppId) < index ? index - 1 : index;
261 }
276 }
262 if (index == spreadView.nextInStack && app.stage == ApplicationInfoInterface.SideStage) {
277 if (index == spreadView.nextInStack && app.stage == ApplicationInfoInterface.SideStage) {
263− if (priv.sideStageAppId) {
278+ if (priv.sideStageAppId && priv.mainStageAppId) {
264 return 2;
279 return 2;
265 }
280 }
266 return 1;
281 return 1;
@@ -406,7 +421,9 @@ Item {
406 sideStageDragHandle.dragging = true;
421 sideStageDragHandle.dragging = true;
407 }
422 }
408 onMouseXChanged: {
423 onMouseXChanged: {
424+ if (priv.mainStageAppId) {
409− sideStageDragHandle.progress = Math.max(0, (-startX + mouseX) / spreadView.sideStageWidth)
425+ sideStageDragHandle.progress = Math.max(0, (-startX + mouseX) / spreadView.sideStageWidth)
426+ }
410 gesturePoints.push(mouseX);
427 gesturePoints.push(mouseX);
411 }
428 }
412 onReleased: {
429 onReleased: {
qml/Stages/TransformedTabletSpreadDelegate.qml+3−2
@@ -129,6 +129,7 @@ SpreadDelegate {
129 property real xTranslate: {
129 property real xTranslate: {
130 var newTranslate = 0;
130 var newTranslate = 0;
131
131
132+ print("zIndex:", zIndex, "index", index)
132 if (otherSelected) {
133 if (otherSelected) {
133 return priv.selectedXTranslate
134 return priv.selectedXTranslate
134 }
135 }
@@ -144,7 +145,7 @@ SpreadDelegate {
144
145
145 // 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
146 // 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
146 // when we're only dragging the side stage in on top of a main stage app
147 // 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 &&
148 ApplicationManager.get(spreadView.nextInStack).stage === ApplicationInfoInterface.MainStage
149 ApplicationManager.get(spreadView.nextInStack).stage === ApplicationInfoInterface.MainStage
149
150
150 if (active) {
151 if (active) {
@@ -255,7 +256,7 @@ SpreadDelegate {
255 }
256 }
256
257
257 // The tile should rotate a bit when another one comes on top, but not when only dragging the side stage in
258 // 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)
259
260
260 if (spreadView.phase == 0) {
261 if (spreadView.phase == 0) {
261 if (nextInStack) {
262 if (nextInStack) {