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



commit 4007f5d36e614d18bc388cb9915083d5d2e87ded
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
    
    Conflicts:
    	js/ui/screenShield.js
    	js/ui/unlockDialog.js

 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 5b93444..988e191 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -458,7 +458,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);
             return true;
         }
@@ -481,7 +481,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);
         }
 
@@ -513,13 +513,14 @@ const ScreenShield = new Lang.Class({
     _onDragBegin: function() {
         Tweener.removeTweens(this._lockScreenGroup);
         this._lockScreenState = MessageTray.State.HIDING;
-        this._ensureUnlockDialog(false);
+        this._ensureUnlockDialog(false, false);
     },
 
     _onDragEnd: function(action, actor, eventX, eventY, modifiers) {
         if (this._lockScreenGroup.y < -(ARROW_DRAG_THRESHOLD * global.stage.height)) {
             // Complete motion automatically
             this._hideLockScreen(true);
+            this._ensureUnlockDialog(false, true);
         } else {
             // restore the lock screen to its original place
             // try to use the same speed as the normal animation
@@ -608,7 +609,7 @@ const ScreenShield = new Lang.Class({
 
         this.actor.show();
         this._isGreeter = Main.sessionMode.isGreeter;
-        this._ensureUnlockDialog(true);
+        this._ensureUnlockDialog(true, true);
         this._hideLockScreen(false);
     },
 
@@ -655,7 +656,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) {
@@ -678,6 +679,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 52ef50c..90fa9f3 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -164,6 +164,7 @@ const UnlockDialog = new Lang.Class({
         this._promptLoginHint.hide();
         this.contentLayout.add_actor(this._promptLoginHint);
 
+        this.allowCancel = false;
         let cancelButton = { label: _("Cancel"),
                              action: Lang.bind(this, this._escape),
                              key: Clutter.KEY_Escape };
@@ -291,8 +292,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]