ScreenShield: show the unlock dialog on the primary monitor when using the keyboard

Make ModalDialog.open() accept an optional onPrimary argument, and
pass it when the dialog is activated using ESC or Return.

https://bugzilla.gnome.org/show_bug.cgi?id=685855
This commit is contained in:
Giovanni Campagna
2012-10-14 18:34:22 +02:00
parent f94369dd6e
commit 48fb16b570
3 changed files with 17 additions and 10 deletions

View File

@ -202,8 +202,11 @@ const ModalDialog = new Lang.Class({
this.emit('destroy');
},
_fadeOpen: function() {
this._monitorConstraint.index = global.screen.get_current_monitor();
_fadeOpen: function(onPrimary) {
if (onPrimary)
this._monitorConstraint.primary = true;
else
this._monitorConstraint.index = global.screen.get_current_monitor();
this.state = State.OPENING;
@ -236,14 +239,14 @@ const ModalDialog = new Lang.Class({
}));
},
open: function(timestamp) {
open: function(timestamp, onPrimary) {
if (this.state == State.OPENED || this.state == State.OPENING)
return true;
if (!this.pushModal(timestamp))
return false;
this._fadeOpen();
this._fadeOpen(onPrimary);
return true;
},