@@ -50,6 +50,8 @@ AbstractStage {
5050
5151 orientationChangesEnabled: true
5252
53+ onAltTabPressedChanged: priv.goneToSpread = altTabPressed
54+
5355 GlobalShortcut {
5456 id: closeWindowShortcut
5557 shortcut: Qt.AltModifier|Qt.Key_F4
@@ -290,7 +292,7 @@ AbstractStage {
290292
291293 states: [
292294 State {
293− name: "spread"; when: root.altTabPressed || priv.goneToSpread
295+ name: "spread"; when: priv.goneToSpread
294296 PropertyChanges { target: floatingFlickable; enabled: true }
295297 PropertyChanges { target: spreadItem; focus: true }
296298 },
@@ -330,8 +332,9 @@ AbstractStage {
330332 Transition {
331333 from: "spread"
332334 SequentialAnimation {
333− ScriptAction { script: {
334− var item = appRepeater.itemAt(spreadItem.highlightedIndex);
335+ ScriptAction {
336+ script: {
337+ var item = appRepeater.itemAt(Math.max(0, spreadItem.highlightedIndex));
335338 item.claimFocus();
336339 item.playFocusAnimation();
337340 }
@@ -368,6 +371,10 @@ AbstractStage {
368371 leftMargin: root.leftMargin
369372 model: root.topLevelSurfaceList
370373 z: 10
374+
375+ onLeaveSpread: {
376+ priv.goneToSpread = false;
377+ }
371378 }
372379
373380 Connections {