@@ -829,6 +829,13 @@ FocusScope {
829 onHeightChanged: appDelegate.updateNormalGeometry();
829 onHeightChanged: appDelegate.updateNormalGeometry();
832+ // True when the Stage is focusing this app and playing its own animation.
833+ // Stays true until the app is unfocused.
834+ // If it is, we don't want to play the slide in/out transition from StageMaths.
835+ // Setting it imperatively is not great, but any declarative solution hits
836+ // race conditions, causing two animations to play for one focus event.
837+ property bool inhibitSlideAnimation: false
832 Binding {
839 Binding {
833 target: appDelegate
840 target: appDelegate
834 property: "y"
841 property: "y"
@@ -975,6 +982,9 @@ FocusScope {
975 target: model.window
982 target: model.window
976 onFocusedChanged: {
983 onFocusedChanged: {
977 updateQmlFocusFromMirSurfaceFocus();
984 updateQmlFocusFromMirSurfaceFocus();
985+ if (!model.window.focused) {
986+ inhibitSlideAnimation = false;
979 onFocusRequested: {
989 onFocusRequested: {
980 appDelegate.activate();
990 appDelegate.activate();
@@ -1208,6 +1218,9 @@ FocusScope {
1208 UbuntuNumberAnimation { target: appDelegate; properties: "x"; to: rightEdgeFocusAnimation.targetX; duration: priv.animationDuration }
1218 UbuntuNumberAnimation { target: appDelegate; properties: "x"; to: rightEdgeFocusAnimation.targetX; duration: priv.animationDuration }
1209 UbuntuNumberAnimation { target: decoratedWindow; properties: "angle"; to: 0; duration: priv.animationDuration }
1219 UbuntuNumberAnimation { target: decoratedWindow; properties: "angle"; to: 0; duration: priv.animationDuration }
1210 UbuntuNumberAnimation { target: decoratedWindow; properties: "itemScale"; to: 1; duration: priv.animationDuration }
1220 UbuntuNumberAnimation { target: decoratedWindow; properties: "itemScale"; to: 1; duration: priv.animationDuration }
1222+ inhibitSlideAnimation = true;
1211 onStopped: {
1224 onStopped: {
1212 appDelegate.activate();
1225 appDelegate.activate();
@@ -1235,6 +1248,7 @@ FocusScope {
1235 sideStageX: sideStage.x
1248 sideStageX: sideStage.x
1236 itemIndex: appDelegate.itemIndex
1249 itemIndex: appDelegate.itemIndex
1237 nextInStack: priv.nextInStack
1250 nextInStack: priv.nextInStack
1251+ animationDuration: priv.animationDuration
1240 StagedRightEdgeMaths {
1254 StagedRightEdgeMaths {
@@ -1387,7 +1401,7 @@ FocusScope {
1388 PropertyChanges {
1402 PropertyChanges {
1389 target: stageMaths
1403 target: stageMaths
1390− animateX: !focusAnimation.running && itemIndex !== spreadItem.highlightedIndex
1404+ animateX: !focusAnimation.running && !rightEdgeFocusAnimation.running && itemIndex !== spreadItem.highlightedIndex && !inhibitSlideAnimation
1392 PropertyChanges {
1406 PropertyChanges {
1393 target: appDelegate.window
1407 target: appDelegate.window