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
80a45c7Gerry Boland
Components/ApplicationManagerWrapper.qml+6−2
@@ -18,7 +18,7 @@ import QtQuick 2.0
18import Unity.Application 0.1
18import Unity.Application 0.1
19
19
20Item {
20Item {
21− id: applicationManager
21+ id: root
22
22
23 property alias mainStageApplications: mainStageModel
23 property alias mainStageApplications: mainStageModel
24 property alias sideStageApplications: sideStageModel
24 property alias sideStageApplications: sideStageModel
@@ -30,6 +30,8 @@ Item {
30
30
31 property bool fake: ApplicationManager.fake ? ApplicationManager.fake : false
31 property bool fake: ApplicationManager.fake ? ApplicationManager.fake : false
32
32
33+ signal focusRequested(string appId)
34+
33 ApplicationsModelStageFiltered {
35 ApplicationsModelStageFiltered {
34 id: mainStageModel
36 id: mainStageModel
35 stage: ApplicationInfo.MainStage
37 stage: ApplicationInfo.MainStage
@@ -48,7 +50,7 @@ Item {
48 mainStageFocusedApplication = null;
50 mainStageFocusedApplication = null;
49 sideStageFocusedApplication = null;
51 sideStageFocusedApplication = null;
50 } else {
52 } else {
51− if (app.stage == ApplicationInfo.MainStage) {
53+ if (app.stage == ApplicationInfo.MainStage || !sideStageEnabled) {
52 mainStageFocusedApplication = app;
54 mainStageFocusedApplication = app;
53 // possible the side stage app being unfocused fired this signal, so check for it
55 // possible the side stage app being unfocused fired this signal, so check for it
54 if (sideStageFocusedApplication && !sideStageFocusedApplication.focused)
56 if (sideStageFocusedApplication && !sideStageFocusedApplication.focused)
@@ -61,6 +63,8 @@ Item {
61 }
63 }
62 }
64 }
63 }
65 }
66+
67+ onFocusRequested: root.focusRequested(appId);
64 }
68 }
65
69
66 function activateApplication(desktopFile, argument) {
70 function activateApplication(desktopFile, argument) {
Components/Stage.qml+5
@@ -84,6 +84,11 @@ Showable {
84 }
84 }
85 }
85 }
86
86
87+ Connections {
88+ target: applicationManager
89+ onFocusRequested: activateApplication(appId)
90+ }
91+
87 /* Keep a reference to the focused application so that we can safely
92 /* Keep a reference to the focused application so that we can safely
88 unfocus it when the stage is not fully shown and refocus it when the stage
93 unfocus it when the stage is not fully shown and refocus it when the stage
89 is fully shown again.
94 is fully shown again.