diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 5b93444eb..988e191ba 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 52ef50cbd..90fa9f361 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) {