From 0bd2eabab3e404c6769fe8f59b639275e960c415 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Mon, 2 Mar 2009 00:42:26 -0500 Subject: [PATCH] http://ftp.x.org/contrib/applications/xscreensaver-2.23.tar.gz -rw-r--r-- 1 zblaxell zblaxell 819372 Jun 20 1998 xscreensaver-2.23.tar.gz dfe504a75427283d509383b79f6bfe5066ace1fb xscreensaver-2.23.tar.gz --- README | 19 + config.h.in | 6 + configure | 847 ++++++++++++++++++++--------- configure.in | 127 ++++- driver/Makefile.in | 26 +- driver/XScreenSaver.ad.in | 70 +-- driver/XScreenSaver_ad.h | 66 +-- driver/demo.c | 5 +- driver/lock.c | 1 + driver/subprocs.c | 37 +- driver/timers.c | 8 + driver/windows.c | 2 + driver/xscreensaver-command.man | 2 +- driver/xscreensaver.c | 12 +- driver/xscreensaver.h | 5 + driver/xscreensaver.man | 36 +- driver/xset.c | 120 ++++- hacks/Makefile.in | 48 +- hacks/attraction.c | 4 +- hacks/blitspin.c | 4 +- hacks/bsod.c | 250 ++++++++- hacks/bubbles.c | 4 +- hacks/compile_axp.com | 2 + hacks/compile_decc.com | 2 + hacks/coral.c | 14 +- hacks/crystal.c | 930 ++++++++++++++++++++++++++++++++ hacks/cynosure.c | 4 +- hacks/deco.c | 4 +- hacks/discrete.c | 410 ++++++++++++++ hacks/epicycle.c | 4 +- hacks/flame.c | 4 +- hacks/glx/Makefile.in | 7 +- hacks/goop.c | 4 +- hacks/greynetic.c | 4 +- hacks/halo.c | 4 +- hacks/helix.c | 2 +- hacks/hypercube.c | 4 +- hacks/imsmap.c | 4 +- hacks/jigsaw.c | 4 +- hacks/kaleidescope.c | 4 +- hacks/lmorph.c | 654 +++++++++++----------- hacks/lmorph.man | 8 +- hacks/maze.c | 4 +- hacks/moire.c | 4 +- hacks/moire2.c | 4 +- hacks/munch.c | 4 +- hacks/noseguy.c | 4 +- hacks/pedal.c | 4 +- hacks/pyro.c | 4 +- hacks/qix.c | 4 +- hacks/rd-bomb.c | 4 +- hacks/rocks.c | 4 +- hacks/rorschach.c | 4 +- hacks/screenhack.c | 19 +- hacks/slidescreen.c | 4 +- hacks/starfish.c | 4 +- hacks/xjack.c | 4 +- hacks/xlockmore.h | 2 + hacks/xlyap.c | 4 +- hacks/xroger-hack.c | 4 +- setup.com | 2 + utils/version.h | 2 +- xscreensaver.lsm | 12 +- 63 files changed, 3082 insertions(+), 791 deletions(-) create mode 100644 hacks/crystal.c create mode 100644 hacks/discrete.c diff --git a/README b/README index b2204503..060af05c 100644 --- a/README +++ b/README @@ -143,6 +143,8 @@ window, which are pointed at by the screensaver's default resource settings. interference - More groovy colored fields. truchet - Nonrepeating planar tilings. bsod - Simulates the system crashes of various other OSes. + crystal - A kaleidoscope of moving polygons. + discrete - Various fractal-ish "discrete map" forms. gears - Draws interlocking rotating gears (GLX only.) morph3d - Draws shiny shape-changing 3d forms (GLX only.) superquadrics - More shiny shape-changing 3d forms (GLX only.) @@ -185,6 +187,23 @@ http://people.netscape.com/jwz/xscreensaver/. -- Jamie Zawinski +Changes since 2.22: * The fix for SGI's "scheme" nonsense broke things, and + let the user's "*background" resource show through. + Fixed it in a different way. +Changes since 2.21: * Added support for the DPMS server extension (Display + Power Management System.) + * Made configure advertize the --enable-subdir option a + little more, since that seemed to cause some people + stress. Also, made that directory be built into the + xscreensaver executable, as a hardcoded prefix to + $PATH. (Might help, shouldn't hurt.) + * Made configure prefer the two-arg gettimeofday to the + one-arg version, since AIX doesn't have any prototypes. + * Made it work with Xaw3d (the 3D Athena library.) + * Made "make install" create directories as necessary. + * New version of lmorph from Sverre. + * Added `crystal' and `discreet' hacks from xlockmore. + * Added a new mode to `bsod'. Changes since 2.20: * Made "xscreensaver-command -time" use different words. (It now describes the two states as "screen blanked since..." and "screen non-blanked since..." instead of diff --git a/config.h.in b/config.h.in index f8aed556..4ee2cd7a 100644 --- a/config.h.in +++ b/config.h.in @@ -90,6 +90,12 @@ */ #undef HAVE_SGI_VC_EXTENSION +/* Define this if you have the XDPMS extension. This is standard on + * sufficiently-recent XFree86 systems, and possibly elsewhere. (It's + * available if the file /usr/include/X11/extensions/dpms.h exists.) + */ +#undef HAVE_DPMS_EXTENSION + /* ************************************************************************* CONFIGURING GRAPHICS TOOLKITS diff --git a/configure b/configure index a651f307..c983155e 100755 --- a/configure +++ b/configure @@ -54,6 +54,10 @@ ac_help="$ac_help extension, if possible (this is the default). --without-sgivc-ext Do not compile in support for this extension." ac_help="$ac_help + --with-dpms-ext Include support for the DPMS server extension, + if possible (this is the default). + --without-dpms-ext Do not compile in support for this extension." +ac_help="$ac_help Toolkit options: @@ -641,7 +645,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:645: checking host system type" >&5 +echo "configure:649: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -665,7 +669,7 @@ echo "$ac_t""$host" 1>&6 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:669: checking for $ac_word" >&5 +echo "configure:673: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -694,7 +698,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:698: checking for $ac_word" >&5 +echo "configure:702: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -742,7 +746,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:746: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:750: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -752,11 +756,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -776,12 +780,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:780: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:784: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:785: checking whether we are using GNU C" >&5 +echo "configure:789: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -790,7 +794,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:794: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:798: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -805,7 +809,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:809: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:813: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -835,7 +839,7 @@ fi if test -z "$GCC"; then echo $ac_n "checking how to request ANSI compilation""... $ac_c" 1>&6 -echo "configure:839: checking how to request ANSI compilation" >&5 +echo "configure:843: checking how to request ANSI compilation" >&5 case "$host" in *-hpux*) echo "$ac_t""HPUX: adding -Ae" 1>&6 @@ -857,16 +861,16 @@ fi echo $ac_n "checking whether the compiler works on ANSI C""... $ac_c" 1>&6 -echo "configure:861: checking whether the compiler works on ANSI C" >&5 +echo "configure:865: checking whether the compiler works on ANSI C" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: Couldn't build even a trivial ANSI C program: check CC." 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 else @@ -895,7 +899,7 @@ esac echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:899: checking how to run the C preprocessor" >&5 +echo "configure:903: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -910,13 +914,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:920: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:924: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -927,13 +931,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:937: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:941: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -966,7 +970,7 @@ echo "$ac_t""$CPP" 1>&6 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:970: checking for a BSD compatible install" >&5 +echo "configure:974: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1016,7 +1020,7 @@ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1020: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1024: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1044,12 +1048,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1048: checking for working const" >&5 +echo "configure:1052: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1106: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1119,21 +1123,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1123: checking for inline" >&5 +echo "configure:1127: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1160,12 +1164,12 @@ esac echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1164: checking for ANSI C header files" >&5 +echo "configure:1168: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1173,7 +1177,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1177: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1181: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1190,7 +1194,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1208,7 +1212,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1229,7 +1233,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1240,7 +1244,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1264,12 +1268,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1268: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1272: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1278,7 +1282,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1282: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1286: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1299,12 +1303,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1303: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1307: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1320,7 +1324,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1328: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1345,12 +1349,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1349: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1353: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -1358,7 +1362,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1362: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1366: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1383,7 +1387,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1387: checking for opendir in -ldir" >&5 +echo "configure:1391: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1391,7 +1395,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1424,7 +1428,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1428: checking for opendir in -lx" >&5 +echo "configure:1432: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1432,7 +1436,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1467,12 +1471,12 @@ fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:1471: checking for mode_t" >&5 +echo "configure:1475: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1500,12 +1504,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:1504: checking for pid_t" >&5 +echo "configure:1508: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1533,12 +1537,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1537: checking for size_t" >&5 +echo "configure:1541: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1566,12 +1570,12 @@ EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1570: checking return type of signal handlers" >&5 +echo "configure:1574: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1588,7 +1592,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1592: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1596: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1608,39 +1612,39 @@ EOF echo $ac_n "checking how to call gettimeofday""... $ac_c" 1>&6 -echo "configure:1612: checking how to call gettimeofday" >&5 +echo "configure:1616: checking how to call gettimeofday" >&5 if eval "test \"`echo '$''{'ac_cv_gettimeofday_args'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include int main() { -struct timeval tv; gettimeofday(&tv); +struct timeval tv; struct timezone tzp; + gettimeofday(&tv, &tzp); ; return 0; } EOF -if { (eval echo configure:1625: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1630: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - ac_gettimeofday_args=1 + ac_gettimeofday_args=2 else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < #include int main() { -struct timeval tv; struct timezone tzp; - gettimeofday(&tv, &tzp); +struct timeval tv; gettimeofday(&tv); ; return 0; } EOF -if { (eval echo configure:1642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1646: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - ac_gettimeofday_args=2 + ac_gettimeofday_args=1 else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 @@ -1678,12 +1682,12 @@ fi for ac_func in select fcntl uname nice setpriority getcwd getwd putenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1682: checking for $ac_func" >&5 +echo "configure:1686: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1733,12 +1737,12 @@ done for ac_func in sigaction do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1737: checking for $ac_func" >&5 +echo "configure:1741: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1790,17 +1794,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1794: checking for $ac_hdr" >&5 +echo "configure:1798: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1804: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1838,12 +1842,19 @@ else fi if test x"$enable_subdir" = xno; then - HACKDIR='$(bindir)' + HACKDIR='${bindir}' elif test x"$enable_subdir" = xyes -o x"$enable_subdir" = x ; then echo "error: must be a subdirectory name: --enable-subdir=$enable_subdir" exit 1 else - HACKDIR='$(bindir)/'$enable_subdir + # there must be a better way than this... + if test -z "`echo $enable_subdir | sed 's@^/.*@@'`" ; then + # absolute path + HACKDIR=$enable_subdir + else + # relative path + HACKDIR='${bindir}/'$enable_subdir + fi fi @@ -1852,7 +1863,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:1856: checking for X" >&5 +echo "configure:1867: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -1914,12 +1925,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1923: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1934: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1988,14 +1999,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -2101,17 +2112,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:2105: checking whether -R must be followed by a space" >&5 +echo "configure:2116: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_nospace=yes else @@ -2127,14 +2138,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_space=yes else @@ -2166,7 +2177,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:2170: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:2181: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2174,7 +2185,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2207,7 +2218,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:2211: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:2222: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2215,7 +2226,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2255,12 +2266,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:2259: checking for gethostbyname" >&5 +echo "configure:2270: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -2304,7 +2315,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:2308: checking for gethostbyname in -lnsl" >&5 +echo "configure:2319: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2312,7 +2323,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2353,12 +2364,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:2357: checking for connect" >&5 +echo "configure:2368: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -2402,7 +2413,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:2406: checking for connect in -lsocket" >&5 +echo "configure:2417: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2410,7 +2421,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2445,12 +2456,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:2449: checking for remove" >&5 +echo "configure:2460: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2488: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -2494,7 +2505,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:2498: checking for remove in -lposix" >&5 +echo "configure:2509: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2502,7 +2513,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2537,12 +2548,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:2541: checking for shmat" >&5 +echo "configure:2552: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -2586,7 +2597,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:2590: checking for shmat in -lipc" >&5 +echo "configure:2601: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2594,7 +2605,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2638,7 +2649,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:2642: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:2653: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2646,7 +2657,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2694,7 +2705,7 @@ fi echo $ac_n "checking for X app-defaults directory""... $ac_c" 1>&6 -echo "configure:2698: checking for X app-defaults directory" >&5 +echo "configure:2709: checking for X app-defaults directory" >&5 if eval "test \"`echo '$''{'ac_cv_x_app_defaults'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2821,7 +2832,7 @@ APPDEFAULTS=$ac_x_app_defaults fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < EOF @@ -2842,7 +2853,7 @@ rm -f conftest* # Check for the availability of the XPointer typedef, and define it otherwise. # echo $ac_n "checking for XPointer""... $ac_c" 1>&6 -echo "configure:2846: checking for XPointer" >&5 +echo "configure:2857: checking for XPointer" >&5 if eval "test \"`echo '$''{'ac_cv_xpointer'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2853,14 +2864,14 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < int main() { XPointer foo = (XPointer) 0; ; return 0; } EOF -if { (eval echo configure:2864: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2875: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_xpointer=yes else @@ -2919,7 +2930,7 @@ case "$host" in # Some versions of Slowlaris Motif require -lgen. But not all. Why? echo $ac_n "checking for regcmp in -lgen""... $ac_c" 1>&6 -echo "configure:2923: checking for regcmp in -lgen" >&5 +echo "configure:2934: checking for regcmp in -lgen" >&5 ac_lib_var=`echo gen'_'regcmp | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2927,7 +2938,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2975,17 +2986,17 @@ have_xmu=no CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/Xmu/Error.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xmu/Error.h""... $ac_c" 1>&6 -echo "configure:2979: checking for X11/Xmu/Error.h" >&5 +echo "configure:2990: checking for X11/Xmu/Error.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3000: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3029,7 +3040,7 @@ if test $have_xmu = yes ; then case "$host" in *-sunos4*) echo $ac_n "checking for the SunOS 4.1.x _get_wmShellWidgetClass bug""... $ac_c" 1>&6 -echo "configure:3033: checking for the SunOS 4.1.x _get_wmShellWidgetClass bug" >&5 +echo "configure:3044: checking for the SunOS 4.1.x _get_wmShellWidgetClass bug" >&5 if eval "test \"`echo '$''{'ac_cv_sunos_xmu_bug'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3042,14 +3053,14 @@ else # with X libraries because we know it's SunOS. LDFLAGS="$LDFLAGS -lXmu -lXt -lX11 -lXext -lm" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_sunos_xmu_bug=no else @@ -3065,21 +3076,21 @@ fi echo "$ac_t""$ac_cv_sunos_xmu_bug" 1>&6 if test $ac_cv_sunos_xmu_bug = yes ; then echo $ac_n "checking whether the compiler understands -static""... $ac_c" 1>&6 -echo "configure:3069: checking whether the compiler understands -static" >&5 +echo "configure:3080: checking whether the compiler understands -static" >&5 if eval "test \"`echo '$''{'ac_cv_ld_static'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -static" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_ld_static=yes else @@ -3125,17 +3136,17 @@ if test $with_sgi = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/XScreenSaver.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/XScreenSaver.h""... $ac_c" 1>&6 -echo "configure:3129: checking for X11/extensions/XScreenSaver.h" >&5 +echo "configure:3140: checking for X11/extensions/XScreenSaver.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3139: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3150: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3190,17 +3201,17 @@ if test $have_sgi != yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/scrnsaver.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/scrnsaver.h""... $ac_c" 1>&6 -echo "configure:3194: checking for X11/extensions/scrnsaver.h" >&5 +echo "configure:3205: checking for X11/extensions/scrnsaver.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3215: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3244,7 +3255,7 @@ fi LDFLAGS="$LDFLAGS -L$x_libraries" fi echo $ac_n "checking for XScreenSaverRegister in -lXext""... $ac_c" 1>&6 -echo "configure:3248: checking for XScreenSaverRegister in -lXext" >&5 +echo "configure:3259: checking for XScreenSaverRegister in -lXext" >&5 ac_lib_var=`echo Xext'_'XScreenSaverRegister | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3252,7 +3263,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3314,7 +3325,7 @@ fi LDFLAGS="$LDFLAGS -L$x_libraries" fi echo $ac_n "checking for XScreenSaverRegister in -lXExExt""... $ac_c" 1>&6 -echo "configure:3318: checking for XScreenSaverRegister in -lXExExt" >&5 +echo "configure:3329: checking for XScreenSaverRegister in -lXExExt" >&5 ac_lib_var=`echo XExExt'_'XScreenSaverRegister | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3322,7 +3333,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXExExt -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3379,7 +3390,7 @@ fi LDFLAGS="$LDFLAGS -L$x_libraries" fi echo $ac_n "checking for XScreenSaverRegister in -lXss""... $ac_c" 1>&6 -echo "configure:3383: checking for XScreenSaverRegister in -lXss" >&5 +echo "configure:3394: checking for XScreenSaverRegister in -lXss" >&5 ac_lib_var=`echo Xss'_'XScreenSaverRegister | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3387,7 +3398,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXss -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3459,17 +3470,17 @@ if test $with_xidle = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/xidle.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/xidle.h""... $ac_c" 1>&6 -echo "configure:3463: checking for X11/extensions/xidle.h" >&5 +echo "configure:3474: checking for X11/extensions/xidle.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3473: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3484: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3524,17 +3535,17 @@ if test $with_xshm = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/XShm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/XShm.h""... $ac_c" 1>&6 -echo "configure:3528: checking for X11/extensions/XShm.h" >&5 +echo "configure:3539: checking for X11/extensions/XShm.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3538: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3549: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3568,17 +3579,17 @@ fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "sys/ipc.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/ipc.h""... $ac_c" 1>&6 -echo "configure:3572: checking for sys/ipc.h" >&5 +echo "configure:3583: checking for sys/ipc.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3582: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3593: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3613,17 +3624,17 @@ fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "sys/shm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/shm.h""... $ac_c" 1>&6 -echo "configure:3617: checking for sys/shm.h" >&5 +echo "configure:3628: checking for sys/shm.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3627: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3638: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3647,6 +3658,75 @@ fi CPPFLAGS="$ac_save_CPPFLAGS" fi + # AIX is pathological, as usual: apparently it's normal for the Xshm headers + # to exist, but the library code to not exist. And even better, the library + # code is in its own library: libXextSam.a. So, if we're on AIX, and that + # lib doesn't exist, give up. + # + case "$host" in + *-aix*) + have_xshm=no + + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" + fi + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + if test \! -z "$x_libraries" ; then + LDFLAGS="$LDFLAGS -L$x_libraries" + fi + echo $ac_n "checking for XShmQueryExtension in -lXextSam""... $ac_c" 1>&6 +echo "configure:3687: checking for XShmQueryExtension in -lXextSam" >&5 +ac_lib_var=`echo XextSam'_'XShmQueryExtension | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lXextSam -lX11 -lXext -lm $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + have_xshm=yes; SAVER_LIBS="$SAVER_LIBS -lXextSam" +else + echo "$ac_t""no" 1>&6 +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" + ;; + esac + # if that succeeded, then we've really got it. if test $have_xshm = yes; then cat >> confdefs.h <<\EOF @@ -3684,17 +3764,17 @@ if test $with_sgivc = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/XSGIvc.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/XSGIvc.h""... $ac_c" 1>&6 -echo "configure:3688: checking for X11/extensions/XSGIvc.h" >&5 +echo "configure:3768: checking for X11/extensions/XSGIvc.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3698: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3778: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3737,7 +3817,7 @@ fi LDFLAGS="$LDFLAGS -L$x_libraries" fi echo $ac_n "checking for XSGIvcQueryGammaMap in -lXsgivc""... $ac_c" 1>&6 -echo "configure:3741: checking for XSGIvcQueryGammaMap in -lXsgivc" >&5 +echo "configure:3821: checking for XSGIvcQueryGammaMap in -lXsgivc" >&5 ac_lib_var=`echo Xsgivc'_'XSGIvcQueryGammaMap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3745,7 +3825,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXsgivc -lXext -lX11 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3794,9 +3874,137 @@ elif test $with_sgivc != no; then fi +# Check for the DPMS server extension header. +# +have_dpms=no +with_dpms_req=unspecified +# Check whether --with-dpms-ext or --without-dpms-ext was given. +if test "${with_dpms_ext+set}" = set; then + withval="$with_dpms_ext" + with_dpms="$withval"; with_dpms_req="$withval" +else + with_dpms=yes +fi + +if test $with_dpms = yes; then + + # first check for dpms.h + + ac_save_CPPFLAGS="$CPPFLAGS" + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + ac_safe=`echo "X11/extensions/dpms.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for X11/extensions/dpms.h""... $ac_c" 1>&6 +echo "configure:3901: checking for X11/extensions/dpms.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3911: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + have_dpms=yes +else + echo "$ac_t""no" 1>&6 +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + + # if that succeeded, then check for the -lXdpms + if test $have_dpms = yes; then + have_dpms=no + + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" + fi + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + if test \! -z "$x_libraries" ; then + LDFLAGS="$LDFLAGS -L$x_libraries" + fi + echo $ac_n "checking for DPMSInfo in -lXdpms""... $ac_c" 1>&6 +echo "configure:3954: checking for DPMSInfo in -lXdpms" >&5 +ac_lib_var=`echo Xdpms'_'DPMSInfo | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lXdpms -lXext -lX11 $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + have_dpms=yes; SAVER_LIBS="$SAVER_LIBS -lXdpms" +else + echo "$ac_t""no" 1>&6 +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" + fi + # if that succeeded, then we've really got it. + if test $have_dpms = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_DPMS_EXTENSION 1 +EOF + fi +elif test $with_dpms != no; then + echo "error: must be yes or no: --with-dpms-ext=$with_dpms" + exit 1 +fi @@ -3804,6 +4012,7 @@ fi # have_motif=no have_athena=no +have_athena3d=no with_motif_req=unspecified with_athena_req=unspecified @@ -3859,17 +4068,17 @@ check_motif() { CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "Xm/Xm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for Xm/Xm.h""... $ac_c" 1>&6 -echo "configure:3863: checking for Xm/Xm.h" >&5 +echo "configure:4072: checking for Xm/Xm.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3873: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4082: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3899,6 +4108,8 @@ fi } check_athena() { + have_athena=no + have_athena3d=no ac_save_CPPFLAGS="$CPPFLAGS" if test \! -z "$includedir" ; then @@ -3907,17 +4118,17 @@ check_athena() { CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/Xaw/Dialog.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/Xaw/Dialog.h""... $ac_c" 1>&6 -echo "configure:3911: checking for X11/Xaw/Dialog.h" >&5 +echo "configure:4122: checking for X11/Xaw/Dialog.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3921: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4132: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3934,16 +4145,75 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 have_athena=yes - cat >> confdefs.h <<\EOF -#define HAVE_ATHENA 1 +else + echo "$ac_t""no" 1>&6 +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" + fi + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + if test \! -z "$x_libraries" ; then + LDFLAGS="$LDFLAGS -L$x_libraries" + fi + echo $ac_n "checking for Xaw3dComputeTopShadowRGB in -lXaw3d""... $ac_c" 1>&6 +echo "configure:4171: checking for Xaw3dComputeTopShadowRGB in -lXaw3d" >&5 +ac_lib_var=`echo Xaw3d'_'Xaw3dComputeTopShadowRGB | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lXaw3d -lXt -lXmu -lXext -lX11 $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" - SAVER_LIBS="-lXaw $SAVER_LIBS" +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + have_athena=yes; have_athena3d=yes else echo "$ac_t""no" 1>&6 fi CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" + + if test $have_athena3d = yes; then + SAVER_LIBS="-lXaw3d $SAVER_LIBS" + elif test $have_athena = yes; then + SAVER_LIBS="-lXaw $SAVER_LIBS" + fi } @@ -3992,7 +4262,7 @@ fi # XawViewportSetCoordinates in Viewport.h (R3 (or R4?) don't.) if test $have_athena = yes ; then echo $ac_n "checking for XawViewportSetCoordinates in Viewport.h""... $ac_c" 1>&6 -echo "configure:3996: checking for XawViewportSetCoordinates in Viewport.h" >&5 +echo "configure:4266: checking for XawViewportSetCoordinates in Viewport.h" >&5 if eval "test \"`echo '$''{'ac_cv_have_XawViewportSetCoordinates'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4004,7 +4274,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < EOF @@ -4033,7 +4303,7 @@ fi have_lesstif=no if test $have_motif = yes ; then echo $ac_n "checking whether Motif is really LessTif""... $ac_c" 1>&6 -echo "configure:4037: checking whether Motif is really LessTif" >&5 +echo "configure:4307: checking whether Motif is really LessTif" >&5 if eval "test \"`echo '$''{'ac_cv_have_lesstif'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4044,14 +4314,14 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < int main() { long vers = LesstifVersion; ; return 0; } EOF -if { (eval echo configure:4055: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4325: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_lesstif=yes else @@ -4076,7 +4346,7 @@ if test $have_lesstif = yes ; then # It must be at least "GNU Lesstif 0.82". # #### If you change this, also sync the warning message lower down. echo $ac_n "checking whether LessTif is of a recent enough vintage""... $ac_c" 1>&6 -echo "configure:4080: checking whether LessTif is of a recent enough vintage" >&5 +echo "configure:4350: checking whether LessTif is of a recent enough vintage" >&5 if eval "test \"`echo '$''{'ac_cv_good_lesstif'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4091,12 +4361,12 @@ else ac_cv_good_lesstif=yes else cat > conftest.$ac_ext < int main() { exit(LesstifVersion < 82); } EOF -if { (eval echo configure:4100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_good_lesstif=yes else @@ -4140,7 +4410,7 @@ if test $have_motif = yes ; then LDFLAGS="$LDFLAGS -L$x_libraries" fi echo $ac_n "checking for XpQueryExtension in -lXp""... $ac_c" 1>&6 -echo "configure:4144: checking for XpQueryExtension in -lXp" >&5 +echo "configure:4414: checking for XpQueryExtension in -lXp" >&5 ac_lib_var=`echo Xp'_'XpQueryExtension | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4148,7 +4418,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXp -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4205,17 +4475,17 @@ if test $with_xpm = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/xpm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/xpm.h""... $ac_c" 1>&6 -echo "configure:4209: checking for X11/xpm.h" >&5 +echo "configure:4479: checking for X11/xpm.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4219: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4489: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4270,17 +4540,17 @@ if test $with_gl = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "GL/gl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for GL/gl.h""... $ac_c" 1>&6 -echo "configure:4274: checking for GL/gl.h" >&5 +echo "configure:4544: checking for GL/gl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4554: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4311,17 +4581,17 @@ fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "GL/glx.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for GL/glx.h""... $ac_c" 1>&6 -echo "configure:4315: checking for GL/glx.h" >&5 +echo "configure:4585: checking for GL/glx.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4325: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4595: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4361,7 +4631,7 @@ EOF fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < EOF @@ -4411,17 +4681,17 @@ if test $with_readdisplay = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/readdisplay.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/readdisplay.h""... $ac_c" 1>&6 -echo "configure:4415: checking for X11/extensions/readdisplay.h" >&5 +echo "configure:4685: checking for X11/extensions/readdisplay.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4425: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4473,17 +4743,17 @@ if test $with_sgivideo = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "dmedia/vl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dmedia/vl.h""... $ac_c" 1>&6 -echo "configure:4477: checking for dmedia/vl.h" >&5 +echo "configure:4747: checking for dmedia/vl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4487: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4757: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -4508,7 +4778,7 @@ fi if test $have_sgivideo = yes; then have_sgivideo=no echo $ac_n "checking for vlOpenVideo in -lvl""... $ac_c" 1>&6 -echo "configure:4512: checking for vlOpenVideo in -lvl" >&5 +echo "configure:4782: checking for vlOpenVideo in -lvl" >&5 ac_lib_var=`echo vl'_'vlOpenVideo | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4516,7 +4786,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lvl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4595,7 +4865,7 @@ if test -n "$with_zippy_req" ; then case "$with_zippy_req" in /*) echo $ac_n "checking for $with_zippy_req""... $ac_c" 1>&6 -echo "configure:4599: checking for $with_zippy_req" >&5 +echo "configure:4869: checking for $with_zippy_req" >&5 if test -x "$with_zippy_req" ; then echo "$ac_t""yes" 1>&6 else @@ -4609,7 +4879,7 @@ echo "configure:4599: checking for $with_zippy_req" >&5 # Extract the first word of "$with_zippy_req", so it can be a program name with args. set dummy $with_zippy_req; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4613: checking for $ac_word" >&5 +echo "configure:4883: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_zip2'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4655,7 +4925,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4659: checking for $ac_word" >&5 +echo "configure:4929: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_emacs_exe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4688,7 +4958,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4692: checking for $ac_word" >&5 +echo "configure:4962: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_xemacs_exe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4722,7 +4992,7 @@ done if test -n "$emacs_exe" ; then echo $ac_n "checking for emacs yow""... $ac_c" 1>&6 -echo "configure:4726: checking for emacs yow" >&5 +echo "configure:4996: checking for emacs yow" >&5 # # get emacs to tell us where the libexec directory is. # @@ -4744,7 +5014,7 @@ echo "configure:4726: checking for emacs yow" >&5 if test -z "$ac_cv_zippy_program" ; then echo $ac_n "checking for xemacs yow""... $ac_c" 1>&6 -echo "configure:4748: checking for xemacs yow" >&5 +echo "configure:5018: checking for xemacs yow" >&5 if test -n "$xemacs_exe" ; then # # get xemacs to tell us where the libexec directory is. @@ -4790,7 +5060,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4794: checking for $ac_word" >&5 +echo "configure:5064: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_fortune'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4825,7 +5095,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4829: checking for $ac_word" >&5 +echo "configure:5099: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_fortune'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4904,7 +5174,7 @@ fi if test $with_kerberos = yes; then echo $ac_n "checking for Kerberos""... $ac_c" 1>&6 -echo "configure:4908: checking for Kerberos" >&5 +echo "configure:5178: checking for Kerberos" >&5 if eval "test \"`echo '$''{'ac_cv_kerberos'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4915,14 +5185,14 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < int main() { ; return 0; } EOF -if { (eval echo configure:4926: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5196: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_kerberos=yes else @@ -4972,7 +5242,7 @@ fi # if test $passwd_cruft_done = no ; then echo $ac_n "checking for Sun-style shadow passwords""... $ac_c" 1>&6 -echo "configure:4976: checking for Sun-style shadow passwords" >&5 +echo "configure:5246: checking for Sun-style shadow passwords" >&5 if eval "test \"`echo '$''{'ac_cv_sun_adjunct'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4983,7 +5253,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < #include @@ -4996,7 +5266,7 @@ struct passwd_adjunct *p = getpwanam("nobody"); const char *pw = p->pwa_passwd; ; return 0; } EOF -if { (eval echo configure:5000: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5270: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sun_adjunct=yes else @@ -5025,7 +5295,7 @@ EOF # if test $passwd_cruft_done = no ; then echo $ac_n "checking for DEC-style shadow passwords""... $ac_c" 1>&6 -echo "configure:5029: checking for DEC-style shadow passwords" >&5 +echo "configure:5299: checking for DEC-style shadow passwords" >&5 if eval "test \"`echo '$''{'ac_cv_enhanced_passwd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5036,7 +5306,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < #include @@ -5053,7 +5323,7 @@ struct pr_passwd *p; pw = p->ufld.fd_encrypt; ; return 0; } EOF -if { (eval echo configure:5057: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5327: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_enhanced_passwd=yes else @@ -5079,7 +5349,7 @@ EOF # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx) # (I'm told it needs -lcurses too, but I don't understand why.) echo $ac_n "checking for getprpwnam in -lprot""... $ac_c" 1>&6 -echo "configure:5083: checking for getprpwnam in -lprot" >&5 +echo "configure:5353: checking for getprpwnam in -lprot" >&5 ac_lib_var=`echo prot'_'getprpwnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5087,7 +5357,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lprot -lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5372: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5118,7 +5388,7 @@ else echo "$ac_t""no" 1>&6 # On DEC, getprpwnam() is in -lsecurity echo $ac_n "checking for getprpwnam in -lsecurity""... $ac_c" 1>&6 -echo "configure:5122: checking for getprpwnam in -lsecurity" >&5 +echo "configure:5392: checking for getprpwnam in -lsecurity" >&5 ac_lib_var=`echo security'_'getprpwnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5126,7 +5396,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsecurity $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5166,7 +5436,7 @@ fi # if test $passwd_cruft_done = no ; then echo $ac_n "checking for HP-style shadow passwords""... $ac_c" 1>&6 -echo "configure:5170: checking for HP-style shadow passwords" >&5 +echo "configure:5440: checking for HP-style shadow passwords" >&5 if eval "test \"`echo '$''{'ac_cv_hpux_passwd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5177,7 +5447,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < #include @@ -5190,7 +5460,7 @@ struct s_passwd *p = getspwnam("nobody"); const char *pw = p->pw_passwd; ; return 0; } EOF -if { (eval echo configure:5194: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_hpux_passwd=yes else @@ -5215,7 +5485,7 @@ EOF # on HPUX, bigcrypt is in -lsec echo $ac_n "checking for bigcrypt in -lsec""... $ac_c" 1>&6 -echo "configure:5219: checking for bigcrypt in -lsec" >&5 +echo "configure:5489: checking for bigcrypt in -lsec" >&5 ac_lib_var=`echo sec'_'bigcrypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5223,7 +5493,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsec $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5261,7 +5531,7 @@ fi # if test $passwd_cruft_done = no ; then echo $ac_n "checking for generic shadow passwords""... $ac_c" 1>&6 -echo "configure:5265: checking for generic shadow passwords" >&5 +echo "configure:5535: checking for generic shadow passwords" >&5 if eval "test \"`echo '$''{'ac_cv_shadow'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5272,7 +5542,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < #include @@ -5284,7 +5554,7 @@ struct spwd *p = getspnam("nobody"); const char *pw = p->sp_pwdp; ; return 0; } EOF -if { (eval echo configure:5288: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5558: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_shadow=yes else @@ -5310,7 +5580,7 @@ EOF # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc. have_getspnam=no echo $ac_n "checking for getspnam in -lc""... $ac_c" 1>&6 -echo "configure:5314: checking for getspnam in -lc" >&5 +echo "configure:5584: checking for getspnam in -lc" >&5 ac_lib_var=`echo c'_'getspnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5318,7 +5588,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5351,7 +5621,7 @@ fi if test $have_getspnam = no ; then echo $ac_n "checking for getspnam in -lgen""... $ac_c" 1>&6 -echo "configure:5355: checking for getspnam in -lgen" >&5 +echo "configure:5625: checking for getspnam in -lgen" >&5 ac_lib_var=`echo gen'_'getspnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5359,7 +5629,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5394,10 +5664,35 @@ fi fi fi + # On FreeBSD, getpwnam() and friends work just like on non-shadow-password + # systems -- except you only get stuff in the pw_passwd field if the running + # program is setuid. So, guess that we've got this lossage to contend with + # if /etc/master.passwd exists, and default to a setuid installation. + # + if test $passwd_cruft_done = no ; then + echo $ac_n "checking for FreeBSD-style shadow passwords""... $ac_c" 1>&6 +echo "configure:5675: checking for FreeBSD-style shadow passwords" >&5 +if eval "test \"`echo '$''{'ac_cv_master_passwd'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -f /etc/master.passwd ; then + ac_cv_master_passwd=yes + else + ac_cv_master_passwd=no + fi +fi + +echo "$ac_t""$ac_cv_master_passwd" 1>&6 + if test $ac_cv_master_passwd = yes; then + need_setuid=yes + passwd_cruft_done=yes + fi + fi + # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc. have_crypt=no echo $ac_n "checking for crypt in -lc""... $ac_c" 1>&6 -echo "configure:5401: checking for crypt in -lc" >&5 +echo "configure:5696: checking for crypt in -lc" >&5 ac_lib_var=`echo c'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5405,7 +5700,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5438,7 +5733,7 @@ fi if test $have_crypt = no ; then echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:5442: checking for crypt in -lcrypt" >&5 +echo "configure:5737: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5446,7 +5741,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:5756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5519,6 +5814,8 @@ DEPEND_FLAGS= DEPEND_DEFINES= +# Autoconf doesn't seem to have an INSTALL_DIRS, so let's define our own... +INSTALL_DIRS='$(INSTALL) -d' # Done testing things -- now substitute in some stuff for the Makefiles. # @@ -5603,6 +5900,7 @@ fi + # Print some warnings before emitting the Makefiles. @@ -5656,6 +5954,10 @@ if test $with_sgivc_req = yes -a $have_sgivc = no ; then warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.' fi +if test $with_dpms_req = yes -a $have_dpms = no ; then + warn 'The DPMS extension was requested, but was not found.' +fi + if test $have_motif = no -a $have_athena = no ; then warnL "Neither Motif nor Athena widgets seem to be available;" warn2 "one or the other is required." @@ -5886,6 +6188,7 @@ s%@XPM_LIBS@%$XPM_LIBS%g s%@GL_LIBS@%$GL_LIBS%g s%@PASSWD_LIBS@%$PASSWD_LIBS%g s%@INSTALL_SETUID@%$INSTALL_SETUID%g +s%@INSTALL_DIRS@%$INSTALL_DIRS%g s%@NEED_SETUID@%$NEED_SETUID%g s%@SGI_VIDEO_OBJS@%$SGI_VIDEO_OBJS%g s%@SGI_VIDEO_LIBS@%$SGI_VIDEO_LIBS%g @@ -6129,3 +6432,37 @@ chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +# You are in a twisty maze of namespaces and syntaxes, all alike. +# Fuck the skull of Unix. +# +eval bindir=${bindir} +eval bindir=${bindir} +eval bindir=${bindir} +eval bindir=${bindir} +eval bindir=${bindir} +eval bindir=${bindir} +eval HACKDIR=${HACKDIR} +eval HACKDIR=${HACKDIR} +eval HACKDIR=${HACKDIR} +eval HACKDIR=${HACKDIR} +eval HACKDIR=${HACKDIR} +eval HACKDIR=${HACKDIR} + +echo "" +echo "$warnsep" +echo "" +echo ' When you run "make install", the "xscreensaver" and' +echo ' "xscreensaver-command" executables will be installed in' +echo " ${bindir}." +echo "" +echo " The various graphics demos (60+ different executables) will" +echo " be installed in ${HACKDIR}." +echo "" +echo " If you would prefer the demos to be installed elsewhere" +echo " (for example, in a dedicated directory) you should re-run" +echo " configure with the --enable-subdir=DIR option. For more" +echo " information, run $0 --help." +echo "" +echo "$warnsep" +echo "" diff --git a/configure.in b/configure.in index 145ea610..4fd08b64 100644 --- a/configure.in +++ b/configure.in @@ -71,13 +71,13 @@ AC_MSG_CHECKING(how to call gettimeofday) AC_CACHE_VAL(ac_cv_gettimeofday_args, [AC_TRY_COMPILE([#include #include ], - [struct timeval tv; gettimeofday(&tv);], - [ac_gettimeofday_args=1], + [struct timeval tv; struct timezone tzp; + gettimeofday(&tv, &tzp);], + [ac_gettimeofday_args=2], [AC_TRY_COMPILE([#include #include ], - [struct timeval tv; struct timezone tzp; - gettimeofday(&tv, &tzp);], - [ac_gettimeofday_args=2], + [struct timeval tv; gettimeofday(&tv);], + [ac_gettimeofday_args=1], [ac_gettimeofday_args=0])]) ac_cv_gettimeofday_args=$ac_gettimeofday_args]) ac_gettimeofday_args=$ac_cv_gettimeofday_args @@ -119,12 +119,19 @@ Installation options: ], [enable_subdir="$enableval"],[enable_subdir=no]) if test x"$enable_subdir" = xno; then - HACKDIR='$(bindir)' + HACKDIR='${bindir}' elif test x"$enable_subdir" = xyes -o x"$enable_subdir" = x ; then echo "error: must be a subdirectory name: --enable-subdir=$enable_subdir" exit 1 else - HACKDIR='$(bindir)/'$enable_subdir + # there must be a better way than this... + if test -z "`echo $enable_subdir | sed 's@^/.*@@'`" ; then + # absolute path + HACKDIR=$enable_subdir + else + # relative path + HACKDIR='${bindir}/'$enable_subdir + fi fi @@ -593,9 +600,37 @@ elif test $with_sgivc != no; then fi +# Check for the DPMS server extension header. +# +have_dpms=no +with_dpms_req=unspecified +AC_ARG_WITH(dpms-ext, +[ --with-dpms-ext Include support for the DPMS server extension, + if possible (this is the default). + --without-dpms-ext Do not compile in support for this extension.], + [with_dpms="$withval"; with_dpms_req="$withval"],[with_dpms=yes]) +if test $with_dpms = yes; then + + # first check for dpms.h + AC_CHECK_X_HEADER(X11/extensions/dpms.h, [have_dpms=yes]) + + # if that succeeded, then check for the -lXdpms + if test $have_dpms = yes; then + have_dpms=no + AC_CHECK_X_LIB(Xdpms, DPMSInfo, + [have_dpms=yes; SAVER_LIBS="$SAVER_LIBS -lXdpms"], [], + -lXext -lX11) + fi + # if that succeeded, then we've really got it. + if test $have_dpms = yes; then + AC_DEFINE(HAVE_DPMS_EXTENSION) + fi - +elif test $with_dpms != no; then + echo "error: must be yes or no: --with-dpms-ext=$with_dpms" + exit 1 +fi @@ -603,6 +638,7 @@ fi # have_motif=no have_athena=no +have_athena3d=no with_motif_req=unspecified with_athena_req=unspecified @@ -653,10 +689,18 @@ check_motif() { } check_athena() { - AC_CHECK_X_HEADER(X11/Xaw/Dialog.h, - [have_athena=yes - AC_DEFINE(HAVE_ATHENA) - SAVER_LIBS="-lXaw $SAVER_LIBS"]) + have_athena=no + have_athena3d=no + AC_CHECK_X_HEADER(X11/Xaw/Dialog.h, [have_athena=yes]) + AC_CHECK_X_LIB(Xaw3d, Xaw3dComputeTopShadowRGB, + [have_athena=yes; have_athena3d=yes], [], + -lXt -lXmu -lXext -lX11) + + if test $have_athena3d = yes; then + SAVER_LIBS="-lXaw3d $SAVER_LIBS" + elif test $have_athena = yes; then + SAVER_LIBS="-lXaw $SAVER_LIBS" + fi } @@ -1179,6 +1223,24 @@ if test $enable_locking = yes; then fi fi + # On FreeBSD, getpwnam() and friends work just like on non-shadow-password + # systems -- except you only get stuff in the pw_passwd field if the running + # program is setuid. So, guess that we've got this lossage to contend with + # if /etc/master.passwd exists, and default to a setuid installation. + # + if test $passwd_cruft_done = no ; then + AC_CACHE_CHECK([for FreeBSD-style shadow passwords], ac_cv_master_passwd, + [if test -f /etc/master.passwd ; then + ac_cv_master_passwd=yes + else + ac_cv_master_passwd=no + fi]) + if test $ac_cv_master_passwd = yes; then + need_setuid=yes + passwd_cruft_done=yes + fi + fi + # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc. have_crypt=no AC_CHECK_LIB(c, crypt, [have_crypt=yes]) @@ -1224,6 +1286,8 @@ DEPEND_FLAGS= DEPEND_DEFINES= +# Autoconf doesn't seem to have an INSTALL_DIRS, so let's define our own... +INSTALL_DIRS='$(INSTALL) -d' # Done testing things -- now substitute in some stuff for the Makefiles. # @@ -1282,6 +1346,7 @@ AC_SUBST(XPM_LIBS) AC_SUBST(GL_LIBS) AC_SUBST(PASSWD_LIBS) AC_SUBST(INSTALL_SETUID) +AC_SUBST(INSTALL_DIRS) AC_SUBST(NEED_SETUID) AC_SUBST(SGI_VIDEO_OBJS) AC_SUBST(SGI_VIDEO_LIBS) @@ -1355,6 +1420,10 @@ if test $with_sgivc_req = yes -a $have_sgivc = no ; then warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.' fi +if test $with_dpms_req = yes -a $have_dpms = no ; then + warn 'The DPMS extension was requested, but was not found.' +fi + if test $have_motif = no -a $have_athena = no ; then warnL "Neither Motif nor Athena widgets seem to be available;" warn2 "one or the other is required." @@ -1430,3 +1499,37 @@ AC_OUTPUT(Makefile hacks/Makefile hacks/glx/Makefile driver/XScreenSaver.ad) + +# You are in a twisty maze of namespaces and syntaxes, all alike. +# Fuck the skull of Unix. +# +eval bindir=${bindir} +eval bindir=${bindir} +eval bindir=${bindir} +eval bindir=${bindir} +eval bindir=${bindir} +eval bindir=${bindir} +eval HACKDIR=${HACKDIR} +eval HACKDIR=${HACKDIR} +eval HACKDIR=${HACKDIR} +eval HACKDIR=${HACKDIR} +eval HACKDIR=${HACKDIR} +eval HACKDIR=${HACKDIR} + +echo "" +echo "$warnsep" +echo "" +echo ' When you run "make install", the "xscreensaver" and' +echo ' "xscreensaver-command" executables will be installed in' +echo " ${bindir}." +echo "" +echo " The various graphics demos (60+ different executables) will" +echo " be installed in ${HACKDIR}." +echo "" +echo " If you would prefer the demos to be installed elsewhere" +echo " (for example, in a dedicated directory) you should re-run" +echo " configure with the --enable-subdir=DIR option. For more" +echo " information, run $0 --help." +echo "" +echo "$warnsep" +echo "" diff --git a/driver/Makefile.in b/driver/Makefile.in index ae4f62bf..2b2b0e14 100644 --- a/driver/Makefile.in +++ b/driver/Makefile.in @@ -20,6 +20,7 @@ CC = @CC@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ DEFS = @DEFS@ +DEFS2 = $(DEFS) -DDEFAULT_PATH_PREFIX='"@HACKDIR@"' LIBS = @LIBS@ DEPEND = @DEPEND@ @@ -32,13 +33,23 @@ SUID_FLAGS = -o root -m 4755 INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SETUID = @INSTALL_SETUID@ INSTALL_DATA = @INSTALL_DATA@ +INSTALL_DIRS = @INSTALL_DIRS@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ -XLIBS = $(X_PRE_LIBS) -lX11 -lXext $(X_EXTRA_LIBS) +# Note: +# +# X_LIBS would more properly be called X_LDFLAGS (it contains the -L args.) +# X_PRE_LIBS contains extra libraries you have to link against on some systems, +# and that must come before -lX11. (e.g., -lSM and -lICE.) +# X_EXTRA_LIBS contains extra libraries needed by X that aren't a part of X. +# (e.g., -lsocket, -lnsl, etc.) +# +XLIBS = $(X_LIBS) $(X_PRE_LIBS) -lX11 -lXext $(X_EXTRA_LIBS) +XTLIBS = $(X_LIBS) $(X_PRE_LIBS) -lXt -lX11 -lXext $(X_EXTRA_LIBS) AD_DIR = @APPDEFAULTS@ @@ -88,11 +99,11 @@ SAVER_OBJS_1 = demo.o stderr.o subprocs.o timers.o windows.o \ SAVER_SRCS = $(SAVER_SRCS_1) $(DIALOG_SRCS) $(LOCK_SRCS) $(UTIL_SRCS) SAVER_OBJS = $(SAVER_OBJS_1) $(DIALOG_OBJS) $(LOCK_OBJS) $(UTIL_OBJS) -SAVER_LIBS = $(X_LIBS) @SAVER_LIBS@ -lXt $(XLIBS) $(PASSWD_LIBS) $(LIBS) +SAVER_LIBS = @SAVER_LIBS@ -lXt $(XTLIBS) $(PASSWD_LIBS) $(LIBS) CMD_SRCS = xscreensaver-command.c CMD_OBJS = xscreensaver-command.o -CMD_LIBS = $(X_LIBS) $(XLIBS) $(LIBS) +CMD_LIBS = $(XLIBS) $(LIBS) EXES = xscreensaver xscreensaver-command @@ -138,15 +149,18 @@ install-program: $$e "" ;\ fi ; \ fi ; \ + if [ ! -d $(bindir) ]; then $(INSTALL_DIRS) $(bindir) ; fi ; \ echo $$inst xscreensaver $(bindir)/xscreensaver ; \ $$inst xscreensaver $(bindir)/xscreensaver $(INSTALL_PROGRAM) xscreensaver-command $(bindir)/xscreensaver-command install-ad: + @if [ ! -d $(AD_DIR) ]; then $(INSTALL_DIRS) $(AD_DIR) ; fi ; \ $(INSTALL_DATA) XScreenSaver.ad $(AD_DIR)/XScreenSaver install-man: @men="$(MEN)" ; \ + if [ ! -d $(man1dir) ]; then $(INSTALL_DIRS) $(man1dir) ; fi ; \ for man in $$men; do \ instname=`echo $$man | sed 's/\.man$$/\.$(mansuffix)/'` ; \ echo $(INSTALL_DATA) $(srcdir)/$$man $(man1dir)/$$instname ; \ @@ -273,7 +287,11 @@ $(UTIL_OBJS): # How we build object files in this directory. .c.o: - $(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $(X_CFLAGS) $< + $(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $(X_CFLAGS) $< + +# subprocs is the only one that takes an extra -D option. +subprocs.o: subprocs.c + $(CC) -c $(INCLUDES) $(DEFS2) $(CFLAGS) $(X_CFLAGS) $< # How we build the default app-defaults file into the program. diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in index a4b78fb3..6da779d9 100644 --- a/driver/XScreenSaver.ad.in +++ b/driver/XScreenSaver.ad.in @@ -4,8 +4,8 @@ ! a screen saver and locker for the X window system ! by Jamie Zawinski ! -! version 2.21 -! 15-Jun-98 +! version 2.23 +! 21-Jun-98 ! ! See "man xscreensaver" for more info. The latest version is always ! available at http://people.netscape.com/jwz/xscreensaver/ @@ -24,8 +24,8 @@ *captureStderr: True *captureStdout: True -*overlayTextForeground: Yellow -*overlayTextBackground: Black +*overlayTextForeground: #FFFF00 +*overlayTextBackground: #000000 *overlayStderr: True *font: *-medium-r-*-140-*-m-* @@ -133,6 +133,8 @@ interference -root \n\ truchet -root -randomize \n\ bsod -root \n\ + crystal -root \n\ + discrete -root \n\ \ mono: rocks -root \n\ color: rocks -root -fg darksalmon \n\ @@ -277,16 +279,16 @@ XScreenSaver*XmList.fontList: *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1 ! Need to fully-qualify the preceeding in the case of of *sgiMode. -*XmDialogShell*foreground: black -*XmDialogShell*background: gray90 -*XmDialogShell*XmTextField.foreground: black -*XmDialogShell*XmTextField.background: white -*XmDialogShell*demoList.foreground: black -*XmDialogShell*demoList.background: white +*XmDialogShell*foreground: #000000 +*XmDialogShell*background: #E5E5E5 +*XmDialogShell*XmTextField.foreground: #000000 +*XmDialogShell*XmTextField.background: #FFFFFF +*XmDialogShell*demoList.foreground: #000000 +*XmDialogShell*demoList.background: #FFFFFF ! Need to fully-qualify the following in the case of of *sgiMode. -XScreenSaver*XmDialogShell*rogerLabel.foreground: red3 -XScreenSaver*XmDialogShell*rogerLabel.background: white +XScreenSaver*XmDialogShell*rogerLabel.foreground: #CD0000 +XScreenSaver*XmDialogShell*rogerLabel.background: #FFFFFF *XmDialogShell.title: XScreenSaver *allowShellResize: True @@ -322,14 +324,14 @@ XScreenSaver*XmDialogShell*rogerLabel.background: white *fadeToggle.labelString: Fade Colormap *unfadeToggle.labelString: Unfade Colormap *lockToggle.labelString: Require Password -*resourcesDone.labelString: Done +*resourcesDone.labelString: OK *resourcesCancel.labelString: Cancel *passwdDialog.title: Password *passwdLabel1.labelString: XScreenSaver %s *passwdLabel2.labelString: This display is locked. *passwdLabel3.labelString: Please type %s's password to unlock it. -*passwdDone.labelString: Done +*passwdDone.labelString: OK *passwdCancel.labelString: Cancel *passwdLabel1.alignment: ALIGNMENT_BEGINNING @@ -353,30 +355,34 @@ XScreenSaver*dragReceiverProtocolStyle: DRAG_NONE *passwd_dialog*font: *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1 *demo_dialog*label1.font: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1 *resources_dialog*label1.font: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1 -*demo_dialog*List.font: *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1 +XScreenSaver.demo_dialog*List.font: \ + *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1 ! This is a hack to make the typed password invisible. ! Surely someone can do better than this... -*passwd_dialog*passwd_form.value*font: *nil* +XScreenSaver.passwd_dialog*passwd_form.value*font: *nil* -*demo_dialog*foreground: black -*demo_dialog*background: gray90 -*demo_dialog*List.background: white -*demo_dialog*Scrollbar.background: gray85 -*demo_dialog*Command.background: gray85 +XScreenSaver.demo_dialog*foreground: #000000 +XScreenSaver.demo_dialog*background: #E5E5E5 +XScreenSaver.demo_dialog*List.background: #FFFFFF +XScreenSaver.demo_dialog*Scrollbar.background: #D9D9D9 +XScreenSaver.demo_dialog*Command.background: #D9D9D9 -*resources_dialog*foreground: black -*resources_dialog*background: gray90 -*resources_dialog*Command.background: gray85 -*resources_dialog*Toggle.background: gray85 -*resources_dialog*Text*background: white +XScreenSaver.resources_dialog*foreground: #000000 +XScreenSaver.resources_dialog*background: #E5E5E5 +XScreenSaver.resources_dialog*Command.background: #D9D9D9 +XScreenSaver.resources_dialog*Toggle.background: #D9D9D9 +XScreenSaver.resources_dialog*Text*background: #FFFFFF *resources_dialog*Dialog.value.translations: #override\n\ Return: beginning-of-line()\n -*passwd_dialog*foreground: black -*passwd_dialog*background: gray90 -*passwd_dialog*Text*background: white +XScreenSaver.passwd_dialog*foreground: #000000 +XScreenSaver.passwd_dialog*background: #E5E5E5 +XScreenSaver.passwd_dialog*Command.background: #D9D9D9 +XScreenSaver.passwd_dialog*Text*background: #FFFFFF +XScreenSaver.passwd_dialog*roger.foreground: #CD0000 +XScreenSaver.passwd_dialog*roger.background: #FFFFFF *demo_dialog*viewport.width: 400 *demo_dialog*viewport.height: 200 @@ -404,21 +410,19 @@ XScreenSaver*dragReceiverProtocolStyle: DRAG_NONE *resources_dialog*buttonbox.fade.label: Fade Colormap *resources_dialog*buttonbox.unfade.label: Unfade Colormap *resources_dialog*buttonbox.lock.label: Require Password -*resources_dialog*done.label: Done +*resources_dialog*done.label: OK *resources_dialog*cancel.label: Cancel *passwd_dialog*label1.label: XScreenSaver %s *passwd_dialog*label2.label: This display is locked. *passwd_dialog*label3.label: Please type %s's password to unlock it. -*passwd_dialog*ok.label: Done +*passwd_dialog*ok.label: OK *passwd_dialog*cancel.label: Cancel *passwd_dialog*passwd_form*label.label: Enter password: *passwd_dialog*Dialog.label: Enter password: *passwd_dialog*passwd_form*Text.width: 200 *passwd_dialog*roger.width: 150 *passwd_dialog*roger.height: 150 -*passwd_dialog*roger.foreground: red3 -*passwd_dialog*roger.background: white *passwd_dialog*roger.borderWidth: 1 diff --git a/driver/XScreenSaver_ad.h b/driver/XScreenSaver_ad.h index 4c649730..24f82dc6 100644 --- a/driver/XScreenSaver_ad.h +++ b/driver/XScreenSaver_ad.h @@ -11,8 +11,8 @@ "*fadeTicks: 20", "*captureStderr: True", "*captureStdout: True", -"*overlayTextForeground: Yellow", -"*overlayTextBackground: Black", +"*overlayTextForeground: #FFFF00", +"*overlayTextBackground: #000000", "*overlayStderr: True", "*font: *-medium-r-*-140-*-m-*", "*installColormap: True", @@ -85,6 +85,8 @@ interference -root \\n\ truchet -root -randomize \\n\ bsod -root \\n\ + crystal -root \\n\ + discrete -root \\n\ \ mono: rocks -root \\n\ color: rocks -root -fg darksalmon \\n\ @@ -121,14 +123,14 @@ "*XmTextField.fontList: *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1", "*passwdDialog.passwdText.fontList: *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1", "XScreenSaver*XmList.fontList: *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1", -"*XmDialogShell*foreground: black", -"*XmDialogShell*background: gray90", -"*XmDialogShell*XmTextField.foreground: black", -"*XmDialogShell*XmTextField.background: white", -"*XmDialogShell*demoList.foreground: black", -"*XmDialogShell*demoList.background: white", -"XScreenSaver*XmDialogShell*rogerLabel.foreground: red3", -"XScreenSaver*XmDialogShell*rogerLabel.background: white", +"*XmDialogShell*foreground: #000000", +"*XmDialogShell*background: #E5E5E5", +"*XmDialogShell*XmTextField.foreground: #000000", +"*XmDialogShell*XmTextField.background: #FFFFFF", +"*XmDialogShell*demoList.foreground: #000000", +"*XmDialogShell*demoList.background: #FFFFFF", +"XScreenSaver*XmDialogShell*rogerLabel.foreground: #CD0000", +"XScreenSaver*XmDialogShell*rogerLabel.background: #FFFFFF", "*XmDialogShell.title: XScreenSaver", "*allowShellResize: True", "*autoUnmanage: False", @@ -157,13 +159,13 @@ "*fadeToggle.labelString: Fade Colormap", "*unfadeToggle.labelString: Unfade Colormap", "*lockToggle.labelString: Require Password", -"*resourcesDone.labelString: Done", +"*resourcesDone.labelString: OK", "*resourcesCancel.labelString: Cancel", "*passwdDialog.title: Password", "*passwdLabel1.labelString: XScreenSaver %s", "*passwdLabel2.labelString: This display is locked.", "*passwdLabel3.labelString: Please type %s's password to unlock it.", -"*passwdDone.labelString: Done", +"*passwdDone.labelString: OK", "*passwdCancel.labelString: Cancel", "*passwdLabel1.alignment: ALIGNMENT_BEGINNING", "*passwdLabel2.alignment: ALIGNMENT_BEGINNING", @@ -176,23 +178,27 @@ "*passwd_dialog*font: *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1", "*demo_dialog*label1.font: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1", "*resources_dialog*label1.font: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1", -"*demo_dialog*List.font: *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1", -"*passwd_dialog*passwd_form.value*font: *nil*", -"*demo_dialog*foreground: black", -"*demo_dialog*background: gray90", -"*demo_dialog*List.background: white", -"*demo_dialog*Scrollbar.background: gray85", -"*demo_dialog*Command.background: gray85", -"*resources_dialog*foreground: black", -"*resources_dialog*background: gray90", -"*resources_dialog*Command.background: gray85", -"*resources_dialog*Toggle.background: gray85", -"*resources_dialog*Text*background: white", +"XScreenSaver.demo_dialog*List.font: \ + *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1", +"XScreenSaver.passwd_dialog*passwd_form.value*font: *nil*", +"XScreenSaver.demo_dialog*foreground: #000000", +"XScreenSaver.demo_dialog*background: #E5E5E5", +"XScreenSaver.demo_dialog*List.background: #FFFFFF", +"XScreenSaver.demo_dialog*Scrollbar.background: #D9D9D9", +"XScreenSaver.demo_dialog*Command.background: #D9D9D9", +"XScreenSaver.resources_dialog*foreground: #000000", +"XScreenSaver.resources_dialog*background: #E5E5E5", +"XScreenSaver.resources_dialog*Command.background: #D9D9D9", +"XScreenSaver.resources_dialog*Toggle.background: #D9D9D9", +"XScreenSaver.resources_dialog*Text*background: #FFFFFF", "*resources_dialog*Dialog.value.translations: #override\\n\ Return: beginning-of-line()\\n", -"*passwd_dialog*foreground: black", -"*passwd_dialog*background: gray90", -"*passwd_dialog*Text*background: white", +"XScreenSaver.passwd_dialog*foreground: #000000", +"XScreenSaver.passwd_dialog*background: #E5E5E5", +"XScreenSaver.passwd_dialog*Command.background: #D9D9D9", +"XScreenSaver.passwd_dialog*Text*background: #FFFFFF", +"XScreenSaver.passwd_dialog*roger.foreground: #CD0000", +"XScreenSaver.passwd_dialog*roger.background: #FFFFFF", "*demo_dialog*viewport.width: 400", "*demo_dialog*viewport.height: 200", "*Form.borderWidth: 0", @@ -216,20 +222,18 @@ "*resources_dialog*buttonbox.fade.label: Fade Colormap", "*resources_dialog*buttonbox.unfade.label: Unfade Colormap", "*resources_dialog*buttonbox.lock.label: Require Password", -"*resources_dialog*done.label: Done", +"*resources_dialog*done.label: OK", "*resources_dialog*cancel.label: Cancel", "*passwd_dialog*label1.label: XScreenSaver %s", "*passwd_dialog*label2.label: This display is locked.", "*passwd_dialog*label3.label: Please type %s's password to unlock it.", -"*passwd_dialog*ok.label: Done", +"*passwd_dialog*ok.label: OK", "*passwd_dialog*cancel.label: Cancel", "*passwd_dialog*passwd_form*label.label: Enter password:", "*passwd_dialog*Dialog.label: Enter password:", "*passwd_dialog*passwd_form*Text.width: 200", "*passwd_dialog*roger.width: 150", "*passwd_dialog*roger.height: 150", -"*passwd_dialog*roger.foreground: red3", -"*passwd_dialog*roger.background: white", "*passwd_dialog*roger.borderWidth: 1", "XScreenSaver.pointerPollTime: 5", "XScreenSaver.initialDelay: 0", diff --git a/driver/demo.c b/driver/demo.c index 2c90218d..23a42974 100644 --- a/driver/demo.c +++ b/driver/demo.c @@ -1,5 +1,5 @@ /* demo.c --- implements the interactive demo-mode and options dialogs. - * xscreensaver, Copyright (c) 1993-1997 Jamie Zawinski + * xscreensaver, Copyright (c) 1993-1998 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 @@ -630,6 +630,7 @@ make_screenhack_dialog (saver_info *si) #endif /* HAVE_ATHENA */ + monitor_power_on (si); pop_up_dialog_box(demo_dialog, demo_form, /* for debugging -- don't ask */ (si->prefs.debug_p ? 69 : 0) + @@ -918,6 +919,7 @@ pop_resources_dialog (saver_info *si) set_toggle_button_state (unfade_toggle, res.unfade); set_toggle_button_state (lock_toggle, res.lock_p); + monitor_power_on (si); pop_up_dialog_box (resources_dialog, resources_form, /* for debugging -- don't ask */ (si->prefs.debug_p ? 69 : 0) + @@ -933,6 +935,7 @@ demo_mode (saver_info *si) { saver_preferences *p = &si->prefs; si->dbox_up_p = True; + monitor_power_on (si); raise_window (si, True, False, False); make_screenhack_dialog (si); while (si->demo_mode_p) diff --git a/driver/lock.c b/driver/lock.c index a5579a37..c6a715a5 100644 --- a/driver/lock.c +++ b/driver/lock.c @@ -604,6 +604,7 @@ pop_passwd_dialog (saver_info *si) XMapRaised (dpy, XtWindow (passwd_dialog)); #endif + monitor_power_on (si); #ifdef HAVE_ATHENA pop_up_athena_dialog_box (parent, passwd_text, passwd_dialog, passwd_form, 2); diff --git a/driver/subprocs.c b/driver/subprocs.c index 97904499..b2b341a8 100644 --- a/driver/subprocs.c +++ b/driver/subprocs.c @@ -76,7 +76,7 @@ extern int kill (pid_t, int); /* signal() is in sys/signal.h... */ extern saver_info *global_si_kludge; /* I hate C so much... */ -static void hack_environment (saver_screen_info *ssi); +static void hack_subproc_environment (saver_screen_info *ssi); static void @@ -831,7 +831,7 @@ spawn_screenhack_1 (saver_screen_info *ssi, Bool first_time_p) case 0: close (ConnectionNumber (si->dpy)); /* close display fd */ nice_subproc (p->nice_inferior); /* change process priority */ - hack_environment (ssi); /* set $DISPLAY */ + hack_subproc_environment (ssi); /* set $DISPLAY */ exec_screenhack (si, hack); /* this does not return */ abort(); break; @@ -849,6 +849,15 @@ void spawn_screenhack (saver_info *si, Bool first_time_p) { int i; + + if (!monitor_powered_on_p (si)) + { + if (si->prefs.verbose_p) + printf ("%s: server reports that monitor has powered down; " + "not launching a new hack.\n", progname); + return; + } + for (i = 0; i < si->nscreens; i++) { saver_screen_info *ssi = &si->screens[i]; @@ -968,7 +977,7 @@ demo_mode_restart_process (saver_info *si) } static void -hack_environment (saver_screen_info *ssi) +hack_subproc_environment (saver_screen_info *ssi) { /* Store $DISPLAY into the environment, so that the $DISPLAY variable that the spawned processes inherit is correct. First, it must be on the same @@ -1009,6 +1018,28 @@ hack_environment (saver_screen_info *ssi) #endif /* HAVE_PUTENV */ } + +void +hack_environment (saver_info *si) +{ +#if defined(HAVE_PUTENV) && defined(DEFAULT_PATH_PREFIX) + static const char *def_path = DEFAULT_PATH_PREFIX; + if (def_path && *def_path) + { + const char *opath = getenv("PATH"); + char *npath = (char *) malloc(strlen(def_path) + strlen(opath) + 20); + strcpy (npath, "PATH="); + strcat (npath, def_path); + strcat (npath, ":"); + strcat (npath, opath); + + if (putenv (npath)) + abort (); + } +#endif /* HAVE_PUTENV && DEFAULT_PATH_PREFIX */ +} + + /* Change the uid/gid of the screensaver process, so that it is safe for it to run setuid root (which it needs to do on some systems to read the diff --git a/driver/timers.c b/driver/timers.c index bc92893a..89026d1b 100644 --- a/driver/timers.c +++ b/driver/timers.c @@ -608,6 +608,14 @@ watchdog_timer (XtPointer closure, XtIntervalId *id) #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); + } } } } diff --git a/driver/windows.c b/driver/windows.c index b91ee2a0..1ec24e4e 100644 --- a/driver/windows.c +++ b/driver/windows.c @@ -1042,6 +1042,8 @@ unblank_screen (saver_info *si) saver_preferences *p = &si->prefs; int i; + monitor_power_on (si); + store_activate_time (si, True); reset_watchdog_timer (si, False); diff --git a/driver/xscreensaver-command.man b/driver/xscreensaver-command.man index cc3de586..f3d345bc 100644 --- a/driver/xscreensaver-command.man +++ b/driver/xscreensaver-command.man @@ -11,7 +11,7 @@ .if n .sp 1 .if t .sp .5 .. -.TH XScreenSaver 1 "15-Jun-98 (2.21)" "X Version 11" +.TH XScreenSaver 1 "21-Jun-98 (2.23)" "X Version 11" .SH NAME xscreensaver-command - control a running xscreensaver process .SH SYNOPSIS diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c index 7f4b0bd8..f3f43a77 100644 --- a/driver/xscreensaver.c +++ b/driver/xscreensaver.c @@ -659,23 +659,23 @@ initialize (saver_info *si, int argc, char **argv) #ifdef NO_LOCKING si->locking_disabled_p = True; si->nolock_reason = "not compiled with locking support"; -#else +#else /* !NO_LOCKING */ si->locking_disabled_p = False; -#ifdef SCO +# ifdef SCO set_auth_parameters(argc, argv); -#endif +# endif /* SCO */ if (! lock_init (argc, argv)) /* before hack_uid() for proper permissions */ { si->locking_disabled_p = True; si->nolock_reason = "error getting password"; } -#endif +#endif /* !NO_LOCKING */ #ifndef NO_SETUID hack_uid (si); -#endif +#endif /* NO_SETUID */ progclass = "XScreenSaver"; @@ -704,6 +704,8 @@ initialize (saver_info *si, int argc, char **argv) if (ensure_no_screensaver_running (si->dpy, si->screens[i].screen)) exit (1); + hack_environment (si); + si->demo_mode_p = initial_demo_mode_p; srandom ((int) time ((time_t *) 0)); diff --git a/driver/xscreensaver.h b/driver/xscreensaver.h index 347963a8..92cba967 100644 --- a/driver/xscreensaver.h +++ b/driver/xscreensaver.h @@ -267,6 +267,10 @@ extern Bool query_mit_saver_extension (saver_info *); extern Bool query_sgi_saver_extension (saver_info *); #endif +/* Display Power Management System (DPMS) interface. */ +extern Bool monitor_powered_on_p (saver_info *si); +extern void monitor_power_on (saver_info *si); + /* ======================================================================= blanking @@ -335,6 +339,7 @@ extern Bool handle_clientmessage (saver_info *, XEvent *, Bool); subprocs ======================================================================= */ +extern void hack_environment (saver_info *si); extern void init_sigchld (void); extern void spawn_screenhack (saver_info *si, Bool first_time_p); extern void kill_screenhack (saver_info *si); diff --git a/driver/xscreensaver.man b/driver/xscreensaver.man index ce5756bb..6d646453 100644 --- a/driver/xscreensaver.man +++ b/driver/xscreensaver.man @@ -11,7 +11,7 @@ .if n .sp 1 .if t .sp .5 .. -.TH XScreenSaver 1 "15-Jun-98 (2.21)" "X Version 11" +.TH XScreenSaver 1 "21-Jun-98 (2.23)" "X Version 11" .SH NAME xscreensaver - graphics hack and screen locker, launched when the user is idle .SH SYNOPSIS @@ -546,6 +546,25 @@ For all the gory details, see the commentary at the top of xscreensaver.c. You can control a running screensaver process by using the .BR xscreensaver\-command (1) program (which see.) +.SH POWER MANAGEMENT +Modern X servers contain support to power down the monitor after an idle +period. If the monitor has powered down, then \fIxscreensaver\fP will +notice this, and will not waste CPU by drawing graphics demos on a black +screen. An attempt will also be made to explicitly power the monitor +back up as soon as user activity is detected. + +If your X server supports power management, then +.BR xset (1) +will accept a \fBdpms\fP option. So, if you wanted \fIxscreensaver\fP +to activate after 5 minutes, but you wanted your monitor to power down +after one hour (3600 seconds) you would do this: +.EX +xset dpms 3600 +.EE +See the man page for the +.BR xset (1) +program for details. (Note that power management requires both software +support in the X server, and hardware support in the monitor itself.) .SH USING XDM(1) You can run \fIxscreensaver\fP from your xdm session, so that the screensaver will run even when nobody is logged in on the console. @@ -658,10 +677,16 @@ under VUE are similar to the above: .RS 4 .TP 3 \fB1: Switch off VUE's locker\fP -Do this by turning off ``\fIScreen Saver and Screen Lock\fP'' in the -Screen section of the Style Manager. +Open the ``\fIStyle Manager\fP'' and select ``\fIScreen\fP.'' +Turn off ``\fIScreen Saver and Screen Lock\fP'' option. +.TP 3 +\fB2: Make sure you have a Session\fP +Next, go to the Style Manager's, ``\fIStartup\fP'' page. +Click on ``\fISet Home Session\fP'' to create a session, then +on ``\fIReturn to Home Session\fP'' to select this session each +time you log in. .TP 3 -\fB2: Edit vue.session\fP +\fB3: Edit vue.session\fP Edit the file \fI~/.vue/sessions/home/vue.session\fP and add to it the line .EX @@ -700,7 +725,7 @@ or (probably) any of \fItwm\fP's many descendants, you can do it like this: .TP 3 \fB1. Create ~/.mwmrc (or ~/.twmrc or ...)\fP If you don't have a \fI~/.mwmrc\fP file (or, on SGIs, a \fI~/.4Dwmrc\fP file; -or, with TWM, a \fI~/.twmrc\fP file) then create one by making a copy of +or, with twm, a \fI~/.twmrc\fP file) then create one by making a copy of the \fI/usr/lib/X11/system.mwmrc\fP file (or \fI/usr/lib/X11/twm/system.twmrc\fP, and so on.) .TP 3 @@ -972,6 +997,7 @@ http://people.netscape.com/jwz/xscreensaver/ .BR X (1), .BR xscreensaver\-command (1), .BR xdm (1), +.BR xset (1), .BR ant (1), .BR atlantis (1), .BR attraction (1), diff --git a/driver/xset.c b/driver/xset.c index 0c6f6f89..142acc32 100644 --- a/driver/xset.c +++ b/driver/xset.c @@ -134,7 +134,7 @@ init_sgi_saver_extension (saver_info *si) #endif /* HAVE_SGI_SAVER_EXTENSION */ -/* Figuring out what the appropriate XSetScreenSaver() paramters are +/* Figuring out what the appropriate XSetScreenSaver() parameters are (one wouldn't expect this to be rocket science.) */ @@ -234,3 +234,121 @@ disable_builtin_screensaver (saver_info *si, Bool turn_off_p) /* Turn off the server builtin saver if it is now running. */ XForceScreenSaver (si->dpy, ScreenSaverReset); } + + +/* Display Power Management System (DPMS.) + + On XFree86 systems, "man xset" reports: + + -dpms The -dpms option disables DPMS (Energy Star) features. + +dpms The +dpms option enables DPMS (Energy Star) features. + + dpms flags... + The dpms option allows the DPMS (Energy Star) + parameters to be set. The option can take up to three + numerical values, or the `force' flag followed by a + DPMS state. The `force' flags forces the server to + immediately switch to the DPMS state specified. The + DPMS state can be one of `standby', `suspend', or + `off'. When numerical values are given, they set the + inactivity period before the three modes are activated. + The first value given is for the `standby' mode, the + second is for the `suspend' mode, and the third is for + the `off' mode. Setting these values implicitly + enables the DPMS features. A value of zero disables a + particular mode. + + However, note that the implementation is more than a little bogus, + in that there is code in /usr/X11R6/lib/libXdpms.a to implement all + the usual server-extension-querying utilities -- but there are no + prototypes in any header file! Thus, the prototypes here. (The + stuff in X11/extensions/dpms.h and X11/extensions/dpmsstr.h define + the raw X protcol, they don't define the API to libXdpms.a.) + */ + +#ifdef HAVE_DPMS_EXTENSION + +#include /* for CARD16 */ +#include +#include + +extern Bool DPMSQueryExtension (Display *dpy, int *event_ret, int *error_ret); +extern Bool DPMSCapable (Display *dpy); +extern Status DPMSForceLevel (Display *dpy, CARD16 level); +extern Status DPMSInfo (Display *dpy, CARD16 *power_level, BOOL *state); + +#if 0 /* others we don't use */ +extern Status DPMSGetVersion (Display *dpy, int *major_ret, int *minor_ret); +extern Status DPMSSetTimeouts (Display *dpy, + CARD16 standby, CARD16 suspend, CARD16 off); +extern Bool DPMSGetTimeouts (Display *dpy, + CARD16 *standby, CARD16 *suspend, CARD16 *off); +extern Status DPMSEnable (Display *dpy); +extern Status DPMSDisable (Display *dpy); +#endif /* 0 */ + + +Bool +monitor_powered_on_p (saver_info *si) +{ + Bool result; + int event_number, error_number; + BOOL onoff = False; + CARD16 state; + + if (!DPMSQueryExtension(si->dpy, &event_number, &error_number)) + /* Server doesn't know -- assume the monitor is on. */ + result = True; + + else if (!DPMSCapable(si->dpy)) + /* Server says the monitor doesn't do power management -- so it's on. */ + result = True; + + else + { + DPMSInfo(si->dpy, &state, &onoff); + if (!onoff) + /* Server says DPMS is disabled -- so the monitor is on. */ + result = True; + else + switch (state) { + case DPMSModeOn: result = True; break; /* really on */ + case DPMSModeStandby: result = False; break; /* kinda off */ + case DPMSModeSuspend: result = False; break; /* pretty off */ + case DPMSModeOff: result = False; break; /* really off */ + default: result = True; break; /* protocol error? */ + } + } + + return result; +} + +void +monitor_power_on (saver_info *si) +{ + if (!monitor_powered_on_p (si)) + { + DPMSForceLevel(si->dpy, DPMSModeOn); + XSync(si->dpy, False); + if (!monitor_powered_on_p (si)) + fprintf (stderr, + "%s: DPMSForceLevel(dpy, DPMSModeOn) did not power the monitor on?\n", + progname); + } +} + +#else /* !HAVE_DPMS_EXTENSION */ + +Bool +monitor_powered_on_p (saver_info *si) +{ + return True; +} + +void +monitor_power_on (saver_info *si) +{ + return; +} + +#endif /* !HAVE_DPMS_EXTENSION */ diff --git a/hacks/Makefile.in b/hacks/Makefile.in index 5f299ce5..ecc170c0 100644 --- a/hacks/Makefile.in +++ b/hacks/Makefile.in @@ -30,6 +30,7 @@ SHELL = /bin/sh INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +INSTALL_DIRS = @INSTALL_DIRS@ HACKDIR = @HACKDIR@ X_CFLAGS = @X_CFLAGS@ @@ -37,6 +38,8 @@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ +# Note: see comment in ../driver/Makefile.in for explanation of X_LIBS, etc. +# HACK_PRE = $(LIBS) $(X_LIBS) $(X_PRE_LIBS) HACK_POST = -lXt -lX11 -lXext $(X_EXTRA_LIBS) -lm HACK_LIBS = $(HACK_PRE) @HACK_LIBS@ $(HACK_POST) @@ -75,7 +78,7 @@ SRCS = attraction.c blitspin.c bouboule.c braid.c bubbles.c \ rd-bomb.c coral.c mountain.c triangle.c lissie.c worm.c \ rotor.c ant.c xjack.c xlyap.c jigsaw.c xscreensaver-sgigl.c \ cynosure.c moire2.c flow.c epicycle.c interference.c \ - truchet.c bsod.c + truchet.c bsod.c crystal.c discrete.c OBJS = attraction.o blitspin.o bouboule.o braid.o bubbles.o \ bubbles-default.o decayscreen.o deco.o drift.o flag.o \ @@ -89,7 +92,7 @@ OBJS = attraction.o blitspin.o bouboule.o braid.o bubbles.o \ rd-bomb.o coral.o mountain.o triangle.o lissie.o worm.o \ rotor.o ant.o xjack.o xlyap.o jigsaw.o xscreensaver-sgigl.o \ cynosure.o moire2.o flow.o epicycle.o interference.o \ - truchet.o bsod.o + truchet.o bsod.o crystal.o discrete.o EXES = attraction blitspin bouboule braid bubbles decayscreen deco \ drift flag flame forest vines galaxy grav greynetic halo \ @@ -99,7 +102,7 @@ EXES = attraction blitspin bouboule braid bubbles decayscreen deco \ slip sphere spiral strange swirl xroger goop starfish munch \ fadeplot rd-bomb coral mountain triangle lissie worm rotor \ ant xjack xlyap jigsaw cynosure moire2 flow epicycle \ - interference truchet bsod + interference truchet bsod crystal discrete HACK_OBJS_1 = $(UTILS_BIN)/resources.o $(UTILS_BIN)/visual.o \ $(UTILS_BIN)/usleep.o $(UTILS_BIN)/yarandom.o @XMU_OBJS@ @@ -148,16 +151,16 @@ install-strip: $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install install-program: - @if [ ! -d $(HACKDIR) ]; then mkdir $(HACKDIR) ; fi ; \ - for program in $(EXES); do \ + @exes="$(EXES)" ; \ + if [ ! -d $(HACKDIR) ]; then $(INSTALL_DIRS) $(HACKDIR) ; fi ; \ + for program in $$exes; do \ echo $(INSTALL_PROGRAM) $$program $(HACKDIR)/$$program ; \ $(INSTALL_PROGRAM) $$program $(HACKDIR)/$$program ; \ done install-man: - @if [ ! -d $(mandir) ]; then mkdir $(mandir) ; fi ; \ - if [ ! -d $(man1dir) ]; then mkdir $(man1dir) ; fi ; \ - men="$(MEN)" ; \ + @men="$(MEN)" ; \ + if [ ! -d $(man1dir) ]; then $(INSTALL_DIRS) $(man1dir) ; fi ; \ for man in $$men; do \ instname=`echo $$man | sed 's/\.man$$/\.$(mansuffix)/'` ; \ echo $(INSTALL_DATA) $(srcdir)/$$man $(man1dir)/$$instname ; \ @@ -529,6 +532,12 @@ ant: ant.o $(XLOCK_OBJS) $(ERASE) flow: flow.o $(XLOCK_OBJS) $(CC_HACK) -o $@ $@.o $(XLOCK_OBJS) $(HACK_LIBS) +discrete: discrete.o $(XLOCK_OBJS) $(ERASE) + $(CC_HACK) -o $@ $@.o $(XLOCK_OBJS) $(ERASE) $(HACK_LIBS) + +crystal: crystal.o $(XLOCK_OBJS) + $(CC_HACK) -o $@ $@.o $(XLOCK_OBJS) $(HACK_LIBS) + ############################################################################## # @@ -1324,4 +1333,27 @@ bsod.o: $(UTILS_SRC)/grabscreen.h bsod.o: $(UTILS_SRC)/visual.h bsod.o: $(srcdir)/images/amiga.xpm bsod.o: $(srcdir)/images/mac.xbm +crystal.o: $(srcdir)/xlockmore.h +crystal.o: ../config.h +crystal.o: $(srcdir)/xlockmoreI.h +crystal.o: $(srcdir)/screenhack.h +crystal.o: $(UTILS_SRC)/yarandom.h +crystal.o: $(UTILS_SRC)/usleep.h +crystal.o: $(UTILS_SRC)/resources.h +crystal.o: $(UTILS_SRC)/hsv.h +crystal.o: $(UTILS_SRC)/colors.h +crystal.o: $(UTILS_SRC)/grabscreen.h +crystal.o: $(UTILS_SRC)/visual.h +discrete.o: $(srcdir)/xlockmore.h +discrete.o: ../config.h +discrete.o: $(srcdir)/xlockmoreI.h +discrete.o: $(srcdir)/screenhack.h +discrete.o: $(UTILS_SRC)/yarandom.h +discrete.o: $(UTILS_SRC)/usleep.h +discrete.o: $(UTILS_SRC)/resources.h +discrete.o: $(UTILS_SRC)/hsv.h +discrete.o: $(UTILS_SRC)/colors.h +discrete.o: $(UTILS_SRC)/grabscreen.h +discrete.o: $(UTILS_SRC)/visual.h +discrete.o: $(UTILS_SRC)/erase.h diff --git a/hacks/attraction.c b/hacks/attraction.c index 667a67b0..0cea509a 100644 --- a/hacks/attraction.c +++ b/hacks/attraction.c @@ -612,8 +612,8 @@ run_balls (Display *dpy, Window window) char *progclass = "Attraction"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*mode: balls", "*points: 0", "*size: 0", diff --git a/hacks/blitspin.c b/hacks/blitspin.c index 5a580626..5b3cf8c1 100644 --- a/hacks/blitspin.c +++ b/hacks/blitspin.c @@ -333,8 +333,8 @@ display (Pixmap pixmap) char *progclass = "BlitSpin"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*delay: 500000", "*delay2: 500000", "*bitmap: (default)", diff --git a/hacks/bsod.c b/hacks/bsod.c index e3c0994a..e127ea1b 100644 --- a/hacks/bsod.c +++ b/hacks/bsod.c @@ -35,7 +35,9 @@ static void draw_string (Display *dpy, Window window, GC gc, XGCValues *gcv, - XFontStruct *font, int win_width, int win_height, + XFontStruct *font, + int xoff, int yoff, + int win_width, int win_height, const char *string, int delay) { int x, y; @@ -68,8 +70,11 @@ draw_string (Display *dpy, Window window, GC gc, XGCValues *gcv, x = (win_width - (width * char_width)) / 2; y = (win_height - (height * line_height)) / 2; - if (x < char_width) x = char_width; - if (y < line_height) y = line_height; + if (x < 0) x = 2; + if (y < 0) y = 2; + + x += xoff; + y += yoff; se = s = string; while (1) @@ -155,7 +160,7 @@ bsod_sleep(Display *dpy, int seconds) XEvent event; int q = seconds * 4; int mask = KeyPressMask|ButtonPressMask; - while (q > 0) + do { XSync(dpy, False); if (XCheckMaskEvent(dpy, mask, &event)) @@ -164,9 +169,14 @@ bsod_sleep(Display *dpy, int seconds) ; return True; } - q--; - usleep(250000); + if (q > 0) + { + q--; + usleep(250000); + } } + while (q > 0); + return False; } @@ -273,9 +283,10 @@ windows (Display *dpy, Window window, int delay, Bool w95p) gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv); if (w95p) - draw_string(dpy, window, gc, &gcv, font, xgwa.width, xgwa.height, w95, 0); + draw_string(dpy, window, gc, &gcv, font, + 0, 0, xgwa.width, xgwa.height, w95, 0); else - draw_string(dpy, window, gc, &gcv, font, 10, 10, wnt, 750); + draw_string(dpy, window, gc, &gcv, font, 0, 0, 10, 10, wnt, 750); XFreeGC(dpy, gc); XSync(dpy, False); @@ -387,7 +398,7 @@ amiga (Display *dpy, Window window, int delay) } XFillRectangle(dpy, window, gc2, 0, 0, xgwa.width, height); - draw_string(dpy, window, gc, &gcv, font, xgwa.width, height, string, 0); + draw_string(dpy, window, gc, &gcv, font, 0, 0, xgwa.width, height, string,0); { GC gca = gc; @@ -459,8 +470,8 @@ mac (Display *dpy, Window window, int delay) gcv.background, xgwa.depth); - draw_string(dpy, window, gc, &gcv, font, xgwa.width, xgwa.height + offset, - string, 0); + draw_string(dpy, window, gc, &gcv, font, 0, 0, + xgwa.width, xgwa.height + offset, string, 0); for(i = 0; i < 2; i++) { @@ -486,26 +497,208 @@ mac (Display *dpy, Window window, int delay) XFreeFont(dpy, font); } +static void +macsbug (Display *dpy, Window window, int delay) +{ + XGCValues gcv; + XWindowAttributes xgwa; + char *fontname; + const char *def_font = "fixed"; + XFontStruct *font; + GC gc, gc2; + + int char_width, line_height; + int col_right, row_top, row_bottom, page_right, page_bottom, body_top; + int xoff, yoff; + + const char *left = (" SP \n" + " 04EB0A58 \n" + "58 00010000\n" + "5C 00010000\n" + " ........\n" + "60 00000000\n" + "64 000004EB\n" + " ........\n" + "68 0000027F\n" + "6C 2D980035\n" + " ....-..5\n" + "70 00000054\n" + "74 0173003E\n" + " ...T.s.>\n" + "78 04EBDA76\n" + "7C 04EBDA8E\n" + " .S.L.a.U\n" + "80 00000000\n" + "84 000004EB\n" + " ........\n" + "88 00010000\n" + "8C 00010000\n" + " ...{3..S\n" + "\n" + "\n" + " CurApName \n" + " Finder \n" + "\n" + " 32-bit VM \n" + "SR Smxnzvc0\n" + "D0 04EC0062\n" + "D1 00000053\n" + "D2 FFFF0100\n" + "D3 00010000\n" + "D4 00010000\n" + "D5 04EBDA76\n" + "D6 04EBDA8E\n" + "D7 00000001\n" + "\n" + "A0 04EBDA76\n" + "A1 04EBDA8E\n" + "A2 A0A00060\n" + "A3 027F2D98\n" + "A4 027F2E58\n" + "A5 04EC04F0\n" + "A6 04EB0A86\n" + "A7 04EB0A58"); + const char *bottom = (" _A09D\n" + " +00884 40843714 #$0700,SR " + " ; A973 | A973\n" + " +00886 40843765 *+$0400 " + " | 4A1F\n" + " +00888 40843718 $0004(A7),([0,A7[)" + " ; 04E8D0AE | 66B8"); + const char *body = ("Bus Error at 4BF6D6CC\n" + "while reading word from 4BF6D6CC in User data space\n" + " Unable to access that address\n" + " PC: 2A0DE3E6\n" + " Frame Type: B008"); + const char *s; + int body_lines = 1; + + for (s = body; *s; s++) if (*s == '\n') body_lines++; + + XGetWindowAttributes (dpy, window, &xgwa); + + fontname = get_string_resource ((xgwa.height > 850 + ? "macsbug.font3" + : (xgwa.height > 700 + ? "macsbug.font2" + : "macsbug.font")), + "MacsBug.Font"); + if (!fontname || !*fontname) fontname = (char *)def_font; + font = XLoadQueryFont (dpy, fontname); + if (!font) font = XLoadQueryFont (dpy, def_font); + if (!font) exit(-1); + if (fontname && fontname != def_font) + free (fontname); + + gcv.font = font->fid; + gcv.foreground = get_pixel_resource("macsbug.foreground", + "MacsBug.Foreground", + dpy, xgwa.colormap); + gcv.background = get_pixel_resource("macsbug.background", + "MacsBug.Background", + dpy, xgwa.colormap); + + gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv); + + gcv.foreground = gcv.background; + gc2 = XCreateGC(dpy, window, GCForeground, &gcv); + + XSetWindowBackground(dpy, window, + get_pixel_resource("macsbug.borderColor", + "MacsBug.BorderColor", + dpy, xgwa.colormap)); + XClearWindow(dpy, window); + + char_width = (font->per_char + ? font->per_char['n'-font->min_char_or_byte2].width + : font->min_bounds.width); + line_height = font->ascent + font->descent + 1; + + col_right = char_width * 12; + page_bottom = line_height * 47; + + if (page_bottom > xgwa.height) page_bottom = xgwa.height; + + row_bottom = page_bottom - line_height; + row_top = row_bottom - (line_height * 4); + page_right = col_right + (char_width * 88); + body_top = row_top - (line_height * body_lines); + + page_bottom += 2; + row_bottom += 2; + body_top -= 4; + + xoff = (xgwa.width - page_right) / 2; + yoff = (xgwa.height - page_bottom) / 2; + if (xoff < 0) xoff = 0; + if (yoff < 0) yoff = 0; + + XFillRectangle(dpy, window, gc2, xoff, yoff, page_right, page_bottom); + + draw_string(dpy, window, gc, &gcv, font, xoff, yoff, 10, 10, left, 0); + draw_string(dpy, window, gc, &gcv, font, xoff+col_right, yoff+row_top, + 10, 10, bottom, 0); + draw_string(dpy, window, gc, &gcv, font, + xoff + col_right + char_width, yoff + body_top, 10, 10, body, 0); + + XFillRectangle(dpy, window, gc, xoff + col_right, yoff, 2, page_bottom); + XDrawLine(dpy, window, gc, + xoff+col_right, yoff+row_top, xoff+page_right, yoff+row_top); + XDrawLine(dpy, window, gc, + xoff+col_right, yoff+row_bottom, xoff+page_right, yoff+row_bottom); + XDrawRectangle(dpy, window, gc, xoff, yoff, page_right, page_bottom); + + while (delay > 0) + { + XDrawLine(dpy, window, gc, + xoff+col_right+(char_width/2)+2, yoff+row_bottom+3, + xoff+col_right+(char_width/2)+2, yoff+page_bottom-3); + XSync(dpy, False); + usleep(666666L); + XDrawLine(dpy, window, gc2, + xoff+col_right+(char_width/2)+2, yoff+row_bottom+3, + xoff+col_right+(char_width/2)+2, yoff+page_bottom-3); + XSync(dpy, False); + usleep(333333L); + if (bsod_sleep(dpy, 0)) + break; + delay--; + } + + XFreeGC(dpy, gc); + XFreeGC(dpy, gc2); + XClearWindow(dpy, window); + XFreeFont(dpy, font); +} + + char *progclass = "BSOD"; char *defaults [] = { - "*delay: 30", - - "BSOD.Windows.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", - "BSOD.Windows.font2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*", - "BSOD.Windows.foreground: White", - "BSOD.Windows.background: Blue", - - "BSOD.Amiga.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", - "BSOD.Amiga.font2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*", - "BSOD.Amiga.foreground: Red", - "BSOD.Amiga.background: Black", - "BSOD.Amiga.background2: White", - - "BSOD.Mac.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", - "BSOD.Mac.foreground: PaleTurquoise1", - "BSOD.Mac.background: Black", + "*delay: 30", + + ".Windows.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", + ".Windows.font2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*", + ".Windows.foreground: White", + ".Windows.background: Blue", + + ".Amiga.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", + ".Amiga.font2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*", + ".Amiga.foreground: Red", + ".Amiga.background: Black", + ".Amiga.background2: White", + + ".Mac.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", + ".Mac.foreground: PaleTurquoise1", + ".Mac.background: Black", + + ".MacsBug.font: -*-courier-medium-r-*-*-*-100-*-*-m-*-*-*", + ".MacsBug.font2: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", + ".MacsBug.font3: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".MacsBug.foreground: Black", + ".MacsBug.background: White", + ".MacsBug.borderColor: #AAAAAA", 0 }; @@ -527,7 +720,7 @@ screenhack (Display *dpy, Window window) while (1) { - while (i == j) i = random() % 4; + while (i == j) i = random() % 5; j = i; switch (i) @@ -536,6 +729,7 @@ screenhack (Display *dpy, Window window) case 1: windows(dpy, window, delay, False); break; case 2: amiga(dpy, window, delay); break; case 3: mac(dpy, window, delay); break; + case 4: macsbug(dpy, window, delay); break; default: abort(); break; } XSync (dpy, True); diff --git a/hacks/bubbles.c b/hacks/bubbles.c index 7b4fdd56..4946aeef 100644 --- a/hacks/bubbles.c +++ b/hacks/bubbles.c @@ -76,8 +76,8 @@ extern char **default_bubbles[]; char *progclass = "Bubbles"; char *defaults [] = { - "Bubbles.background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*simple: false", "*broken: false", "*delay: 800", diff --git a/hacks/compile_axp.com b/hacks/compile_axp.com index d6421375..809004c8 100644 --- a/hacks/compile_axp.com +++ b/hacks/compile_axp.com @@ -7,9 +7,11 @@ $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) BUBBLES-DEFAULT.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) BUBBLES.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) CORAL.C +$ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) CRYSTAL.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) CYNOSURE.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) DECAYSCREEN.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) DECO.C +$ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) DISCRETE.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) DRIFT.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) EPICYCLE.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) FADEPLOT.C diff --git a/hacks/compile_decc.com b/hacks/compile_decc.com index d6421375..809004c8 100644 --- a/hacks/compile_decc.com +++ b/hacks/compile_decc.com @@ -7,9 +7,11 @@ $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) BUBBLES-DEFAULT.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) BUBBLES.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) CORAL.C +$ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) CRYSTAL.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) CYNOSURE.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) DECAYSCREEN.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) DECO.C +$ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) DISCRETE.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) DRIFT.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) EPICYCLE.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,STANDALONE)/INCL=([],[-],[-.UTILS]) FADEPLOT.C diff --git a/hacks/coral.c b/hacks/coral.c index 74b5120b..8ace44d2 100644 --- a/hacks/coral.c +++ b/hacks/coral.c @@ -225,13 +225,13 @@ coral(Display *dpy, Window window) char *progclass = "Coral"; char *defaults[] = { - "Coral.background: black", - "Coral.foreground: white", - "*density: 25", - "*seeds: 20", /* too many for 640x480, too few for 1280x1024 */ - "*delay: 5", - "*delay2: 1000", - 0 + ".background: black", + ".foreground: white", + "*density: 25", + "*seeds: 20", /* too many for 640x480, too few for 1280x1024 */ + "*delay: 5", + "*delay2: 1000", + 0 }; XrmOptionDescRec options[] = { diff --git a/hacks/crystal.c b/hacks/crystal.c new file mode 100644 index 00000000..caab2a89 --- /dev/null +++ b/hacks/crystal.c @@ -0,0 +1,930 @@ +/* -*- Mode: C; tab-width: 4 -*- */ +/* crystal --- polygons moving according to plane group rules */ + +#if !defined( lint ) && !defined( SABER ) +static const char sccsid[] = "@(#)crystal.c 4.07 97/11/24 xlockmore"; + +#endif + +/*- + * Copyright (c) 1997 by Jouk Jansen + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation. + * + * This file is provided AS IS with no warranties of any kind. The author + * shall have no liability with respect to the infringement of copyrights, + * trade secrets or any patents by this file or any part thereof. In no + * event will the author be liable for any lost revenue or profits or + * other special, indirect and consequential damages. + * + * The author should like to be notified if changes have been made to the + * routine. Response will only be guaranteed when a VMS version of the + * program is available. + * + * A moving polygon-mode. The polygons obey 2D-planegroup symmetry. + * + * Revision History: + * 24-Feb-98: added option centre which turns on/off forcing the centre of + * the screen to be used + * added option maxsize which forces the dimensions to be chasen + * in such ua way that the largest possible part of the screen is + * used + * When only one unit cell is drawn, it is chosen at random + * 18-Feb-98: added support for negative numbers with -nx and -ny meaning + * "random" choice with geiven maximum + * added +/-grid option. If -cell is specified this option + * determines if one or all unit cells are drawn. + * -batchcount is now a parameter for all the objects on the screen + * instead of the number of "unique" objects + * The maximum size of the objects now scales with the part + * of the screen used. + * fixed "size" problem. Now very small non-vissable objects + * are not allowed + * 13-Feb-98: randomized the unit cell size + * runtime options -/+cell (turn on/off unit cell drawing) + * -nx num (number of translational symmetries in x-direction + * -ny num (idem y-direction but ignored for square and + * hexagonal space groups + * i.e. try xlock -mode crystal -nx 3 -ny 2 + * Fullrandom overrules the -/+cell option. + * 05-Feb-98: Revision + bug repairs + * shows unit cell + * use part of the screen for unit cell + * in hexagonal and square groups a&b axis forced to be equal + * cell angle for oblique groups randomly chosen between 60 and 120 + * bugs solved: planegroups with cell angles <> 90.0 now work properly + * 19-Sep-97: Added remaining hexagonal groups + * 12-Jun-97: Created + */ + +#ifdef STANDALONE +# define PROGCLASS "Crystal" +# define HACK_INIT init_crystal +# define HACK_DRAW draw_crystal +# define crystal_opts xlockmore_opts +# define DEFAULTS "*delay: 60000 \n" \ + "*count: -500 \n" \ + "*cycles: 200 \n" \ + "*size: -15 \n" \ + "*ncolors: 200 \n" \ + "*fullrandom: True \n" \ + "*verbose: False \n" +# include "xlockmore.h" /* in xscreensaver distribution */ +#else /* STANDALONE */ +# include "xlock.h" /* in xlockmore distribution */ +#endif /* STANDALONE */ + +#define DEF_CELL "True" /* Draw unit cell */ +#define DEF_GRID "False" /* Draw unit all cell if DEF_CELL is True */ +#define DEF_NX "-3" /* number of unit cells in x-direction */ +#define DEF_NX1 1 /* number of unit cells in x-direction */ +#define DEF_NY "-3" /* number of unit cells in y-direction */ +#define DEF_NY1 1 /* number of unit cells in y-direction */ +#define DEF_CENTRE "False" +#define DEF_MAXSIZE "False" + +#define min(a,b) ((a) <= (b) ? (a) : (b)) + +static int nx, ny; + +static Bool unit_cell, grid_cell, centre, maxsize; + +static XrmOptionDescRec opts[] = +{ + {"-nx", "crystal.nx", XrmoptionSepArg, (caddr_t) NULL}, + {"-ny", "crystal.ny", XrmoptionSepArg, (caddr_t) NULL}, + {"-centre", ".crystal.centre", XrmoptionNoArg, (caddr_t) "on"}, + {"+centre", ".crystal.centre", XrmoptionNoArg, (caddr_t) "off"}, + {"-maxsize", ".crystal.maxsize", XrmoptionNoArg, (caddr_t) "on"}, + {"+maxsize", ".crystal.maxsize", XrmoptionNoArg, (caddr_t) "off"}, + {"-cell", ".crystal.cell", XrmoptionNoArg, (caddr_t) "on"}, + {"+cell", ".crystal.cell", XrmoptionNoArg, (caddr_t) "off"}, + {"-grid", ".crystal.grid", XrmoptionNoArg, (caddr_t) "on"}, + {"+grid", ".crystal.grid", XrmoptionNoArg, (caddr_t) "off"} +}; + +static argtype vars[] = +{ + {(caddr_t *) & nx, "nx", "nx", DEF_NX, t_Int}, + {(caddr_t *) & ny, "ny", "ny", DEF_NY, t_Int}, + {(caddr_t *) & centre, "centre", "Centre", DEF_CENTRE, t_Bool}, + {(caddr_t *) & maxsize, "maxsize", "Maxsize", DEF_MAXSIZE, t_Bool}, + {(caddr_t *) & unit_cell, "cell", "Cell", DEF_CELL, t_Bool}, + {(caddr_t *) & grid_cell, "grid", "Grid", DEF_GRID, t_Bool} +}; +static OptionStruct desc[] = +{ + {"-nx num", "Number of unit cells in x-direction"}, + {"-ny num", "Number of unit cells in y-direction"}, + {"-/+centre", "turn on/off cenetering on screen"}, + {"-/+maxsize", "turn on/off use of maximum part of screen"}, + {"-/+cell", "turn on/off drawing of unit cell"}, + {"-/+grid", "turn on/off drawing of grid of unit cells (if -cell is on)"} +}; + +ModeSpecOpt crystal_opts = +{sizeof opts / sizeof opts[0], opts, sizeof vars / sizeof vars[0], vars, desc}; + +#ifdef USE_MODULES +ModStruct crystal_description = +{"crystal", "init_crystal", "draw_crystal", "release_crystal", + "refresh_crystal", "init_crystal", NULL, &crystal_opts, + 60000, -40, 200, -15, 64, 1.0, "", + "Shows polygons in 2D plane groups", 0, NULL}; + +#endif + +#define DEF_NUM_ATOM 10 + +#define DEF_SIZ_ATOM 10 + +#define PI_RAD (M_PI / 180.0) + +static Bool centro[17] = +{ + False, + True, + False, + False, + False, + True, + True, + True, + True, + True, + True, + True, + False, + False, + False, + True, + True +}; + +static Bool primitive[17] = +{ + True, + True, + True, + True, + False, + True, + True, + True, + False, + True, + True, + True, + True, + True, + True, + True, + True +}; + +static short numops[34] = +{ + 1, 0, + 1, 0, + 9, 7, + 2, 0, + 9, 7, + 9, 7, + 4, 2, + 5, 3, + 9, 7, + 8, 6, + 10, 6, + 8, 4, + 16, 13, + 19, 13, + 16, 10, + 19, 13, + 19, 13 +}; + +static short operation[114] = +{ + 1, 0, 0, 1, 0, 0, + -1, 0, 0, 1, 0, 1, + -1, 0, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 0, + -1, 0, 0, 1, 1, 1, + 1, 0, 0, 1, 1, 1, + 0, -1, 1, 0, 0, 0, + 1, 0, 0, 1, 0, 0, + -1, 0, 0, 1, 0, 0, + 0, 1, 1, 0, 0, 0, + -1, 0, -1, 1, 0, 0, + 1, -1, 0, -1, 0, 0, + 0, 1, 1, 0, 0, 0, + 0, -1, 1, -1, 0, 0, + -1, 1, -1, 0, 0, 0, + 1, 0, 0, 1, 0, 0, + 0, -1, -1, 0, 0, 0, + -1, 1, 0, 1, 0, 0, + 1, 0, 1, -1, 0, 0 +}; + +typedef struct { + unsigned long colour; + int x0, y0, velocity[2]; + float angle, velocity_a; + int num_point, at_type, size_at; + XPoint xy[5]; +} crystalatom; + +typedef struct { + Bool painted; + int win_width, win_height, num_atom; + int planegroup, a, b, offset_w, offset_h, nx, ny; + float gamma; + crystalatom *atom; + GC gc; + Bool unit_cell, grid_cell; +} crystalstruct; + +static crystalstruct *crystals = NULL; + +static void +trans_coor(XPoint * xyp, XPoint * new_xyp, int num_points, + float gamma) +{ + int i; + + for (i = 0; i <= num_points; i++) { + new_xyp[i].x = xyp[i].x + + (int) (xyp[i].y * sin((gamma - 90.0) * PI_RAD)); + new_xyp[i].y = (int) (xyp[i].y / cos((gamma - 90.0) * PI_RAD)); + } +} + +static void +trans_coor_back(XPoint * xyp, XPoint * new_xyp, + int num_points, float gamma, int offset_w, int offset_h) +{ + int i; + + for (i = 0; i <= num_points; i++) { + new_xyp[i].y = (int) (xyp[i].y * cos((gamma - 90) * PI_RAD)) + + offset_h; + new_xyp[i].x = xyp[i].x - (int) (xyp[i].y * sin((gamma - 90.0) + * PI_RAD)) + offset_w; + } +} + +static void +crystal_setupatom(crystalatom * atom0, float gamma) +{ + XPoint xy[5]; + int x0, y0; + + y0 = (int) (atom0->y0 * cos((gamma - 90) * PI_RAD)); + x0 = atom0->x0 - (int) (atom0->y0 * sin((gamma - 90.0) * PI_RAD)); + switch (atom0->at_type) { + case 0: /* rectangles */ + xy[0].x = x0 + (int) (2 * atom0->size_at * + cos(atom0->angle)) + + (int) (atom0->size_at * sin(atom0->angle)); + xy[0].y = y0 + (int) (atom0->size_at * + cos(atom0->angle)) - + (int) (2 * atom0->size_at * sin(atom0->angle)); + xy[1].x = x0 + (int) (2 * atom0->size_at * + cos(atom0->angle)) - + (int) (atom0->size_at * sin(atom0->angle)); + xy[1].y = y0 - (int) (atom0->size_at * + cos(atom0->angle)) - + (int) (2 * atom0->size_at * sin(atom0->angle)); + xy[2].x = x0 - (int) (2 * atom0->size_at * + cos(atom0->angle)) - + (int) (atom0->size_at * sin(atom0->angle)); + xy[2].y = y0 - (int) (atom0->size_at * + cos(atom0->angle)) + + (int) (2 * atom0->size_at * sin(atom0->angle)); + xy[3].x = x0 - (int) (2 * atom0->size_at * + cos(atom0->angle)) + + (int) (atom0->size_at * sin(atom0->angle)); + xy[3].y = y0 + (int) (atom0->size_at * + cos(atom0->angle)) + + (int) (2 * atom0->size_at * + sin(atom0->angle)); + xy[4].x = xy[0].x; + xy[4].y = xy[0].y; + trans_coor(xy, atom0->xy, 4, gamma); + return; + case 1: /* squares */ + xy[0].x = x0 + (int) (1.5 * atom0->size_at * + cos(atom0->angle)) + + (int) (1.5 * atom0->size_at * + sin(atom0->angle)); + xy[0].y = y0 + (int) (1.5 * atom0->size_at * + cos(atom0->angle)) - + (int) (1.5 * atom0->size_at * + sin(atom0->angle)); + xy[1].x = x0 + (int) (1.5 * atom0->size_at * + cos(atom0->angle)) - + (int) (1.5 * atom0->size_at * + sin(atom0->angle)); + xy[1].y = y0 - (int) (1.5 * atom0->size_at * + cos(atom0->angle)) - + (int) (1.5 * atom0->size_at * + sin(atom0->angle)); + xy[2].x = x0 - (int) (1.5 * atom0->size_at * + cos(atom0->angle)) - + (int) (1.5 * atom0->size_at * + sin(atom0->angle)); + xy[2].y = y0 - (int) (1.5 * atom0->size_at * + cos(atom0->angle)) + + (int) (1.5 * atom0->size_at * + sin(atom0->angle)); + xy[3].x = x0 - (int) (1.5 * atom0->size_at * + cos(atom0->angle)) + + (int) (1.5 * atom0->size_at * + sin(atom0->angle)); + xy[3].y = y0 + (int) (1.5 * atom0->size_at * + cos(atom0->angle)) + + (int) (1.5 * atom0->size_at * + sin(atom0->angle)); + xy[4].x = xy[0].x; + xy[4].y = xy[0].y; + trans_coor(xy, atom0->xy, 4, gamma); + return; + case 2: /* triangles */ + xy[0].x = x0 + (int) (1.5 * atom0->size_at * + sin(atom0->angle)); + xy[0].y = y0 + (int) (1.5 * atom0->size_at * + cos(atom0->angle)); + xy[1].x = x0 + (int) (1.5 * atom0->size_at * + cos(atom0->angle)) - + (int) (1.5 * atom0->size_at * + sin(atom0->angle)); + xy[1].y = y0 - (int) (1.5 * atom0->size_at * + cos(atom0->angle)) - + (int) (1.5 * atom0->size_at * + sin(atom0->angle)); + xy[2].x = x0 - (int) (1.5 * atom0->size_at * + cos(atom0->angle)) - + (int) (1.5 * atom0->size_at * + sin(atom0->angle)); + xy[2].y = y0 - (int) (1.5 * atom0->size_at * + cos(atom0->angle)) + + (int) (1.5 * atom0->size_at * + sin(atom0->angle)); + xy[3].x = xy[0].x; + xy[3].y = xy[0].y; + trans_coor(xy, atom0->xy, 3, gamma); + return; + } +} + +static void +crystal_drawatom(ModeInfo * mi, crystalatom * atom0) +{ + crystalstruct *cryst; + Display *display = MI_DISPLAY(mi); + Window window = MI_WINDOW(mi); + int j, k, l, m; + + cryst = &crystals[MI_SCREEN(mi)]; + for (j = numops[2 * cryst->planegroup + 1]; + j < numops[2 * cryst->planegroup]; j++) { + XPoint xy[5], new_xy[5]; + XPoint xy_1[5]; + int xtrans, ytrans; + + xtrans = operation[j * 6] * atom0->x0 + operation[j * 6 + 1] * + atom0->y0 + (int) (operation[j * 6 + 4] * cryst->a / + 2.0); + ytrans = operation[j * 6 + 2] * atom0->x0 + operation[j * 6 + + 3] * atom0->y0 + (int) (operation[j * 6 + 5] * + cryst->b / 2.0); + if (xtrans < 0) { + if (xtrans < -cryst->a) + xtrans = 2 * cryst->a; + else + xtrans = cryst->a; + } else if (xtrans >= cryst->a) + xtrans = -cryst->a; + else + xtrans = 0; + if (ytrans < 0) + ytrans = cryst->b; + else if (ytrans >= cryst->b) + ytrans = -cryst->b; + else + ytrans = 0; + for (k = 0; k < atom0->num_point; k++) { + xy[k].x = operation[j * 6] * atom0->xy[k].x + + operation[j * 6 + 1] * + atom0->xy[k].y + (int) (operation[j * 6 + 4] * + cryst->a / 2.0) + + xtrans; + xy[k].y = operation[j * 6 + 2] * atom0->xy[k].x + + operation[j * 6 + 3] * + atom0->xy[k].y + (int) (operation[j * 6 + 5] * + cryst->b / 2.0) + + ytrans; + } + xy[atom0->num_point].x = xy[0].x; + xy[atom0->num_point].y = xy[0].y; + for (l = 0; l < cryst->nx; l++) { + for (m = 0; m < cryst->ny; m++) { + + for (k = 0; k <= atom0->num_point; k++) { + xy_1[k].x = xy[k].x + l * cryst->a; + xy_1[k].y = xy[k].y + m * cryst->b; + } + trans_coor_back(xy_1, new_xy, atom0->num_point, + cryst->gamma, cryst->offset_w, cryst->offset_h); + XFillPolygon(display, window, cryst->gc, new_xy, + atom0->num_point, Convex, CoordModeOrigin); + } + } + if (centro[cryst->planegroup] == True) { + for (k = 0; k <= atom0->num_point; k++) { + xy[k].x = cryst->a - xy[k].x; + xy[k].y = cryst->b - xy[k].y; + } + for (l = 0; l < cryst->nx; l++) { + for (m = 0; m < cryst->ny; m++) { + + for (k = 0; k <= atom0->num_point; k++) { + xy_1[k].x = xy[k].x + l * cryst->a; + xy_1[k].y = xy[k].y + m * cryst->b; + } + trans_coor_back(xy_1, new_xy, atom0->num_point, + cryst->gamma, cryst->offset_w, cryst->offset_h); + XFillPolygon(display, window, cryst->gc, + new_xy, + atom0->num_point, Convex, + CoordModeOrigin); + } + } + } + if (primitive[cryst->planegroup] == False) { + if (xy[atom0->num_point].x >= (int) (cryst->a / 2.0)) + xtrans = (int) (-cryst->a / 2.0); + else + xtrans = (int) (cryst->a / 2.0); + if (xy[atom0->num_point].y >= (int) (cryst->b / 2.0)) + ytrans = (int) (-cryst->b / 2.0); + else + ytrans = (int) (cryst->b / 2.0); + for (k = 0; k <= atom0->num_point; k++) { + xy[k].x = xy[k].x + xtrans; + xy[k].y = xy[k].y + ytrans; + } + for (l = 0; l < cryst->nx; l++) { + for (m = 0; m < cryst->ny; m++) { + + for (k = 0; k <= atom0->num_point; k++) { + xy_1[k].x = xy[k].x + l * cryst->a; + xy_1[k].y = xy[k].y + m * cryst->b; + } + trans_coor_back(xy_1, new_xy, atom0->num_point, + cryst->gamma, cryst->offset_w, cryst->offset_h); + XFillPolygon(display, window, cryst->gc, + new_xy, + atom0->num_point, Convex, + CoordModeOrigin); + } + } + if (centro[cryst->planegroup] == True) { + XPoint xy1[5]; + + for (k = 0; k <= atom0->num_point; k++) { + xy1[k].x = cryst->a - xy[k].x; + xy1[k].y = cryst->b - xy[k].y; + } + for (l = 0; l < cryst->nx; l++) { + for (m = 0; m < cryst->ny; m++) { + + for (k = 0; k <= atom0->num_point; k++) { + xy_1[k].x = xy1[k].x + l * cryst->a; + xy_1[k].y = xy1[k].y + m * cryst->b; + } + trans_coor_back(xy_1, new_xy, atom0->num_point, + cryst->gamma, cryst->offset_w, cryst->offset_h); + XFillPolygon(display, window, + cryst->gc, + new_xy, atom0->num_point, + Convex, CoordModeOrigin); + } + } + } + } + } +} + +void +draw_crystal(ModeInfo * mi) +{ + Display *display = MI_DISPLAY(mi); + crystalstruct *cryst = &crystals[MI_SCREEN(mi)]; + int i; + + cryst->painted = True; + XSetFunction(display, cryst->gc, GXxor); + for (i = 0; i < cryst->num_atom; i++) { + crystalatom *atom0; + + atom0 = &cryst->atom[i]; + XSetForeground(display, cryst->gc, atom0->colour); + crystal_drawatom(mi, atom0); + atom0->velocity[0] += NRAND(3) - 1; + atom0->velocity[0] = MAX(-20, MIN(20, atom0->velocity[0])); + atom0->velocity[1] += NRAND(3) - 1; + atom0->velocity[1] = MAX(-20, MIN(20, atom0->velocity[1])); + atom0->x0 += atom0->velocity[0]; + /*if (cryst->gamma == 90.0) { */ + if (atom0->x0 < 0) + atom0->x0 += cryst->a; + else if (atom0->x0 >= cryst->a) + atom0->x0 -= cryst->a; + atom0->y0 += atom0->velocity[1]; + if (atom0->y0 < 0) + atom0->y0 += cryst->b; + else if (atom0->y0 >= cryst->b) + atom0->y0 -= cryst->b; + /*} */ + atom0->velocity_a += ((float) NRAND(1001) - 500.0) / 2000.0; + atom0->angle += atom0->velocity_a; + crystal_setupatom(atom0, cryst->gamma); + crystal_drawatom(mi, atom0); + } + XSetFunction(display, cryst->gc, GXcopy); +} + +void +refresh_crystal(ModeInfo * mi) +{ + Display *display = MI_DISPLAY(mi); + Window window = MI_WINDOW(mi); + crystalstruct *cryst = &crystals[MI_SCREEN(mi)]; + int i; + + if (!cryst->painted) + return; + MI_CLEARWINDOW(mi); + XSetFunction(display, cryst->gc, GXxor); + + if (cryst->unit_cell) { + if (MI_NPIXELS(mi) > 2) + XSetForeground(display, cryst->gc, MI_PIXEL(mi, NRAND(MI_NPIXELS(mi)))); + else + XSetForeground(display, cryst->gc, MI_BLACK_PIXEL(mi)); + if (cryst->grid_cell) { + int inx, iny; + + XDrawLine(display, window, cryst->gc, cryst->offset_w, + cryst->offset_h, cryst->offset_w + cryst->nx * cryst->a, + cryst->offset_h); + XDrawLine(display, window, cryst->gc, cryst->offset_w, + cryst->offset_h, (int) (cryst->offset_w - cryst->ny * cryst->b * + sin((cryst->gamma - 90) * PI_RAD)), + (int) (cryst->ny * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h); + inx = cryst->nx; + for (iny = 1; iny <= cryst->ny; iny++) { + XDrawLine(display, window, cryst->gc, + (int) (cryst->offset_w + + inx * cryst->a - (int) (iny * cryst->b * + sin((cryst->gamma - 90) * PI_RAD))), + (int) (iny * cryst->b * cos((cryst->gamma - 90) * + PI_RAD)) + cryst->offset_h, + (int) (cryst->offset_w - iny * cryst->b * + sin((cryst->gamma - 90) * PI_RAD)), + (int) (iny * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + + cryst->offset_h); + } + iny = cryst->ny; + for (inx = 1; inx <= cryst->nx; inx++) { + XDrawLine(display, window, cryst->gc, + (int) (cryst->offset_w + + inx * cryst->a - (int) (iny * cryst->b * + sin((cryst->gamma - 90) * PI_RAD))), + (int) (iny * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h, + cryst->offset_w + inx * cryst->a, cryst->offset_h); + } + } else { + int inx, iny; + + inx = NRAND(cryst->nx); + iny = NRAND(cryst->ny); + XDrawLine(display, window, cryst->gc, + cryst->offset_w + inx * cryst->a - (int) (iny * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) (iny * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h, + cryst->offset_w + (inx + 1) * cryst->a - (int) (iny * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) (iny * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h); + XDrawLine(display, window, cryst->gc, + cryst->offset_w + inx * cryst->a - (int) (iny * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) (iny * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h, + cryst->offset_w + inx * cryst->a - (int) ((iny + 1) * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) ((iny + 1) * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h); + XDrawLine(display, window, cryst->gc, + cryst->offset_w + (inx + 1) * cryst->a - (int) (iny * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) (iny * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h, + cryst->offset_w + (inx + 1) * cryst->a - (int) ((iny + 1) * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) ((iny + 1) * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h); + XDrawLine(display, window, cryst->gc, + cryst->offset_w + inx * cryst->a - (int) ((iny + 1) * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) ((iny + 1) * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h, + cryst->offset_w + (inx + 1) * cryst->a - (int) ((iny + 1) * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) ((iny + 1) * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h); + } + } + for (i = 0; i < cryst->num_atom; i++) { + crystalatom *atom0; + + atom0 = &cryst->atom[i]; + XSetForeground(display, cryst->gc, atom0->colour); + crystal_drawatom(mi, atom0); + } + XSetFunction(display, cryst->gc, GXcopy); +} + +void +release_crystal(ModeInfo * mi) +{ + Display *display = MI_DISPLAY(mi); + + if (crystals != NULL) { + int screen; + + for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) { + crystalstruct *cryst = &crystals[screen]; + + if (cryst->gc != NULL) + XFreeGC(display, cryst->gc); + if (cryst->atom != NULL) + (void) free((void *) cryst->atom); + } + (void) free((void *) crystals); + crystals = NULL; + } +} + +void +init_crystal(ModeInfo * mi) +{ + Display *display = MI_DISPLAY(mi); + Window window = MI_WINDOW(mi); + crystalstruct *cryst; + int i, max_atoms, size_atom, neqv; + int cell_min; + +#define MIN_CELL 200 + +/* initialize */ + if (crystals == NULL) { + if ((crystals = (crystalstruct *) calloc(MI_NUM_SCREENS(mi), + sizeof (crystalstruct))) == NULL) + return; + } + cryst = &crystals[MI_SCREEN(mi)]; + + if (!cryst->gc) { + if ((cryst->gc = XCreateGC(display, MI_WINDOW(mi), + (unsigned long) 0, (XGCValues *) NULL)) == None) + return; + } +/* Clear Display */ + MI_CLEARWINDOW(mi); + cryst->painted = False; + XSetFunction(display, cryst->gc, GXxor); + +/*Set up crystal data */ + if (MI_IS_FULLRANDOM(mi)) { + if (LRAND() & 1) + cryst->unit_cell = True; + else + cryst->unit_cell = False; + } else + cryst->unit_cell = unit_cell; + if (cryst->unit_cell) { + if (MI_IS_FULLRANDOM(mi)) { + if (LRAND() & 1) + cryst->grid_cell = True; + else + cryst->grid_cell = False; + } else + cryst->grid_cell = grid_cell; + } + cryst->win_width = MI_WIDTH(mi); + cryst->win_height = MI_HEIGHT(mi); + cell_min = min(cryst->win_width / 2 + 1, MIN_CELL); + cell_min = min(cell_min, cryst->win_height / 2 + 1); + cryst->planegroup = NRAND(17); + if (MI_IS_VERBOSE(mi)) + (void) fprintf(stdout, "Selected plane group no %d\n", + cryst->planegroup + 1); + if (cryst->planegroup > 11) + cryst->gamma = 120.0; + else if (cryst->planegroup < 2) + cryst->gamma = 60.0 + NRAND(60); + else + cryst->gamma = 90.0; + neqv = numops[2 * cryst->planegroup] - numops[2 * cryst->planegroup + 1]; + if (centro[cryst->planegroup] == True) + neqv = 2 * neqv; + if (primitive[cryst->planegroup] == False) + neqv = 2 * neqv; + + + if (nx > 0) + cryst->nx = nx; + else if (nx < 0) + cryst->nx = NRAND(-nx) + 1; + else + cryst->nx = DEF_NX1; + if (cryst->planegroup > 8) + cryst->ny = cryst->nx; + else if (ny > 0) + cryst->ny = ny; + else if (ny < 0) + cryst->ny = NRAND(-ny) + 1; + else + cryst->ny = DEF_NY1; + neqv = neqv * cryst->nx * cryst->ny; + + cryst->num_atom = MI_COUNT(mi); + max_atoms = MI_COUNT(mi); + if (cryst->num_atom == 0) { + cryst->num_atom = DEF_NUM_ATOM; + max_atoms = DEF_NUM_ATOM; + } else if (cryst->num_atom < 0) { + max_atoms = -cryst->num_atom; + cryst->num_atom = NRAND(-cryst->num_atom) + 1; + } + if (neqv > 1) + cryst->num_atom = cryst->num_atom / neqv + 1; + + if (cryst->atom == NULL) + cryst->atom = (crystalatom *) calloc(max_atoms, sizeof ( + crystalatom)); + + if (maxsize) { + if (cryst->planegroup < 13) { + cryst->gamma = 90.0; + cryst->offset_w = 0; + cryst->offset_h = 0; + if (cryst->planegroup < 10) { + cryst->b = cryst->win_height; + cryst->a = cryst->win_width; + } else { + cryst->b = min(cryst->win_height, cryst->win_width); + cryst->a = cryst->b; + } + } else { + cryst->gamma = 120.0; + cryst->a = (int) (cryst->win_width * 2.0 / 3.0); + cryst->b = cryst->a; + cryst->offset_h = (int) (cryst->b * 0.25 * + cos((cryst->gamma - 90) * PI_RAD)); + cryst->offset_w = (int) (cryst->b * 0.5); + } + } else { + cryst->offset_w = -1; + while (cryst->offset_w < 4 || (int) (cryst->offset_w - cryst->b * + sin((cryst->gamma - 90) * PI_RAD)) < 4) { + cryst->b = NRAND((int) (cryst->win_height / (cos((cryst->gamma - 90) * + PI_RAD))) - cell_min) + cell_min; + if (cryst->planegroup > 8) + cryst->a = cryst->b; + else + cryst->a = NRAND(cryst->win_width - cell_min) + cell_min; + cryst->offset_w = (int) ((cryst->win_width - (cryst->a - cryst->b * + sin((cryst->gamma - 90) * + PI_RAD))) / 2.0); + } + cryst->offset_h = (int) ((cryst->win_height - cryst->b * cos(( + cryst->gamma - 90) * PI_RAD)) / 2.0); + if (!centre) { + if (cryst->offset_h > 0) + cryst->offset_h = NRAND(2 * cryst->offset_h); + cryst->offset_w = (int) (cryst->win_width - cryst->a - + cryst->b * + fabs(sin((cryst->gamma - 90) * PI_RAD))); + if (cryst->gamma > 90.0) { + if (cryst->offset_w > 0) + cryst->offset_w = NRAND(cryst->offset_w) + + cryst->b * sin((cryst->gamma - 90) * PI_RAD); + else + cryst->offset_w = (int) (cryst->b * sin((cryst->gamma - 90) * + PI_RAD)); + } else if (cryst->offset_w > 0) + cryst->offset_w = NRAND(cryst->offset_w); + else + cryst->offset_w = 0; + } + } + + size_atom = min((int) ((float) (cryst->a) / 40.) + 1, + (int) ((float) (cryst->b) / 40.) + 1); + if (MI_SIZE(mi) < size_atom) { + if (MI_SIZE(mi) < -size_atom) + size_atom = -size_atom; + else + size_atom = MI_SIZE(mi); + } + cryst->a = cryst->a / cryst->nx; + cryst->b = cryst->b / cryst->ny; + if (cryst->unit_cell) { + if (MI_NPIXELS(mi) > 2) + XSetForeground(display, cryst->gc, MI_PIXEL(mi, NRAND(MI_NPIXELS(mi)))); + else + XSetForeground(display, cryst->gc, MI_BLACK_PIXEL(mi)); + if (cryst->grid_cell) { + int inx, iny; + + XDrawLine(display, window, cryst->gc, cryst->offset_w, + cryst->offset_h, cryst->offset_w + cryst->nx * cryst->a, + cryst->offset_h); + XDrawLine(display, window, cryst->gc, cryst->offset_w, + cryst->offset_h, (int) (cryst->offset_w - cryst->ny * cryst->b * + sin((cryst->gamma - 90) * PI_RAD)), + (int) (cryst->ny * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h); + inx = cryst->nx; + for (iny = 1; iny <= cryst->ny; iny++) { + XDrawLine(display, window, cryst->gc, + (int) (cryst->offset_w + + inx * cryst->a - (int) (iny * cryst->b * + sin((cryst->gamma - 90) * PI_RAD))), + (int) (iny * cryst->b * cos((cryst->gamma - 90) * + PI_RAD)) + cryst->offset_h, + (int) (cryst->offset_w - iny * cryst->b * + sin((cryst->gamma - 90) * PI_RAD)), + (int) (iny * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + + cryst->offset_h); + } + iny = cryst->ny; + for (inx = 1; inx <= cryst->nx; inx++) { + XDrawLine(display, window, cryst->gc, + (int) (cryst->offset_w + + inx * cryst->a - (int) (iny * cryst->b * + sin((cryst->gamma - 90) * PI_RAD))), + (int) (iny * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h, + cryst->offset_w + inx * cryst->a, cryst->offset_h); + } + } else { + int inx, iny; + + inx = NRAND(cryst->nx); + iny = NRAND(cryst->ny); + XDrawLine(display, window, cryst->gc, + cryst->offset_w + inx * cryst->a - (int) (iny * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) (iny * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h, + cryst->offset_w + (inx + 1) * cryst->a - (int) (iny * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) (iny * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h); + XDrawLine(display, window, cryst->gc, + cryst->offset_w + inx * cryst->a - (int) (iny * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) (iny * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h, + cryst->offset_w + inx * cryst->a - (int) ((iny + 1) * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) ((iny + 1) * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h); + XDrawLine(display, window, cryst->gc, + cryst->offset_w + (inx + 1) * cryst->a - (int) (iny * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) (iny * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h, + cryst->offset_w + (inx + 1) * cryst->a - (int) ((iny + 1) * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) ((iny + 1) * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h); + XDrawLine(display, window, cryst->gc, + cryst->offset_w + inx * cryst->a - (int) ((iny + 1) * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) ((iny + 1) * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h, + cryst->offset_w + (inx + 1) * cryst->a - (int) ((iny + 1) * cryst->b * sin((cryst->gamma - 90) * PI_RAD)), + (int) ((iny + 1) * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h); + } + } + for (i = 0; i < cryst->num_atom; i++) { + crystalatom *atom0; + + atom0 = &cryst->atom[i]; + if (MI_NPIXELS(mi) > 2) + atom0->colour = MI_PIXEL(mi, NRAND(MI_NPIXELS(mi))); + else + atom0->colour = 1; /*Xor'red so WHITE may not be appropriate */ + XSetForeground(display, cryst->gc, atom0->colour); + atom0->x0 = NRAND(cryst->a); + atom0->y0 = NRAND(cryst->b); + atom0->velocity[0] = NRAND(7) - 3; + atom0->velocity[1] = NRAND(7) - 3; + atom0->velocity_a = (NRAND(7) - 3) * PI_RAD; + atom0->angle = NRAND(90) * PI_RAD; + atom0->at_type = NRAND(3); + if (size_atom == 0) + atom0->size_at = DEF_SIZ_ATOM; + else if (size_atom > 0) + atom0->size_at = size_atom; + else + atom0->size_at = NRAND(-size_atom) + 1; + atom0->size_at++; + if (atom0->at_type == 2) + atom0->num_point = 3; + else + atom0->num_point = 4; + crystal_setupatom(atom0, cryst->gamma); + crystal_drawatom(mi, atom0); + } + XSetFunction(display, cryst->gc, GXcopy); +} diff --git a/hacks/cynosure.c b/hacks/cynosure.c index 3a837126..7d41e7a2 100644 --- a/hacks/cynosure.c +++ b/hacks/cynosure.c @@ -119,8 +119,8 @@ static int gridSize; char *progclass = "Cynosure"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*delay: 500000", "*colors: 128", "*iterations: 100", diff --git a/hacks/deco.c b/hacks/deco.c index 63ca3aea..4479c640 100644 --- a/hacks/deco.c +++ b/hacks/deco.c @@ -59,8 +59,8 @@ deco (Display *dpy, char *progclass = "Deco"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*maxDepth: 12", "*minWidth: 20", "*minHeight: 20", diff --git a/hacks/discrete.c b/hacks/discrete.c new file mode 100644 index 00000000..7f336a65 --- /dev/null +++ b/hacks/discrete.c @@ -0,0 +1,410 @@ +/* -*- Mode: C; tab-width: 4 -*- */ +/* discrete --- chaotic mappings */ + +#if !defined( lint ) && !defined( SABER ) +static const char sccsid[] = "@(#)discrete.c 4.10 98/04/24 xlockmore"; + +#endif + +/*- + * Copyright (c) 1996 by Tim Auckland + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation. + * + * This file is provided AS IS with no warranties of any kind. The author + * shall have no liability with respect to the infringement of copyrights, + * trade secrets or any patents by this file or any part thereof. In no + * event will the author be liable for any lost revenue or profits or + * other special, indirect and consequential damages. + * + * "discrete" shows a number of fractals based on the "discrete map" + * type of dynamical systems. They include a different way of looking + * at the HOPALONG system, an inverse julia-set iteration, the "Standard + * Map" and the "Bird in a Thornbush" fractal. + * + * Revision History: + * 31-Jul-97: Ported to xlockmore-4 + * 08-Aug-96: Adapted from hop.c Copyright (c) 1991 by Patrick J. Naughton. + */ + +#ifdef STANDALONE +# define PROGCLASS "Discrete" +# define HACK_INIT init_discrete +# define HACK_DRAW draw_discrete +# define discrete_opts xlockmore_opts +# define SMOOTH_COLORS +# define BRIGHT_COLORS +# define DEFAULTS "*delay: 1000 \n" \ + "*count: 4096 \n" \ + "*cycles: 2500 \n" \ + "*ncolors: 100 \n" + +# include "xlockmore.h" /* in xscreensaver distribution */ +# include "erase.h" + +#else /* STANDALONE */ +# include "xlock.h" /* in xlockmore distribution */ +#endif /* STANDALONE */ + +ModeSpecOpt discrete_opts = +{0, NULL, 0, NULL, NULL}; + +#ifdef USE_MODULES +ModStruct discrete_description = +{"discrete", "init_discrete", "draw_discrete", "release_discrete", + "refresh_discrete", "init_discrete", NULL, &discrete_opts, + 1000, 4096, 2500, 1, 64, 1.0, "", + "Shows various discrete maps", 0, NULL}; + +#endif + +enum ftypes { + SQRT, BIRDIE, STANDARD, TRIG, CUBIC, HENON, AILUJ, HSHOE, DELOG +}; + +/*#define TEST STANDARD */ + +#define BIASES 18 +static int bias[BIASES] = +{ + STANDARD, STANDARD, STANDARD, STANDARD, + SQRT, SQRT, SQRT, SQRT, + BIRDIE, BIRDIE, BIRDIE, + AILUJ, AILUJ, AILUJ, + TRIG, TRIG, + CUBIC, + HENON, +}; + +typedef struct { + int maxx; + int maxy; /* max of the screen */ + double a; + double b; + double c; + double d; + double e; + double i; + double j; /* discrete parameters */ + double ic; + double jc; + double is; + double js; + int inc; + int pix; + enum ftypes op; + int count; + XPoint *pointBuffer; /* pointer for XDrawPoints */ +} discretestruct; + +static discretestruct *discretes = NULL; + +void +init_discrete(ModeInfo * mi) +{ + double range; + discretestruct *hp; + + if (discretes == NULL) { + if ((discretes = + (discretestruct *) calloc(MI_NUM_SCREENS(mi), + sizeof (discretestruct))) == NULL) + return; + } + hp = &discretes[MI_SCREEN(mi)]; + + + hp->maxx = MI_WIDTH(mi); + hp->maxy = MI_HEIGHT(mi); +#ifdef TEST + hp->op = TEST; +#else + hp->op = bias[LRAND() % BIASES]; +#endif + switch (hp->op) { + case HSHOE: + hp->ic = 0; + hp->jc = 0; + hp->is = hp->maxx / (4); + hp->js = hp->maxy / (4); + hp->a = 0.5; + hp->b = 0.5; + hp->c = 0.2; + hp->d = -1.25; + hp->e = 1; + hp->i = hp->j = 0.0; + break; + case DELOG: + hp->ic = 0.5; + hp->jc = 0.3; + hp->is = hp->maxx / 1.5; + hp->js = hp->maxy / 1.5; + hp->a = 2.176399; + hp->i = hp->j = 0.01; + break; + case HENON: + hp->jc = ((LRAND() / MAXRAND) * 2.0 - 1.0) * 0.4; + hp->ic = 1.3 * (1 - (hp->jc * hp->jc) / (0.4 * 0.4)); + hp->is = hp->maxx; + hp->js = hp->maxy * 1.5; + hp->a = 1; + hp->b = 1.4; + hp->c = 0.3; + hp->i = hp->j = 0; + break; + case SQRT: + hp->ic = 0; + hp->jc = 0; + hp->is = 1; + hp->js = 1; + range = sqrt((double) hp->maxx * 2 * hp->maxx * 2 + + (double) hp->maxy * 2 * hp->maxy * 2) / + (10.0 + LRAND() % 10); + + hp->a = (LRAND() / MAXRAND) * range - range / 2.0; + hp->b = (LRAND() / MAXRAND) * range - range / 2.0; + hp->c = (LRAND() / MAXRAND) * range - range / 2.0; + if (!(LRAND() % 2)) + hp->c = 0.0; + hp->i = hp->j = 0.0; + break; + case STANDARD: + hp->ic = M_PI; + hp->jc = M_PI; + hp->is = hp->maxx / (M_PI * 2); + hp->js = hp->maxy / (M_PI * 2); + hp->a = 0; /* decay */ + hp->b = (LRAND() / MAXRAND) * 2.0; + hp->c = 0; + hp->i = M_PI; + hp->j = M_PI; + break; + case BIRDIE: + hp->ic = 0; + hp->jc = 0; + hp->is = hp->maxx / 2; + hp->js = hp->maxy / 2; + hp->a = 1.99 + ((LRAND() / MAXRAND) * 2.0 - 1.0) * 0.2; + hp->b = 0; + hp->c = 0.8 + ((LRAND() / MAXRAND) * 2.0 - 1.0) * 0.1; + hp->i = hp->j = 0; + break; + case TRIG: + hp->a = 5; + hp->b = 0.5 + ((LRAND() / MAXRAND) * 2.0 - 1.0) * 0.3; + hp->ic = hp->a; + hp->jc = 0; + hp->is = hp->maxx / (hp->b * 20); + hp->js = hp->maxy / (hp->b * 20); + hp->i = hp->j = 0; + break; + case CUBIC: + hp->a = 2.77; + hp->b = 0.1 + ((LRAND() / MAXRAND) * 2.0 - 1.0) * 0.1; + hp->ic = 0; + hp->jc = 0; + hp->is = hp->maxx / 4; + hp->js = hp->maxy / 4; + hp->i = hp->j = 0.1; + break; + case AILUJ: + { + int i; + double x, y, xn, yn; + + hp->ic = 0; + hp->jc = 0; + hp->is = hp->maxx / 4; + hp->js = hp->maxx / 4; + do { + hp->a = ((LRAND() / MAXRAND) * 2.0 - 1.0) * 1.5 - 0.5; + hp->b = ((LRAND() / MAXRAND) * 2.0 - 1.0) * 1.5; + x = y = 0; +#define MAXITER 10 + for (i = 0; i < MAXITER && x * x + y * y < 13; i++) { /* 'Brot calc */ + xn = x * x - y * y + hp->a; + yn = 2 * x * y + hp->b; + x = xn; + y = yn; + } + } while (i < MAXITER); /* wait for a connected set */ + hp->i = hp->j = 0.1; + break; + } + } + hp->pix = 0; + hp->inc = 0; + + if (hp->pointBuffer == NULL) + hp->pointBuffer = (XPoint *) malloc(MI_COUNT(mi) * sizeof (XPoint)); + + /* Clear the background. */ + MI_CLEARWINDOW(mi); + + hp->count = 0; +} + + +void +draw_discrete(ModeInfo * mi) +{ + Display *dsp = MI_DISPLAY(mi); + Window win = MI_WINDOW(mi); + double oldj, oldi; + int batchcount = MI_COUNT(mi); + int cycles = MI_CYCLES(mi); + int k; + XPoint *xp; + GC gc = MI_GC(mi); + discretestruct *hp = &discretes[MI_SCREEN(mi)]; + + k = batchcount; + xp = hp->pointBuffer; + + hp->inc++; + + if (MI_NPIXELS(mi) > 2) { + XSetForeground(dsp, gc, MI_PIXEL(mi, hp->pix)); + if (++hp->pix >= MI_NPIXELS(mi)) + hp->pix = 0; + } + while (k--) { + oldj = hp->j; + oldi = hp->i; + switch (hp->op) { + case HSHOE: + { + int i; + +#if 0 + if (!k) { + XSetForeground(dsp, gc, MI_BLACK_PIXEL(mi)); + XFillRectangle(dsp, win, gc, 0, 0, hp->maxx, hp->maxy); + XSetForeground(dsp, gc, MI_PIXEL(mi, hp->pix)); + } else +#endif +#define HD +#ifdef HD + if (k < batchcount / 4) { + hp->i = ((double) k / batchcount) * 8 - 1; + hp->j = 1; + } else if (k < batchcount / 2) { + hp->i = 1; + hp->j = 3 - ((double) k / batchcount) * 8; + } else if (k < 3 * batchcount / 4) { + hp->i = 5 - ((double) k / batchcount) * 8; + hp->j = -1; + } else { + hp->i = -1; + hp->j = ((double) k / batchcount) * 8 - 7; + } + for (i = 1; i < (hp->inc % 15); i++) { + oldj = hp->j; + oldi = hp->i; +#endif + hp->i = (hp->a * oldi + hp->b) * oldj; + hp->j = (hp->e - hp->d + hp->c * oldi) * oldj * oldj - hp->c * oldi + hp->d; +#ifdef HD + } +#endif + break; + } + case DELOG: + hp->j = oldi; + hp->i = hp->a * oldi * (1 - oldj); + break; + case HENON: + hp->i = oldj + hp->a - hp->b * oldi * oldi; + hp->j = hp->c * oldi; + break; + case SQRT: + if (k) { + hp->j = hp->a + hp->i; + hp->i = -oldj + (hp->i < 0 + ? sqrt(fabs(hp->b * (hp->i - hp->c))) + : -sqrt(fabs(hp->b * (hp->i - hp->c)))); + } else { + static int s = 1; + + hp->i = s * hp->inc * hp->maxx / cycles / 2; + hp->j = hp->a + hp->i; + s = -s; + } + break; + case STANDARD: + if (k) { + hp->j = (1 - hp->a) * oldj + hp->b * sin(oldi) + hp->a * hp->c; + hp->j = fmod(hp->j + 2 * M_PI, 2 * M_PI); + hp->i = oldi + hp->j; + hp->i = fmod(hp->i + 2 * M_PI, 2 * M_PI); + } else { + static int s = 1; + + hp->j = M_PI + fmod(s * hp->inc * 2 * M_PI / (cycles - 0.5), M_PI); + hp->i = M_PI; + s = -s; + } + break; + case BIRDIE: + hp->j = oldi; + hp->i = (1 - hp->c) * cos(M_PI * hp->a * oldj) + hp->c * hp->b; + hp->b = oldj; + break; + case TRIG: + { + double r2 = oldi * oldi + oldj * oldj; + + hp->i = hp->a + hp->b * (oldi * cos(r2) - oldj * sin(r2)); + hp->j = hp->b * (oldj * cos(r2) + oldi * sin(r2)); + } + break; + case CUBIC: + hp->i = oldj; + hp->j = hp->a * oldj - oldj * oldj * oldj - hp->b * oldi; + break; + case AILUJ: + hp->i = ((LRAND() < MAXRAND / 2) ? -1 : 1) * + sqrt(((oldi - hp->a) + + sqrt((oldi - hp->a) * (oldi - hp->a) + (oldj - hp->b) * (oldj - hp->b))) / 2); + hp->j = (oldj - hp->b) / (2 * hp->i); + break; + } + xp->x = hp->maxx / 2 + (int) ((hp->i - hp->ic) * hp->is); + xp->y = hp->maxy / 2 - (int) ((hp->j - hp->jc) * hp->js); + xp++; + } + XDrawPoints(dsp, win, gc, hp->pointBuffer, batchcount, CoordModeOrigin); + if (++hp->count > cycles) { +#ifdef STANDALONE + erase_full_window(MI_DISPLAY(mi), MI_WINDOW(mi)); +#endif /* STANDALONE */ + init_discrete(mi); + } +} + +void +release_discrete(ModeInfo * mi) +{ + if (discretes != NULL) { + int screen; + + for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) { + discretestruct *hp = &discretes[screen]; + + if (hp->pointBuffer != NULL) + (void) free((void *) hp->pointBuffer); + } + (void) free((void *) discretes); + discretes = NULL; + } +} + +void +refresh_discrete(ModeInfo * mi) +{ + MI_CLEARWINDOW(mi); +} diff --git a/hacks/epicycle.c b/hacks/epicycle.c index addaaaaf..eed186ca 100644 --- a/hacks/epicycle.c +++ b/hacks/epicycle.c @@ -50,8 +50,8 @@ char *progclass="Epicycle"; * to get pleasing figures. */ char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*colors: 100", "*color0: red", "*delay: 1000", diff --git a/hacks/flame.c b/hacks/flame.c index bbdbfdec..851b2615 100644 --- a/hacks/flame.c +++ b/hacks/flame.c @@ -381,8 +381,8 @@ int matherr(x) char *progclass = "Flame"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*colors: 64", "*iterations: 25", "*delay: 50000", diff --git a/hacks/glx/Makefile.in b/hacks/glx/Makefile.in index 18df9f6e..f85df1cf 100644 --- a/hacks/glx/Makefile.in +++ b/hacks/glx/Makefile.in @@ -30,6 +30,7 @@ SHELL = /bin/sh INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +INSTALL_DIRS = @INSTALL_DIRS@ HACKDIR = @HACKDIR@ X_CFLAGS = @X_CFLAGS@ @@ -37,6 +38,8 @@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ +# Note: see comment in ../driver/Makefile.in for explanation of X_LIBS, etc. +# HACK_LIBS = $(LIBS) $(X_LIBS) $(X_PRE_LIBS) @GL_LIBS@ @HACK_LIBS@ \ -lXt -lX11 -lXext $(X_EXTRA_LIBS) -lm @@ -92,6 +95,7 @@ install-strip: install-program: @exes="$(EXES)" ; \ + if [ ! -d $(HACKDIR) ]; then $(INSTALL_DIRS) $(HACKDIR) ; fi ; \ for program in $$exes; do \ echo $(INSTALL_PROGRAM) $$program $(HACKDIR)/$$program ; \ $(INSTALL_PROGRAM) $$program $(HACKDIR)/$$program ; \ @@ -99,6 +103,7 @@ install-program: install-man: @men="$(MEN)" ; \ + if [ ! -d $(man1dir) ]; then $(INSTALL_DIRS) $(man1dir) ; fi ; \ for man in $$men; do \ instname=`echo $$man | sed 's/\.man$$/\.$(mansuffix)/'` ; \ echo $(INSTALL_DATA) $(srcdir)/$$man $(man1dir)/$$instname ; \ @@ -136,7 +141,7 @@ depend: # close. This excludes dependencies on files in /usr/include, etc. It tries # to include only dependencies on files which are themselves a part of this # package. -distdepend: +distdepend:: @echo updating dependencies in `pwd`/Makefile.in... ; \ $(DEPEND) -w 0 -f - \ -s '# DO NOT DELETE: updated by make distdepend' $(DEPEND_FLAGS) -- \ diff --git a/hacks/goop.c b/hacks/goop.c index f31f9b91..8619c9ff 100644 --- a/hacks/goop.c +++ b/hacks/goop.c @@ -488,8 +488,8 @@ run_goop (Display *dpy, Window window, struct goop *goop) char *progclass = "Goop"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*delay: 12000", "*transparent: true", "*additive: true", diff --git a/hacks/greynetic.c b/hacks/greynetic.c index 6018d125..0ffb332a 100644 --- a/hacks/greynetic.c +++ b/hacks/greynetic.c @@ -159,8 +159,8 @@ greynetic (Display *dpy, Window window) char *progclass = "Greynetic"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*delay: 0", 0 }; diff --git a/hacks/halo.c b/hacks/halo.c index 80166335..f159a02a 100644 --- a/hacks/halo.c +++ b/hacks/halo.c @@ -417,8 +417,8 @@ run_circles (Display *dpy, Window window) char *progclass = "Halo"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*colorMode: random", "*colors: 100", "*cycle: true", diff --git a/hacks/helix.c b/hacks/helix.c index 3a26984e..97de40dc 100644 --- a/hacks/helix.c +++ b/hacks/helix.c @@ -282,7 +282,7 @@ random_helix_or_trig (Display *dpy, Window window) char *progclass = "Helix"; char *defaults [] = { - "*background: black", + ".background: black", "*delay: 5", 0 }; diff --git a/hacks/hypercube.c b/hacks/hypercube.c index 3fef0e6a..6ad94a83 100644 --- a/hacks/hypercube.c +++ b/hacks/hypercube.c @@ -219,8 +219,8 @@ hyper (double xy, double xz, double yz, double xw, double yw, double zw) char *progclass = "Hypercube"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*color0: red", "*color1: orange", "*color2: yellow", diff --git a/hacks/imsmap.c b/hacks/imsmap.c index a6b53cd6..fa861ac0 100644 --- a/hacks/imsmap.c +++ b/hacks/imsmap.c @@ -453,8 +453,8 @@ draw_map (Display *dpy, Window window) char *progclass = "Imsmap"; char *defaults [] = { - "*background: black", - "*foreground: black", + ".background: black", + ".foreground: black", "*mode: random", "*ncolors: 50", "*iterations: 7", diff --git a/hacks/jigsaw.c b/hacks/jigsaw.c index 892315e7..0a210307 100644 --- a/hacks/jigsaw.c +++ b/hacks/jigsaw.c @@ -533,8 +533,8 @@ done(void) char *progclass = "Jigsaw"; char *defaults [] = { - "*background: Black", - "*foreground: Gray40", + ".background: Black", + ".foreground: Gray40", "*delay: 70000", "*delay2: 5", 0 diff --git a/hacks/kaleidescope.c b/hacks/kaleidescope.c index 22f4a9b0..78890147 100644 --- a/hacks/kaleidescope.c +++ b/hacks/kaleidescope.c @@ -83,8 +83,8 @@ OBJECT *objects; char *progclass = "Kaleidescope"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*color_mode: nice", "*symmetry: 11", "*ntrails: 100", diff --git a/hacks/lmorph.c b/hacks/lmorph.c index 70c91eee..f372c1ee 100644 --- a/hacks/lmorph.c +++ b/hacks/lmorph.c @@ -7,18 +7,37 @@ * DESCRIPTION Bilinear interpolation for morphing line shapes. * * WRITTEN BY Sverre H. Huseby Glenn T. Lines - * Maridalsvn. 122, leil 101 Frysjavn. 3, 5. etg. - * N-0461 Oslo N-0883 Oslo + * Kurvn. 30 Østgaardsgt. 5 + * N-0495 Oslo N-0474 Oslo * Norway Norway * - * Phone: +47 22 71 99 08 Phone: +47 22 23 71 99 - * E-mail: sverrehu@ifi.uio.no E-mail: gtl@si.sintef.no + * Phone: +47 901 63 579 Phone: +47 22 04 67 28 + * E-mail: sverrehu@online.no E-mail: gtl@si.sintef.no + * URL: http://home.sol.no/~sverrehu/ * * The original idea, and the bilinear interpolation * mathematics used, emerged in the head of the wise - * Glenn Terje Lines. + * Glenn T. Lines. * - * MODIFICATIONS march 1995 + * MODIFICATIONS june 1998 (shh) + * * Minor code cleanup. + * + * march 1997 (shh) + * * Added -mailfile option to allow checking for + * new mail while the screensaver is active. + * + * january 1997 (shh) + * * Some code reformatting. + * * Added possibility to use float arithmetic. + * * Added -figtype option. + * * Made color blue default. + * + * december 1995 (jwz) + * * Function headers converted from ANSI to K&R. + * * Added posibility for random number of steps, and + * made this the default. + * + * march 1995 (shh) * * Converted from an MS-Windows program to X Window. * **************************************************************************/ @@ -35,38 +54,43 @@ * * **************************************************************************/ -/* Define MARGINS to make some space around the figure */ -#define MARGINS /**/ +/* define MARGINS to make some space around the figure. */ +#define MARGINS + +/* define USE_FLOAT to avoid using integer calculations in + createPoints. integer calculation is supposed to be faster, but it + won't work for displays larger than 2048x2048 or so pixels. */ +#undef USE_FLOAT #define MAXFIGS 20 #define TWO_PI (2.0 * M_PI) #define RND(x) (random() % (x)) + +#define FT_OPEN 1 +#define FT_CLOSED 2 +#define FT_ALL (FT_OPEN | FT_CLOSED) + static int - cFig = 0, /* Number of figure arrays. */ - cPoint, /* Number of points in each array. */ - nWork, /* Current work array number. */ - nFrom, /* Current from array number. */ - nTo; /* Current to array number. */ -static long - delay; /* usecs to wait between updates. */ + numFigs = 0, /* number of figure arrays. */ + numPoints, /* number of points in each array. */ + nWork, /* current work array number. */ + nFrom, /* current from array number. */ + nTo, /* current to array number. */ + figType; +static long delay; /* usecs to wait between updates. */ static XPoint - *aWork[2], /* Working arrays. */ - *a[MAXFIGS], /* The figure arrays. */ - *aTmp, /* Used as source when interrupting morph */ - *aPrev, /* Previous points displayed. */ - *aCurr, /* The current points displayed. */ - *aFrom, /* Figure converting from. */ - *aTo; /* Figure converting to. */ -static double - gam, - maxGamma = 1.0, - delta_gam; -static GC - gcDraw, gcClear; -static Display - *dpy; -static Window - window; + *aWork[2], /* working arrays. */ + *a[MAXFIGS], /* the figure arrays. */ + *aTmp, /* used as source when interrupting morph */ + *aPrev, /* previous points displayed. */ + *aCurr, /* the current points displayed. */ + *aFrom, /* figure converting from. */ + *aTo; /* figure converting to. */ +static int scrWidth, scrHeight; +static double currGamma, maxGamma = 1.0, deltaGamma; +static GC gcDraw, gcClear; +static Display *dpy; +static Window window; @@ -79,20 +103,24 @@ static Window char *progclass = "LMorph"; char *defaults [] = { - "LMorph.background: black", - "LMorph.foreground: green", + ".background: black", + ".foreground: blue", "*points: 150", "*steps: 0", "*delay: 50000", + "*figtype: all", 0 }; XrmOptionDescRec options [] = { - { "-points", ".points", XrmoptionSepArg, 0 }, - { "-steps", ".steps", XrmoptionSepArg, 0 }, - { "-delay", ".delay", XrmoptionSepArg, 0 }, + { "-points", ".points", XrmoptionSepArg, 0 }, + { "-steps", ".steps", XrmoptionSepArg, 0 }, + { "-delay", ".delay", XrmoptionSepArg, 0 }, + { "-figtype", ".figtype", XrmoptionSepArg, 0 }, { 0, 0, 0, 0 } }; +int options_size = (sizeof (options) / sizeof (options[0])); + /************************************************************************** @@ -113,308 +141,220 @@ xmalloc(size_t size) return ret; } - - -static double frnd (void) -{ - /* - * Hm. for some reason the second line (using RAND_MAX) didn't - * work on some machines, so I always use the first. - */ -#ifndef dont_use_RAND_MAX - return (double) (random() & 0x7FFF) / 0x7FFF; -#else /* RAND_MAX */ - return ((double) random()) / RAND_MAX; -#endif /* RAND_MAX */ -} - - - -static void initPointArrays (void) +static void +initPointArrays(void) { - XWindowAttributes wa; int q, w, - mx, my, /* Max screen coordinates. */ - mp, /* Max point number. */ + mx, my, /* max screen coordinates. */ + mp, /* max point number. */ s, rx, ry, marginx, marginy; double scalex, scaley; - XGetWindowAttributes(dpy, window, &wa); - mx = wa.width - 1; - my = wa.height - 1; - mp = cPoint - 1; - - aWork[0] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - aWork[1] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - aTmp = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - - - /* - * Figure 0 - */ - a[cFig] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - s = cPoint / 4; - for (q = 0; q < s; q++) { - a[cFig][q].x = ((double) q / s) * mx; - a[cFig][q].y = 0; - a[cFig][s + q].x = mx; - a[cFig][s + q].y = ((double) q / s) * my; - a[cFig][2 * s + q].x = mx - ((double) q / s) * mx; - a[cFig][2 * s + q].y = my; - a[cFig][3 * s + q].x = 0; - a[cFig][3 * s + q].y = my - ((double) q / s) * my; - } - for (q = 4 * s; q < cPoint; q++) - a[cFig][q].x = a[cFig][q].y = 0; - a[cFig][mp].x = a[cFig][0].x; - a[cFig][mp].y = a[cFig][0].y; - ++cFig; - - /* - * Figure 1 - */ - a[cFig] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - for (q = 0; q < cPoint; q++) { - a[cFig][q].x = ((double) q / cPoint) * mx; - a[cFig][q].y = (1.0 - sin(((double) q / mp) * TWO_PI)) * my / 2.0; - } - ++cFig; - - /* - * Figure 2 - */ - a[cFig] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - rx = mx / 2; - ry = my / 2; - for (q = 0; q < cPoint; q++) { - a[cFig][q].x = mx / 2 + rx * sin(1 * TWO_PI * (double) q / mp); - a[cFig][q].y = my / 2 + ry * cos(3 * TWO_PI * (double) q / mp); - } - a[cFig][mp].x = a[cFig][0].x; - a[cFig][mp].y = a[cFig][0].y; - ++cFig; - - /* - * Figure 3 - */ - a[cFig] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - rx = mx / 2; - ry = my / 2; - for (q = 0; q < cPoint; q++) { - a[cFig][q].x = mx / 2 + ry * sin(3 * TWO_PI * (double) q / mp); - a[cFig][q].y = my / 2 + ry * cos(1 * TWO_PI * (double) q / mp); - } - a[cFig][mp].x = a[cFig][0].x; - a[cFig][mp].y = a[cFig][0].y; - ++cFig; - - /* - * Figure 4 - */ - a[cFig] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - rx = mx / 2; - ry = my / 2; - for (q = 0; q < cPoint; q++) { - a[cFig][q].x = mx / 2 + ry * (1 - 0.1 * frnd()) - * sin(TWO_PI * (double) q / mp); - a[cFig][q].y = my / 2 + ry * (1 - 0.1 * frnd()) - * cos(TWO_PI * (double) q / mp); - } - a[cFig][mp].x = a[cFig][0].x; - a[cFig][mp].y = a[cFig][0].y; - ++cFig; - - /* - * Figure 5 - */ - a[cFig] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - rx = mx / 2; - ry = my / 2; - for (q = 0; q < cPoint; q++) { - a[cFig][q].x = mx / 2 + ry * (0.8 - 0.2 * sin(30 * TWO_PI * q / mp)) - * sin(TWO_PI * (double) q / mp); - a[cFig][q].y = my / 2 + ry * (0.8 - 0.2 * sin(30 * TWO_PI * q / mp)) - * cos(TWO_PI * (double) q / mp); - } - a[cFig][mp].x = a[cFig][0].x; - a[cFig][mp].y = a[cFig][0].y; - ++cFig; - - /* - * Figure 6 - */ - a[cFig] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - rx = mx / 2; - ry = my / 2; - for (q = 0; q < cPoint; q++) { - a[cFig][q].x = mx / 2 + ry * sin(TWO_PI * (double) q / mp); - a[cFig][q].y = my / 2 + ry * cos(TWO_PI * (double) q / mp); - } - a[cFig][mp].x = a[cFig][0].x; - a[cFig][mp].y = a[cFig][0].y; - ++cFig; - - /* - * Figure 7 - */ - a[cFig] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - rx = mx / 2; - ry = my / 2; - for (q = 0; q < cPoint; q++) { - a[cFig][q].x = mx / 2 + rx * cos(TWO_PI * (double) q / mp); - a[cFig][q].y = my / 2 + ry * sin(TWO_PI * (double) q / mp); - } - a[cFig][mp].x = a[cFig][0].x; - a[cFig][mp].y = a[cFig][0].y; - ++cFig; - - /* - * Figure 8 - */ - a[cFig] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - for (q = 0; q < cPoint; q++) { - a[cFig][q].x = ((double) q / mp) * mx; - a[cFig][q].y = (1.0 - cos(((double) q / mp) * 3 * TWO_PI)) * my / 2.0; - } - ++cFig; - - /* - * Figure 9 - */ - a[cFig] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - rx = mx / 2; - ry = my / 2; - for (q = 0; q < cPoint; q++) { - a[cFig][q].x = mx / 2 + rx * sin(2 * TWO_PI * (double) q / mp); - a[cFig][q].y = my / 2 + ry * cos(3 * TWO_PI * (double) q / mp); - } - a[cFig][mp].x = a[cFig][0].x; - a[cFig][mp].y = a[cFig][0].y; - ++cFig; - - /* - * Figure 10 - */ - a[cFig] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - rx = mx / 2; - ry = my / 2; - for (q = 0; q < cPoint; q++) { - a[cFig][q].x = mx / 2 + ry * sin(5 * TWO_PI * (double) q / mp) - * ((double) q / mp); - a[cFig][q].y = my / 2 + ry * cos(5 * TWO_PI * (double) q / mp) - * ((double) q / mp); - } - ++cFig; - - /* - * Figure 11 - */ - a[cFig] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - rx = mx / 2; - ry = my / 2; - for (q = 0; q < cPoint; q++) { - a[cFig][q].x = mx / 2 + ry * sin(6 * TWO_PI * (double) q / mp) - * ((double) q / mp); - a[cFig][q].y = my / 2 - ry * cos(6 * TWO_PI * (double) q / mp) - * ((double) q / mp); + mx = scrWidth - 1; + my = scrHeight - 1; + mp = numPoints - 1; + + aWork[0] = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + aWork[1] = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + aTmp = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + + if (figType & FT_CLOSED) { + /* rectangle */ + a[numFigs] = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + s = numPoints / 4; + for (q = 0; q < s; q++) { + a[numFigs][q].x = ((double) q / s) * mx; + a[numFigs][q].y = 0; + a[numFigs][s + q].x = mx; + a[numFigs][s + q].y = ((double) q / s) * my; + a[numFigs][2 * s + q].x = mx - ((double) q / s) * mx; + a[numFigs][2 * s + q].y = my; + a[numFigs][3 * s + q].x = 0; + a[numFigs][3 * s + q].y = my - ((double) q / s) * my; + } + for (q = 4 * s; q < numPoints; q++) + a[numFigs][q].x = a[numFigs][q].y = 0; + a[numFigs][mp].x = a[numFigs][0].x; + a[numFigs][mp].y = a[numFigs][0].y; + ++numFigs; + + /* */ + a[numFigs] = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + rx = mx / 2; + ry = my / 2; + for (q = 0; q < numPoints; q++) { + a[numFigs][q].x = mx / 2 + rx * sin(1 * TWO_PI * (double) q / mp); + a[numFigs][q].y = my / 2 + ry * cos(3 * TWO_PI * (double) q / mp); + } + a[numFigs][mp].x = a[numFigs][0].x; + a[numFigs][mp].y = a[numFigs][0].y; + ++numFigs; + + /* */ + a[numFigs] = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + rx = mx / 2; + ry = my / 2; + for (q = 0; q < numPoints; q++) { + a[numFigs][q].x = mx / 2 + ry * sin(3 * TWO_PI * (double) q / mp); + a[numFigs][q].y = my / 2 + ry * cos(1 * TWO_PI * (double) q / mp); + } + a[numFigs][mp].x = a[numFigs][0].x; + a[numFigs][mp].y = a[numFigs][0].y; + ++numFigs; + + /* */ + a[numFigs] = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + rx = mx / 2; + ry = my / 2; + for (q = 0; q < numPoints; q++) { + a[numFigs][q].x = mx / 2 + ry + * (0.8 - 0.2 * sin(30 * TWO_PI * q / mp)) + * sin(TWO_PI * (double) q / mp); + a[numFigs][q].y = my / 2 + ry + * (0.8 - 0.2 * sin(30 * TWO_PI * q / mp)) + * cos(TWO_PI * (double) q / mp); + } + a[numFigs][mp].x = a[numFigs][0].x; + a[numFigs][mp].y = a[numFigs][0].y; + ++numFigs; + + /* */ + a[numFigs] = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + rx = mx / 2; + ry = my / 2; + for (q = 0; q < numPoints; q++) { + a[numFigs][q].x = mx / 2 + ry * sin(TWO_PI * (double) q / mp); + a[numFigs][q].y = my / 2 + ry * cos(TWO_PI * (double) q / mp); + } + a[numFigs][mp].x = a[numFigs][0].x; + a[numFigs][mp].y = a[numFigs][0].y; + ++numFigs; + + /* */ + a[numFigs] = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + rx = mx / 2; + ry = my / 2; + for (q = 0; q < numPoints; q++) { + a[numFigs][q].x = mx / 2 + rx * cos(TWO_PI * (double) q / mp); + a[numFigs][q].y = my / 2 + ry * sin(TWO_PI * (double) q / mp); + } + a[numFigs][mp].x = a[numFigs][0].x; + a[numFigs][mp].y = a[numFigs][0].y; + ++numFigs; + + /* */ + a[numFigs] = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + rx = mx / 2; + ry = my / 2; + for (q = 0; q < numPoints; q++) { + a[numFigs][q].x = mx / 2 + rx * sin(2 * TWO_PI * (double) q / mp); + a[numFigs][q].y = my / 2 + ry * cos(3 * TWO_PI * (double) q / mp); + } + a[numFigs][mp].x = a[numFigs][0].x; + a[numFigs][mp].y = a[numFigs][0].y; + ++numFigs; } - ++cFig; - - /* - * Figure 12 - */ - a[cFig] = (XPoint *) xmalloc(cPoint * sizeof(XPoint)); - for (q = 0; q < cPoint; q++) { - a[cFig][q].x = ((double) q / mp) * mx; - a[cFig][q].y = (1.0 - sin(((double) q / mp) * 5 * TWO_PI)) * my / 2.0; + + if (figType & FT_OPEN) { + /* sine wave, one period */ + a[numFigs] = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + for (q = 0; q < numPoints; q++) { + a[numFigs][q].x = ((double) q / numPoints) * mx; + a[numFigs][q].y = (1.0 - sin(((double) q / mp) * TWO_PI)) + * my / 2.0; + } + ++numFigs; + + /* */ + a[numFigs] = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + for (q = 0; q < numPoints; q++) { + a[numFigs][q].x = ((double) q / mp) * mx; + a[numFigs][q].y = (1.0 - cos(((double) q / mp) * 3 * TWO_PI)) + * my / 2.0; + } + ++numFigs; + + /* spiral, one endpoint at bottom */ + a[numFigs] = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + rx = mx / 2; + ry = my / 2; + for (q = 0; q < numPoints; q++) { + a[numFigs][q].x = mx / 2 + ry * sin(5 * TWO_PI * (double) q / mp) + * ((double) q / mp); + a[numFigs][q].y = my / 2 + ry * cos(5 * TWO_PI * (double) q / mp) + * ((double) q / mp); + } + ++numFigs; + + /* spiral, one endpoint at top */ + a[numFigs] = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + rx = mx / 2; + ry = my / 2; + for (q = 0; q < numPoints; q++) { + a[numFigs][q].x = mx / 2 + ry * sin(6 * TWO_PI * (double) q / mp) + * ((double) q / mp); + a[numFigs][q].y = my / 2 - ry * cos(6 * TWO_PI * (double) q / mp) + * ((double) q / mp); + } + ++numFigs; + + /* */ + a[numFigs] = (XPoint *) xmalloc(numPoints * sizeof(XPoint)); + for (q = 0; q < numPoints; q++) { + a[numFigs][q].x = ((double) q / mp) * mx; + a[numFigs][q].y = (1.0 - sin(((double) q / mp) * 5 * TWO_PI)) + * my / 2.0; + } + ++numFigs; } - ++cFig; #ifdef MARGINS - /* - * Make some space around the figures. - */ + /* make some space around the figures. */ marginx = (mx + 1) / 10; marginy = (my + 1) / 10; scalex = (double) ((mx + 1) - 2.0 * marginx) / (mx + 1.0); scaley = (double) ((my + 1) - 2.0 * marginy) / (my + 1.0); - for (q = 0; q < cFig; q++) - for (w = 0; w < cPoint; w++) { + for (q = 0; q < numFigs; q++) + for (w = 0; w < numPoints; w++) { a[q][w].x = marginx + a[q][w].x * scalex; a[q][w].y = marginy + a[q][w].y * scaley; } #endif } - - -static void createPoints (void) -{ - int q; - XPoint *pa = aCurr, *pa1 = aFrom, *pa2 = aTo; - long lg, l1g; - - - lg = 8192L * gam, l1g = 8192L * (1.0 - gam); - for (q = 0; q < cPoint; q++) { - pa->x = (short) ((l1g * pa1->x + lg * pa2->x) / 8192L); - pa->y = (short) ((l1g * pa1->y + lg * pa2->y) / 8192L); - ++pa; - ++pa1; - ++pa2; - } -} - - -static void drawImage (void) -{ - register int q; - XPoint *old0, *old1, *new0, *new1; - - /* - * Problem: update the window without too much flickering. I do - * this by handling each linesegment separately. First remove a - * line, then draw the new line. The problem is that this leaves - * small black pixels on the figure. To fix this, I draw the - * entire figure using XDrawLines() afterwards. - */ - if (aPrev) { - old0 = aPrev; - old1 = aPrev + 1; - new0 = aCurr; - new1 = aCurr + 1; - for (q = cPoint - 1; q; q--) { - XDrawLine(dpy, window, gcClear, - old0->x, old0->y, old1->x, old1->y); - XDrawLine(dpy, window, gcDraw, - new0->x, new0->y, new1->x, new1->y); - ++old0; - ++old1; - ++new0; - ++new1; - } - } - XDrawLines(dpy, window, gcDraw, aCurr, cPoint, CoordModeOrigin); - XFlush(dpy); -} - -static void initLMorph (void) +static void +initLMorph(void) { int steps; XGCValues gcv; XWindowAttributes wa; Colormap cmap; + char *ft; - cPoint = get_integer_resource("points", "Integer"); + numPoints = get_integer_resource("points", "Integer"); steps = get_integer_resource("steps", "Integer"); delay = get_integer_resource("delay", "Integer"); + ft = get_string_resource("figtype", "String"); + + if (strcmp(ft, "all") == 0) + figType = FT_ALL; + else if (strcmp(ft, "open") == 0) + figType = FT_OPEN; + else if (strcmp(ft, "closed") == 0) + figType = FT_CLOSED; + else { + fprintf(stderr, "figtype should be `all', `open' or `closed'.\n"); + figType = FT_ALL; + } if (steps <= 0) steps = (random() % 400) + 100; - delta_gam = 1.0 / steps; + deltaGamma = 1.0 / steps; XGetWindowAttributes(dpy, window, &wa); + scrWidth = wa.width; + scrHeight = wa.height; cmap = wa.colormap; gcv.foreground = get_pixel_resource("foreground", "Foreground", dpy, cmap); gcDraw = XCreateGC(dpy, window, GCForeground, &gcv); @@ -423,13 +363,14 @@ static void initLMorph (void) gcClear = XCreateGC(dpy, window, GCForeground, &gcv); XClearWindow(dpy, window); + srandom(time(NULL)); initPointArrays(); aCurr = aWork[nWork = 0]; aPrev = NULL; - gam = 2.0; - nTo = RND(cFig); + currGamma = maxGamma + 1.0; /* force creation of new figure at startup */ + nTo = RND(numFigs); - { + { /* jwz for version 2.11 */ int width = random() % 10; int style = LineSolid; int cap = (width > 1 ? CapRound : CapButt); @@ -438,45 +379,108 @@ static void initLMorph (void) XSetLineAttributes(dpy, gcDraw, width, style, cap, join); XSetLineAttributes(dpy, gcClear, width, style, cap, join); } +} + +/* 55% of execution time */ +static void +createPoints(void) +{ + int q; + XPoint *pa = aCurr, *pa1 = aFrom, *pa2 = aTo; +#ifdef USE_FLOAT + float fg, f1g; +#else + long lg, l1g; +#endif + +#ifdef USE_FLOAT + fg = currGamma; + f1g = 1.0 - currGamma; +#else + lg = 8192L * currGamma; + l1g = 8192L * (1.0 - currGamma); +#endif + for (q = numPoints; q; q--) { +#ifdef USE_FLOAT + pa->x = (short) (f1g * pa1->x + fg * pa2->x); + pa->y = (short) (f1g * pa1->y + fg * pa2->y); +#else + pa->x = (short) ((l1g * pa1->x + lg * pa2->x) / 8192L); + pa->y = (short) ((l1g * pa1->y + lg * pa2->y) / 8192L); +#endif + ++pa; + ++pa1; + ++pa2; + } +} + +/* 36% of execution time */ +static void +drawImage(void) +{ + int q; + XPoint *old0, *old1, *new0, *new1; + + /* Problem: update the window without too much flickering. I do + * this by handling each linesegment separately. First remove a + * line, then draw the new line. The problem is that this leaves + * small black pixels on the figure. To fix this, I draw the + * entire figure using XDrawLines() afterwards. */ + if (aPrev) { + old0 = aPrev; + old1 = aPrev + 1; + new0 = aCurr; + new1 = aCurr + 1; + for (q = numPoints - 1; q; q--) { + XDrawLine(dpy, window, gcClear, + old0->x, old0->y, old1->x, old1->y); + XDrawLine(dpy, window, gcDraw, + new0->x, new0->y, new1->x, new1->y); + ++old0; + ++old1; + ++new0; + ++new1; + } + } + XDrawLines(dpy, window, gcDraw, aCurr, numPoints, CoordModeOrigin); + XFlush(dpy); } -static void animateLMorph (void) +/* neglectible % of execution time */ +static void +animateLMorph(void) { - if (gam > maxGamma) { - gam = 0.0; + if (currGamma > maxGamma) { + currGamma = 0.0; if (maxGamma == 1.0) { nFrom = nTo; aFrom = a[nFrom]; } else { - memcpy(aTmp, aCurr, cPoint * sizeof(XPoint)); + memcpy(aTmp, aCurr, numPoints * sizeof(XPoint)); aFrom = aTmp; nFrom = -1; } do { - nTo = RND(cFig); + nTo = RND(numFigs); } while (nTo == nFrom); aTo = a[nTo]; if (RND(2)) { - /* - * Reverse the array to get more variation. - */ + /* reverse the array to get more variation. */ int i1, i2; XPoint p; - for (i1 = 0, i2 = cPoint - 1; i1 < cPoint / 2; i1++, i2--) { + for (i1 = 0, i2 = numPoints - 1; i1 < numPoints / 2; i1++, i2--) { p = aTo[i1]; aTo[i1] = aTo[i2]; aTo[i2] = p; } } - /* - * It may be nice to interrupt the next run. - */ - if (RND(3) > 0) - maxGamma = 0.1 + 0.7 * (RND(1001) / 1000.0); + /* occationally interrupt the next run. */ + if (RND(4) == 0) + maxGamma = 0.1 + 0.7 * (RND(1001) / 1000.0); /* partial run */ else - maxGamma = 1.0; + maxGamma = 1.0; /* full run */ } createPoints(); @@ -484,7 +488,7 @@ static void animateLMorph (void) aPrev = aCurr; aCurr = aWork[nWork ^= 1]; - gam += delta_gam; + currGamma += deltaGamma; } diff --git a/hacks/lmorph.man b/hacks/lmorph.man index a631f24c..63ab3f69 100644 --- a/hacks/lmorph.man +++ b/hacks/lmorph.man @@ -3,7 +3,7 @@ lmorph \- morphing lines .SH SYNOPSIS .B lmorph -[\-display \fIhost:display.screen\fP] [\-foreground \fIcolor\fP] [\-background \fIcolor\fP] [\-window] [\-root] [\-mono] [\-install] [\-visual \fIvisual\fP] [\-points \fIint\fP] [\-steps \fIint\fP] [\-delay \fIusecs\fP] +[\-display \fIhost:display.screen\fP] [\-foreground \fIcolor\fP] [\-background \fIcolor\fP] [\-window] [\-root] [\-mono] [\-install] [\-visual \fIvisual\fP] [\-points \fIint\fP] [\-steps \fIint\fP] [\-delay \fIusecs\fP] [\-figtype \fItype\fP] .SH DESCRIPTION The \fIlmorph\fP program morphs between simple linedrawings using bilinear interpolation. @@ -37,6 +37,10 @@ means a random number between 100 and 500. .B \-delay \fImicroseconds\fP How much of a delay should be introduced between steps of the animation. Default 50000. +.TP 8 +.B \-figtype \fItype\fP +Limit the figures to only open or closed figures. Possible types are +"all" (default), "open" and "closed". .SH ENVIRONMENT .PP .TP 8 @@ -50,5 +54,5 @@ stored in the RESOURCE_MANAGER property. .BR X (1), .BR xscreensaver (1) .SH AUTHOR -Sverre H. Huseby and Glenn T. Lines , +Sverre H. Huseby and Glenn T. Lines , built on top of the screen saver routines by Jamie Zawinski . diff --git a/hacks/maze.c b/hacks/maze.c index a037f3db..dbb77535 100644 --- a/hacks/maze.c +++ b/hacks/maze.c @@ -1324,8 +1324,8 @@ enter_square (int n) /* move into a neighboring square */ char *progclass = "Maze"; char *defaults[] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*gridSize: 0", "*solveDelay: 5000", "*preDelay: 2000000", diff --git a/hacks/moire.c b/hacks/moire.c index 9ce9097d..4b48484c 100644 --- a/hacks/moire.c +++ b/hacks/moire.c @@ -161,8 +161,8 @@ moire (Display *dpy, Window window, int offset, XColor *colors, int ncolors) char *progclass = "Moire"; char *defaults [] = { - "*background: blue", - "*foreground: red", + ".background: blue", + ".foreground: red", "*random: true", "*delay: 5", "*ncolors: 64", diff --git a/hacks/moire2.c b/hacks/moire2.c index 61d68c70..ee85b89e 100644 --- a/hacks/moire2.c +++ b/hacks/moire2.c @@ -207,8 +207,8 @@ moire2 (Display *dpy, Window window) char *progclass = "Moire2"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*delay: 50000", "*thickness: 0", "*colors: 150", diff --git a/hacks/munch.c b/hacks/munch.c index b686b95a..352c5dc9 100644 --- a/hacks/munch.c +++ b/hacks/munch.c @@ -44,8 +44,8 @@ char *progclass = "Munch"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*delay: 5000", "*hold: 100000", "*clear: 50", diff --git a/hacks/noseguy.c b/hacks/noseguy.c index 606e9fef..f23e8b6f 100644 --- a/hacks/noseguy.c +++ b/hacks/noseguy.c @@ -610,8 +610,8 @@ get_words (void) char *progclass = "Noseguy"; char *defaults [] = { - "*background: black", - "*foreground: gray80", + ".background: black", + ".foreground: gray80", #ifndef VMS "*mode: program", #else diff --git a/hacks/pedal.c b/hacks/pedal.c index 5d11097d..4306f8a2 100644 --- a/hacks/pedal.c +++ b/hacks/pedal.c @@ -351,8 +351,8 @@ char *progclass = "Pedal"; * should be dark. */ char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*delay: 5", "*fadedelay: 200000", "*maxlines: 1000", diff --git a/hacks/pyro.c b/hacks/pyro.c index 4aa71da7..b62e17ac 100644 --- a/hacks/pyro.c +++ b/hacks/pyro.c @@ -223,8 +223,8 @@ pyro (Display *dpy, Window window, Colormap cmap) char *progclass = "Pyro"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*count: 100", "*frequency: 30", "*scatter: 20", diff --git a/hacks/qix.c b/hacks/qix.c index c86bf646..f2898f1c 100644 --- a/hacks/qix.c +++ b/hacks/qix.c @@ -454,8 +454,8 @@ qix1 (Display *dpy, Window window, struct qix *qix) char *progclass = "Qix"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*count: 1", "*segments: 50", "*poly: 2", diff --git a/hacks/rd-bomb.c b/hacks/rd-bomb.c index 65295710..867ecf03 100644 --- a/hacks/rd-bomb.c +++ b/hacks/rd-bomb.c @@ -282,8 +282,8 @@ char *progclass = "RD"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*width: 0", /* tried to use -1 but it complained */ "*height: 0", "*epoch: 40000", diff --git a/hacks/rocks.c b/hacks/rocks.c index fa5e5048..f70f26c2 100644 --- a/hacks/rocks.c +++ b/hacks/rocks.c @@ -488,8 +488,8 @@ init_rocks (Display *d, Window w) char *progclass = "Rocks"; char *defaults [] = { - "*background: Black", - "*foreground: #E9967A", + ".background: Black", + ".foreground: #E9967A", "*colors: 5", "*count: 100", "*delay: 50000", diff --git a/hacks/rorschach.c b/hacks/rorschach.c index d6e0e225..4b623628 100644 --- a/hacks/rorschach.c +++ b/hacks/rorschach.c @@ -108,8 +108,8 @@ hurm (Display *dpy, Window window) char *progclass = "Rorschach"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*xsymmetry: true", "*ysymmetry: false", "*iterations: 4000", diff --git a/hacks/screenhack.c b/hacks/screenhack.c index 86789e48..1f99b3ab 100644 --- a/hacks/screenhack.c +++ b/hacks/screenhack.c @@ -71,7 +71,7 @@ static XrmOptionDescRec default_options [] = { }; static char *default_defaults[] = { - "*root: false", + ".root: false", "*geometry: 600x480", /* this should be .geometry, but nooooo... */ "*mono: false", "*installColormap: false", @@ -115,6 +115,23 @@ merge_options (void) def_defaults_size * sizeof(*defaults)); memcpy (merged_defaults + def_defaults_size, defaults, (defaults_size + 1) * sizeof(*defaults)); + + /* This totally sucks. Xt should behave like this by default. + If the string in `defaults' looks like ".foo", change that + to "Progclass.foo". + */ + { + char **s; + for (s = merged_defaults; *s; s++) + if (**s == '.') + { + const char *oldr = *s; + char *newr = (char *) malloc(strlen(oldr) + strlen(progclass) + 3); + strcpy (newr, progclass); + strcat (newr, oldr); + *s = newr; + } + } } diff --git a/hacks/slidescreen.c b/hacks/slidescreen.c index f910dbe7..366cdfb9 100644 --- a/hacks/slidescreen.c +++ b/hacks/slidescreen.c @@ -331,8 +331,8 @@ char *defaults [] = { "*visualID: Best", #endif - "SlidePuzzle.background: Black", - "SlidePuzzle.foreground: Gray", + ".background: Black", + ".foreground: Gray", "*gridSize: 70", "*pixelIncrement: 10", "*internalBorderWidth: 4", diff --git a/hacks/starfish.c b/hacks/starfish.c index 75880b5b..89638197 100644 --- a/hacks/starfish.c +++ b/hacks/starfish.c @@ -422,8 +422,8 @@ run_starfish (Display *dpy, Window window, struct starfish *s) char *progclass = "Starfish"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*delay: 10000", "*cycleDelay: 100000", "*thickness: 0", /* pixels, 0 = random */ diff --git a/hacks/xjack.c b/hacks/xjack.c index 6bc76ff2..5711be45 100644 --- a/hacks/xjack.c +++ b/hacks/xjack.c @@ -23,8 +23,8 @@ char *progclass = "XJack"; char *defaults [] = { - "*background: black", - "*foreground: #00EE00", + ".background: black", + ".foreground: #00EE00", "XJack.font: -*-courier-medium-r-*-*-*-240-*-*-m-*-*-*", "*delay: 50000", 0 diff --git a/hacks/xlockmore.h b/hacks/xlockmore.h index 9ad4e98e..b0b7ec41 100644 --- a/hacks/xlockmore.h +++ b/hacks/xlockmore.h @@ -82,6 +82,8 @@ ERROR! Sorry, xlockmore.h requires ANSI C (gcc, for example.) #define MI_COUNT(MI) (MI_BATCHCOUNT((MI))) #define MI_BLACK_PIXEL(MI) (MI_WIN_BLACK_PIXEL(MI)) #define MI_WHITE_PIXEL(MI) (MI_WIN_WHITE_PIXEL(MI)) +#define MI_IS_FULLRANDOM(MI) (MI_WIN_IS_FULLRANDOM(MI)) +#define MI_IS_VERBOSE(MI) (MI_WIN_IS_VERBOSE(MI)) #define MI_CLEARWINDOW(mi) XClearWindow(MI_DISPLAY(mi), MI_WINDOW(mi)) diff --git a/hacks/xlyap.c b/hacks/xlyap.c index a343cfff..908d8d82 100644 --- a/hacks/xlyap.c +++ b/hacks/xlyap.c @@ -47,8 +47,8 @@ char *progclass = "XLyap"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*randomize: false", "*builtin: -1", "*minColor: 1", diff --git a/hacks/xroger-hack.c b/hacks/xroger-hack.c index d8db872c..0138c64a 100644 --- a/hacks/xroger-hack.c +++ b/hacks/xroger-hack.c @@ -14,8 +14,8 @@ char *progclass = "XRoger"; char *defaults [] = { - "XRoger.background: black", - "XRoger.foreground: red", + ".background: black", + ".foreground: red", "*delay: 5", 0 }; diff --git a/setup.com b/setup.com index ec5cd5dc..00f3b031 100644 --- a/setup.com +++ b/setup.com @@ -11,9 +11,11 @@ $ braid :== $'mydir'braid $ bsod :== $'mydir'bsod $ bubbles :== $'mydir'bubbles $ coral :== $'mydir'coral +$ crystal :== $'mydir'crystal $ cynosure :== $'mydir'cynosure $ decayscreen :== $'mydir'decayscreen $ deco :== $'mydir'deco +$ discrete :== $'mydir'discrete $ drift :== $'mydir'drift $ epicycle :== $'mydir'epicycle $ fadeplot :== $'mydir'fadeplot diff --git a/utils/version.h b/utils/version.h index 9fbd8af3..021352d5 100644 --- a/utils/version.h +++ b/utils/version.h @@ -1,2 +1,2 @@ static const char screensaver_id[] = - "@(#)xscreensaver 2.21, by Jamie Zawinski (jwz@netscape.com)"; + "@(#)xscreensaver 2.23, by Jamie Zawinski (jwz@netscape.com)"; diff --git a/xscreensaver.lsm b/xscreensaver.lsm index 6e20d120..d729d382 100644 --- a/xscreensaver.lsm +++ b/xscreensaver.lsm @@ -1,7 +1,7 @@ Begin3 Title: xscreensaver -Version: 2.21 -Entered-date: 15JUN98 +Version: 2.23 +Entered-date: 21JUN98 Description: A modular screen saver and locker for the X Window System. Highly customizable: allows the use of any program that can draw on the root window as a display mode. @@ -11,12 +11,12 @@ Keywords: screen saver, screen lock, lock, xlock, X11 Author: jwz@netscape.com (Jamie Zawinski) Maintained-by: jwz@netscape.com (Jamie Zawinski) Primary-site: ftp.x.org /contrib/applications/ - 805K xscreensaver-2.21.tar.gz - 21K xscreensaver.README + 819K xscreensaver-2.23.tar.gz + 22K xscreensaver.README 1K xscreensaver.lsm Alternate-site: sunsite.unc.edu /pub/Linux/X11/screensavers/ - 805K xscreensaver-2.21.tar.gz - 21K xscreensaver.README + 819K xscreensaver-2.23.tar.gz + 22K xscreensaver.README 1K xscreensaver.lsm Platforms: Linux, Irix, SunOS, Solaris, HPUX, AIX, FreeBSD, NetBSD, BSDI, SCO, OSF1, Ultrix, VMS. -- 2.30.2