[gnome-settings-daemon/gnome-3-8] power: Cancelling a temporary unidle shouldn't set an idle mode



commit f99c73cdc5a3b12a93cb20aa58a7977c316154cc
Author: Rui Matos <tiagomatos gmail com>
Date:   Fri May 2 14:37:53 2014 +0200

    power: Cancelling a temporary unidle shouldn't set an idle mode
    
    The caller already knows which idle mode it wants us to move to.
    
    Automatically going back to the previous idle mode here would at best
    cause a quick spurious idle mode switch which would be immediately
    overriden by the caller or, at worst, we could go into suspend if the
    previously saved mode was SLEEP.
    
    The latter could happen on resume from suspend because there's a race
    between idle_became_active_cb() and handle_wake_up_screen(). If the
    second wins the race then we'd set a teporary unidle with the previous
    mode being SLEEP, meaning that when idle_became_active_cb() cancels
    the temporary unidle afterwards we'd immediately move to SLEEP again.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=729024

 plugins/power/gsd-power-manager.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 645df66..f7d9fe4 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -2770,11 +2770,12 @@ set_temporary_unidle_on_ac (GsdPowerManager *manager,
                             gboolean         enable)
 {
         if (!enable) {
+                /* Don't automatically go back to the previous idle
+                   mode. The caller probably has a better idea of
+                   which state to move to when disabling us. */
                 if (manager->priv->temporary_unidle_on_ac_id != 0) {
                         g_source_remove (manager->priv->temporary_unidle_on_ac_id);
                         manager->priv->temporary_unidle_on_ac_id = 0;
-
-                        idle_set_mode (manager, manager->priv->previous_idle_mode);
                 }
         } else {
                 /* Don't overwrite the previous idle mode when an unidle is


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