@@ -46,7 +46,7 @@ Item {
4646 target: ApplicationManager
4747
4848 onFocusRequested: {
49− if (spreadView.visible) {
49+ if (spreadView.phase > 0) {
5050 spreadView.snapTo(priv.indexOf(appId));
5151 } else {
5252 priv.switchToApp(appId);
@@ -55,12 +55,8 @@ Item {
5555
5656 onFocusedApplicationIdChanged: {
5757 if (ApplicationManager.focusedApplicationId.length > 0) {
58− if (priv.secondApplicationStarting || priv.applicationStarting) {
59− appSplashTimer.restart();
60− } else {
61− var application = priv.focusedApplication;
62− root.fullscreen = application.fullscreen;
63− }
58+ var application = priv.focusedApplication;
59+ root.fullscreen = application.fullscreen;
6460 } else {
6561 spreadView.selectedIndex = -1;
6662 spreadView.phase = 0;
@@ -69,7 +65,13 @@ Item {
6965 }
7066
7167 onApplicationAdded: {
72− spreadView.snapTo(0);
68+ if (spreadView.phase > 0) {
69+ spreadView.snapTo(0);
70+
71+// TODO: Enable this once a newly added app is not directly focused any more.
72+// } else {
73+// priv.switchToApp(appId)
74+ }
7375 }
7476 }
7577
@@ -79,16 +81,11 @@ Item {
7981 property string focusedAppId: ApplicationManager.focusedApplicationId
8082 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
8183
82− property bool applicationStarting: false
83− property bool secondApplicationStarting: false
84−
85− property string newFocusedAppId
86−
8784 function switchToApp(appId) {
8885 if (priv.focusedAppId) {
89− priv.newFocusedAppId = appId;
9086 root.fullscreen = ApplicationManager.findApplication(appId).fullscreen;
91− applicationSwitchingAnimation.start();
87+ spreadView.focusChanging = true
88+ ApplicationManager.focusApplication(appId);
9289 } else {
9390 ApplicationManager.focusApplication(appId);
9491 }
@@ -154,6 +151,8 @@ Item {
154151 property int draggedIndex: -1
155152 property int closingIndex: -1
156153
154+ property bool focusChanging: false
155+
157156 onShiftedContentXChanged: {
158157 switch (phase) {
159158 case 0:
@@ -268,6 +267,18 @@ Item {
268267 }
269268 }
270269
270+ Behavior on x {
271+ enabled: spreadView.focusChanging && index == 0
272+ UbuntuNumberAnimation {
273+ duration: UbuntuAnimation.FastDuration
274+ onRunningChanged: {
275+ if (!running) {
276+ spreadView.focusChanging = false
277+ }
278+ }
279+ }
280+ }
281+
271282 // Each tile has a different progress value running from 0 to 1.
272283 // A progress value of 0 means the tile is at the right edge. 1 means the tile has reched the left edge.
273284 progress: {