[gnome-shell] Block cancellation of the unlock dialog when dragging



commit 4535a70f08be31a6c0a5caf3778484ea1725a89f
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Oct 24 17:53:19 2012 +0200

    Block cancellation of the unlock dialog when dragging
    
    Pressing esc while the mouse is down should not make the curtain fall,
    otherwise a gray screen results.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686800

 js/ui/screenShield.js |   13 ++++++++-----
 js/ui/unlockDialog.js |    7 +++++--
 2 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index fd16459..c016d83 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -502,7 +502,7 @@ const ScreenShield = new Lang.Class({
         if (symbol == Clutter.KEY_Escape ||
             symbol == Clutter.KEY_Return ||
             symbol == Clutter.KEY_KP_Enter) {
-            this._ensureUnlockDialog(true);
+            this._ensureUnlockDialog(true, true);
             this._hideLockScreen(true, 0);
             return true;
         }
@@ -525,7 +525,7 @@ const ScreenShield = new Lang.Class({
 
         // 7 standard scrolls to lift up
         if (this._lockScreenScrollCounter > 35) {
-            this._ensureUnlockDialog(false);
+            this._ensureUnlockDialog(false, true);
             this._hideLockScreen(true, 0);
         }
 
@@ -557,7 +557,7 @@ const ScreenShield = new Lang.Class({
     _onDragBegin: function() {
         Tweener.removeTweens(this._lockScreenGroup);
         this._lockScreenState = MessageTray.State.HIDING;
-        this._ensureUnlockDialog(false);
+        this._ensureUnlockDialog(false, false);
 
         return true;
     },
@@ -579,6 +579,7 @@ const ScreenShield = new Lang.Class({
             // Complete motion automatically
 	    let [velocity, velocityX, velocityY] = this._dragAction.get_velocity(0);
 	    this._hideLockScreen(true, -velocityY);
+            this._ensureUnlockDialog(false, true);
         } else {
             // restore the lock screen to its original place
             // try to use the same speed as the normal animation
@@ -661,7 +662,7 @@ const ScreenShield = new Lang.Class({
 
         this.actor.show();
         this._isGreeter = Main.sessionMode.isGreeter;
-        this._ensureUnlockDialog(true);
+        this._ensureUnlockDialog(true, true);
         this._hideLockScreen(false, 0);
     },
 
@@ -717,7 +718,7 @@ const ScreenShield = new Lang.Class({
             Main.sessionMode.popMode('lock-screen');
     },
 
-    _ensureUnlockDialog: function(onPrimary) {
+    _ensureUnlockDialog: function(onPrimary, allowCancel) {
         if (!this._dialog) {
             let constructor = Main.sessionMode.unlockDialog;
             if (!constructor) {
@@ -740,6 +741,8 @@ const ScreenShield = new Lang.Class({
             this._dialog.connect('failed', Lang.bind(this, this._onUnlockFailed));
             this._dialog.connect('unlocked', Lang.bind(this, this._onUnlockSucceded));
         }
+
+        this._dialog.allowCancel = allowCancel;
     },
 
     _onUnlockFailed: function() {
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index 4db878c..24a82a3 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -174,6 +174,7 @@ const UnlockDialog = new Lang.Class({
         this._workSpinner.actor.opacity = 0;
         this._workSpinner.actor.show();
 
+        this.allowCancel = false;
         this.buttonLayout.visible = true;
         this.addButton({ label: _("Cancel"),
                          action: Lang.bind(this, this._escape),
@@ -349,8 +350,10 @@ const UnlockDialog = new Lang.Class({
     },
 
     _escape: function() {
-        this._userVerifier.cancel();
-        this.emit('failed');
+        if (this.allowCancel) {
+            this._userVerifier.cancel();
+            this.emit('failed');
+        }
     },
 
     _otherUserClicked: function(button, event) {



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