screenShield: Only release logind inhibitor on suspend
To make sure that the screen shield is shown before suspending, we take a logind inhibitor and release it when the screen shield is shown. As the screen shield is not only shown on suspend, we can end up releasing the inhibitor independently from suspending (lock, idle), in which case the screen might not be locked when we do suspend. To fix, only release the inhibitor after showing the screen shield when we are about to suspend. https://bugzilla.gnome.org/show_bug.cgi?id=693708
This commit is contained in:
parent
ec014a7ecf
commit
4b3bf05aaf
@ -502,6 +502,7 @@ const ScreenShield = new Lang.Class({
|
||||
this._screenSaverDBus = new ShellDBus.ScreenSaverDBus(this);
|
||||
|
||||
this._inhibitor = null;
|
||||
this._aboutToSuspend = false;
|
||||
this._loginManager = LoginManager.getLoginManager();
|
||||
this._loginManager.connect('prepare-for-sleep',
|
||||
Lang.bind(this, this._prepareForSleep));
|
||||
@ -644,6 +645,8 @@ const ScreenShield = new Lang.Class({
|
||||
},
|
||||
|
||||
_prepareForSleep: function(loginManager, aboutToSuspend) {
|
||||
this._aboutToSuspend = aboutToSuspend;
|
||||
|
||||
if (aboutToSuspend) {
|
||||
if (!this._settings.get_boolean(LOCK_ENABLED_KEY)) {
|
||||
this._uninhibitSuspend();
|
||||
@ -999,7 +1002,8 @@ const ScreenShield = new Lang.Class({
|
||||
if (prevIsActive != this._isActive)
|
||||
this.emit('active-changed');
|
||||
|
||||
this._uninhibitSuspend();
|
||||
if (this._aboutToSuspend)
|
||||
this._uninhibitSuspend();
|
||||
|
||||
this.emit('lock-screen-shown');
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user