From http://www.jwz.org/xscreensaver/xscreensaver-5.27.tar.gz
[xscreensaver] / driver / prefs.c
index f01f11476c6f17c43a7a636d898d700b0693f6f9..e2d765ab377d8cd605497c72890cd3b32c3374c3 100644 (file)
@@ -1,5 +1,5 @@
 /* dotfile.c --- management of the ~/.xscreensaver file.
- * xscreensaver, Copyright (c) 1998-2011 Jamie Zawinski <jwz@jwz.org>
+ * xscreensaver, Copyright (c) 1998-2013 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -64,6 +64,7 @@
 #endif
 
 
+#include "version.h"
 #include "prefs.h"
 #include "resources.h"
 
@@ -1634,7 +1635,9 @@ stop_the_insanity (saver_preferences *p)
 
   if (p->dpms_standby == 0 &&     /* if *all* are 0, then DPMS is disabled */
       p->dpms_suspend == 0 &&
-      p->dpms_off     == 0)
+      p->dpms_off     == 0 &&
+      !(p->dpms_quickoff_p)           /* ... but we want to do DPMS quick off */
+      )
     p->dpms_enabled_p = False;
 
 
@@ -1648,3 +1651,43 @@ stop_the_insanity (saver_preferences *p)
   if (p->pointer_hysteresis < 0)   p->pointer_hysteresis = 0;
   if (p->pointer_hysteresis > 100) p->pointer_hysteresis = 100;
 }
+
+
+/* Getting very tired of bug reports of already-fixed bugs due to
+   Linux distros shipping multi-year-old versions.
+ */
+Bool
+senescent_p (void)
+{
+  time_t now = time ((time_t *) 0);
+  struct tm *tm = localtime (&now);
+  const char *s = screensaver_id;
+  char mon[4], year[5];
+  int m, y, months;
+  s = strchr (s, ' '); if (!s) abort(); s++;
+  s = strchr (s, '('); if (!s) abort(); s++;
+  s = strchr (s, '-'); if (!s) abort(); s++;
+  strncpy (mon, s, 3);
+  mon[3] = 0;
+  s = strchr (s, '-'); if (!s) abort(); s++;
+  strncpy (year, s, 4);
+  year[4] = 0;
+  y = atoi (year);
+  if      (!strcmp(mon, "Jan")) m = 0;
+  else if (!strcmp(mon, "Feb")) m = 1;
+  else if (!strcmp(mon, "Mar")) m = 2;
+  else if (!strcmp(mon, "Apr")) m = 3;
+  else if (!strcmp(mon, "May")) m = 4;
+  else if (!strcmp(mon, "Jun")) m = 5;
+  else if (!strcmp(mon, "Jul")) m = 6;
+  else if (!strcmp(mon, "Aug")) m = 7;
+  else if (!strcmp(mon, "Sep")) m = 8;
+  else if (!strcmp(mon, "Oct")) m = 9;
+  else if (!strcmp(mon, "Nov")) m = 10;
+  else if (!strcmp(mon, "Dec")) m = 11;
+  else abort();
+  months = ((((tm->tm_year + 1900) * 12) + tm->tm_mon) -
+            (y * 12 + m));
+
+  return (months > 12);
+}