on xenial help sign in
hide stages if current app is unfocused (e.g. closed)
7f75348Michael Zanetti
qml/Shell.qml+5−1
@@ -234,7 +234,9 @@ FocusScope {
234
234
235 function hide() {
235 function hide() {
236 shown = false;
236 shown = false;
237+ if (ApplicationManager.focusedApplicationId) {
237− ApplicationManager.unfocusCurrentApplication();
238+ ApplicationManager.unfocusCurrentApplication();
239+ }
238 }
240 }
239
241
240 Connections {
242 Connections {
@@ -242,6 +244,8 @@ FocusScope {
242 onFocusedApplicationIdChanged: {
244 onFocusedApplicationIdChanged: {
243 if (ApplicationManager.focusedApplicationId.length > 0) {
245 if (ApplicationManager.focusedApplicationId.length > 0) {
244 stages.show();
246 stages.show();
247+ } else {
248+ stages.hide();
245 }
249 }
246 }
250 }
247
251
tests/mocks/Unity/Application/ApplicationManager.cpp+3−1
@@ -191,8 +191,10 @@ bool ApplicationManager::stopApplication(const QString &appId)
191 if (application == nullptr)
191 if (application == nullptr)
192 return false;
192 return false;
193
193
194+ if (application->appId() == focusedApplicationId()) {
195+ unfocusCurrentApplication();
196+ }
194 remove(application);
197 remove(application);
195− Q_EMIT focusedApplicationIdChanged();
196 qDebug() << Q_FUNC_INFO << "emitting focusedAppChanged" << focusedApplicationId();
198 qDebug() << Q_FUNC_INFO << "emitting focusedAppChanged" << focusedApplicationId();
197 return true;
199 return true;
198}
200}
tests/qmltests/tst_Shell.qml+5
@@ -103,8 +103,12 @@ Item {
103 swipeAwayGreeter();
103 swipeAwayGreeter();
104 }
104 }
105
105
106+ print("killing apps in 5 secs")
107+ wait(1000)
106 // kill all (fake) running apps
108 // kill all (fake) running apps
107 killApps(ApplicationManager);
109 killApps(ApplicationManager);
110+ print("killed apps")
111+ wait(1000)
108
112
109 var dashHome = findChild(shell, "DashHome");
113 var dashHome = findChild(shell, "DashHome");
110 swipeUntilScopeViewIsReached(dashHome);
114 swipeUntilScopeViewIsReached(dashHome);
@@ -511,6 +515,7 @@ Item {
511 function test_DashShown(data) {
515 function test_DashShown(data) {
512
516
513 print("step1")
517 print("step1")
518+// wait(1000)
514 // greeter: false,
519 // greeter: false,
515 if (data.greeter) {
520 if (data.greeter) {
516 // Swipe the greeter in
521 // Swipe the greeter in