ScreenShield: don't rely on gnome-session to hide the lightbox
If we lock before the user becomes active again, gnome-session will never change presence from IDLE, and thus we'll never hide the lightbox. Instead, install our own idle monitor. https://bugzilla.gnome.org/show_bug.cgi?id=687020
This commit is contained in:
parent
6e4c89b310
commit
1c3e7330f3
@ -436,6 +436,8 @@ const ScreenShield = new Lang.Class({
|
|||||||
{ inhibitEvents: true,
|
{ inhibitEvents: true,
|
||||||
fadeInTime: STANDARD_FADE_TIME,
|
fadeInTime: STANDARD_FADE_TIME,
|
||||||
fadeFactor: 1 });
|
fadeFactor: 1 });
|
||||||
|
|
||||||
|
this.idleMonitor = new GnomeDesktop.IdleMonitor();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onLockScreenKeyRelease: function(actor, event) {
|
_onLockScreenKeyRelease: function(actor, event) {
|
||||||
@ -545,35 +547,43 @@ const ScreenShield = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_onStatusChanged: function(status) {
|
_onStatusChanged: function(status) {
|
||||||
if (status == GnomeSession.PresenceStatus.IDLE) {
|
if (status != GnomeSession.PresenceStatus.IDLE)
|
||||||
if (this._dialog) {
|
return;
|
||||||
this._dialog.cancel();
|
|
||||||
if (!this._isGreeter) {
|
if (this._dialog) {
|
||||||
this._dialog = null;
|
this._dialog.cancel();
|
||||||
|
if (!this._isGreeter) {
|
||||||
|
this._dialog = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this._isModal) {
|
||||||
|
Main.pushModal(this.actor);
|
||||||
|
this._isModal = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this._isActive) {
|
||||||
|
this._lightbox.show();
|
||||||
|
|
||||||
|
if (this._activationTime == 0)
|
||||||
|
this._activationTime = GLib.get_monotonic_time();
|
||||||
|
|
||||||
|
this._becameActiveId = this.idleMonitor.connect('became-active', Lang.bind(this, function() {
|
||||||
|
this.idleMonitor.disconnect(this._becameActiveId);
|
||||||
|
|
||||||
|
let lightboxWasShown = this._lightbox.shown;
|
||||||
|
this._lightbox.hide();
|
||||||
|
|
||||||
|
let shouldLock = lightboxWasShown && this._settings.get_boolean(LOCK_ENABLED_KEY);
|
||||||
|
if (shouldLock || this._isLocked) {
|
||||||
|
this.lock(false);
|
||||||
|
} else if (this._isActive) {
|
||||||
|
this.unlock();
|
||||||
}
|
}
|
||||||
}
|
}));
|
||||||
|
|
||||||
if (!this._isModal) {
|
this._isActive = true;
|
||||||
Main.pushModal(this.actor);
|
this.emit('lock-status-changed');
|
||||||
this._isModal = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this._isActive) {
|
|
||||||
this._lightbox.show();
|
|
||||||
|
|
||||||
if (this._activationTime == 0)
|
|
||||||
this._activationTime = GLib.get_monotonic_time();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let lightboxWasShown = this._lightbox.shown;
|
|
||||||
this._lightbox.hide();
|
|
||||||
|
|
||||||
let shouldLock = lightboxWasShown && this._settings.get_boolean(LOCK_ENABLED_KEY);
|
|
||||||
if (shouldLock || this._isActive) {
|
|
||||||
this.lock(false);
|
|
||||||
} else if (this._isModal) {
|
|
||||||
this.unlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -830,6 +840,7 @@ const ScreenShield = new Lang.Class({
|
|||||||
|
|
||||||
this._activationTime = 0;
|
this._activationTime = 0;
|
||||||
this._isActive = false;
|
this._isActive = false;
|
||||||
|
this._isLocked = false;
|
||||||
this.emit('lock-status-changed');
|
this.emit('lock-status-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -854,6 +865,7 @@ const ScreenShield = new Lang.Class({
|
|||||||
this._resetLockScreen(animate, animate);
|
this._resetLockScreen(animate, animate);
|
||||||
|
|
||||||
this._isActive = true;
|
this._isActive = true;
|
||||||
|
this._isLocked = true;
|
||||||
this.emit('lock-status-changed');
|
this.emit('lock-status-changed');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user