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:
parent
f94369dd6e
commit
48fb16b570
@ -43,6 +43,8 @@ const MonitorConstraint = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
set primary(v) {
|
set primary(v) {
|
||||||
|
if (v)
|
||||||
|
this._index = -1;
|
||||||
this._primary = v;
|
this._primary = v;
|
||||||
if (this.actor)
|
if (this.actor)
|
||||||
this.actor.queue_relayout();
|
this.actor.queue_relayout();
|
||||||
@ -54,6 +56,7 @@ const MonitorConstraint = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
set index(v) {
|
set index(v) {
|
||||||
|
this._primary = false;
|
||||||
this._index = v;
|
this._index = v;
|
||||||
if (this.actor)
|
if (this.actor)
|
||||||
this.actor.queue_relayout();
|
this.actor.queue_relayout();
|
||||||
|
@ -202,8 +202,11 @@ const ModalDialog = new Lang.Class({
|
|||||||
this.emit('destroy');
|
this.emit('destroy');
|
||||||
},
|
},
|
||||||
|
|
||||||
_fadeOpen: function() {
|
_fadeOpen: function(onPrimary) {
|
||||||
this._monitorConstraint.index = global.screen.get_current_monitor();
|
if (onPrimary)
|
||||||
|
this._monitorConstraint.primary = true;
|
||||||
|
else
|
||||||
|
this._monitorConstraint.index = global.screen.get_current_monitor();
|
||||||
|
|
||||||
this.state = State.OPENING;
|
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)
|
if (this.state == State.OPENED || this.state == State.OPENING)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!this.pushModal(timestamp))
|
if (!this.pushModal(timestamp))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
this._fadeOpen();
|
this._fadeOpen(onPrimary);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -453,7 +453,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();
|
this._ensureUnlockDialog(true);
|
||||||
this._hideLockScreen(true);
|
this._hideLockScreen(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -476,7 +476,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();
|
this._ensureUnlockDialog(false);
|
||||||
this._hideLockScreen(true);
|
this._hideLockScreen(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,7 +508,7 @@ 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();
|
this._ensureUnlockDialog(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragEnd: function(action, actor, eventX, eventY, modifiers) {
|
_onDragEnd: function(action, actor, eventX, eventY, modifiers) {
|
||||||
@ -585,7 +585,7 @@ const ScreenShield = new Lang.Class({
|
|||||||
|
|
||||||
this.actor.show();
|
this.actor.show();
|
||||||
this._isGreeter = Main.sessionMode.isGreeter;
|
this._isGreeter = Main.sessionMode.isGreeter;
|
||||||
this._ensureUnlockDialog();
|
this._ensureUnlockDialog(true);
|
||||||
this._hideLockScreen(false);
|
this._hideLockScreen(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -632,7 +632,7 @@ const ScreenShield = new Lang.Class({
|
|||||||
Main.sessionMode.popMode('lock-screen');
|
Main.sessionMode.popMode('lock-screen');
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureUnlockDialog: function() {
|
_ensureUnlockDialog: function(onPrimary) {
|
||||||
if (!this._dialog) {
|
if (!this._dialog) {
|
||||||
let constructor = Main.sessionMode.unlockDialog;
|
let constructor = Main.sessionMode.unlockDialog;
|
||||||
this._dialog = new constructor(this._lockDialogGroup);
|
this._dialog = new constructor(this._lockDialogGroup);
|
||||||
@ -642,8 +642,9 @@ const ScreenShield = new Lang.Class({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let time = global.get_current_time();
|
||||||
this._dialog.connect('loaded', Lang.bind(this, function() {
|
this._dialog.connect('loaded', Lang.bind(this, function() {
|
||||||
if (!this._dialog.open()) {
|
if (!this._dialog.open(time, onPrimary)) {
|
||||||
log('Could not open login dialog: failed to acquire grab');
|
log('Could not open login dialog: failed to acquire grab');
|
||||||
this.unlock();
|
this.unlock();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user