Skip to content

Commit

Permalink
Changed the compositor to handle stopping an application
Browse files Browse the repository at this point in the history
The UI usually doesn't stop an application, instead just the visibility
is changed and the surface items are not deleted at all.

If an application is stopped (e.g. by stopping it using the
appman-controller) we need to make sure to first run the closing animation
before we actually release the window.

Otherwise the closing animation looks broken and we leave the window
StackView in an broken state

Change-Id: I0d184283d7b0f6b41910435e328d286ed7bb1c76
Reviewed-by: Nedim Hadzic <[email protected]>
  • Loading branch information
Gagi2k committed Sep 1, 2016
1 parent 950bda6 commit 9ebe067
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
25 changes: 24 additions & 1 deletion imports/system/models/ApplicationManagerInterface.qml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ QtObject {
property var minimizedItems: [NavigationService.defaultNavApp] // Apps which will be started but not shown in full screen
property Item windowItem
property Item mapWidget
property var itemsToRelease: []

property Timer timer: Timer {
interval: 1000
Expand Down Expand Up @@ -149,7 +150,29 @@ QtObject {
}

function windowLostHandler(index, item) {
WindowManager.releasewindow(item) // immediately close anything which is not handled by this container
var isClusterWidget = (WindowManager.windowProperty(item, "windowType") === "clusterWidget")
//We don't have a closing transition for widgets so it's save to release them immediately
if (isClusterWidget) {
WindowManager.releaseWindow(item)
} else {
//If the item is visible the closing application hasn't been played yet and we need to wait unti it is finished
if (item.visible) {
itemsToRelease.push(item)
root.releaseApplicationSurface()
} else {
WindowManager.releaseWindow(item)
}
}
}

//Called once the closing transition has finished and it would be save to release the window
function releasingApplicationSurfaceDone(item) {
for (var i = 0; i < itemsToRelease.length; ++i) {
if (item === itemsToRelease[i]) {
itemsToRelease.splice(i, 1)
WindowManager.releaseWindow(item) // immediately close anything which is not handled by this container
}
}
}

function applicationActivated(appId, appAliasId) {
Expand Down
19 changes: 13 additions & 6 deletions sysui/LaunchController.qml
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,19 @@ StackView {
to: 1.0
duration: popTransition.duration*.2
}
PropertyAnimation {
target: exitItem
property: "scale"
from: 1.0
to: 0.1
duration: popTransition.duration

SequentialAnimation {
PropertyAnimation {
target: exitItem
property: "scale"
from: 1.0
to: 0.1
duration: popTransition.duration
}

ScriptAction {
script: { exitItem.visible = false; ApplicationManagerInterface.releasingApplicationSurfaceDone(exitItem) }
}
}
}
}
Expand Down

0 comments on commit 9ebe067

Please sign in to comment.