ScreenShield: handle Escape on the stage, not on the lock screen

This allows to press esc to unlock even if the focus is not on
the lock screen (for example after dismissing the auth failure
notification).

https://bugzilla.gnome.org/show_bug.cgi?id=681143
This commit is contained in:
Giovanni Campagna 2012-08-03 22:56:49 +02:00
parent 29958df7e7
commit 82f7431a28

View File

@ -274,8 +274,6 @@ const ScreenShield = new Lang.Class({
can_focus: true,
layout_manager: new Clutter.BinLayout()
});
this._lockScreenGroup.connect('key-release-event',
Lang.bind(this, this._onLockScreenKeyRelease));
this._background = Meta.BackgroundActor.new_for_screen(global.screen);
this._background.add_effect(new Clutter.BlurEffect());
@ -330,7 +328,10 @@ const ScreenShield = new Lang.Class({
fadeFactor: 1 });
},
_onLockScreenKeyRelease: function(actor, event) {
_onStageKeyRelease: function(actor, event) {
if (!this._isLocked)
return false;
if (event.get_key_symbol() == Clutter.KEY_Escape) {
this._showUnlockDialog(true);
return true;
@ -495,7 +496,9 @@ const ScreenShield = new Lang.Class({
this.emit('lock-screen-shown');
}
this._lockScreenGroup.grab_key_focus();
if (!this._stageKeyHandler)
this._stageKeyHandler = global.stage.connect('key-release-event',
Lang.bind(this, this._onStageKeyRelease));
},
// Some of the actors in the lock screen are heavy in
@ -544,6 +547,11 @@ const ScreenShield = new Lang.Class({
if (this._hasLockScreen)
this._clearLockScreen();
if (this._stageKeyHandler) {
global.stage.disconnect(this._stageKeyHandler);
this._stageKeyHandler = 0;
}
if (this._keepDialog) {
// The dialog must be kept alive,
// so immediately go back to it