/* timers.c --- detecting when the user is idle, and other timer-related tasks.
- * xscreensaver, Copyright (c) 1991-1997 Jamie Zawinski <jwz@netscape.com>
+ * xscreensaver, Copyright (c) 1991-1997, 1998
+ * Jamie Zawinski <jwz@netscape.com>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
saver_info *si = (saver_info *) closure;
saver_preferences *p = &si->prefs;
Time how_long = p->cycle;
- if (si->dbox_up_p)
+ if (si->dbox_up_p || si->question_up_p)
{
if (p->verbose_p)
- printf ("%s: dbox up; delaying hack change.\n", progname);
+ printf ("%s: dialog box up; delaying hack change.\n", progname);
how_long = 30000; /* 30 secs */
}
else
if (p->verbose_p)
printf ("%s: starting cycle_timer (%ld, %ld)\n",
progname, how_long, si->cycle_id);
-#endif
+#endif /* DEBUG_TIMERS */
}
if (p->verbose_p)
printf ("%s: killing idle_timer (%ld, %ld)\n",
progname, p->timeout, si->timer_id);
-#endif
+#endif /* DEBUG_TIMERS */
+
XtRemoveTimeOut (si->timer_id);
si->timer_id = XtAppAddTimeOut (si->app, p->timeout, idle_timer,
(XtPointer) si);
if (p->verbose_p)
printf ("%s: restarting idle_timer (%ld, %ld)\n",
progname, p->timeout, si->timer_id);
-#endif
+#endif /* DEBUG_TIMERS */
si->last_activity_time = time ((time_t *) 0);
}
else
printf ("%s: pointer moved at %s on screen %d.\n",
progname, timestring(), i);
-#endif
+#endif /* DEBUG_TIMERS */
si->last_activity_screen = ssi;
ssi->poll_mouse_last_root_x = root_x;
/* Wake up periodically to ask the server if we are idle. */
si->timer_id = XtAppAddTimeOut (si->app, p->timeout, idle_timer,
(XtPointer) si);
+
#ifdef DEBUG_TIMERS
if (p->verbose_p)
printf ("%s: starting idle_timer (%ld, %ld)\n",
progname, p->timeout, si->timer_id);
-#endif
+#endif /* DEBUG_TIMERS */
}
if (!p->use_xidle_extension &&
printf ("%s: KeyPress seen on 0x%X at %s\n", progname,
(unsigned int) event.xkey.window, timestring ());
}
-#endif
+#endif /* DEBUG_TIMERS */
/* We got a user event */
if (!until_idle_p)
if (si->screen_blanked_p)
{
Bool running_p = screenhack_running_p(si);
+
#ifdef DEBUG_TIMERS
if (si->prefs.verbose_p)
printf ("%s: watchdog timer raising %sscreen.\n",
progname, (running_p ? "" : "and clearing "));
-#endif
+#endif /* DEBUG_TIMERS */
+
raise_window (si, True, True, running_p);
+
+ if (!monitor_powered_on_p (si))
+ {
+ if (si->prefs.verbose_p)
+ printf ("%s: server reports that monitor has powered down; "
+ "killing running hacks.\n", progname);
+ kill_screenhack (si);
+ }
}
}
}
if (p->verbose_p)
printf ("%s: restarting watchdog_timer (%ld, %ld)\n",
progname, p->watchdog_timeout, si->watchdog_id);
-#endif
+#endif /* DEBUG_TIMERS */
+
}
}