[gnome-shell] screenShield: Only release logind inhibitor on suspend



commit 4b3bf05aaf66d4033d3261952072a72283ffc489
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Mar 14 16:37:40 2013 +0100

    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

 js/ui/screenShield.js |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index f2a1cea..3c8dd6e 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -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');
     },


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]