summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Matos <tiagomatos@gmail.com>2014-05-02 14:37:53 +0200
committerRui Matos <tiagomatos@gmail.com>2014-05-05 16:19:33 +0200
commitcc3208dba3bb334d910e5d9c637ac9fae7c93b43 (patch)
treeadb6a321e14bdcffa571629d7ab1a35e794b2feb
parent188ca42ecbd3de0922ca0c9c40e842d6466637fd (diff)
downloadgnome-settings-daemon-cc3208dba3bb334d910e5d9c637ac9fae7c93b43.tar.gz
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
-rw-r--r--plugins/power/gsd-power-manager.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index ac269357..a45ac247 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