X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=driver%2Fprefs.c;h=e2d765ab377d8cd605497c72890cd3b32c3374c3;hb=8afc01a67be4fbf3f1cc0fce9adf01b5289a21c6;hp=1df877287d621930caa45930428a48f05825dae8;hpb=50be9bb40dc60130c99ffa568e6677779904ff70;p=xscreensaver diff --git a/driver/prefs.c b/driver/prefs.c index 1df87728..e2d765ab 100644 --- a/driver/prefs.c +++ b/driver/prefs.c @@ -1,5 +1,5 @@ /* dotfile.c --- management of the ~/.xscreensaver file. - * xscreensaver, Copyright (c) 1998-2008 Jamie Zawinski + * xscreensaver, Copyright (c) 1998-2013 Jamie Zawinski * * 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" @@ -276,6 +277,7 @@ static const char * const prefs[] = { "ignoreUninstalledPrograms", "font", "dpmsEnabled", + "dpmsQuickOff", "dpmsStandby", "dpmsSuspend", "dpmsOff", @@ -297,9 +299,9 @@ static const char * const prefs[] = { "pointerHysteresis", "windowCreationTimeout", "initialDelay", - "sgiSaverExtension", + "sgiSaverExtension", /* not saved -- obsolete */ "mitSaverExtension", /* not saved -- obsolete */ - "xidleExtension", + "xidleExtension", /* not saved -- obsolete */ "GetViewPortIsFullOfLies", "procInterrupts", "xinputExtensionDev", @@ -817,6 +819,7 @@ write_init_file (Display *dpy, CHECK("font") type = pref_str, s = stderr_font; CHECK("dpmsEnabled") type = pref_bool, b = p->dpms_enabled_p; + CHECK("dpmsQuickOff") type = pref_bool, b = p->dpms_quickoff_p; CHECK("dpmsStandby") type = pref_time, t = p->dpms_standby; CHECK("dpmsSuspend") type = pref_time, t = p->dpms_suspend; CHECK("dpmsOff") type = pref_time, t = p->dpms_off; @@ -851,9 +854,9 @@ write_init_file (Display *dpy, CHECK("pointerHysteresis")type = pref_int, i = p->pointer_hysteresis; CHECK("windowCreationTimeout")type=pref_time,t= p->notice_events_timeout; CHECK("initialDelay") type = pref_time, t = p->initial_delay; - CHECK("sgiSaverExtension")type = pref_bool, b=p->use_sgi_saver_extension; + CHECK("sgiSaverExtension") continue; /* don't save */ CHECK("mitSaverExtension") continue; /* don't save */ - CHECK("xidleExtension") type = pref_bool, b = p->use_xidle_extension; + CHECK("xidleExtension") continue; /* don't save */ CHECK("procInterrupts") type = pref_bool, b = p->use_proc_interrupts; CHECK("xinputExtensionDev") type = pref_bool, b = p->use_xinput_extension; CHECK("GetViewPortIsFullOfLies") type = pref_bool, @@ -861,7 +864,7 @@ write_init_file (Display *dpy, CHECK("overlayStderr") type = pref_bool, b = overlay_stderr_p; CHECK("overlayTextBackground") continue; /* don't save */ CHECK("overlayTextForeground") continue; /* don't save */ - CHECK("bourneShell") continue; + CHECK("bourneShell") continue; /* don't save */ else abort(); # undef CHECK @@ -1073,6 +1076,7 @@ load_init_file (Display *dpy, saver_preferences *p) "Time"); p->dpms_enabled_p = get_boolean_resource (dpy, "dpmsEnabled", "Boolean"); + p->dpms_quickoff_p = get_boolean_resource (dpy, "dpmsQuickOff", "Boolean"); p->dpms_standby = 1000 * get_minutes_resource (dpy, "dpmsStandby", "Time"); p->dpms_suspend = 1000 * get_minutes_resource (dpy, "dpmsSuspend", "Time"); p->dpms_off = 1000 * get_minutes_resource (dpy, "dpmsOff", "Time"); @@ -1118,17 +1122,20 @@ load_init_file (Display *dpy, saver_preferences *p) } p->use_xidle_extension = get_boolean_resource (dpy, "xidleExtension","Boolean"); -#if 0 /* ignore this, it is evil. */ - p->use_mit_saver_extension = get_boolean_resource (dpy, - "mitSaverExtension", - "Boolean"); -#endif +#if 0 /* obsolete. */ p->use_sgi_saver_extension = get_boolean_resource (dpy, "sgiSaverExtension", "Boolean"); - +#endif +#ifdef HAVE_XINPUT p->use_xinput_extension = get_boolean_resource (dpy, "xinputExtensionDev", "Boolean"); +#endif +#if 0 /* broken and evil. */ + p->use_mit_saver_extension = get_boolean_resource (dpy, + "mitSaverExtension", + "Boolean"); +#endif p->use_proc_interrupts = get_boolean_resource (dpy, "procInterrupts", "Boolean"); @@ -1628,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; @@ -1642,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); +}