X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=driver%2Fprefs.c;h=55bac7ba8fffb22a09f7b245f8fdbd45fef93b05;hb=6afd6db0ae9396cd7ff897ade597cd5483f49b0e;hp=c8e4ae14868c671fb66371901667dade718413e2;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/driver/prefs.c b/driver/prefs.c index c8e4ae14..55bac7ba 100644 --- a/driver/prefs.c +++ b/driver/prefs.c @@ -1,5 +1,5 @@ /* dotfile.c --- management of the ~/.xscreensaver file. - * xscreensaver, Copyright (c) 1998-2006 Jamie Zawinski + * xscreensaver, Copyright (c) 1998-2014 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" @@ -272,9 +273,11 @@ static const char * const prefs[] = { "fadeTicks", "captureStderr", "captureStdout", /* not saved -- obsolete */ + "logFile", /* not saved */ "ignoreUninstalledPrograms", "font", "dpmsEnabled", + "dpmsQuickOff", "dpmsStandby", "dpmsSuspend", "dpmsOff", @@ -296,15 +299,17 @@ 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", "overlayStderr", "overlayTextBackground", /* not saved -- X resources only */ "overlayTextForeground", /* not saved -- X resources only */ "bourneShell", /* not saved -- X resources only */ + "authWarningSlack", 0 }; @@ -808,12 +813,14 @@ write_init_file (Display *dpy, CHECK("fadeTicks") type = pref_int, i = p->fade_ticks; CHECK("captureStderr") type = pref_bool, b = p->capture_stderr_p; CHECK("captureStdout") continue; /* don't save */ + CHECK("logFile") continue; /* don't save */ CHECK("ignoreUninstalledPrograms") type = pref_bool, b = p->ignore_uninstalled_p; 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; @@ -848,16 +855,18 @@ 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, b = p->getviewport_full_of_lies_p; 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 */ + CHECK("authWarningSlack") type = pref_int, i = p->auth_warning_slack; else abort(); # undef CHECK @@ -1069,6 +1078,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"); @@ -1094,6 +1104,8 @@ load_init_file (Display *dpy, saver_preferences *p) p->new_login_command = get_string_resource(dpy, "newLoginCommand", "NewLoginCommand"); + p->auth_warning_slack = get_integer_resource(dpy, "authWarningSlack", + "Integer"); /* If "*splash" is unset, default to true. */ { @@ -1114,14 +1126,21 @@ 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. */ +#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_sgi_saver_extension = get_boolean_resource (dpy, - "sgiSaverExtension", - "Boolean"); + p->use_proc_interrupts = get_boolean_resource (dpy, "procInterrupts", "Boolean"); @@ -1620,7 +1639,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; @@ -1633,4 +1654,87 @@ stop_the_insanity (saver_preferences *p) if (p->pointer_hysteresis < 0) p->pointer_hysteresis = 0; if (p->pointer_hysteresis > 100) p->pointer_hysteresis = 100; + + if (p->auth_warning_slack < 0) p->auth_warning_slack = 0; + if (p->auth_warning_slack > 300) p->auth_warning_slack = 300; +} + + +Bool +senescent_p (void) +{ + /* If you are in here because you're planning on disabling this warning + before redistributing my software, please don't. + + I sincerely request that you do one of the following: + + 1: leave this code intact and this warning in place, -OR- + + 2: Remove xscreensaver from your distribution. + + I would seriously prefer that you not distribute my software at all + than that you distribute one version and then never update it for + years. + + I am *constantly* getting email from users reporting bugs that have + been fixed for literally years who have no idea that the software + they are running is years out of date. Yes, it would be great if we + lived in the ideal world where people checked that they were running + the latest release before they report a bug, but we don't. To most + people, "running the latest release" is synonymous with "running the + latest release that my distro packages for me." + + When they even bother to tell me what version they're running, I + say, "That version is three years old!", and they say "But this is + the latest version my distro ships". Then I say, "your distro + sucks", and they say "but I don't know how to compile from source, + herp derp I eat paste", and *everybody* goes away unhappy. + + It wastes an enormous amount of my time, and kind of makes me regret + ever having released this software in the first place. + + So seriously. I ask that if you're planning on disabling this + obsolescence warning, that you instead just remove xscreensaver from + your distro entirely. Everybody will be happier that way. Check + out gnome-screensaver instead, I understand it's really nice. + + Of course, my license allows you to ignore me and do whatever the + fuck you want, but as the author, I hope you will have the common + courtesy of complying with my request. + + Thank you! + + jwz, 2014 + */ + time_t now = time ((time_t *) 0); /* N */ + struct tm *tm = localtime (&now); /* o */ + const char *s = screensaver_id; /* */ + char mon[4], year[5]; /* d */ + int m, y, months; /* o */ + s = strchr (s, ' '); if (!s) abort(); s++; /* n */ + s = strchr (s, '('); if (!s) abort(); s++; /* ' */ + s = strchr (s, '-'); if (!s) abort(); s++; /* t */ + strncpy (mon, s, 3); /* */ + mon[3] = 0; /* d */ + s = strchr (s, '-'); if (!s) abort(); s++; /* o */ + strncpy (year, s, 4); /* */ + year[4] = 0; /* i */ + y = atoi (year); /* t */ + if (!strcmp(mon, "Jan")) m = 0; /* , */ + else if (!strcmp(mon, "Feb")) m = 1; /* */ + else if (!strcmp(mon, "Mar")) m = 2; /* s */ + else if (!strcmp(mon, "Apr")) m = 3; /* t */ + else if (!strcmp(mon, "May")) m = 4; /* o */ + else if (!strcmp(mon, "Jun")) m = 5; /* p */ + else if (!strcmp(mon, "Jul")) m = 6; /* , */ + else if (!strcmp(mon, "Aug")) m = 7; /* */ + else if (!strcmp(mon, "Sep")) m = 8; /* s */ + else if (!strcmp(mon, "Oct")) m = 9; /* t */ + else if (!strcmp(mon, "Nov")) m = 10; /* a */ + else if (!strcmp(mon, "Dec")) m = 11; /* a */ + else abort(); /* a */ + months = ((((tm->tm_year + 1900) * 12) + tm->tm_mon) - /* h */ + (y * 12 + m)); /* h */ + /* h */ + return (months > 18); /* p */ }