on xenial help sign in
side/mainStageFocusedApplication now being determined correctly
6667b30Gerry Boland
Components/ApplicationManagerWrapper.qml+34−8
@@ -22,8 +22,8 @@ Item {
22
22
23 property alias mainStageApplications: mainStageModel
23 property alias mainStageApplications: mainStageModel
24 property alias sideStageApplications: sideStageModel
24 property alias sideStageApplications: sideStageModel
25− property alias mainStageFocusedApplication: mainStageModel.focusedApplication
25+ property variant mainStageFocusedApplication: null
26− property alias sideStageFocusedApplication: sideStageModel.focusedApplication
26+ property variant sideStageFocusedApplication: null
27 property bool sideStageEnabled: true
27 property bool sideStageEnabled: true
28 signal focusRequested(string desktopFile)
28 signal focusRequested(string desktopFile)
29 property bool keyboardVisible: ApplicationManager.keyboardVisible
29 property bool keyboardVisible: ApplicationManager.keyboardVisible
@@ -31,6 +31,9 @@ Item {
31
31
32 property bool fake: ApplicationManager.fake ? ApplicationManager.fake : false
32 property bool fake: ApplicationManager.fake ? ApplicationManager.fake : false
33
33
34+ onMainStageFocusedApplicationChanged: (mainStageFocusedApplication)?mainStageFocusedApplication.appId: "null"
35+ onSideStageFocusedApplicationChanged: (sideStageFocusedApplication)?sideStageFocusedApplication.appId: "null"
36+
34 ApplicationsModelStageFiltered {
37 ApplicationsModelStageFiltered {
35 id: mainStageModel
38 id: mainStageModel
36 stage: ApplicationInfo.MainStage
39 stage: ApplicationInfo.MainStage
@@ -41,6 +44,29 @@ Item {
41 stage: ApplicationInfo.SideStage
44 stage: ApplicationInfo.SideStage
42 }
45 }
43
46
47+ Connections {
48+ target: ApplicationManager
49+ onFocusedApplicationIdChanged: {
50+ var app = ApplicationManager.findApplication(ApplicationManager.focusedApplicationId)
51+ if (!app) { //nothing at all focused, so clear all
52+ mainStageFocusedApplication = null;
53+ sideStageFocusedApplication = null;
54+ } else {
55+ if (app.stage == ApplicationInfo.MainStage) {
56+ mainStageFocusedApplication = app;
57+ // possible the side stage app being unfocused fired this signal, so check for it
58+ if (sideStageFocusedApplication && !sideStageFocusedApplication.focused)
59+ sideStageFocusedApplication = null;
60+ } else {
61+ sideStageFocusedApplication = app;
62+ // possible the main stage app being unfocused fired this signal, so check for it
63+ if (mainStageFocusedApplication && !mainStageFocusedApplication.focused)
64+ mainStageFocusedApplication = null;
65+ }
66+ }
67+ }
68+ }
69+
44 function activateApplication(desktopFile, argument) {
70 function activateApplication(desktopFile, argument) {
45 var appId;
71 var appId;
46
72
@@ -65,20 +91,20 @@ Item {
65 }
91 }
66 }
92 }
67
93
68− function stopProcess(application) {
94+ function stopApplication(application) {
69 var appId;
95 var appId;
70
96
71 // HACK: might be called with appId, or else with Application object
97 // HACK: might be called with appId, or else with Application object
72 if (typeof application == "string") {
98 if (typeof application == "string") {
73− appId = desktopFileToAppId(application.desktopFile);
74− } else {
75 appId = application;
99 appId = application;
100+ } else {
101+ appId = desktopFileToAppId(application.desktopFile);
76 }
102 }
77
103
78− ApplicationManager.stopProcess(appId);
104+ ApplicationManager.stopApplication(appId);
79 }
105 }
80
106
81− function focusApplication(application) {print("focusApplication", application.appId)
107+ function focusApplication(application) {
82 if (application == null || application == undefined) {
108 if (application == null || application == undefined) {
83 return;
109 return;
84 }
110 }
@@ -90,7 +116,7 @@ Item {
90 ApplicationManager.unfocusCurrentApplication();
116 ApplicationManager.unfocusCurrentApplication();
91 }
117 }
92
118
93− function moveRunningApplicationStackPosition(from, to, stage) { print("moveRunningApplicationStackPosition", from, to, stage)
119+ function moveRunningApplicationStackPosition(from, to, stage) {
94 if (from == to || from < 0 || to < 0) return;
120 if (from == to || from < 0 || to < 0) return;
95
121
96 if (stage == ApplicationInfo.SideStage) {
122 if (stage == ApplicationInfo.SideStage) {
Components/ApplicationScreenshot.qml+1−1
@@ -25,7 +25,7 @@ Item {
25 property bool withBackground: false
25 property bool withBackground: false
26 property bool ready: applicationImage.ready || withBackground
26 property bool ready: applicationImage.ready || withBackground
27
27
28− function setApplication(application) { print("SET APP", application, (application) ? application.appId : "")
28+ function setApplication(application) {
29 applicationScreenshot.application = application
29 applicationScreenshot.application = application
30 }
30 }
31
31
Components/ApplicationsModelStageFiltered.qml+6−6
@@ -21,10 +21,8 @@ import Unity.Application 0.1
21SortFilterProxyModel {
21SortFilterProxyModel {
22 id: root
22 id: root
23 property int stage
23 property int stage
24− property variant focusedApplication: null
25
24
26 function get(index) {
25 function get(index) {
27− print("GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG get", index)
28 return ApplicationManager.get(mapRowToSource(index));
26 return ApplicationManager.get(mapRowToSource(index));
29 }
27 }
30
28
@@ -39,6 +37,7 @@ SortFilterProxyModel {
39 // assuming wanting to move to end of list
37 // assuming wanting to move to end of list
40 realTo = ApplicationManager.count;
38 realTo = ApplicationManager.count;
41 }
39 }
40+ if (realFrom == realTo) return;
42 ApplicationManager.move(realFrom, realTo);
41 ApplicationManager.move(realFrom, realTo);
43 }
42 }
44
43
@@ -47,8 +46,9 @@ SortFilterProxyModel {
47 filterRole: ApplicationManager.RoleStage
46 filterRole: ApplicationManager.RoleStage
48 filterRegExp: RegExp(stage)
47 filterRegExp: RegExp(stage)
49
48
50− onLayoutChanged: {
49+// onLayoutChanged: {
51− focusedApplication = get(0);
50+// for (var i=0, len=root.count; i<len; i++) {
52− print("LAYOUT CHANGED", focusedApplication.appId)
51+// print(i, get(i).appId);
52+// }
53− }
53+// }
54}
54}