[gnome-settings-daemon] power: Fix blanking not working



commit 16e98b1edb0d3bd72e28121dcbf7b713ea109b5e
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jan 17 18:52:01 2013 +0100

    power: Fix blanking not working
    
    When we got the ActiveChanged() signal from gnome-shell's screen lock,
    we would reconfigure the blank time out to be much shorter. The problem
    is that the timeout is based on idleness, and we would already have been
    past that amount of idleness when we setup the new idle monitor.
    
    Instead of basing ourselves on idle timeouts, just wait for the
    screensaver to come on and blank it. We'll handle idleness as normal
    (so it's possible to cancel the login, and have the screen be blanked
    quickly).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=691965

 plugins/power/gsd-power-manager.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index abf03f6..90398d2 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -2613,16 +2613,16 @@ idle_configure (GsdPowerManager *manager)
                 return;
         }
 
-        /* set up blank callback even when session is not idle,
-         * but only if we actually want to blank. */
+        /* set up blank callback only when the screensaver is on,
+         * as it's what will drive the blank */
         on_battery = up_client_get_on_battery (manager->priv->up_client);
+        timeout_blank = 0;
         if (manager->priv->screensaver_active) {
+                /* The tail is wagging the dog.
+                 * The screensaver coming on will blank the screen.
+                 * If an event occurs while the screensaver is on,
+                 * the aggressive idle watch will handle it */
                 timeout_blank = SCREENSAVER_TIMEOUT_BLANK;
-        } else {
-                timeout_blank = g_settings_get_uint (manager->priv->settings_session,
-                                                     "idle-delay");
-                if (timeout_blank != 0)
-                        timeout_blank += SCREENSAVER_FADE_TIME;
         }
 
         clear_idle_watch (manager->priv->idle_monitor,
@@ -2804,6 +2804,13 @@ screensaver_signal_cb (GDBusProxy *proxy,
                 if (manager->priv->screensaver_active != active) {
                         manager->priv->screensaver_active = active;
                         idle_configure (manager);
+
+                        /* Setup blank as soon as the screensaver comes on,
+                         * and its fade has finished.
+                         *
+                         * See also idle_configure() */
+                        if (active)
+                                idle_set_mode (manager, GSD_POWER_IDLE_MODE_BLANK);
                 }
         }
 }



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