X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=driver%2Fprefs.c;h=1ef9a276fee115c8e2c37186c22d18041c14656e;hb=0d6b320def9180cf907ceaed56b23a972a11b757;hp=a4d8103ca37db5b213c8dc9baa869b5ab57f97d3;hpb=447db08c956099b3b183886729108bf5b364c4b8;p=xscreensaver diff --git a/driver/prefs.c b/driver/prefs.c index a4d8103c..1ef9a276 100644 --- a/driver/prefs.c +++ b/driver/prefs.c @@ -86,7 +86,14 @@ chase_symlinks (const char *file) # ifdef HAVE_REALPATH if (file) { - char buf [2048]; +# ifndef PATH_MAX +# ifdef MAXPATHLEN +# define PATH_MAX MAXPATHLEN +# else +# define PATH_MAX 2048 +# endif +# endif + char buf[PATH_MAX]; if (realpath (file, buf)) return strdup (buf); @@ -1576,11 +1583,15 @@ stop_the_insanity (saver_preferences *p) p->dpms_off < 10 * 1000) p->dpms_off = 4 * 60 * 60 * 1000; /* 4 hours */ - /* standby may not be greater than suspend. - suspend may not be greater than off. + /* suspend may not be greater than off, unless off is 0. + standby may not be greater than suspend, unless suspend is 0. */ - if (p->dpms_standby > p->dpms_suspend) p->dpms_standby = p->dpms_suspend; - if (p->dpms_suspend > p->dpms_off) p->dpms_suspend = p->dpms_off; + if (p->dpms_off != 0 && + p->dpms_suspend > p->dpms_off) + p->dpms_suspend = p->dpms_off; + if (p->dpms_suspend != 0 && + p->dpms_standby > p->dpms_suspend) + p->dpms_standby = p->dpms_suspend; if (p->dpms_standby == 0 && /* if *all* are 0, then DPMS is disabled */ @@ -1589,9 +1600,12 @@ stop_the_insanity (saver_preferences *p) p->dpms_enabled_p = False; + /* Set watchdog timeout to about half of the cycle timeout, but + don't let it be faster than 1/2 minute or slower than 1 minute. + */ p->watchdog_timeout = p->cycle * 0.6; - if (p->watchdog_timeout < 30000) p->watchdog_timeout = 30000; /* 30 secs */ - if (p->watchdog_timeout > 3600000) p->watchdog_timeout = 3600000; /* 1 hr */ + if (p->watchdog_timeout < 27000) p->watchdog_timeout = 27000; /* 27 secs */ + if (p->watchdog_timeout > 57000) p->watchdog_timeout = 57000; /* 57 secs */ if (p->pointer_hysteresis < 0) p->pointer_hysteresis = 0; if (p->pointer_hysteresis > 100) p->pointer_hysteresis = 100;