[gnome-shell] ScreenShield: consolidate code that handles dialog cancellation



commit b16ee1a3a6c02facc803be45d2859e53c906decd
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Jun 8 19:04:36 2013 +0200

    ScreenShield: consolidate code that handles dialog cancellation
    
    This way we ensure the same behavior everywhere.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701731

 js/ui/screenShield.js |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index b5e2743..b99645e 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -591,6 +591,21 @@ const ScreenShield = new Lang.Class({
         }
     },
 
+    _maybeCancelDialog: function() {
+        if (!this._dialog)
+            return;
+
+        this._dialog.cancel();
+        if (this._isGreeter) {
+            // LoginDialog.cancel() will grab the key focus
+            // on its own, so ensure it stays on lock screen
+            // instead
+            this._lockScreenGroup.grab_key_focus();
+        } else {
+            this._dialog = null;
+        }
+    },
+
     _becomeModal: function() {
         if (this._isModal)
             return true;
@@ -746,13 +761,7 @@ const ScreenShield = new Lang.Class({
                                onCompleteScope: this,
                              });
 
-            // If we have a unlock dialog, cancel it
-            if (this._dialog) {
-                this._dialog.cancel();
-                if (!this._isGreeter) {
-                    this._dialog = null;
-                }
-            }
+            this._maybeCancelDialog();
         }
     },
 
@@ -760,12 +769,7 @@ const ScreenShield = new Lang.Class({
         if (status != GnomeSession.PresenceStatus.IDLE)
             return;
 
-        if (this._dialog) {
-            this._dialog.cancel();
-            if (!this._isGreeter) {
-                this._dialog = null;
-            }
-        }
+        this._maybeCancelDialog();
 
         if (this._lightbox.actor.visible ||
             this._isActive) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]