[gnome-settings-daemon] power: When timeout_blank >= timeout_sleep, adjust sleep timer to blank timer



commit bd34438973aa036bde6dd0eb07ac32fa3b3d5b80
Author: timchen119 <tim chen119 canonical com>
Date:   Wed Nov 14 11:49:34 2012 +0000

    power: When timeout_blank >= timeout_sleep, adjust sleep timer to blank timer
    
    The previous behavior is that when sleep-inactive-* smaller or equal than
    idle-delay/sleep-display-*, system will sleep at idle-delay/sleep-display-*
    time. So system will sleep at timing which is the bigger one of
    idle-delay/sleep-display-* or sleep-inactive-*.
    
    To mimic the behavior, I wrote a patch which adjust the sleep timer to blank
    timer when sleep-display-* >= sleep-inactive-*-timeout, just add a slightly
    delay and add SCREENSAVER_FADE_TIME into account should be enough.
    
    Resolves: https://bugzilla.gnome.org/show_bug.cgi?id=668703
    
    Signed-off-by: Richard Hughes <richard hughsie com>

 plugins/power/gsd-power-manager.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 649f40d..b17ac6c 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -3182,7 +3182,13 @@ idle_configure (GsdPowerManager *manager)
                                                     "sleep-inactive-ac-timeout");
         }
         if (timeout_sleep != 0) {
-                g_debug ("setting up sleep callback %is", timeout_sleep);
+                if (timeout_blank && timeout_blank >= timeout_sleep) {
+                        /* adjust sleep timer to blank timer and allow 2 secs margin delay */
+                        timeout_sleep = timeout_blank + SCREENSAVER_FADE_TIME + 2;
+                        g_debug ("blank timer >= sleep timer, setting up sleep callback %is", timeout_sleep);
+                } else {
+                        g_debug ("setting up sleep callback %is", timeout_sleep);
+                }
 
                 manager->priv->idle_sleep_id = gnome_idle_monitor_add_watch (manager->priv->idle_monitor,
                                                                              idle_adjust_timeout (current_idle_time, timeout_sleep) * 1000,



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