on xenial help sign in
Don't unfocus apps on display-wake, but rather on greeter-hide
commit2bda15ea5de0f620dbab71d9f89d786154c20112 authorMichael Terry <michael.terry@canonical.com> dateTue 8 Oct 2013, 14:14 (13 years ago) parentca78ba9
1 file changed+27−30
Shell.qml+27−30
Shell.qml+27−30
@@ -103,7 +103,10 @@ FocusScope {
103103 // like a snap decision (say, an incoming call).
104104 // TODO: this should be protected to only unlock for certain applications / certain usecases
105105 // potentially only in connection with a notification.
106− greeter.hide()
106+ if (greeter.shown && currentFocusedAppId) {
107+ greeter.hide()
108+ }
109+ hud.hide()
107110 }
108111
109112 function activateApplication(desktopFile, argument) {
@@ -468,6 +471,26 @@ FocusScope {
468471
469472 dragHandleWidth: shell.edgeSize
470473
474+ property var previousMainApp: null
475+ property var previousSideApp: null
476+
477+ function setFocused(focused) {
478+ if (!focused) {
479+ previousMainApp = applicationManager.mainStageFocusedApplication;
480+ previousSideApp = applicationManager.sideStageFocusedApplication;
481+ applicationManager.unfocusCurrentApplication();
482+ } else {
483+ if (previousMainApp) {
484+ applicationManager.focusApplication(previousMainApp);
485+ previousMainApp = null;
486+ }
487+ if (previousSideApp) {
488+ applicationManager.focusApplication(previousSideApp);
489+ previousSideApp = null;
490+ }
491+ }
492+ }
493+
471494 onShownChanged: {
472495 if (shown) {
473496 lockscreen.reset();
@@ -478,6 +501,9 @@ FocusScope {
478501 greeter.selected(0);
479502 }
480503 greeter.forceActiveFocus();
504+ setFocused(false);
505+ } else {
506+ setFocused(true);
481507 }
482508 }
483509
@@ -506,34 +532,11 @@ FocusScope {
506532 id: powerConnection
507533 target: Powerd
508534
509− property var previousMainApp: null
510− property var previousSideApp: null
511−
512− function setFocused(focused) {
513− if (!focused) {
514− powerConnection.previousMainApp = applicationManager.mainStageFocusedApplication;
515− powerConnection.previousSideApp = applicationManager.sideStageFocusedApplication;
516− applicationManager.unfocusCurrentApplication();
517− } else {
518− if (powerConnection.previousMainApp) {
519− applicationManager.focusApplication(powerConnection.previousMainApp);
520− powerConnection.previousMainApp = null;
521− }
522− if (powerConnection.previousSideApp) {
523− applicationManager.focusApplication(powerConnection.previousSideApp);
524− powerConnection.previousSideApp = null;
525− }
526− }
527− }
528−
529535 onDisplayPowerStateChange: {
530536 // We ignore any display-off signals when the proximity sensor
531537 // is active. This usually indicates something like a phone call.
532538 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
533− powerConnection.setFocused(false);
534539 greeter.showNow();
535− } else if (status == Powerd.On) {
536− powerConnection.setFocused(true);
537540 }
538541
539542 // No reason to chew demo CPU when user isn't watching
@@ -594,12 +597,6 @@ FocusScope {
594597 shown: false
595598 showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
596599 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
597−
598− Connections {
599− target: shell.applicationManager
600− onMainStageFocusedApplicationChanged: hud.hide()
601− onSideStageFocusedApplicationChanged: hud.hide()
602− }
603600 }
604601
605602 Revealer {