[gnome-desktop] idle-monitor: Reset the alarm so it can be triggered again
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop] idle-monitor: Reset the alarm so it can be triggered again
- Date: Fri, 14 Dec 2012 16:30:59 +0000 (UTC)
commit 7f9fba8b6e52b1ef397084708839e70395678a92
Author: Bastien Nocera <hadess hadess net>
Date: Tue Nov 13 10:57:22 2012 +0100
idle-monitor: Reset the alarm so it can be triggered again
http://www.x.org/archive/X11R7.6/doc/xextproto/sync.txt says:
[... If] the delta is 0 and test-type is PositiveComparison
or NegativeComparison, no change is made to value and the alarm
state is changed to Inactive before the event is generated.
But we want to receive to receive events about the idleness/business
of the counter, so reset the alarm when the alarm is triggered.
https://bugzilla.gnome.org/show_bug.cgi?id=688227
libgnome-desktop/gnome-idle-monitor.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/libgnome-desktop/gnome-idle-monitor.c b/libgnome-desktop/gnome-idle-monitor.c
index f1dad99..9365b1b 100644
--- a/libgnome-desktop/gnome-idle-monitor.c
+++ b/libgnome-desktop/gnome-idle-monitor.c
@@ -143,11 +143,12 @@ handle_alarm_notify_event (GnomeIdleMonitor *monitor,
if (alarm_event->alarm == monitor->priv->xalarm_reset) {
g_signal_emit (monitor, signals[BECAME_ACTIVE], 0);
} else {
- GnomeIdleMonitorWatch *watch = find_watch_for_alarm (monitor, alarm_event->alarm);
+ GnomeIdleMonitorWatch *watch;
+ XSyncAlarmAttributes attr;
- if (watch == NULL) {
+ watch = find_watch_for_alarm (monitor, alarm_event->alarm);
+ if (watch == NULL)
return;
- }
g_signal_emit (monitor, signals[TRIGGERED_IDLE], 0, watch->id);
@@ -156,6 +157,10 @@ handle_alarm_notify_event (GnomeIdleMonitor *monitor,
watch->id,
watch->user_data);
}
+
+ /* Reset the alarm so it can be triggered again */
+ attr.events = TRUE;
+ XSyncChangeAlarm (watch->display, watch->xalarm, XSyncCAEvents, &attr);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]