on xenial help sign in
When an application requests focus, handle it in Shell.qml by hiding the greeter and stopping any edge demo
157b786Michael Terry
qml/Components/Stage.qml−5
@@ -84,11 +84,6 @@ Showable {
84 }
84 }
85 }
85 }
86
86
87− Connections {
88− target: applicationManager
89− onFocusRequested: activateApplication(appId)
90− }
91−
92 /* Keep a reference to the focused application so that we can safely
87 /* Keep a reference to the focused application so that we can safely
93 unfocus it when the stage is not fully shown and refocus it when the stage
88 unfocus it when the stage is not fully shown and refocus it when the stage
94 is fully shown again.
89 is fully shown again.
qml/Shell.qml+6−6
@@ -107,6 +107,8 @@ FocusScope {
107 if (application == null) {
107 if (application == null) {
108 return;
108 return;
109 }
109 }
110+ edgeDemo.stopDemo();
111+ greeter.hide();
110 if (application.stage == ApplicationInfo.MainStage || !sideStage.enabled) {
112 if (application.stage == ApplicationInfo.MainStage || !sideStage.enabled) {
111 mainStage.activateApplication(appId, addDelay);
113 mainStage.activateApplication(appId, addDelay);
112 } else {
114 } else {
@@ -541,6 +543,7 @@ FocusScope {
541 greeter.hide()
543 greeter.hide()
542 }
544 }
543 }
545 }
546+ onFocusRequested: shell.activateApplication(appId)
544 }
547 }
545 }
548 }
546
549
@@ -685,12 +688,9 @@ FocusScope {
685 }
688 }
686 }
689 }
687 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("applications.scope", false, true)
690 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("applications.scope", false, true)
688− onLauncherApplicationSelected:{
691+ onLauncherApplicationSelected: {
689− if (edgeDemo.running)
692+ if (!edgeDemo.running)
690− return;
691−
692− greeter.hide()
693− shell.activateApplication(appId)
693+ shell.activateApplication(appId)
694 }
694 }
695 onShownChanged: {
695 onShownChanged: {
696 if (shown) {
696 if (shown) {
tests/qmltests/tst_Shell.qml+11
@@ -549,5 +549,16 @@ Item {
549 tryCompare(greeter, "shown", true)
549 tryCompare(greeter, "shown", true)
550 tryCompare(searchIndicator, "opacity", 0)
550 tryCompare(searchIndicator, "opacity", 0)
551 }
551 }
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+ }
552 }
563 }
553}
564}