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
This commit is contained in:
Giovanni Campagna 2012-10-24 17:53:19 +02:00
parent a2b8b969bd
commit 4007f5d36e
2 changed files with 13 additions and 7 deletions

View File

@ -458,7 +458,7 @@ const ScreenShield = new Lang.Class({
if (symbol == Clutter.KEY_Escape || if (symbol == Clutter.KEY_Escape ||
symbol == Clutter.KEY_Return || symbol == Clutter.KEY_Return ||
symbol == Clutter.KEY_KP_Enter) { symbol == Clutter.KEY_KP_Enter) {
this._ensureUnlockDialog(true); this._ensureUnlockDialog(true, true);
this._hideLockScreen(true); this._hideLockScreen(true);
return true; return true;
} }
@ -481,7 +481,7 @@ const ScreenShield = new Lang.Class({
// 7 standard scrolls to lift up // 7 standard scrolls to lift up
if (this._lockScreenScrollCounter > 35) { if (this._lockScreenScrollCounter > 35) {
this._ensureUnlockDialog(false); this._ensureUnlockDialog(false, true);
this._hideLockScreen(true); this._hideLockScreen(true);
} }
@ -513,13 +513,14 @@ const ScreenShield = new Lang.Class({
_onDragBegin: function() { _onDragBegin: function() {
Tweener.removeTweens(this._lockScreenGroup); Tweener.removeTweens(this._lockScreenGroup);
this._lockScreenState = MessageTray.State.HIDING; this._lockScreenState = MessageTray.State.HIDING;
this._ensureUnlockDialog(false); this._ensureUnlockDialog(false, false);
}, },
_onDragEnd: function(action, actor, eventX, eventY, modifiers) { _onDragEnd: function(action, actor, eventX, eventY, modifiers) {
if (this._lockScreenGroup.y < -(ARROW_DRAG_THRESHOLD * global.stage.height)) { if (this._lockScreenGroup.y < -(ARROW_DRAG_THRESHOLD * global.stage.height)) {
// Complete motion automatically // Complete motion automatically
this._hideLockScreen(true); this._hideLockScreen(true);
this._ensureUnlockDialog(false, true);
} else { } else {
// restore the lock screen to its original place // restore the lock screen to its original place
// try to use the same speed as the normal animation // try to use the same speed as the normal animation
@ -608,7 +609,7 @@ const ScreenShield = new Lang.Class({
this.actor.show(); this.actor.show();
this._isGreeter = Main.sessionMode.isGreeter; this._isGreeter = Main.sessionMode.isGreeter;
this._ensureUnlockDialog(true); this._ensureUnlockDialog(true, true);
this._hideLockScreen(false); this._hideLockScreen(false);
}, },
@ -655,7 +656,7 @@ const ScreenShield = new Lang.Class({
Main.sessionMode.popMode('lock-screen'); Main.sessionMode.popMode('lock-screen');
}, },
_ensureUnlockDialog: function(onPrimary) { _ensureUnlockDialog: function(onPrimary, allowCancel) {
if (!this._dialog) { if (!this._dialog) {
let constructor = Main.sessionMode.unlockDialog; let constructor = Main.sessionMode.unlockDialog;
if (!constructor) { if (!constructor) {
@ -678,6 +679,8 @@ const ScreenShield = new Lang.Class({
this._dialog.connect('failed', Lang.bind(this, this._onUnlockFailed)); this._dialog.connect('failed', Lang.bind(this, this._onUnlockFailed));
this._dialog.connect('unlocked', Lang.bind(this, this._onUnlockSucceded)); this._dialog.connect('unlocked', Lang.bind(this, this._onUnlockSucceded));
} }
this._dialog.allowCancel = allowCancel;
}, },
_onUnlockFailed: function() { _onUnlockFailed: function() {

View File

@ -164,6 +164,7 @@ const UnlockDialog = new Lang.Class({
this._promptLoginHint.hide(); this._promptLoginHint.hide();
this.contentLayout.add_actor(this._promptLoginHint); this.contentLayout.add_actor(this._promptLoginHint);
this.allowCancel = false;
let cancelButton = { label: _("Cancel"), let cancelButton = { label: _("Cancel"),
action: Lang.bind(this, this._escape), action: Lang.bind(this, this._escape),
key: Clutter.KEY_Escape }; key: Clutter.KEY_Escape };
@ -291,8 +292,10 @@ const UnlockDialog = new Lang.Class({
}, },
_escape: function() { _escape: function() {
if (this.allowCancel) {
this._userVerifier.cancel(); this._userVerifier.cancel();
this.emit('failed'); this.emit('failed');
}
}, },
_otherUserClicked: function(button, event) { _otherUserClicked: function(button, event) {