[gnome-power-manager/gnome-2-28] throttle screensaver before suspend/hibernate



commit 26182959c7fea5aa63a23e57de4cf62b8da5fe54
Author: Tormod Volden <debian tormod gmail com>
Date:   Sat Oct 3 17:12:11 2009 +0200

    throttle screensaver before suspend/hibernate
    
    Otherwise the screensaver will flash by for a second, bug #586555.
    
    Signed-off-by: Tormod Volden <debian tormod gmail com>

 src/gpm-control.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/gpm-control.c b/src/gpm-control.c
index 4148dcf..31b96c9 100644
--- a/src/gpm-control.c
+++ b/src/gpm-control.c
@@ -245,6 +245,7 @@ gpm_control_suspend (GpmControl *control, GError **error)
 	gboolean lock_gnome_keyring;
 	GnomeKeyringResult keyres;
 	GpmScreensaver *screensaver;
+	guint32 throttle_cookie = 0;
 
 	screensaver = gpm_screensaver_new ();
 
@@ -268,8 +269,10 @@ gpm_control_suspend (GpmControl *control, GError **error)
 	}
 
 	do_lock = gpm_control_get_lock_policy (control, GPM_CONF_LOCK_ON_SUSPEND);
-	if (do_lock)
+	if (do_lock) {
+		throttle_cookie = gpm_screensaver_add_throttle (screensaver, "suspend");
 		gpm_screensaver_lock (screensaver);
+	}
 
 	nm_sleep = gconf_client_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, NULL);
 	if (nm_sleep)
@@ -289,8 +292,11 @@ gpm_control_suspend (GpmControl *control, GError **error)
 		g_signal_emit (control, signals [SLEEP_FAILURE], 0, GPM_CONTROL_ACTION_SUSPEND);
 	}
 
-	if (do_lock)
+	if (do_lock) {
 		gpm_screensaver_poke (screensaver);
+		if (throttle_cookie)
+			gpm_screensaver_remove_throttle (screensaver, throttle_cookie);
+	}
 
 	nm_sleep = gconf_client_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, NULL);
 	if (nm_sleep)
@@ -314,6 +320,7 @@ gpm_control_hibernate (GpmControl *control, GError **error)
 	gboolean lock_gnome_keyring;
 	GnomeKeyringResult keyres;
 	GpmScreensaver *screensaver;
+	guint32 throttle_cookie = 0;
 
 	screensaver = gpm_screensaver_new ();
 
@@ -339,8 +346,10 @@ gpm_control_hibernate (GpmControl *control, GError **error)
 	}
 
 	do_lock = gpm_control_get_lock_policy (control, GPM_CONF_LOCK_ON_HIBERNATE);
-	if (do_lock)
+	if (do_lock) {
+		throttle_cookie = gpm_screensaver_add_throttle (screensaver, "hibernate");
 		gpm_screensaver_lock (screensaver);
+	}
 
 	nm_sleep = gconf_client_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, NULL);
 	if (nm_sleep)
@@ -359,8 +368,11 @@ gpm_control_hibernate (GpmControl *control, GError **error)
 		g_signal_emit (control, signals [SLEEP_FAILURE], 0, GPM_CONTROL_ACTION_HIBERNATE);
 	}
 
-	if (do_lock)
+	if (do_lock) {
 		gpm_screensaver_poke (screensaver);
+		if (throttle_cookie)
+			gpm_screensaver_remove_throttle (screensaver, throttle_cookie);
+	}
 
 	nm_sleep = gconf_client_get_bool (control->priv->conf, GPM_CONF_NETWORKMANAGER_SLEEP, NULL);
 	if (nm_sleep)



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