on xenial help sign in
WM: AppManager has new signal to ask shell to request focus for app - use it to properly animate and focus the app
commit80a45c7864107a18509082f7c834adf3a672aee4 authorGerry Boland <gerry.boland@canonical.com> dateFri 11 Oct 2013, 12:24 (13 years ago) parent0bc5663
2 files changed+11−2
Components/ApplicationManagerWrapper.qml+6−2 Components/Stage.qml+5
Components/ApplicationManagerWrapper.qml+6−2
@@ -18,7 +18,7 @@ import QtQuick 2.0
1818import Unity.Application 0.1
1919
2020Item {
21− id: applicationManager
21+ id: root
2222
2323 property alias mainStageApplications: mainStageModel
2424 property alias sideStageApplications: sideStageModel
@@ -30,6 +30,8 @@ Item {
3030
3131 property bool fake: ApplicationManager.fake ? ApplicationManager.fake : false
3232
33+ signal focusRequested(string appId)
34+
3335 ApplicationsModelStageFiltered {
3436 id: mainStageModel
3537 stage: ApplicationInfo.MainStage
@@ -48,7 +50,7 @@ Item {
4850 mainStageFocusedApplication = null;
4951 sideStageFocusedApplication = null;
5052 } else {
51− if (app.stage == ApplicationInfo.MainStage) {
53+ if (app.stage == ApplicationInfo.MainStage || !sideStageEnabled) {
5254 mainStageFocusedApplication = app;
5355 // possible the side stage app being unfocused fired this signal, so check for it
5456 if (sideStageFocusedApplication && !sideStageFocusedApplication.focused)
@@ -61,6 +63,8 @@ Item {
6163 }
6264 }
6365 }
66+
67+ onFocusRequested: root.focusRequested(appId);
6468 }
6569
6670 function activateApplication(desktopFile, argument) {
Components/Stage.qml+5
@@ -84,6 +84,11 @@ Showable {
8484 }
8585 }
8686
87+ Connections {
88+ target: applicationManager
89+ onFocusRequested: activateApplication(appId)
90+ }
91+
8792 /* Keep a reference to the focused application so that we can safely
8893 unfocus it when the stage is not fully shown and refocus it when the stage
8994 is fully shown again.