[gnome-session] presence: Handle really short idle delays
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] presence: Handle really short idle delays
- Date: Wed, 23 Jan 2013 15:57:44 +0000 (UTC)
commit 4a2c33203840bc48dec1e9478872d677c908e394
Author: Bastien Nocera <hadess hadess net>
Date: Wed Jan 23 15:54:26 2013 +0100
presence: Handle really short idle delays
We wouldn't end up idle in the following scenario:
idle-delay = 10 secs
we've been idle for 7 secs
idle-delay = 5 secs
idle time is 7 secs, but our idle watch is for 5 seconds.
We handle this by manually checking for the idle time. In the case of a
race where the idle time might be triggered twice, it would not have
any adverse effects as set_session_idle() knows we're already idle.
https://bugzilla.gnome.org/show_bug.cgi?id=692395
gnome-session/gsm-presence.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gnome-session/gsm-presence.c b/gnome-session/gsm-presence.c
index 0c031b0..0cd0a1e 100644
--- a/gnome-session/gsm-presence.c
+++ b/gnome-session/gsm-presence.c
@@ -179,6 +179,15 @@ reset_idle_watch (GsmPresence *presence)
g_debug ("GsmPresence: adding idle watch (%i) for %d secs",
presence->priv->idle_watch_id,
presence->priv->idle_timeout / 1000);
+
+ /* If the idle-delay is really short, we might end up with
+ * the idletime already being past the timeout */
+ if (presence->priv->idle_timeout < gnome_idle_monitor_get_idletime (presence->priv->idle_monitor)) {
+ g_debug ("Idle time %i already expired, triggering idle", presence->priv->idle_timeout);
+ idle_became_idle_cb (presence->priv->idle_monitor,
+ presence->priv->idle_watch_id,
+ presence);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]