on xenial help sign in
When an application requests focus, handle it in Shell.qml by hiding the greeter and stopping any edge demo
commit157b786097c49d970ad5f12c3c660db5899ad76f authorMichael Terry <michael.terry@canonical.com> dateWed 15 Jan 2014, 12:12 (13 years ago) parent09de2ed
3 files changed+17−11
qml/Components/Stage.qml−5 qml/Shell.qml+6−6 tests/qmltests/tst_Shell.qml+11
qml/Components/Stage.qml−5
@@ -84,11 +84,6 @@ Showable {
8484 }
8585 }
8686
87− Connections {
88− target: applicationManager
89− onFocusRequested: activateApplication(appId)
90− }
91−
9287 /* Keep a reference to the focused application so that we can safely
9388 unfocus it when the stage is not fully shown and refocus it when the stage
9489 is fully shown again.
qml/Shell.qml+6−6
@@ -107,6 +107,8 @@ FocusScope {
107107 if (application == null) {
108108 return;
109109 }
110+ edgeDemo.stopDemo();
111+ greeter.hide();
110112 if (application.stage == ApplicationInfo.MainStage || !sideStage.enabled) {
111113 mainStage.activateApplication(appId, addDelay);
112114 } else {
@@ -541,6 +543,7 @@ FocusScope {
541543 greeter.hide()
542544 }
543545 }
546+ onFocusRequested: shell.activateApplication(appId)
544547 }
545548 }
546549
@@ -685,12 +688,9 @@ FocusScope {
685688 }
686689 }
687690 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("applications.scope", false, true)
688− onLauncherApplicationSelected:{
689− if (edgeDemo.running)
690− return;
691−
692− greeter.hide()
693− shell.activateApplication(appId)
691+ onLauncherApplicationSelected: {
692+ if (!edgeDemo.running)
693+ shell.activateApplication(appId)
694694 }
695695 onShownChanged: {
696696 if (shown) {
tests/qmltests/tst_Shell.qml+11
@@ -549,5 +549,16 @@ Item {
549549 tryCompare(greeter, "shown", true)
550550 tryCompare(searchIndicator, "opacity", 0)
551551 }
552+
553+ function test_focusRequestedHidesGreeter() {
554+ var greeter = findChild(shell, "greeter")
555+
556+ greeter.show()
557+ tryCompare(greeter, "showProgress", 1)
558+
559+ ApplicationManager.focusRequested("notes-app")
560+ tryCompare(greeter, "showProgress", 0)
561+ waitUntilApplicationWindowIsFullyVisible()
562+ }
552563 }
553564}