- term_update(inst->term);
- term_blink(inst->term, 0);
- return TRUE;
+static gint timer_trigger(gpointer data)
+{
+ long now = GPOINTER_TO_INT(data);
+ long next;
+ long ticks;
+
+ if (run_timers(now, &next)) {
+ ticks = next - GETTICKCOUNT();
+ timer_id = gtk_timeout_add(ticks > 0 ? ticks : 1, timer_trigger,
+ GINT_TO_POINTER(next));
+ }
+
+ /*
+ * Never let a timer resume. If we need another one, we've
+ * asked for it explicitly above.
+ */
+ return FALSE;
+}
+
+void timer_change_notify(long next)
+{
+ long ticks;
+
+ if (timer_id)
+ gtk_timeout_remove(timer_id);
+
+ ticks = next - GETTICKCOUNT();
+ if (ticks <= 0)
+ ticks = 1; /* just in case */
+
+ timer_id = gtk_timeout_add(ticks, timer_trigger,
+ GINT_TO_POINTER(next));