ScreenShield: only inhibit suspend if we're the active session
If we aren't the active session clutter can't animate and thus we can't expect the shield to be shown before releasing the suspend inhibitor so we should release it immediately when becoming inactive. https://bugzilla.gnome.org/show_bug.cgi?id=749228
This commit is contained in:
parent
518e7d9fc5
commit
2a3e410d71
@ -511,11 +511,14 @@ const ScreenShield = new Lang.Class({
|
|||||||
this._loginManager.connect('prepare-for-sleep',
|
this._loginManager.connect('prepare-for-sleep',
|
||||||
Lang.bind(this, this._prepareForSleep));
|
Lang.bind(this, this._prepareForSleep));
|
||||||
|
|
||||||
|
this._loginSession = null;
|
||||||
this._loginManager.getCurrentSessionProxy(Lang.bind(this,
|
this._loginManager.getCurrentSessionProxy(Lang.bind(this,
|
||||||
function(sessionProxy) {
|
function(sessionProxy) {
|
||||||
this._loginSession = sessionProxy;
|
this._loginSession = sessionProxy;
|
||||||
this._loginSession.connectSignal('Lock', Lang.bind(this, function() { this.lock(false); }));
|
this._loginSession.connectSignal('Lock', Lang.bind(this, function() { this.lock(false); }));
|
||||||
this._loginSession.connectSignal('Unlock', Lang.bind(this, function() { this.deactivate(false); }));
|
this._loginSession.connectSignal('Unlock', Lang.bind(this, function() { this.deactivate(false); }));
|
||||||
|
this._loginSession.connect('g-properties-changed', Lang.bind(this, this._syncInhibitor));
|
||||||
|
this._syncInhibitor();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._settings = new Gio.Settings({ schema_id: SCREENSAVER_SCHEMA });
|
this._settings = new Gio.Settings({ schema_id: SCREENSAVER_SCHEMA });
|
||||||
@ -675,7 +678,8 @@ const ScreenShield = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_syncInhibitor: function() {
|
_syncInhibitor: function() {
|
||||||
let inhibit = (!this._isActive && this._settings.get_boolean(LOCK_ENABLED_KEY));
|
let inhibit = (this._loginSession && this._loginSession.Active &&
|
||||||
|
!this._isActive && this._settings.get_boolean(LOCK_ENABLED_KEY));
|
||||||
if (inhibit) {
|
if (inhibit) {
|
||||||
this._loginManager.inhibit(_("GNOME needs to lock the screen"),
|
this._loginManager.inhibit(_("GNOME needs to lock the screen"),
|
||||||
Lang.bind(this, function(inhibitor) {
|
Lang.bind(this, function(inhibitor) {
|
||||||
|
Loading…
Reference in New Issue
Block a user