on xenial help sign in
bring the lifecycle code back
commit5a252fb95b014e76841a9af977bf20efac92d369 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 30 Aug 2016, 14:44 (10 years ago) parentba6a18e
1 file changed+26−10
qml/Stage/Stage.qml+26−10
qml/Stage/Stage.qml+26−10
@@ -293,16 +293,31 @@ AbstractStage {
293293
294294 Instantiator {
295295 model: root.applicationManager
296− delegate: Binding {
297− target: model.application
298− property: "requestedState"
299−
300− // TODO: figure out some lifecycle policy, like suspending minimized apps
301− // if running on a tablet or something.
302− // TODO: If the device has a dozen suspended apps because it was running
303− // in staged mode, when it switches to Windowed mode it will suddenly
304− // resume all those apps at once. We might want to avoid that.
305− value: ApplicationInfoInterface.RequestedRunning // Always running for now
296+ delegate: QtObject {
297+ property var stateBinding: Binding {
298+ readonly property bool isDash: model.application ? model.application.appId == "unity8-dash" : false
299+ target: model.application
300+ property: "requestedState"
301+
302+ // TODO: figure out some lifecycle policy, like suspending minimized apps
303+ // or something if running windowed.
304+ // TODO: If the device has a dozen suspended apps because it was running
305+ // in staged mode, when it switches to Windowed mode it will suddenly
306+ // resume all those apps at once. We might want to avoid that.
307+ value: root.mode === "windowed"
308+ || (isDash && root.keepDashRunning)
309+ || (!root.suspended && model.application && priv.focusedAppDelegate.appId === model.application.appId)
310+ ? ApplicationInfoInterface.RequestedRunning
311+ : ApplicationInfoInterface.RequestedSuspended
312+ }
313+
314+ property var lifecycleBinding: Binding {
315+ target: model.application
316+ property: "exemptFromLifecycle"
317+ value: model.application
318+ ? (!model.application.isTouchApp || isExemptFromLifecycle(model.application.appId))
319+ : false
320+ }
306321 }
307322 }
308323
@@ -608,6 +623,7 @@ AbstractStage {
608623 readonly property alias resizeArea: resizeArea
609624 readonly property alias focusedSurface: decoratedWindow.focusedSurface
610625
626+ readonly property string appId: model.application.appId
611627 readonly property bool isDash: model.application.appId == "unity8-dash"
612628
613629 function claimFocus() {