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



commit cc3208dba3bb334d910e5d9c637ac9fae7c93b43
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 ac26935..a45ac24 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -2681,11 +2681,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]