From 03b0594911e71cabf6ad77a962fcf70fca24f1e2 Mon Sep 17 00:00:00 2001 From: Richard Hult Date: Sun, 2 May 2004 12:05:36 +0000 Subject: [PATCH] drw-monitor.c Raise the threshold for detecting activity, makes totem not 2004-05-02 Richard Hult * drw-monitor.c Raise the threshold for detecting activity, makes totem not trigger typing breaks. Fixes bug #121876. --- typing-break/ChangeLog | 5 +++++ typing-break/drw-monitor.c | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/typing-break/ChangeLog b/typing-break/ChangeLog index 5e6e8a8e5..35d49effa 100644 --- a/typing-break/ChangeLog +++ b/typing-break/ChangeLog @@ -1,3 +1,8 @@ +2004-05-02 Richard Hult + + * drw-monitor.c Raise the threshold for detecting activity, makes + totem not trigger typing breaks. Fixes bug #121876. + 2004-04-15 Jody Goldberg * Release 2.6.1 diff --git a/typing-break/drw-monitor.c b/typing-break/drw-monitor.c index 7985b5ad3..2a4653760 100644 --- a/typing-break/drw-monitor.c +++ b/typing-break/drw-monitor.c @@ -38,6 +38,8 @@ struct _DrwMonitorPriv { XScreenSaverInfo *ss_info; guint timeout_id; unsigned long last_idle; + + time_t last_activity; }; /* Signals */ @@ -139,12 +141,19 @@ static gboolean drw_monitor_timeout (DrwMonitor *monitor) { DrwMonitorPriv *priv; + time_t now; priv = monitor->priv; if (XScreenSaverQueryInfo (GDK_DISPLAY (), DefaultRootWindow (GDK_DISPLAY ()), priv->ss_info) != 0) { if (priv->ss_info->idle < priv->last_idle) { - g_signal_emit (monitor, signals[ACTIVITY], 0, NULL); + now = time (NULL); + + if (now - priv->last_activity < 25) { + g_signal_emit (monitor, signals[ACTIVITY], 0, NULL); + } + + priv->last_activity = now; } priv->last_idle = priv->ss_info->idle; @@ -168,6 +177,8 @@ drw_monitor_setup (DrwMonitor *monitor) priv->ss_info = XScreenSaverAllocInfo (); + priv->last_activity = time (NULL); + priv->timeout_id = g_timeout_add (3000, (GSourceFunc) drw_monitor_timeout, monitor); return TRUE;