From: Zygo Blaxell Date: Mon, 2 Mar 2009 05:42:39 +0000 (-0500) Subject: http://ftp.x.org/contrib/applications/xscreensaver-3.21.tar.gz X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=commitdiff_plain;h=0ed85ca0e4b0eae40a4f50a51d63f2f41e45373a ftp.x.org/contrib/applications/xscreensaver-3.21.tar.gz -rw-r--r-- 1 zblaxell zblaxell 1262926 Nov 17 1999 xscreensaver-3.21.tar.gz 1c47eb3afcf40e676b766131e0686c14c46d86fd xscreensaver-3.21.tar.gz --- diff --git a/Makefile.in b/Makefile.in index 00a5d99d..f1a39486 100644 --- a/Makefile.in +++ b/Makefile.in @@ -161,7 +161,7 @@ update_spec_version:: V=`sed -n 's/.*\([0-9][0-9]*\.[0-9]*\).*/\1/p' < $$U` ; \ echo -n "Updating version number in $$S to \"$$V\"... " ; \ T=/tmp/xs.$$$$ ; \ - sed "s/^\(Version:[^0-9]*\)\(.*\)/\1$$V/" \ + sed "s/^\(%define.version[^0-9]*\)\(.*\)/\1$$V/" \ < $$S > $$T ; \ if cmp -s $$S $$T ; then \ echo "unchanged." ; \ @@ -172,17 +172,17 @@ update_spec_version:: rm $$T rpm:: - @ \ - VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][0-9]*\).*/\1/p' utils/version.h` ; \ - DIR=/usr/src/redhat ; \ - cp -p xscreensaver-$$VERS.tar.gz $$DIR/SOURCES/ ; \ - rpm -ba xscreensaver.spec ; \ - rm -f $$DIR/xscreensaver-$$VERS.tar.gz ; \ - rm -rf $$DIR/BUILD/xscreensaver-$$VERS ; \ - mv $$DIR/RPMS/i386/xscreensaver-$$VERS-*.rpm . ; \ - mv $$DIR/SRPMS/xscreensaver-$$VERS-*.rpm . ; \ - echo '' ; \ - ls -lFG xscreensaver-$$VERS-*.rpm + @ \ + VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][0-9]*\).*/\1/p' utils/version.h` ; \ + DIR=/usr/src/redhat ; \ + cp -p xscreensaver-$$VERS.tar.gz $$DIR/SOURCES/ ; \ + rpm --define "USE_GL yes" -ba xscreensaver.spec ; \ + rm -f $$DIR/xscreensaver-$$VERS.tar.gz ; \ + rm -rf $$DIR/BUILD/xscreensaver-$$VERS ; \ + mv $$DIR/SRPMS/xscreensaver*-$$VERS-*.rpm . ; \ + mv $$DIR/RPMS/i386/xscreensaver*-$$VERS-*.rpm . ; \ + echo '' ; \ + ls -lFG xscreensaver*-$$VERS-*.rpm test-tar:: @ \ diff --git a/README b/README index 374d7694..9beb90ec 100644 --- a/README +++ b/README @@ -77,7 +77,13 @@ http://www.jwz.org/xscreensaver/. ============ -Changes since 3.19: * Added new hack `ripples' and `sierpinski3d'. +Changes since 3.20: * Tweaked the xscreensaver-demo UI (Gtk only.) + * Fixed a few visual selection bugs. I think the proper + GL visual should be used with nVidia systems now. + * Made the Makefiles obey $install_prefix. + * Made the `xscreensaver.spec' file able to generate both + GL and non-GL packages simultaniously. +Changes since 3.19: * Added new hacks `ripples' and `sierpinski3d'. * Made `xscreensaver-command -exit' be silent when no screen saver was running (instead of complaining.) * Made `webcollage' and `vidwhacker' use `xloadimage' diff --git a/configure b/configure index b698405d..4d398d4a 100755 --- a/configure +++ b/configure @@ -6874,6 +6874,7 @@ fi have_gl=no ac_have_mesa_gl=no with_gl_req=unspecified +gl_halfassed=no # Check whether --with-gl or --without-gl was given. if test "${with_gl+set}" = set; then withval="$with_gl" @@ -6890,7 +6891,7 @@ fi /*) echo $ac_n "checking for GL headers""... $ac_c" 1>&6 -echo "configure:6905: checking for GL headers" >&5 +echo "configure:6906: checking for GL headers" >&5 d=$with_gl/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -6900,7 +6901,7 @@ echo "configure:6905: checking for GL headers" >&5 fi echo $ac_n "checking for GL libs""... $ac_c" 1>&6 -echo "configure:6915: checking for GL libs" >&5 +echo "configure:6916: checking for GL libs" >&5 d=$with_gl/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -6936,17 +6937,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:6951: checking for GL/gl.h" >&5 +echo "configure:6952: 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:6961: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6962: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6977,17 +6978,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:6992: checking for GL/glx.h" >&5 +echo "configure:6993: 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:7002: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7003: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7019,7 +7020,7 @@ fi # to link against. # echo $ac_n "checking whether GL is really MesaGL""... $ac_c" 1>&6 -echo "configure:7034: checking whether GL is really MesaGL" >&5 +echo "configure:7035: checking whether GL is really MesaGL" >&5 if eval "test \"`echo '$''{'ac_cv_have_mesa_gl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7031,7 +7032,7 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" cat > conftest.$ac_ext < EOF @@ -7060,7 +7061,7 @@ echo "$ac_t""$ac_cv_have_mesa_gl" 1>&6 # if test "$ac_have_mesa_gl" = yes; then echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:7075: checking for pthread_create in -lpthread" >&5 +echo "configure:7076: checking for pthread_create in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7068,7 +7069,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7126,7 +7127,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for glXCreateContext in -lMesaGL""... $ac_c" 1>&6 -echo "configure:7141: checking for glXCreateContext in -lMesaGL" >&5 +echo "configure:7142: checking for glXCreateContext in -lMesaGL" >&5 ac_lib_var=`echo MesaGL'_'glXCreateContext | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7134,7 +7135,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lMesaGL -lMesaGLU $GL_LIBS -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7191,7 +7192,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for glXCreateContext in -lGL""... $ac_c" 1>&6 -echo "configure:7206: checking for glXCreateContext in -lGL" >&5 +echo "configure:7207: checking for glXCreateContext in -lGL" >&5 ac_lib_var=`echo GL'_'glXCreateContext | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7199,7 +7200,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lGL -lGLU $GL_LIBS -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7241,6 +7242,7 @@ fi # we have headers, but no libs -- bail. have_gl=no ac_have_mesa_gl=no + gl_halfassed=yes else # linking works -- we can build the GL hacks. cat >> confdefs.h <<\EOF @@ -7267,12 +7269,12 @@ EOF if test "$ac_have_mesa_gl" = yes; then echo $ac_n "checking MesaGL version number""... $ac_c" 1>&6 -echo "configure:7282: checking MesaGL version number" >&5 +echo "configure:7284: checking MesaGL version number" >&5 if eval "test \"`echo '$''{'ac_cv_mesagl_version_string'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < configure: MESA_MAJOR_VERSION MESA_MINOR_VERSION @@ -7338,7 +7340,7 @@ echo "$ac_t""$ac_cv_mesagl_version_string" 1>&6 LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for glBindTexture in -l$gl_lib_1""... $ac_c" 1>&6 -echo "configure:7353: checking for glBindTexture in -l$gl_lib_1" >&5 +echo "configure:7355: checking for glBindTexture in -l$gl_lib_1" >&5 ac_lib_var=`echo $gl_lib_1'_'glBindTexture | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7346,7 +7348,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$gl_lib_1 $GL_LIBS -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7374: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7391,7 +7393,7 @@ fi # See comments in utils/visual-gl.c for why this is sometimes necessary. # echo $ac_n "checking whether drastic GL measures must be taken""... $ac_c" 1>&6 -echo "configure:7406: checking whether drastic GL measures must be taken" >&5 +echo "configure:7408: checking whether drastic GL measures must be taken" >&5 case "$host" in *-sgi*) echo "$ac_t""yes -- hello, SGI." 1>&6 @@ -7427,6 +7429,7 @@ fi have_gle=no with_gle_req=unspecified +gle_halfassed=no # Check whether --with-gle or --without-gle was given. if test "${with_gle+set}" = set; then withval="$with_gle" @@ -7443,7 +7446,7 @@ fi /*) echo $ac_n "checking for GLE headers""... $ac_c" 1>&6 -echo "configure:7458: checking for GLE headers" >&5 +echo "configure:7461: checking for GLE headers" >&5 d=$with_gle/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -7453,7 +7456,7 @@ echo "configure:7458: checking for GLE headers" >&5 fi echo $ac_n "checking for GLE libs""... $ac_c" 1>&6 -echo "configure:7468: checking for GLE libs" >&5 +echo "configure:7471: checking for GLE libs" >&5 d=$with_gle/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -7489,17 +7492,17 @@ if test "$with_gle" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "GL/gutil.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for GL/gutil.h""... $ac_c" 1>&6 -echo "configure:7504: checking for GL/gutil.h" >&5 +echo "configure:7507: checking for GL/gutil.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:7514: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7530,17 +7533,17 @@ fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "GL/tube.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for GL/tube.h""... $ac_c" 1>&6 -echo "configure:7545: checking for GL/tube.h" >&5 +echo "configure:7548: checking for GL/tube.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:7555: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7558: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7564,11 +7567,9 @@ fi CPPFLAGS="$ac_save_CPPFLAGS" fi -# /usr/local/lib/GL/libgle.a -# /usr/local/lib/GL/libmatrix.a - if test "$have_gle" = yes ; then have_gle=no + gle_halfassed=yes ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -7587,7 +7588,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for gleCreateGC in -lgle""... $ac_c" 1>&6 -echo "configure:7602: checking for gleCreateGC in -lgle" >&5 +echo "configure:7603: checking for gleCreateGC in -lgle" >&5 ac_lib_var=`echo gle'_'gleCreateGC | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7595,7 +7596,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgle $GL_LIBS -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7621,7 +7622,7 @@ LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - have_gle=yes; GLE_LIBS="-lgle" + have_gle=yes; gle_halfassed=no, GLE_LIBS="-lgle" else echo "$ac_t""no" 1>&6 fi @@ -7633,6 +7634,7 @@ fi fi if test "$have_gle" = yes ; then have_gle=no + gle_halfassed=yes ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -7651,7 +7653,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for uview_direction_d in -lmatrix""... $ac_c" 1>&6 -echo "configure:7666: checking for uview_direction_d in -lmatrix" >&5 +echo "configure:7668: checking for uview_direction_d in -lmatrix" >&5 ac_lib_var=`echo matrix'_'uview_direction_d | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7659,7 +7661,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmatrix $GL_LIBS -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7685,7 +7687,8 @@ LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - have_gle=yes; GLE_LIBS="$GLE_LIBS -lmatrix" + have_gle=yes; gle_halfassed=no, + GLE_LIBS="$GLE_LIBS -lmatrix" else echo "$ac_t""no" 1>&6 fi @@ -7735,7 +7738,7 @@ fi /*) echo $ac_n "checking for XPM headers""... $ac_c" 1>&6 -echo "configure:7750: checking for XPM headers" >&5 +echo "configure:7753: checking for XPM headers" >&5 d=$with_xpm/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -7745,7 +7748,7 @@ echo "configure:7750: checking for XPM headers" >&5 fi echo $ac_n "checking for XPM libs""... $ac_c" 1>&6 -echo "configure:7760: checking for XPM libs" >&5 +echo "configure:7763: checking for XPM libs" >&5 d=$with_xpm/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -7778,17 +7781,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:7793: checking for X11/xpm.h" >&5 +echo "configure:7796: 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:7803: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7806: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7854,7 +7857,7 @@ fi /*) echo $ac_n "checking for XSHM headers""... $ac_c" 1>&6 -echo "configure:7869: checking for XSHM headers" >&5 +echo "configure:7872: checking for XSHM headers" >&5 d=$with_xshm/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -7864,7 +7867,7 @@ echo "configure:7869: checking for XSHM headers" >&5 fi echo $ac_n "checking for XSHM libs""... $ac_c" 1>&6 -echo "configure:7879: checking for XSHM libs" >&5 +echo "configure:7882: checking for XSHM libs" >&5 d=$with_xshm/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -7899,17 +7902,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:7914: checking for X11/extensions/XShm.h" >&5 +echo "configure:7917: 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:7924: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7927: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7943,17 +7946,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:7958: checking for sys/ipc.h" >&5 +echo "configure:7961: 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:7968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7971: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7988,17 +7991,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:8003: checking for sys/shm.h" >&5 +echo "configure:8006: 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:8013: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8016: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8030,8 +8033,9 @@ fi # case "$host" in *-aix*) - have_xshm=no - + if `uname -v` -eq 3 ; then + have_xshm=no + ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" # ac_save_LIBS="$LIBS" @@ -8049,7 +8053,7 @@ fi LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" echo $ac_n "checking for XShmQueryExtension in -lXextSam""... $ac_c" 1>&6 -echo "configure:8064: checking for XShmQueryExtension in -lXextSam" >&5 +echo "configure:8068: 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 @@ -8057,7 +8061,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXextSam -lX11 -lXext -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8093,6 +8097,7 @@ fi LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" + fi ;; esac @@ -8134,7 +8139,7 @@ fi /*) echo $ac_n "checking for DOUBLE-BUFFER headers""... $ac_c" 1>&6 -echo "configure:8149: checking for DOUBLE-BUFFER headers" >&5 +echo "configure:8154: checking for DOUBLE-BUFFER headers" >&5 d=$with_xdbe/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -8144,7 +8149,7 @@ echo "configure:8149: checking for DOUBLE-BUFFER headers" >&5 fi echo $ac_n "checking for DOUBLE-BUFFER libs""... $ac_c" 1>&6 -echo "configure:8159: checking for DOUBLE-BUFFER libs" >&5 +echo "configure:8164: checking for DOUBLE-BUFFER libs" >&5 d=$with_xdbe/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -8178,17 +8183,17 @@ if test "$with_xdbe" = yes; then CPPFLAGS="$CPPFLAGS $X_CFLAGS" ac_safe=`echo "X11/extensions/Xdbe.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/Xdbe.h""... $ac_c" 1>&6 -echo "configure:8193: checking for X11/extensions/Xdbe.h" >&5 +echo "configure:8198: checking for X11/extensions/Xdbe.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:8203: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8251,7 +8256,7 @@ fi /*) echo $ac_n "checking for XReadDisplay headers""... $ac_c" 1>&6 -echo "configure:8266: checking for XReadDisplay headers" >&5 +echo "configure:8271: checking for XReadDisplay headers" >&5 d=$with_readdisplay/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -8261,7 +8266,7 @@ echo "configure:8266: checking for XReadDisplay headers" >&5 fi echo $ac_n "checking for XReadDisplay libs""... $ac_c" 1>&6 -echo "configure:8276: checking for XReadDisplay libs" >&5 +echo "configure:8281: checking for XReadDisplay libs" >&5 d=$with_readdisplay/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -8294,17 +8299,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:8309: checking for X11/extensions/readdisplay.h" >&5 +echo "configure:8314: 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:8319: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8324: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8359,7 +8364,7 @@ fi /*) echo $ac_n "checking for Iris Video headers""... $ac_c" 1>&6 -echo "configure:8374: checking for Iris Video headers" >&5 +echo "configure:8379: checking for Iris Video headers" >&5 d=$with_sgivideo/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" @@ -8369,7 +8374,7 @@ echo "configure:8374: checking for Iris Video headers" >&5 fi echo $ac_n "checking for Iris Video libs""... $ac_c" 1>&6 -echo "configure:8384: checking for Iris Video libs" >&5 +echo "configure:8389: checking for Iris Video libs" >&5 d=$with_sgivideo/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" @@ -8402,17 +8407,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:8417: checking for dmedia/vl.h" >&5 +echo "configure:8422: 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:8427: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8432: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8437,7 +8442,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:8452: checking for vlOpenVideo in -lvl" >&5 +echo "configure:8457: 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 @@ -8445,7 +8450,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lvl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8527,7 +8532,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:8542: checking for $with_zippy_req" >&5 +echo "configure:8547: checking for $with_zippy_req" >&5 if test -x "$with_zippy_req" ; then echo "$ac_t""yes" 1>&6 else @@ -8541,7 +8546,7 @@ echo "configure:8542: 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:8556: checking for $ac_word" >&5 +echo "configure:8561: 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 @@ -8591,7 +8596,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:8606: checking for $ac_word" >&5 +echo "configure:8611: 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 @@ -8625,7 +8630,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:8640: checking for $ac_word" >&5 +echo "configure:8645: 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 @@ -8660,7 +8665,7 @@ done if test -n "$emacs_exe" ; then echo $ac_n "checking for emacs yow""... $ac_c" 1>&6 -echo "configure:8675: checking for emacs yow" >&5 +echo "configure:8680: checking for emacs yow" >&5 # # get emacs to tell us where the libexec directory is. # @@ -8682,7 +8687,7 @@ echo "configure:8675: 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:8697: checking for xemacs yow" >&5 +echo "configure:8702: checking for xemacs yow" >&5 if test -n "$xemacs_exe" ; then # # get xemacs to tell us where the libexec directory is. @@ -8741,7 +8746,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:8756: checking for $ac_word" >&5 +echo "configure:8761: 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 @@ -8777,7 +8782,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:8792: checking for $ac_word" >&5 +echo "configure:8797: 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 @@ -9597,7 +9602,6 @@ if test "$have_gl" = yes -a "$ac_have_mesa_gl" = yes ; then fi fi - if test "$have_gl" = no ; then if test "$with_gl_req" = yes ; then warnL 'Use of GL was requested, but it was not found.' @@ -9607,6 +9611,14 @@ if test "$have_gl" = no ; then noteL 'The OpenGL 3D library was not found.' fi + if test "$gl_halfassed" = yes ; then + echo '' + warn2 'More specifically, we found the headers, but not the' + warn2 'libraries; so either GL is half-installed on this' + warn2 "system, or something else went wrong. The \`config.log'" + warn2 'file might contain some clues.' + fi + echo '' warn2 'Those demos which use 3D will not be built or installed.' warn2 'You might want to consider installing OpenGL and' @@ -9621,19 +9633,32 @@ fi if test "$have_gl" = yes -a "$have_gle" = no ; then if test "$with_gle_req" = yes ; then - warnL 'Use of GLE was requested, but it was not found.' + noteL 'Use of the GLE (GL Extrusion) library was requested, but' + warn2 'it was not found (though the OpenGL library was found, and' + warn2 'is being used.)' elif test "$with_gle_req" = no ; then - noteL 'The GLE (GL Extrusion) library is not being used.' + noteL 'The OpenGL Library is being used, but the GLE (GL Extrusion)' + warn2 'library is not.' else - noteL 'The GLE (GL Extrusion) library was not found.' + noteL 'The OpenGL Library was found, but the GLE (GL Extrusion)' + warn2 'was not.' + fi + + if test "$gle_halfassed" = yes ; then + echo '' + warn2 'More specifically, we found the headers, but not the' + warn2 'libraries; so either GLE is half-installed on this' + warn2 "system, or something else went wrong. The \`config.log'" + warn2 'file might contain some clues.' fi echo '' - warn2 'Some of the OpenGL (3D) demos will not be built or installed.' - warn2 'You might want to consider installing GLE and re-running' - warn2 'configure. (Remember to delete the config.cache file first.)' - warn2 'You can find the GLE library at .' - warn2 'For general OpenGL info, see .' + warn2 'Some of the OpenGL (3D) demos (those that depend on GLE)' + warn2 'will not be built or installed. You might want to consider' + warn2 'installing GLE and re-running configure. (Remember to delete' + warn2 'the config.cache file first.) You can find the GLE library' + warn2 'at . For general OpenGL info,' + warn2 'see .' fi diff --git a/configure.in b/configure.in index 322862f6..30fc7634 100644 --- a/configure.in +++ b/configure.in @@ -1789,6 +1789,7 @@ fi have_gl=no ac_have_mesa_gl=no with_gl_req=unspecified +gl_halfassed=no AC_ARG_WITH(gl,[ Graphics options: @@ -1856,6 +1857,7 @@ if test "$with_gl" = yes; then # we have headers, but no libs -- bail. have_gl=no ac_have_mesa_gl=no + gl_halfassed=yes else # linking works -- we can build the GL hacks. AC_DEFINE(HAVE_GL) @@ -1962,6 +1964,7 @@ fi have_gle=no with_gle_req=unspecified +gle_halfassed=no AC_ARG_WITH(gle, [ --with-gle Build those demos which depend on GLE (the OpenGL "extrusion" library.)], @@ -1978,19 +1981,19 @@ if test "$with_gle" = yes; then AC_CHECK_X_HEADER(GL/tube.h, have_gle=yes, have_gle=no) fi -# /usr/local/lib/GL/libgle.a -# /usr/local/lib/GL/libmatrix.a - if test "$have_gle" = yes ; then have_gle=no + gle_halfassed=yes AC_CHECK_X_LIB(gle, gleCreateGC, - [have_gle=yes; GLE_LIBS="-lgle"], + [have_gle=yes; gle_halfassed=no, GLE_LIBS="-lgle"], [], $GL_LIBS -lX11 -lXext -lm) fi if test "$have_gle" = yes ; then have_gle=no + gle_halfassed=yes AC_CHECK_X_LIB(matrix, uview_direction_d, - [have_gle=yes; GLE_LIBS="$GLE_LIBS -lmatrix"], + [have_gle=yes; gle_halfassed=no, + GLE_LIBS="$GLE_LIBS -lmatrix"], [], $GL_LIBS -lX11 -lXext -lm) fi @@ -2079,10 +2082,12 @@ if test "$with_xshm" = yes; then # case "$host" in *-aix*) - have_xshm=no - AC_CHECK_X_LIB(XextSam, XShmQueryExtension, - [have_xshm=yes; X_EXTRA_LIBS="$X_EXTRA_LIBS -lXextSam"], - [true], -lX11 -lXext -lm) + if [ `uname -v` -eq 3 ]; then + have_xshm=no + AC_CHECK_X_LIB(XextSam, XShmQueryExtension, + [have_xshm=yes; X_EXTRA_LIBS="$X_EXTRA_LIBS -lXextSam"], + [true], -lX11 -lXext -lm) + fi ;; esac @@ -2695,7 +2700,6 @@ if test "$have_gl" = yes -a "$ac_have_mesa_gl" = yes ; then fi fi - if test "$have_gl" = no ; then if test "$with_gl_req" = yes ; then warnL 'Use of GL was requested, but it was not found.' @@ -2705,6 +2709,14 @@ if test "$have_gl" = no ; then noteL 'The OpenGL 3D library was not found.' fi + if test "$gl_halfassed" = yes ; then + echo '' + warn2 'More specifically, we found the headers, but not the' + warn2 'libraries; so either GL is half-installed on this' + warn2 "system, or something else went wrong. The \`config.log'" + warn2 'file might contain some clues.' + fi + echo '' warn2 'Those demos which use 3D will not be built or installed.' warn2 'You might want to consider installing OpenGL and' @@ -2719,19 +2731,32 @@ fi if test "$have_gl" = yes -a "$have_gle" = no ; then if test "$with_gle_req" = yes ; then - warnL 'Use of GLE was requested, but it was not found.' + noteL 'Use of the GLE (GL Extrusion) library was requested, but' + warn2 'it was not found (though the OpenGL library was found, and' + warn2 'is being used.)' elif test "$with_gle_req" = no ; then - noteL 'The GLE (GL Extrusion) library is not being used.' + noteL 'The OpenGL Library is being used, but the GLE (GL Extrusion)' + warn2 'library is not.' else - noteL 'The GLE (GL Extrusion) library was not found.' + noteL 'The OpenGL Library was found, but the GLE (GL Extrusion)' + warn2 'was not.' + fi + + if test "$gle_halfassed" = yes ; then + echo '' + warn2 'More specifically, we found the headers, but not the' + warn2 'libraries; so either GLE is half-installed on this' + warn2 "system, or something else went wrong. The \`config.log'" + warn2 'file might contain some clues.' fi echo '' - warn2 'Some of the OpenGL (3D) demos will not be built or installed.' - warn2 'You might want to consider installing GLE and re-running' - warn2 'configure. (Remember to delete the config.cache file first.)' - warn2 'You can find the GLE library at .' - warn2 'For general OpenGL info, see .' + warn2 'Some of the OpenGL (3D) demos (those that depend on GLE)' + warn2 'will not be built or installed. You might want to consider' + warn2 'installing GLE and re-running configure. (Remember to delete' + warn2 'the config.cache file first.) You can find the GLE library' + warn2 'at . For general OpenGL info,' + warn2 'see .' fi diff --git a/driver/Makefile.in b/driver/Makefile.in index 3e830096..36a50c02 100644 --- a/driver/Makefile.in +++ b/driver/Makefile.in @@ -1,4 +1,4 @@ -# driver/Makefile.in --- xscreensaver, Copyright (c) 1997 Jamie Zawinski. +# driver/Makefile.in --- xscreensaver, Copyright (c) 1997-1999 Jamie Zawinski. # the `../configure' script generates `driver/Makefile' from this file. @SET_MAKE@ @@ -182,7 +182,9 @@ install-strip: install install-program: $(EXES) - @if [ ! -d $(bindir) ]; then $(INSTALL_DIRS) $(bindir) ; fi + @if [ ! -d $(install_prefix)$(bindir) ]; then \ + $(INSTALL_DIRS) $(install_prefix)$(bindir) ; \ + fi @inst="$(INSTALL_PROGRAM)" ; \ if [ @NEED_SETUID@ = yes ]; then \ me=`PATH="$$PATH:/usr/ucb" whoami` ; \ @@ -202,24 +204,30 @@ install-program: $(EXES) $$e " means that locking might not work. (Try it and see.)" ;\ $$e " ####################################################################";\ $$e "" ;\ - fi ; \ - fi ; \ - echo $$inst xscreensaver $(bindir)/xscreensaver ; \ - $$inst xscreensaver $(bindir)/xscreensaver - $(INSTALL_PROGRAM) xscreensaver-command $(bindir)/xscreensaver-command - $(INSTALL_PROGRAM) xscreensaver-demo $(bindir)/xscreensaver-demo + fi ; \ + fi ; \ + echo $$inst xscreensaver $(install_prefix)$(bindir)/xscreensaver ; \ + $$inst xscreensaver $(install_prefix)$(bindir)/xscreensaver + $(INSTALL_PROGRAM) xscreensaver-command \ + $(install_prefix)$(bindir)/xscreensaver-command + $(INSTALL_PROGRAM) xscreensaver-demo \ + $(install_prefix)$(bindir)/xscreensaver-demo install-ad: XScreenSaver.ad - @if [ ! -d $(AD_DIR) ]; then $(INSTALL_DIRS) $(AD_DIR) ; fi - @-echo $(INSTALL_DATA) XScreenSaver.ad $(AD_DIR)/XScreenSaver ; \ - if $(INSTALL_DATA) XScreenSaver.ad $(AD_DIR)/XScreenSaver ; then \ + @if [ ! -d $(install_prefix)$(AD_DIR) ]; then \ + $(INSTALL_DIRS) $(install_prefix)$(AD_DIR) ; \ + fi + @-echo $(INSTALL_DATA) XScreenSaver.ad \ + $(install_prefix)$(AD_DIR)/XScreenSaver ; \ + if $(INSTALL_DATA) XScreenSaver.ad \ + $(install_prefix)$(AD_DIR)/XScreenSaver ; then \ true ; \ else \ e=echo ; \ - if [ -f $(AD_DIR)/XScreenSaver ]; then \ + if [ -f $(install_prefix)$(AD_DIR)/XScreenSaver ]; then \ $$e "" ;\ $$e " ####################################################################";\ - $$e " Warning: unable to install $(AD_DIR)/XScreenSaver" ;\ + $$e " Warning: unable to install $(install_prefix)$(AD_DIR)/XScreenSaver" ;\ $$e " That file exists, and is unwritable. It is probably from" ;\ $$e " an older version of xscreensaver, and could cause things" ;\ $$e " to malfunction. Please delete it!" ;\ @@ -229,7 +237,7 @@ install-ad: XScreenSaver.ad else \ $$e "" ;\ $$e " ####################################################################";\ - $$e " Warning: unable to install $(AD_DIR)/XScreenSaver" ;\ + $$e " Warning: unable to install $(install_prefix)$(AD_DIR)/XScreenSaver" ;\ $$e " The directory is unwritable. This is probably ok;" ;\ $$e " xscreensaver should work without that file." ;\ $$e " ####################################################################";\ @@ -240,36 +248,40 @@ install-ad: XScreenSaver.ad install-man: $(MEN) @men="$(MEN)" ; \ - if [ ! -d $(man1dir) ]; then $(INSTALL_DIRS) $(man1dir) ; fi ; \ + if [ ! -d $(install_prefix)$(man1dir) ]; then \ + $(INSTALL_DIRS) $(install_prefix)$(man1dir) ; \ + fi ; \ for man in $$men; do \ instname=`echo $$man | sed 's/\.man$$/\.$(mansuffix)/'` ; \ instname=`echo $$instname | sed 's/-old//'` ; \ - echo $(INSTALL_DATA) $(srcdir)/$$man $(man1dir)/$$instname ; \ - $(INSTALL_DATA) $(srcdir)/$$man $(man1dir)/$$instname ; \ + echo $(INSTALL_DATA) $(srcdir)/$$man \ + $(install_prefix)$(man1dir)/$$instname ; \ + $(INSTALL_DATA) $(srcdir)/$$man \ + $(install_prefix)$(man1dir)/$$instname ; \ done uninstall-program: @for program in $(EXES); do \ - echo rm -f $(bindir)/$$program ; \ - rm -f $(bindir)/$$program ; \ + echo rm -f $(install_prefix)$(bindir)/$$program ; \ + rm -f $(install_prefix)$(bindir)/$$program ; \ done uninstall-ad: - rm -f $(AD_DIR)/XScreenSaver + rm -f $(install_prefix)$(AD_DIR)/XScreenSaver uninstall-man: @men="$(MEN)" ; \ for man in $$men; do \ instname=`echo $$man | sed 's/\.man$$/\.$(mansuffix)/'` ; \ - echo rm -f $(man1dir)/$$instname ; \ - rm -f $(man1dir)/$$instname ; \ + echo rm -f $(install_prefix)$(man1dir)/$$instname ; \ + rm -f $(install_prefix)$(man1dir)/$$instname ; \ done install-pam: @src="$(srcdir)/xscreensaver.pam" ; \ dest=`sed -n 's/.*PAM_SERVICE_NAME[ ]*"\([^"]*\)".*$$/\1/p' \ < ../config.h` ; \ - dir="$(PAM_DIR)" ; \ + dir="$(install_prefix)$(PAM_DIR)" ; \ conf="$(PAM_CONF)" ; \ \ if [ -d $$dir ] ; then \ @@ -313,7 +325,7 @@ install-pam: install-kde: @src="$(srcdir)/xscreensaver.kss" ; \ if [ "$$KDEDIR" != "" ]; then \ - dir="$$KDEDIR/bin" ; \ + dir="$(install_prefix)$$KDEDIR/bin" ; \ dest="$$dir/xscreensaver.kss" ; \ echo $(INSTALL_PROGRAM) $$src $$dest ; \ if $(INSTALL_PROGRAM) $$src $$dest ; then \ @@ -323,10 +335,10 @@ install-kde: $$e "" ;\ $$e " ####################################################################";\ $$e " Warning: unable to install $$dest" ;\ - if [ ! -d $$KDEDIR ]; then \ - $$e " $$KDEDIR (\$$KDEDIR) does not exist." ;\ - elif [ ! -d $$KDEDIR/bin ]; then \ - $$e " $$KDEDIR/bin (\$$KDEDIR/bin) does not exist." ;\ + if [ ! -d $(install_prefix)$$KDEDIR ]; then \ + $$e " $(install_prefix)$$KDEDIR (\$$KDEDIR) does not exist." ;\ + elif [ ! -d $(install_prefix)$$KDEDIR/bin ]; then \ + $$e " $(install_prefix)$$KDEDIR/bin (\$$KDEDIR/bin) does not exist.";\ elif [ -f $$dest ]; then \ $$e " That file exists, and is unwritable." ;\ else \ @@ -340,7 +352,7 @@ install-kde: uninstall-kde: @if [ "$$KDEDIR" != "" ]; then \ - dest="$$KDEDIR/bin/xscreensaver.kss" ; \ + dest="$(install_prefix)$$KDEDIR/bin/xscreensaver.kss" ; \ echo rm -f $$dest ; \ rm -f $$dest ; \ fi diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in index bc0f4031..825c4c72 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 3.20 -! 12-Nov-99 +! version 3.21 +! 18-Nov-99 ! ! See "man xscreensaver" for more info. The latest version is always ! available at http://www.jwz.org/xscreensaver/ @@ -59,6 +59,12 @@ ! The "helpURL" will be substituted for up to two occurrences of "%s". *loadURL: netscape -remote 'openURL(%s)' || netscape '%s' +! This is what the "Manual" button in xscreensaver-demo runs (/bin/sh syntax.) +*manualCommand: xterm +sb -fg black -bg gray75 -T '%s manual' \ + -e /bin/sh -c 'man "%s" || read' +! Gnome folks might prefer this: +!*manualCommand: gnome-help-browser 'man:%s' + ! The format used for printing the date and time in the password dialog box ! (see the strftime(3) manual page for details.) @@ -118,14 +124,20 @@ "Qix (transparent)" qix -root -count 4 -solid -transparent \n\ "Qix (linear)" qix -root -count 5 -solid -transparent \ -linear -segments 250 -size 100 \n\ +- mono: "Qix (xor)" qix -root -linear -count 5 -size 200 \ + -spread 30 -segments 75 -solid -xor \n\ + \ "Attraction (balls)" attraction -root -mode balls \n\ "Attraction (lines)" attraction -root -mode lines -points 3 \ -segments 200 \n\ +- "Attraction (poly)" attraction -root -mode polygons \n\ "Attraction (splines)" attraction -root -mode splines -segments \ 300 \n\ "Attraction (orbital)" attraction -root -mode lines -radius 300 \ -orbit -vmult 0.5 \n\ + \ pyro -root \n\ + rocks -root \n\ helix -root \n\ pedal -root \n\ rorschach -root -offset 7 \n\ @@ -223,22 +235,13 @@ ccurve -root \n\ blaster -root \n\ bumps -root \n\ + color: bubbles -root \n\ default-n: webcollage -root \n\ default-n: "WebCollage (whacked)" \ webcollage -root -filter \ 'vidwhacker -stdin -stdout' \n\ - default-n: vidwhacker -root \n\ \ -- mono: "Rocks (mono)" rocks -root \n\ - color: "Rocks (color)" rocks -root -fg darksalmon \n\ -- mono: "Qix (xor)" qix -root -linear -count 5 -size 200 \ - -spread 30 -segments 75 -solid -xor \n\ - color: "Attraction (poly)" attraction -root -mode polygons \n\ -- color: "Attraction (filled)" attraction -root -mode filled-splines \ - -segments 0 \n\ -- Color: "Attraction (glow)" attraction -root -glow -points 10 \n\ - color: bubbles -root \n\ - \ @GL_KLUDGE@ GL: gears -root \n\ @GL_KLUDGE@ GL: superquadrics -root \n\ @GL_KLUDGE@ GL: morph3d -root \n\ @@ -258,28 +261,19 @@ -texture_quality -light -fog \n\ @GLE_KLUDGE@GL: extrusion -root \n\ @GL_KLUDGE@ GL: sierpinski3d -root \n\ - + \ +- xdaliclock -root -builtin3 -cycle \n\ +- default-n: xearth -nofork -nostars -ncolors 50 \ + -night 3 -wait 0 -timewarp 400.0 -pos \ + sunrel/38/-30 \n\ +- ssystem -fullscreen :32 \n\ +- xmountains -b -M -Z 0 -r 1 \n\ +- "XMountains (top)" xmountains -b -M -Z 0 -r 1 -m \n\ +- xaos -root -autopilot -incoloring -1 \ + -nogui -outcoloring -1 \n\ +- xfishtank -d \n + -! Some other programs that you might want to track down (these work as -! XScreenSaver helpers, but are not distributed with it): -! -! xdaliclock -root -builtin2 \n\ -! xswarm -r 2>&- \n\ -! xwave -root \n\ -! xbouncebits ... \n\ -! ico -r -faces -sleep 1 -obj ico \n\ -! xsplinefun \n\ -! xmountains -b -M \n\ -! color: xfishtank -c black -d -r 2 \n\ -! -! xtacy is ok, but it only works on the default visual. We can satisfy -! that constraint like so: -! -! default: "Xtacy (funky)" xtacy -root -delay 100 -funky -number 3 \n\ -! default: "Xtacy (grav)" xtacy -root -delay 100 -gravity \n\ -! default: "Xtacy (mixer)" xtacy -root -delay 100 -mixer \n\ -! default: "Xtacy (taffy)" xtacy -root -delay 100 -taffy -pal 4 \n\ -! ! To display a randomized slideshow of images, you can do something like this: ! ! default-n: "Slideshow" xv -root -rmode 5 -random -viewonly \ @@ -308,10 +302,6 @@ ! (meaning, "-visual default -install") but you probably won't ever need ! to use that. ! -! XEarth is nice, too: -! -! default-n: xearth -nostars -wait 0 -timewarp 400 -pos sunrel/38/-30 -! ! ! Some of the GL demos that SGI ships work with XScreenSaver; most don't. ! XScreenSaver includes a program (not built or installed by default) @@ -328,16 +318,7 @@ ! ! You can also use the "ant" demo, but first you need to wrap a shell script ! around it that cds to its home directory, so that it can find its files; -! and also pass it the -S argument, to prevent it from forking. -! -! -! Also, since these actually end up mapping their own windows instead of -! drawing on the XScreenSaver-provided root, when they are being run from -! demo-mode, you can't pop up the demo-mode dialog just by clicking the -! mouse: you must first type ESC to make the SGI programs exit. This sucks. -! Things should work properly when they are being run by xscreensaver in -! non-demo-mode, however. -! +! and also pass it the -S argument, to prevent it from forking. What a mess! ! Basically, the SGI demo writers went out of their way to make my life hell. @@ -1234,20 +1215,41 @@ like something is dripping into it. Written by Tom Hammersley. *hacks.xdaliclock.name: XDaliClock *hacks.xdaliclock.documentation: \ XDaliClock draws a large digital clock, the numbers of which change by \ -``melting'' into their new shapes. Written by Jamie Zawinski. +``melting'' into their new shapes. Written by Jamie Zawinski. This \ +is not included with the XScreenSaver package, but if you don't have \ +it already, you can find it at . *hacks.xearth.documentation: \ XEarth draws an image of the Earth, as seen from your favorite vantage \ point in space, correctly shaded for the current position of the Sun. \ -Written by Kirk Johnson. +Written by Kirk Johnson. This is not included with the XScreenSaver \ +package, but if you don't have it already, you can find it at \ +. *hacks.ssystem.name: SSystem *hacks.ssystem.documentation: \ SSystem is a GL Solar System simulator. It simulates flybys of Sun, \ the nine planets and a few major satellites, with four camera modes. \ -Written by Raul Alonso. +Written by Raul Alonso. This is not included with the XScreenSaver \ +package, but if you don't have it already, you can find it at \ +. *hacks.xmountains.documentation: \ XMountains generates realistic-looking fractal terrains of snow-capped \ mountains near water, with either a top view or a side view. \ -Written by Stephen Booth. +Written by Stephen Booth. This is not included with the XScreenSaver \ +package, but if you don't have it already, you can find it at \ +. + +*hacks.xaos.name: XaoS +*hacks.xaos.documentation: \ +XaoS generates fast fly-through animations of the Mandelbrot and other \ +fractal sets. Written by Thomas Marsh and Jan Hubicka. This is not \ +included with the XScreenSaver package, but if you don't have it \ +already, you can find it at . + +*hacks.xfishtank.name: XFishTank +*hacks.xfishtank.documentation: \ +Fish! This is not included with the XScreenSaver package, but if you \ +don't have it already, you can find it at \ +. diff --git a/driver/XScreenSaver_ad.h b/driver/XScreenSaver_ad.h index 10bef579..0ec2056a 100644 --- a/driver/XScreenSaver_ad.h +++ b/driver/XScreenSaver_ad.h @@ -27,6 +27,8 @@ "*prefsCommand: xscreensaver-demo -prefs", "*helpURL: http://www.jwz.org/xscreensaver/man.html", "*loadURL: netscape -remote 'openURL(%s)' || netscape '%s'", +"*manualCommand: xterm +sb -fg black -bg gray75 -T '%s manual' \ + -e /bin/sh -c 'man \"%s\" || read'", "*dateFormat: %d-%b-%y (%a); %I:%M %p", "*installColormap: True", "*programs: \ @@ -34,14 +36,20 @@ \"Qix (transparent)\" qix -root -count 4 -solid -transparent \\n\ \"Qix (linear)\" qix -root -count 5 -solid -transparent \ -linear -segments 250 -size 100 \\n\ +- mono: \"Qix (xor)\" qix -root -linear -count 5 -size 200 \ + -spread 30 -segments 75 -solid -xor \\n\ + \ \"Attraction (balls)\" attraction -root -mode balls \\n\ \"Attraction (lines)\" attraction -root -mode lines -points 3 \ -segments 200 \\n\ +- \"Attraction (poly)\" attraction -root -mode polygons \\n\ \"Attraction (splines)\" attraction -root -mode splines -segments \ 300 \\n\ \"Attraction (orbital)\" attraction -root -mode lines -radius 300 \ -orbit -vmult 0.5 \\n\ + \ pyro -root \\n\ + rocks -root \\n\ helix -root \\n\ pedal -root \\n\ rorschach -root -offset 7 \\n\ @@ -139,22 +147,13 @@ ccurve -root \\n\ blaster -root \\n\ bumps -root \\n\ + color: bubbles -root \\n\ default-n: webcollage -root \\n\ default-n: \"WebCollage (whacked)\" \ webcollage -root -filter \ 'vidwhacker -stdin -stdout' \\n\ - default-n: vidwhacker -root \\n\ \ -- mono: \"Rocks (mono)\" rocks -root \\n\ - color: \"Rocks (color)\" rocks -root -fg darksalmon \\n\ -- mono: \"Qix (xor)\" qix -root -linear -count 5 -size 200 \ - -spread 30 -segments 75 -solid -xor \\n\ - color: \"Attraction (poly)\" attraction -root -mode polygons \\n\ -- color: \"Attraction (filled)\" attraction -root -mode filled-splines \ - -segments 0 \\n\ -- Color: \"Attraction (glow)\" attraction -root -glow -points 10 \\n\ - color: bubbles -root \\n\ - \ GL: gears -root \\n\ GL: superquadrics -root \\n\ GL: morph3d -root \\n\ @@ -174,7 +173,17 @@ -texture_quality -light -fog \\n\ GL: extrusion -root \\n\ GL: sierpinski3d -root \\n\ - ", + \ +- xdaliclock -root -builtin3 -cycle \\n\ +- default-n: xearth -nofork -nostars -ncolors 50 \ + -night 3 -wait 0 -timewarp 400.0 -pos \ + sunrel/38/-30 \\n\ +- ssystem -fullscreen :32 \\n\ +- xmountains -b -M -Z 0 -r 1 \\n\ +- \"XMountains (top)\" xmountains -b -M -Z 0 -r 1 -m \\n\ +- xaos -root -autopilot -incoloring -1 \ + -nogui -outcoloring -1 \\n\ +- xfishtank -d \\n", "XScreenSaver.pointerPollTime: 5", "XScreenSaver.initialDelay: 0", "XScreenSaver.windowCreationTimeout: 30", @@ -885,17 +894,36 @@ like something is dripping into it. Written by Tom Hammersley.", "*hacks.xdaliclock.name: XDaliClock", "*hacks.xdaliclock.documentation: \ XDaliClock draws a large digital clock, the numbers of which change by \ -``melting'' into their new shapes. Written by Jamie Zawinski.", +``melting'' into their new shapes. Written by Jamie Zawinski. This \ +is not included with the XScreenSaver package, but if you don't have \ +it already, you can find it at .", "*hacks.xearth.documentation: \ XEarth draws an image of the Earth, as seen from your favorite vantage \ point in space, correctly shaded for the current position of the Sun. \ -Written by Kirk Johnson.", +Written by Kirk Johnson. This is not included with the XScreenSaver \ +package, but if you don't have it already, you can find it at \ +.", "*hacks.ssystem.name: SSystem", "*hacks.ssystem.documentation: \ SSystem is a GL Solar System simulator. It simulates flybys of Sun, \ the nine planets and a few major satellites, with four camera modes. \ -Written by Raul Alonso.", +Written by Raul Alonso. This is not included with the XScreenSaver \ +package, but if you don't have it already, you can find it at \ +.", "*hacks.xmountains.documentation: \ XMountains generates realistic-looking fractal terrains of snow-capped \ mountains near water, with either a top view or a side view. \ -Written by Stephen Booth.", +Written by Stephen Booth. This is not included with the XScreenSaver \ +package, but if you don't have it already, you can find it at \ +.", +"*hacks.xaos.name: XaoS", +"*hacks.xaos.documentation: \ +XaoS generates fast fly-through animations of the Mandelbrot and other \ +fractal sets. Written by Thomas Marsh and Jan Hubicka. This is not \ +included with the XScreenSaver package, but if you don't have it \ +already, you can find it at .", +"*hacks.xfishtank.name: XFishTank", +"*hacks.xfishtank.documentation: \ +Fish! This is not included with the XScreenSaver package, but if you \ +don't have it already, you can find it at \ +.", diff --git a/driver/demo-Gtk-stubs.h b/driver/demo-Gtk-stubs.h index cd86ee6b..8211d199 100644 --- a/driver/demo-Gtk-stubs.h +++ b/driver/demo-Gtk-stubs.h @@ -54,17 +54,17 @@ run_this_cb (GtkButton *button, gpointer user_data); void -apply_this_cb (GtkButton *button, +apply_manual_cb (GtkButton *button, gpointer user_data); void -cancel_this_cb (GtkButton *button, +prefs_ok_cb (GtkButton *button, gpointer user_data); void -prefs_ok_cb (GtkButton *button, +prefs_cancel_cb (GtkButton *button, gpointer user_data); void -prefs_cancel_cb (GtkButton *button, +manual_cb (GtkButton *button, gpointer user_data); diff --git a/driver/demo-Gtk-widgets.c b/driver/demo-Gtk-widgets.c index 0b133bc3..510c9d63 100644 --- a/driver/demo-Gtk-widgets.c +++ b/driver/demo-Gtk-widgets.c @@ -67,10 +67,9 @@ create_xscreensaver_demo () GList *visual_combo_items = NULL; GtkWidget *combo_entry1; GtkWidget *demo_hline; - GtkWidget *demo_cancel_hbox; + GtkWidget *demo_manual_hbox; GtkWidget *demo; - GtkWidget *apply; - GtkWidget *cancel; + GtkWidget *manual; GtkWidget *demo_tab; GtkWidget *prefs_hbox; GtkWidget *prefs_frame; @@ -535,13 +534,13 @@ create_xscreensaver_demo () gtk_widget_show (demo_hline); gtk_box_pack_start (GTK_BOX (opts_vbox), demo_hline, FALSE, FALSE, 5); - demo_cancel_hbox = gtk_hbutton_box_new (); - gtk_widget_set_name (demo_cancel_hbox, "demo_cancel_hbox"); - gtk_widget_ref (demo_cancel_hbox); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "demo_cancel_hbox", demo_cancel_hbox, + demo_manual_hbox = gtk_hbutton_box_new (); + gtk_widget_set_name (demo_manual_hbox, "demo_manual_hbox"); + gtk_widget_ref (demo_manual_hbox); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "demo_manual_hbox", demo_manual_hbox, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (demo_cancel_hbox); - gtk_box_pack_start (GTK_BOX (opts_vbox), demo_cancel_hbox, FALSE, TRUE, 0); + gtk_widget_show (demo_manual_hbox); + gtk_box_pack_start (GTK_BOX (opts_vbox), demo_manual_hbox, FALSE, TRUE, 0); demo = gtk_button_new_with_label ("Demo"); gtk_widget_set_name (demo, "demo"); @@ -549,29 +548,19 @@ create_xscreensaver_demo () gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "demo", demo, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (demo); - gtk_container_add (GTK_CONTAINER (demo_cancel_hbox), demo); + gtk_container_add (GTK_CONTAINER (demo_manual_hbox), demo); GTK_WIDGET_SET_FLAGS (demo, GTK_CAN_DEFAULT); - gtk_tooltips_set_tip (tooltips, demo, "Make any changes to this demo's parameters permanent, and run it in full-screen mode (click the mouse to return.)", NULL); + gtk_tooltips_set_tip (tooltips, demo, "Run this one in full-screen mode (click the mouse to return.)", NULL); - apply = gtk_button_new_with_label ("Apply"); - gtk_widget_set_name (apply, "apply"); - gtk_widget_ref (apply); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "apply", apply, + manual = gtk_button_new_with_label ("Documentation..."); + gtk_widget_set_name (manual, "manual"); + gtk_widget_ref (manual); + gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "manual", manual, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (apply); - gtk_container_add (GTK_CONTAINER (demo_cancel_hbox), apply); - GTK_WIDGET_SET_FLAGS (apply, GTK_CAN_DEFAULT); - gtk_tooltips_set_tip (tooltips, apply, "Make any changes to this demo's parameters permanent.", NULL); - - cancel = gtk_button_new_with_label ("Cancel"); - gtk_widget_set_name (cancel, "cancel"); - gtk_widget_ref (cancel); - gtk_object_set_data_full (GTK_OBJECT (xscreensaver_demo), "cancel", cancel, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (cancel); - gtk_container_add (GTK_CONTAINER (demo_cancel_hbox), cancel); - GTK_WIDGET_SET_FLAGS (cancel, GTK_CAN_DEFAULT); - gtk_tooltips_set_tip (tooltips, cancel, "Discard any changes you have made to this demo's parameters.", NULL); + gtk_widget_show (manual); + gtk_container_add (GTK_CONTAINER (demo_manual_hbox), manual); + GTK_WIDGET_SET_FLAGS (manual, GTK_CAN_DEFAULT); + gtk_tooltips_set_tip (tooltips, manual, "Click here to read the manual for this display mode, if it has one.", NULL); demo_tab = gtk_label_new ("Graphics Demos"); gtk_widget_set_name (demo_tab, "demo_tab"); @@ -871,11 +860,8 @@ create_xscreensaver_demo () gtk_signal_connect (GTK_OBJECT (demo), "clicked", GTK_SIGNAL_FUNC (run_this_cb), NULL); - gtk_signal_connect (GTK_OBJECT (apply), "clicked", - GTK_SIGNAL_FUNC (apply_this_cb), - NULL); - gtk_signal_connect (GTK_OBJECT (cancel), "clicked", - GTK_SIGNAL_FUNC (cancel_this_cb), + gtk_signal_connect (GTK_OBJECT (manual), "clicked", + GTK_SIGNAL_FUNC (manual_cb), NULL); gtk_signal_connect (GTK_OBJECT (prefs_ok), "clicked", GTK_SIGNAL_FUNC (prefs_ok_cb), diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c index f0e88246..2b07ab0c 100644 --- a/driver/demo-Gtk.c +++ b/driver/demo-Gtk.c @@ -87,12 +87,8 @@ typedef struct { static void *global_prefs_pair; /* I hate C so much... */ - - char *blurb (void) { return progname; } -static void run_hack (int which); - static char *short_version = 0; Atom XA_VROOT; @@ -101,10 +97,10 @@ Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO; Atom XA_ACTIVATE, XA_BLANK, XA_LOCK, XA_RESTART, XA_EXIT; - static void populate_demo_window (GtkWidget *toplevel, int which, prefs_pair *pair); static void populate_prefs_page (GtkWidget *top, prefs_pair *pair); +static int apply_changes_and_save (GtkWidget *widget); @@ -310,20 +306,38 @@ warning_dialog (GtkWidget *parent, const char *message, int center) static void -run_hack (int which) +run_cmd (GtkWidget *widget, Atom command, int arg) { + char *err = 0; int status; - if (which < 0) return; - status = xscreensaver_command (gdk_display, XA_DEMO, which + 1, False); + + apply_changes_and_save (widget); + status = xscreensaver_command (gdk_display, command, arg, False, &err); if (status < 0) { char buf [255]; - sprintf (buf, - "Error:\n\n" - "The DEMO %d command failed (%d).\n", which + 1, status); -#if 0 - warning_dialog (GTK_WIDGET (menuitem), buf, 1); -#endif + if (err) + sprintf (buf, "Error:\n\n%s", err); + else + strcpy (buf, "Unknown error!"); + warning_dialog (widget, buf, 100); + } + if (err) free (err); +} + + +static void +run_hack (GtkWidget *widget, int which, Bool report_errors_p) +{ + if (which < 0) return; + apply_changes_and_save (widget); + if (report_errors_p) + run_cmd (widget, XA_ACTIVATE, 0); + else + { + char *s = 0; + xscreensaver_command (gdk_display, XA_DEMO, which + 1, False, &s); + if (s) free (s); } } @@ -335,13 +349,15 @@ run_hack (int which) void exit_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { + apply_changes_and_save (GTK_WIDGET (menuitem)); gtk_main_quit (); } static void wm_close_cb (GtkWidget *widget, GdkEvent *event, gpointer data) { - exit_menu_cb (NULL, NULL); + apply_changes_and_save (widget); + gtk_main_quit (); } @@ -426,45 +442,21 @@ doc_menu_cb (GtkMenuItem *menuitem, gpointer user_data) void activate_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { - int status = xscreensaver_command (gdk_display, XA_ACTIVATE, 0, False); - if (status < 0) - { - char buf [255]; - sprintf (buf, - "Error:\n\n" - "The ACTIVATE command failed (%d).\n", status); - warning_dialog (GTK_WIDGET (menuitem), buf, 100); - } + run_cmd (GTK_WIDGET (menuitem), XA_ACTIVATE, 0); } void lock_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { - int status = xscreensaver_command (gdk_display, XA_LOCK, 0, False); - if (status < 0) - { - char buf [255]; - sprintf (buf, - "Error:\n\n" - "The LOCK command failed (%d).\n", status); - warning_dialog (GTK_WIDGET (menuitem), buf, 100); - } + run_cmd (GTK_WIDGET (menuitem), XA_LOCK, 0); } void kill_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { - int status = xscreensaver_command (gdk_display, XA_EXIT, 0, False); - if (status < 0) - { - char buf [255]; - sprintf (buf, - "Error:\n\n" - "The EXIT command failed (%d).\n", status); - warning_dialog (GTK_WIDGET (menuitem), buf, 100); - } + run_cmd (GTK_WIDGET (menuitem), XA_EXIT, 0); } @@ -472,26 +464,22 @@ void restart_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { #if 0 - int status = xscreensaver_command (gdk_display, XA_RESTART, 0, False); - if (status < 0) - { - char buf [255]; - sprintf (buf, - "Error:\n\n" - "The RESTART command failed (%d).\n", status); - warning_dialog (GTK_WIDGET (menuitem), buf, 100); - } + run_cmd (GTK_WIDGET (menuitem), XA_RESTART, 0); #else - xscreensaver_command (gdk_display, XA_EXIT, 0, False); + apply_changes_and_save (GTK_WIDGET (menuitem)); + xscreensaver_command (gdk_display, XA_EXIT, 0, False, NULL); sleep (1); system ("xscreensaver -nosplash &"); #endif } +static int _selected_hack_number = -1; + static int selected_hack_number (GtkWidget *toplevel) { +#if 0 GtkViewport *vp = GTK_VIEWPORT (name_to_widget (toplevel, "viewport")); GtkList *list_widget = GTK_LIST (GTK_BIN(vp)->child); GList *slist = list_widget->selection; @@ -500,25 +488,50 @@ selected_hack_number (GtkWidget *toplevel) ? gtk_list_child_position (list_widget, GTK_WIDGET (selected)) : -1); return which; +#else + return _selected_hack_number; +#endif } -void -apply_this_cb (GtkButton *button, gpointer user_data) +static int +demo_write_init_file (GtkWidget *widget, saver_preferences *p) +{ + if (!write_init_file (p, short_version, False)) + return 0; + else + { + const char *f = init_file_name(); + if (!f || !*f) + warning_dialog (widget, + "Error:\n\nCouldn't determine init file name!\n", + 100); + else + { + char *b = (char *) malloc (strlen(f) + 1024); + sprintf (b, "Error:\n\nCouldn't write %s\n", f); + warning_dialog (widget, b, 100); + free (b); + } + return -1; + } +} + + +static int +apply_changes_and_save (GtkWidget *widget) { /* prefs_pair *pair = (prefs_pair *) client_data; */ prefs_pair *pair = global_prefs_pair; /* I hate C so much... */ - saver_preferences *p = pair->a; GtkList *list_widget = - GTK_LIST (name_to_widget (GTK_WIDGET (button), "list")); - int which = selected_hack_number (GTK_WIDGET (button)); + GTK_LIST (name_to_widget (widget, "list")); + int which = selected_hack_number (widget); - GtkEntry *cmd = GTK_ENTRY (name_to_widget (GTK_WIDGET (button), "cmd_text")); + GtkEntry *cmd = GTK_ENTRY (name_to_widget (widget, "cmd_text")); GtkToggleButton *enabled = - GTK_TOGGLE_BUTTON (name_to_widget (GTK_WIDGET (button), "enabled")); - GtkCombo *vis = GTK_COMBO (name_to_widget (GTK_WIDGET (button), - "visual_combo")); + GTK_TOGGLE_BUTTON (name_to_widget (widget, "enabled")); + GtkCombo *vis = GTK_COMBO (name_to_widget (widget, "visual_combo")); Bool enabled_p = gtk_toggle_button_get_active (enabled); const char *visual = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (vis)->entry)); @@ -527,12 +540,13 @@ apply_this_cb (GtkButton *button, gpointer user_data) char c; unsigned long id; - if (which < 0) return; + if (which < 0) return -1; /* Sanity-check and canonicalize whatever the user typed into the combo box. */ - if (!strcasecmp (visual, "any")) visual = ""; - if (!strcasecmp (visual, "default")) visual = "Default"; + if (!strcasecmp (visual, "")) visual = ""; + else if (!strcasecmp (visual, "any")) visual = ""; + else if (!strcasecmp (visual, "default")) visual = "Default"; else if (!strcasecmp (visual, "default-n")) visual = "Default-N"; else if (!strcasecmp (visual, "default-i")) visual = "Default-I"; else if (!strcasecmp (visual, "best")) visual = "Best"; @@ -558,41 +572,86 @@ apply_this_cb (GtkButton *button, gpointer user_data) gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (vis)->entry), "Any"); } - p->screenhacks[which]->enabled_p = enabled_p; - if (p->screenhacks[which]->visual) - free (p->screenhacks[which]->visual); - if (p->screenhacks[which]->command) - free (p->screenhacks[which]->command); - p->screenhacks[which]->visual = strdup (visual); - p->screenhacks[which]->command = strdup (command); - ensure_selected_item_visible (GTK_WIDGET (list_widget)); - write_init_file (p, short_version); -} + if (!p->screenhacks[which]->visual) + p->screenhacks[which]->visual = strdup (""); + if (!p->screenhacks[which]->command) + p->screenhacks[which]->command = strdup (""); + if (p->screenhacks[which]->enabled_p != enabled_p || + !!strcasecmp (p->screenhacks[which]->visual, visual) || + !!strcasecmp (p->screenhacks[which]->command, command)) + { + /* Something was changed -- store results into the struct, + and write the file. + */ + free (p->screenhacks[which]->visual); + free (p->screenhacks[which]->command); + p->screenhacks[which]->visual = strdup (visual); + p->screenhacks[which]->command = strdup (command); + p->screenhacks[which]->enabled_p = enabled_p; + + return demo_write_init_file (widget, p); + } + + /* No changes made */ + return 0; +} void run_this_cb (GtkButton *button, gpointer user_data) { int which = selected_hack_number (GTK_WIDGET (button)); if (which < 0) return; - apply_this_cb (button, user_data); - run_hack (which); + if (0 == apply_changes_and_save (GTK_WIDGET (button))) + run_hack (GTK_WIDGET (button), which, True); } void -cancel_this_cb (GtkButton *button, gpointer user_data) +manual_cb (GtkButton *button, gpointer user_data) { /* prefs_pair *pair = (prefs_pair *) client_data; */ prefs_pair *pair = global_prefs_pair; /* I hate C so much... */ + saver_preferences *p = pair->a; GtkList *list_widget = GTK_LIST (name_to_widget (GTK_WIDGET (button), "list")); int which = selected_hack_number (GTK_WIDGET (button)); + char *name, *name2, *cmd, *s; if (which < 0) return; + apply_changes_and_save (GTK_WIDGET (button)); ensure_selected_item_visible (GTK_WIDGET (list_widget)); - populate_demo_window (GTK_WIDGET (button), which, pair); + + name = strdup (p->screenhacks[which]->command); + name2 = name; + while (isspace (*name2)) name2++; + s = name2; + while (*s && !isspace (*s)) s++; + *s = 0; + s = strrchr (name2, '/'); + if (s) name = s+1; + + cmd = get_string_resource ("manualCommand", "ManualCommand"); + if (cmd) + { + char *cmd2 = (char *) malloc (strlen (cmd) + strlen (name2) + 100); + strcpy (cmd2, "( "); + sprintf (cmd2 + strlen (cmd2), + cmd, + name2, name2, name2, name2); + strcat (cmd2, " ) &"); + system (cmd2); + free (cmd2); + } + else + { + warning_dialog (GTK_WIDGET (button), + "Error:\n\nno `manualCommand' resource set.", + 100); + } + + free (name); } @@ -615,10 +674,11 @@ run_next_cb (GtkButton *button, gpointer user_data) if (which >= p->screenhacks_count) which = 0; + apply_changes_and_save (GTK_WIDGET (button)); gtk_list_select_item (GTK_LIST (list_widget), which); ensure_selected_item_visible (GTK_WIDGET (list_widget)); populate_demo_window (GTK_WIDGET (button), which, pair); - run_hack (which); + run_hack (GTK_WIDGET (button), which, False); } @@ -641,10 +701,11 @@ run_prev_cb (GtkButton *button, gpointer user_data) if (which < 0) which = p->screenhacks_count - 1; + apply_changes_and_save (GTK_WIDGET (button)); gtk_list_select_item (GTK_LIST (list_widget), which); ensure_selected_item_visible (GTK_WIDGET (list_widget)); populate_demo_window (GTK_WIDGET (button), which, pair); - run_hack (which); + run_hack (GTK_WIDGET (button), which, False); } @@ -675,6 +736,7 @@ prefs_ok_cb (GtkButton *button, gpointer user_data) saver_preferences *p = pair->a; saver_preferences *p2 = pair->b; + Bool changed = False; # define SECONDS(field, name) \ hack_time_text (gtk_entry_get_text (\ @@ -701,32 +763,48 @@ prefs_ok_cb (GtkButton *button, gpointer user_data) *(field) = value; \ } while(0) +# define CHECKBOX(field, name) \ + field = gtk_toggle_button_get_active (\ + GTK_TOGGLE_BUTTON (name_to_widget (GTK_WIDGET(button), (name)))) + MINUTES (&p2->timeout, "timeout_text"); MINUTES (&p2->cycle, "cycle_text"); SECONDS (&p2->fade_seconds, "fade_text"); INTEGER (&p2->fade_ticks, "ticks_text"); MINUTES (&p2->lock_timeout, "lock_text"); SECONDS (&p2->passwd_timeout, "pass_text"); - -#undef SECONDS -#undef MINUTES -#undef INTEGER - - p->timeout = p2->timeout; - p->cycle = p2->cycle; - p->lock_timeout = p2->lock_timeout; - p->passwd_timeout = p2->passwd_timeout; - p->fade_seconds = p2->fade_seconds; - p->fade_ticks = p2->fade_ticks; - p->verbose_p = p2->verbose_p; - p->install_cmap_p = p2->install_cmap_p; - p->fade_p = p2->fade_p; - p->unfade_p = p2->unfade_p; - p->lock_p = p2->lock_p; + CHECKBOX (p2->verbose_p, "verbose_button"); + CHECKBOX (p2->install_cmap_p, "install_button"); + CHECKBOX (p2->fade_p, "fade_button"); + CHECKBOX (p2->unfade_p, "unfade_button"); + CHECKBOX (p2->lock_p, "lock_button"); + +# undef SECONDS +# undef MINUTES +# undef INTEGER +# undef CHECKBOX + +# define COPY(field) \ + if (p->field != p2->field) changed = True; \ + p->field = p2->field + + COPY(timeout); + COPY(cycle); + COPY(lock_timeout); + COPY(passwd_timeout); + COPY(fade_seconds); + COPY(fade_ticks); + COPY(verbose_p); + COPY(install_cmap_p); + COPY(fade_p); + COPY(unfade_p); + COPY(lock_p); +# undef COPY populate_prefs_page (GTK_WIDGET (button), pair); - write_init_file (p, short_version); + if (changed) + demo_write_init_file (GTK_WIDGET (button), p); } @@ -751,7 +829,7 @@ list_doubleclick_cb (GtkWidget *button, GdkEventButton *event, int which = gtk_list_child_position (list, GTK_WIDGET (button)); if (which >= 0) - run_hack (which); + run_hack (GTK_WIDGET (button), which, True); } return FALSE; @@ -765,6 +843,7 @@ list_select_cb (GtkList *list, GtkWidget *child) prefs_pair *pair = global_prefs_pair; /* I hate C so much... */ int which = gtk_list_child_position (list, GTK_WIDGET (child)); + apply_changes_and_save (GTK_WIDGET (list)); populate_demo_window (GTK_WIDGET (list), which, pair); } @@ -774,6 +853,7 @@ list_unselect_cb (GtkList *list, GtkWidget *child) /* prefs_pair *pair = (prefs_pair *) client_data; */ prefs_pair *pair = global_prefs_pair; /* I hate C so much... */ + apply_changes_and_save (GTK_WIDGET (list)); populate_demo_window (GTK_WIDGET (list), -1, pair); } @@ -876,6 +956,7 @@ scroll_to_current_hack (GtkWidget *toplevel, prefs_pair *pair) return; list = GTK_LIST (name_to_widget (toplevel, "list")); + apply_changes_and_save (toplevel); gtk_list_select_item (list, which); ensure_selected_item_visible (GTK_WIDGET (list)); populate_demo_window (toplevel, which, pair); @@ -1003,7 +1084,7 @@ sensitize_demo_widgets (GtkWidget *toplevel, Bool sensitive_p) { const char *names[] = { "cmd_label", "cmd_text", "enabled", "visual", "visual_combo", - "demo", "apply", "cancel" }; + "demo", "manual" }; int i; for (i = 0; i < countof(names); i++) { @@ -1324,7 +1405,7 @@ populate_demo_window (GtkWidget *toplevel, int which, prefs_pair *pair) gtk_toggle_button_set_active (enabled, (hack ? hack->enabled_p : False)); gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (vis)->entry), (hack - ? (hack->visual && hack->visual + ? (hack->visual && *hack->visual ? hack->visual : "Any") : "")); @@ -1335,6 +1416,8 @@ populate_demo_window (GtkWidget *toplevel, int which, prefs_pair *pair) if (pretty_name) free (pretty_name); if (doc_string) free (doc_string); + + _selected_hack_number = which; } diff --git a/driver/demo.c b/driver/demo.c index bec72e0e..e73a1f5e 100644 --- a/driver/demo.c +++ b/driver/demo.c @@ -461,7 +461,7 @@ text_cb (WIDGET text_widget, POINTER client_data, POINTER call_data) #endif /* HAVE_ATHENA */ if (save) - write_init_file (p, short_version); + write_init_file (p, short_version, p->verbose_p); XSync (dpy, False); usleep (500000); /* give the disk time to settle down */ @@ -661,7 +661,7 @@ quit_cb CB_ARGS(WIDGET button, POINTER client_data, POINTER ignored) static void restart_cb CB_ARGS(WIDGET button, POINTER client_data, POINTER ignored) { - xscreensaver_command (widget_display (button), XA_RESTART, 0, False); + xscreensaver_command (widget_display (button), XA_RESTART, 0, False, NULL); } @@ -968,7 +968,7 @@ prefs_ok_cb CB_ARGS(WIDGET button, POINTER client_data, POINTER call_data) p->unfade_p = p2->unfade_p; p->lock_p = p2->lock_p; - write_init_file (p, short_version); + write_init_file (p, short_version, p->verbose_p); } @@ -1090,7 +1090,7 @@ static void run_hack (Display *dpy, int n) { if (n <= 0) abort(); - xscreensaver_command (dpy, XA_DEMO, n, False); + xscreensaver_command (dpy, XA_DEMO, n, False, NULL); } diff --git a/driver/prefs.c b/driver/prefs.c index 2b8be46d..ae490864 100644 --- a/driver/prefs.c +++ b/driver/prefs.c @@ -533,9 +533,11 @@ write_entry (FILE *out, const char *key, const char *value) free(v); } -void -write_init_file (saver_preferences *p, const char *version_string) +int +write_init_file (saver_preferences *p, const char *version_string, + Bool verbose_p) { + int status = -1; const char *name = init_file_name(); const char *tmp_name = init_file_tmp_name(); char *n2 = chase_symlinks (name); @@ -555,7 +557,7 @@ write_init_file (saver_preferences *p, const char *version_string) if (n2) name = n2; - if (p->verbose_p) + if (verbose_p) fprintf (stderr, "%s: writing \"%s\".\n", blurb(), name); unlink (tmp_name); @@ -571,13 +573,19 @@ write_init_file (saver_preferences *p, const char *version_string) /* Give the new .xscreensaver file the same permissions as the old one; except ensure that it is readable and writable by owner, and not - executable. + executable. Extra hack: if we're running as root, make the file + be world-readable (so that the daemon, running as "nobody", will + still be able to read it.) */ if (stat(name, &st) == 0) { mode_t mode = st.st_mode; - mode |= S_IRUSR | S_IWUSR; - mode &= ~(S_IXUSR | S_IXGRP | S_IXOTH); + mode |= S_IRUSR | S_IWUSR; /* read/write by user */ + mode &= ~(S_IXUSR | S_IXGRP | S_IXOTH); /* executable by none */ + + if (getuid() == (uid_t) 0) /* read by group/other */ + mode |= S_IRGRP | S_IROTH; + if (fchmod (fileno(out), mode) != 0) { char *buf = (char *) malloc(1024 + strlen(name)); @@ -777,6 +785,8 @@ write_init_file (saver_preferences *p, const char *version_string) /* Since the .xscreensaver file is used for IPC, let's try and make sure that the bits actually land on the disk right away. */ sync (); + + status = 0; /* wrote and renamed successfully! */ } } else @@ -791,6 +801,7 @@ write_init_file (saver_preferences *p, const char *version_string) END: if (n2) free (n2); + return status; } diff --git a/driver/prefs.h b/driver/prefs.h index b5a528c9..8395f323 100644 --- a/driver/prefs.h +++ b/driver/prefs.h @@ -83,7 +83,8 @@ struct saver_preferences { extern void load_init_file (saver_preferences *p); extern Bool init_file_changed_p (saver_preferences *p); -extern void write_init_file (saver_preferences *p, const char *version_string); +extern int write_init_file (saver_preferences *p, const char *version_string, + Bool verbose_p); const char *init_file_name (void); extern screenhack *parse_screenhack (const char *line); diff --git a/driver/remote.c b/driver/remote.c index e05c93e4..b8ab8e15 100644 --- a/driver/remote.c +++ b/driver/remote.c @@ -129,23 +129,32 @@ find_screensaver_window (Display *dpy, char **version) static int send_xscreensaver_command (Display *dpy, Atom command, long arg, - Window *window_ret) + Window *window_ret, char **error_ret) { char *v = 0; Window window = find_screensaver_window (dpy, &v); XWindowAttributes xgwa; + char err[2048]; if (window_ret) *window_ret = window; if (!window) { + sprintf (err, "no screensaver is running on display %s", + DisplayString (dpy)); + + if (error_ret) + { + *error_ret = strdup (err); + return -1; + } + if (command == XA_EXIT) + /* Don't print an error if xscreensaver is already dead. */ return 1; - /* Don't print this if xscreensaver is already dead. */ - fprintf (stderr, "%s: no screensaver is running on display %s\n", - progname, DisplayString (dpy)); + fprintf (stderr, "%s: %s\n", progname, err); return -1; } @@ -160,16 +169,24 @@ send_xscreensaver_command (Display *dpy, Atom command, long arg, memset (&hint, 0, sizeof(hint)); if (!v || !*v) { - fprintf (stderr, "%s: version property not set on window 0x%x?\n", - progname, (unsigned int) window); + sprintf (err, "version property not set on window 0x%x?", + (unsigned int) window); + if (error_ret) + *error_ret = strdup (err); + else + fprintf (stderr, "%s: %s\n", progname, err); return -1; } XGetClassHint(dpy, window, &hint); if (!hint.res_class) { - fprintf (stderr, "%s: class hints not set on window 0x%x?\n", - progname, (unsigned int) window); + sprintf (err, "class hints not set on window 0x%x?", + (unsigned int) window); + if (error_ret) + *error_ret = strdup (err); + else + fprintf (stderr, "%s: %s\n", progname, err); return -1; } @@ -206,8 +223,7 @@ send_xscreensaver_command (Display *dpy, Atom command, long arg, if (data) free (data); fprintf (stdout, "\n"); fflush (stdout); - fprintf (stderr, "%s: bad status format on root window.\n", - progname); + fprintf (stderr, "bad status format on root window.\n"); return -1; } @@ -268,8 +284,7 @@ send_xscreensaver_command (Display *dpy, Atom command, long arg, if (data) free (data); fprintf (stdout, "\n"); fflush (stdout); - fprintf (stderr, "%s: no saver status on root window.\n", - progname); + fprintf (stderr, "no saver status on root window.\n"); return -1; } } @@ -304,8 +319,12 @@ send_xscreensaver_command (Display *dpy, Atom command, long arg, event.xclient.data.l[2] = arg2; if (! XSendEvent (dpy, window, False, 0L, &event)) { - fprintf (stderr, "%s: XSendEvent(dpy, 0x%x ...) failed.\n", - progname, (unsigned int) window); + sprintf (err, "XSendEvent(dpy, 0x%x ...) failed.\n", + (unsigned int) window); + if (error_ret) + *error_ret = strdup (err); + else + fprintf (stderr, "%s: %s\n", progname, err); return -1; } } @@ -316,13 +335,15 @@ send_xscreensaver_command (Display *dpy, Atom command, long arg, static int xscreensaver_command_response (Display *dpy, Window window, - Bool verbose_p, Bool exiting_p) + Bool verbose_p, Bool exiting_p, + char **error_ret) { int fd = ConnectionNumber (dpy); int timeout = 10; int status; fd_set fds; struct timeval tv; + char err[2048]; while (1) { @@ -335,13 +356,25 @@ xscreensaver_command_response (Display *dpy, Window window, if (status < 0) { char buf[1024]; - sprintf (buf, "%s: waiting for reply", progname); - perror (buf); + if (error_ret) + { + sprintf (buf, "error waiting for reply"); + *error_ret = strdup (buf); + } + else + { + sprintf (buf, "%s: error waiting for reply", progname); + perror (buf); + } return status; } else if (status == 0) { - fprintf (stderr, "%s: no response to command.\n", progname); + sprintf (err, "no response to command."); + if (error_ret) + *error_ret = strdup (err); + else + fprintf (stderr, "%s: %s\n", progname, err); return -1; } else @@ -376,9 +409,13 @@ xscreensaver_command_response (Display *dpy, Window window, if (exiting_p) return 0; - fprintf (stderr, - "%s: xscreensaver window unexpectedly deleted.\n", - progname); + sprintf (err, "xscreensaver window unexpectedly deleted."); + + if (error_ret) + *error_ret = strdup (err); + else + fprintf (stderr, "%s: %s\n", progname, err); + return -1; } @@ -386,28 +423,38 @@ xscreensaver_command_response (Display *dpy, Window window, { if (type != XA_STRING || format != 8) { - fprintf (stderr, - "%s: unrecognized response property.\n", - progname); + sprintf (err, "unrecognized response property."); + + if (error_ret) + *error_ret = strdup (err); + else + fprintf (stderr, "%s: %s\n", progname, err); + if (msg) XFree (msg); return -1; } else if (!msg || (msg[0] != '+' && msg[0] != '-')) { - fprintf (stderr, - "%s: unrecognized response message.\n", - progname); + sprintf (err, "unrecognized response message."); + + if (error_ret) + *error_ret = strdup (err); + else + fprintf (stderr, "%s: %s\n", progname, err); + if (msg) XFree (msg); return -1; } else { int ret = (msg[0] == '+' ? 0 : -1); - if (verbose_p || ret != 0) - fprintf ((ret < 0 ? stderr : stdout), - "%s: %s\n", - progname, - msg+1); + sprintf (err, "%s: %s\n", progname, msg+1); + + if (error_ret) + *error_ret = strdup (err); + else if (verbose_p || ret != 0) + fprintf ((ret < 0 ? stderr : stdout), "%s\n", err); + XFree (msg); return ret; } @@ -419,13 +466,15 @@ xscreensaver_command_response (Display *dpy, Window window, int -xscreensaver_command (Display *dpy, Atom command, long arg, Bool verbose_p) +xscreensaver_command (Display *dpy, Atom command, long arg, Bool verbose_p, + char **error_ret) { Window w = 0; - int status = send_xscreensaver_command (dpy, command, arg, &w); + int status = send_xscreensaver_command (dpy, command, arg, &w, error_ret); if (status == 0) status = xscreensaver_command_response (dpy, w, verbose_p, - (command == XA_EXIT)); + (command == XA_EXIT), + error_ret); fflush (stdout); fflush (stderr); diff --git a/driver/remote.h b/driver/remote.h index d368e43c..e1db3517 100644 --- a/driver/remote.h +++ b/driver/remote.h @@ -14,7 +14,7 @@ #define _XSCREENSAVER_REMOTE_H_ extern int xscreensaver_command (Display *dpy, Atom command, long arg, - Bool verbose_p); + Bool verbose_p, char **error_ret); extern void server_xscreensaver_version (Display *dpy, char **version_ret, diff --git a/driver/stderr.c b/driver/stderr.c index fafb1e58..d4361df8 100644 --- a/driver/stderr.c +++ b/driver/stderr.c @@ -47,9 +47,14 @@ static char stderr_buffer [4096]; static char *stderr_tail = 0; static time_t stderr_last_read = 0; +static int stderr_stdout_read_fd = -1; + static void make_stderr_overlay_window (saver_screen_info *); +/* Recreates the stderr window or GCs: do this when the xscreensaver window + on a screen has been re-created. + */ void reset_stderr (saver_screen_info *ssi) { @@ -75,6 +80,10 @@ reset_stderr (saver_screen_info *ssi) ssi->stderr_cmap = 0; } +/* Erases any stderr text overlaying the screen (if possible) and resets + the stderr output cursor to the upper left. Do this when the xscreensaver + window is cleared. + */ void clear_stderr (saver_screen_info *ssi) { @@ -86,6 +95,8 @@ clear_stderr (saver_screen_info *ssi) } +/* Draws the string on the screen's window. + */ static void print_stderr_1 (saver_screen_info *ssi, char *string) { @@ -235,6 +246,8 @@ make_stderr_overlay_window (saver_screen_info *ssi) } +/* Draws the string on each screen's window as error text. + */ static void print_stderr (saver_info *si, char *string) { @@ -250,6 +263,9 @@ print_stderr (saver_info *si, char *string) } +/* Polls the stderr buffer every few seconds and if it finds any text, + writes it on all screens. + */ static void stderr_popup_timer_fn (XtPointer closure, XtIntervalId *id) { @@ -272,6 +288,9 @@ stderr_popup_timer_fn (XtPointer closure, XtIntervalId *id) } +/* Called when data becomes available on the stderr pipe. Copies it into + stderr_buffer where stderr_popup_timer_fn() can find it later. + */ static void stderr_callback (XtPointer closure, int *fd, XtIntervalId *id) { @@ -281,6 +300,9 @@ stderr_callback (XtPointer closure, int *fd, XtIntervalId *id) int size; int read_this_time = 0; + if (!fd || *fd < 0 || *fd != stderr_stdout_read_fd) + abort(); + if (stderr_tail == 0) stderr_tail = stderr_buffer; @@ -333,6 +355,10 @@ stderr_callback (XtPointer closure, int *fd, XtIntervalId *id) } } +/* If stderr capturing is desired, this replaces `stdout' and `stderr' + with a pipe, so that any output written to them will show up on the + screen as well as on the original value of those streams. + */ void initialize_stderr (saver_info *si) { @@ -439,6 +465,31 @@ initialize_stderr (saver_info *si) } } + stderr_stdout_read_fd = in; XtAppAddInput (si->app, in, (XtPointer) XtInputReadMask, stderr_callback, (XtPointer) si); } + + +/* If there is anything in the stderr buffer, flush it to the real stderr. + This does no X operations. Call this when exiting to make sure any + last words actually show up. + */ +void +shutdown_stderr (saver_info *si) +{ + if (!real_stderr || stderr_stdout_read_fd < 0) + return; + + stderr_callback ((XtPointer) si, &stderr_stdout_read_fd, 0); + + if (stderr_buffer && + stderr_tail && + stderr_buffer < stderr_tail) + { + *stderr_tail = 0; + fprintf (real_stderr, "%s", stderr_buffer); + fflush (real_stderr); + stderr_tail = stderr_buffer; + } +} diff --git a/driver/subprocs.c b/driver/subprocs.c index c693d5b6..256934b8 100644 --- a/driver/subprocs.c +++ b/driver/subprocs.c @@ -395,12 +395,6 @@ make_job (pid_t pid, const char *cmd) } while (isspace(*in)) in++; /* skip whitespace */ - if (first && *in == ':') /* token was a visual name; skip it. */ - { - out = name; - first = 0; - goto AGAIN; - } *out = 0; job->name = strdup(name); @@ -771,7 +765,7 @@ select_visual_of_hack (saver_screen_info *ssi, screenhack *hack) saver_preferences *p = &si->prefs; Bool selected; - if (hack->visual && *hack->visual == ':') + if (hack->visual && *hack->visual) selected = select_visual(ssi, hack->visual); else selected = select_visual(ssi, 0); diff --git a/driver/test-passwd.c b/driver/test-passwd.c index f4fef0d5..f86f8069 100644 --- a/driver/test-passwd.c +++ b/driver/test-passwd.c @@ -55,6 +55,7 @@ Bool handle_clientmessage (saver_info *si, XEvent *e, Bool u) { return False; } int BadWindow_ehandler (Display *dpy, XErrorEvent *error) { exit(1); } const char *signal_name(int signal) { return "???"; } void restore_real_vroot (saver_info *si) {} +void store_saver_status (saver_info *si) {} void saver_exit (saver_info *si, int status, const char *core) { exit(status);} int move_mouse_grab (saver_info *si, Window to, Cursor cursor) { return 0; } diff --git a/driver/windows.c b/driver/windows.c index 21eb6a39..a375e306 100644 --- a/driver/windows.c +++ b/driver/windows.c @@ -651,14 +651,10 @@ saver_exit (saver_info *si, int status, const char *dump_core_reason) vrs = restore_real_vroot_1 (si); emergency_kill_subproc (si); + shutdown_stderr (si); - if (p->verbose_p) /* nobody cares about this */ - { - if (vrs) - fprintf (real_stderr, "%s: vroot restored, exiting.\n", blurb()); - else if (p->verbose_p) - fprintf (real_stderr, "%s: no vroot to restore; exiting.\n", blurb()); - } + if (p->verbose_p && vrs) + fprintf (real_stderr, "%s: old vroot restored.\n", blurb()); fflush(real_stdout); diff --git a/driver/xdpyinfo.c b/driver/xdpyinfo.c index acce0443..21e10164 100644 --- a/driver/xdpyinfo.c +++ b/driver/xdpyinfo.c @@ -23,10 +23,11 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * * Author: Jim Fulton, MIT X Consortium + * * GLX and Overlay support added by Jamie Zawinski , 11-Nov-99 * * To compile: - * cc -DHAVE_GLX glxdpyinfo.c -o glxdpyinfo -lGL -lX11 -lXext -lm + * cc -DHAVE_GLX xdpyinfo.c -o xdpyinfo -lGL -lX11 -lXext -lm * * Other defines to consider: * -DHAVE_XIE -DHAVE_XTEST -DHAVE_SYNC -DHAVE_XRECORD diff --git a/driver/xscreensaver-command.c b/driver/xscreensaver-command.c index cd2ea714..8c74bac4 100644 --- a/driver/xscreensaver-command.c +++ b/driver/xscreensaver-command.c @@ -295,7 +295,7 @@ main (int argc, char **argv) so if we're issuing an activation command, wait a second. */ sleep (1); - i = xscreensaver_command (dpy, *cmd, arg, True); + i = xscreensaver_command (dpy, *cmd, arg, True, NULL); if (i < 0) exit (i); else exit (0); } diff --git a/driver/xscreensaver-command.man b/driver/xscreensaver-command.man index 3374a78c..dcc9d43a 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 "12-Nov-99 (3.20)" "X Version 11" +.TH XScreenSaver 1 "18-Nov-99 (3.21)" "X Version 11" .SH NAME xscreensaver-command - control a running xscreensaver process .SH SYNOPSIS @@ -182,7 +182,7 @@ right \fI.xscreensaver\fP file. .B \-watch Prints a line each time the screensaver changes state: when the screen blanks, locks, unblanks, or when the running hack is changed. This option -never returns; it is intended for by shell scripts that want to react to +never returns; it is intended for use by shell scripts that want to react to the screensaver in some way. An example of its output would be: .EX BLANK Fri Nov 5 01:57:22 1999 @@ -224,7 +224,7 @@ while () { .EE Note that LOCK might come either with or without a preceeding BLANK (depending on whether the lock-timeout is non-zero), so the above program -is keeps track of both of them. +keeps track of both of them. .SH DIAGNOSTICS If an error occurs while communicating with the \fIxscreensaver\fP daemon, or if the daemon reports an error, a diagnostic message will be printed to diff --git a/driver/xscreensaver-demo.glade b/driver/xscreensaver-demo.glade index c1a6751b..659dc913 100644 --- a/driver/xscreensaver-demo.glade +++ b/driver/xscreensaver-demo.glade @@ -525,7 +525,7 @@ Mono GtkHButtonBox - demo_cancel_hbox + demo_manual_hbox GTK_BUTTONBOX_DEFAULT_STYLE 30 85 @@ -541,7 +541,7 @@ Mono GtkButton demo - Make any changes to this demo's parameters permanent, and run it in full-screen mode (click the mouse to return.) + Run this one in full-screen mode (click the mouse to return.) True True @@ -554,30 +554,16 @@ Mono GtkButton - apply - Make any changes to this demo's parameters permanent. + manual + Click here to read the manual for this display mode, if it has one. True True clicked - apply_this_cb - Mon, 08 Nov 1999 04:46:59 GMT + manual_cb + Wed, 17 Nov 1999 09:43:37 GMT - - - - - GtkButton - cancel - Discard any changes you have made to this demo's parameters. - True - True - - clicked - cancel_this_cb - Mon, 08 Nov 1999 04:47:15 GMT - - + diff --git a/driver/xscreensaver-demo.man b/driver/xscreensaver-demo.man index e087b12c..9012c7d5 100644 --- a/driver/xscreensaver-demo.man +++ b/driver/xscreensaver-demo.man @@ -11,7 +11,7 @@ .if n .sp 1 .if t .sp .5 .. -.TH XScreenSaver 1 "12-Nov-99 (3.20)" "X Version 11" +.TH XScreenSaver 1 "18-Nov-99 (3.21)" "X Version 11" .SH NAME xscreensaver-demo - interactively control the background xscreensaver daemon .SH SYNOPSIS @@ -124,19 +124,13 @@ This is a combo-box, so you can either select an item from the popup menu, or type in a specific visual's hexadecimal ID. .TP 4 .B Demo -This button saves your changes and runs the demo in full-screen mode so -that you can try it out. Click the mouse to dismiss it. +This button runs the demo in full-screen mode so that you can try it out. +Click the mouse to dismiss it. .TP 4 -.B Apply -This button saves your changes to your \fI~/.xscreensaver\fP file, -where the -.BR xscreensaver (1) -can see them. -.TP 4 -.B Cancel -This button discards any unsaved changes you have made, and reverts the -settings for the selected demo back to what they were before. Note that -once you hit \fIDemo\fP or \fIApply\fP, that's it! +.B Documentation +Since each of the display modes is actually a separate program, they each +may have their own manual. This opens a window viewing the man page of +this program, if it has one. .SH SCREENSAVER OPTIONS TAB This tab lets you change various settings used by the xscreensaver daemon itself, rather than its sub-programs. diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c index fc8b89a4..a799ab3a 100644 --- a/driver/xscreensaver.c +++ b/driver/xscreensaver.c @@ -1056,7 +1056,8 @@ main (int argc, char **argv) memset(si, 0, sizeof(*si)); global_si_kludge = si; /* I hate C so much... */ - srandom ((int) time ((time_t *) 0)); +# undef ya_rand_init + ya_rand_init ((int) time ((time_t *) 0)); save_argv (argc, argv); set_version_string (si, &argc, argv); diff --git a/driver/xscreensaver.h b/driver/xscreensaver.h index cd797d47..448fd37f 100644 --- a/driver/xscreensaver.h +++ b/driver/xscreensaver.h @@ -386,6 +386,7 @@ extern FILE *real_stdout; extern void initialize_stderr (saver_info *si); extern void reset_stderr (saver_screen_info *ssi); extern void clear_stderr (saver_screen_info *ssi); +extern void shutdown_stderr (saver_info *si); /* ======================================================================= diff --git a/driver/xscreensaver.man b/driver/xscreensaver.man index 013aff22..c25553da 100644 --- a/driver/xscreensaver.man +++ b/driver/xscreensaver.man @@ -11,7 +11,7 @@ .if n .sp 1 .if t .sp .5 .. -.TH XScreenSaver 1 "12-Nov-99 (3.20)" "X Version 11" +.TH XScreenSaver 1 "18-Nov-99 (3.21)" "X Version 11" .SH NAME xscreensaver - graphics hack and screen locker, launched when the user is idle .SH SYNOPSIS diff --git a/hacks/Makefile.in b/hacks/Makefile.in index 72b8b52b..d51a7252 100644 --- a/hacks/Makefile.in +++ b/hacks/Makefile.in @@ -1,4 +1,4 @@ -# hacks/Makefile.in --- xscreensaver, Copyright (c) 1997 Jamie Zawinski. +# hacks/Makefile.in --- xscreensaver, Copyright (c) 1997-1999 Jamie Zawinski. # the `../configure' script generates `hacks/Makefile' from this file. @SET_MAKE@ @@ -172,10 +172,14 @@ install-strip: $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install install-program: $(EXES) - @if [ ! -d $(HACKDIR) ]; then $(INSTALL_DIRS) $(HACKDIR) ; fi ; \ + @if [ ! -d $(install_prefix)$(HACKDIR) ]; then \ + $(INSTALL_DIRS) $(install_prefix)$(HACKDIR) ; \ + fi ; \ for program in $(EXES); do \ - echo $(INSTALL_PROGRAM) $$program $(HACKDIR)/$$program ; \ - $(INSTALL_PROGRAM) $$program $(HACKDIR)/$$program ; \ + echo $(INSTALL_PROGRAM) $$program \ + $(install_prefix)$(HACKDIR)/$$program ; \ + $(INSTALL_PROGRAM) $$program \ + $(install_prefix)$(HACKDIR)/$$program ; \ done install-scripts: $(SCRIPTS) munge-scripts @@ -185,8 +189,10 @@ install-scripts: $(SCRIPTS) munge-scripts else \ p=$(srcdir)/$$program ; \ fi ; \ - echo $(INSTALL_PROGRAM) $$p $(HACKDIR)/$$program ; \ - $(INSTALL_PROGRAM) $$p $(HACKDIR)/$$program ; \ + echo $(INSTALL_PROGRAM) $$p \ + $(install_prefix)$(HACKDIR)/$$program ; \ + $(INSTALL_PROGRAM) $$p \ + $(install_prefix)$(HACKDIR)/$$program ; \ done munge-scripts: $(SCRIPTS) @@ -205,25 +211,29 @@ munge-scripts: $(SCRIPTS) install-man: $(MEN) @men="$(MEN)" ; \ - if [ ! -d $(man1dir) ]; then $(INSTALL_DIRS) $(man1dir) ; fi ; \ + if [ ! -d $(install_prefix)$(man1dir) ]; then \ + $(INSTALL_DIRS) $(install_prefix)$(man1dir) ; \ + fi ; \ for man in $$men; do \ instname=`echo $$man | sed 's/\.man$$/\.$(mansuffix)/'` ; \ - echo $(INSTALL_DATA) $(srcdir)/$$man $(man1dir)/$$instname ; \ - $(INSTALL_DATA) $(srcdir)/$$man $(man1dir)/$$instname ; \ + echo $(INSTALL_DATA) $(srcdir)/$$man \ + $(install_prefix)$(man1dir)/$$instname ; \ + $(INSTALL_DATA) $(srcdir)/$$man \ + $(install_prefix)$(man1dir)/$$instname ; \ done uninstall-program: @for program in $(EXES) $(SCRIPTS); do \ - echo rm -f $(HACKDIR)/$$program ; \ - rm -f $(HACKDIR)/$$program ; \ + echo rm -f $(install_prefix)$(HACKDIR)/$$program ; \ + rm -f $(install_prefix)$(HACKDIR)/$$program ; \ done uninstall-man: @men="$(MEN)" ; \ for man in $$men; do \ instname=`echo $$man | sed 's/\.man$$/\.$(mansuffix)/'` ; \ - echo rm -f $(man1dir)/$$instname ; \ - rm -f $(man1dir)/$$instname ; \ + echo rm -f $(install_prefix)$(man1dir)/$$instname ; \ + rm -f $(install_prefix)$(man1dir)/$$instname ; \ done clean: diff --git a/hacks/critical.c b/hacks/critical.c index 17abf8f4..3f8f2763 100644 --- a/hacks/critical.c +++ b/hacks/critical.c @@ -267,8 +267,8 @@ screenhack (Display *dpy, Window window) fgc = XCreateGC (dpy, window, 0, &gcv); - x2 = rand() % model_w; - y2 = rand() % model_h; + x2 = random() % model_w; + y2 = random() % model_h; delay_usecs = get_integer_resource ("delay", "Integer"); n_restart = get_integer_resource ("restart", "Integer"); diff --git a/hacks/deluxe.c b/hacks/deluxe.c index 458d94ab..0bbc8486 100644 --- a/hacks/deluxe.c +++ b/hacks/deluxe.c @@ -246,7 +246,7 @@ screenhack (Display *dpy, Window window) int delay = get_integer_resource ("delay", "Integer"); int ncolors = get_integer_resource ("ncolors", "Integer"); Bool dbuf = get_boolean_resource ("doubleBuffer", "Boolean"); - XColor colors[255]; + XColor *colors = 0; XGCValues gcv; GC erase_gc = 0; int i; @@ -261,6 +261,8 @@ screenhack (Display *dpy, Window window) transparent_p = get_boolean_resource("transparent", "Transparent"); + colors = (XColor *) calloc (sizeof(*colors), ncolors); + if (get_boolean_resource("mono", "Boolean")) { MONO: diff --git a/hacks/epicycle.c b/hacks/epicycle.c index b812e6ae..3732cb8e 100644 --- a/hacks/epicycle.c +++ b/hacks/epicycle.c @@ -266,7 +266,7 @@ new_circle_chain(void) /* There are between minCircles and maxCircles in each figure. */ - n = minCircles + rand() % (maxCircles - minCircles); + n = minCircles + random() % (maxCircles - minCircles); head = NULL; while (n--) diff --git a/hacks/glx/Makefile.in b/hacks/glx/Makefile.in index f50e987d..626f2926 100644 --- a/hacks/glx/Makefile.in +++ b/hacks/glx/Makefile.in @@ -1,4 +1,4 @@ -# hacks/glx/Makefile.in --- xscreensaver, Copyright (c) 1997 Jamie Zawinski. +# hacks/glx/Makefile.in --- xscreensaver, Copyright (c) 1999 Jamie Zawinski. # the `../../configure' script generates `hacks/glx/Makefile' from this file. @SET_MAKE@ @@ -113,34 +113,43 @@ install-strip: $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install install-program: $(EXES) - @exes="$(EXES)" ; \ - if [ ! -d $(HACKDIR) ]; then $(INSTALL_DIRS) $(HACKDIR) ; fi ; \ + @if [ ! -d $(install_prefix)$(HACKDIR) ]; then \ + $(INSTALL_DIRS) $(install_prefix)$(HACKDIR) ; \ + fi ; \ + exes="$(EXES)" ; \ for program in $$exes; do \ - echo $(INSTALL_PROGRAM) $$program $(HACKDIR)/$$program ; \ - $(INSTALL_PROGRAM) $$program $(HACKDIR)/$$program ; \ + echo $(INSTALL_PROGRAM) $$program \ + $(install_prefix)$(HACKDIR)/$$program ; \ + $(INSTALL_PROGRAM) $$program \ + $(install_prefix)$(HACKDIR)/$$program ; \ done install-man: $(MEN) @men="$(MEN)" ; \ - if [ ! -d $(man1dir) ]; then $(INSTALL_DIRS) $(man1dir) ; fi ; \ + if [ ! -d $(install_prefix)$(man1dir) ]; then \ + $(INSTALL_DIRS) $(install_prefix)$(man1dir) ; \ + fi ; \ for man in $$men; do \ instname=`echo $$man | sed 's/\.man$$/\.$(mansuffix)/'` ; \ - echo $(INSTALL_DATA) $(srcdir)/$$man $(man1dir)/$$instname ; \ - $(INSTALL_DATA) $(srcdir)/$$man $(man1dir)/$$instname ; \ + echo $(INSTALL_DATA) $(srcdir)/$$man \ + $(install_prefix)$(man1dir)/$$instname ; \ + $(INSTALL_DATA) $(srcdir)/$$man \ + $(install_prefix)$(man1dir)/$$instname ; \ done uninstall-program: - @for program in $(EXES); do \ - echo rm -f $(HACKDIR)/$$program ; \ - rm -f $(HACKDIR)/$$program ; \ + @exes="$(EXES)" ; \ + for program in $$exes; do \ + echo rm -f $(install_prefix)$(HACKDIR)/$$program ; \ + rm -f $(install_prefix)$(HACKDIR)/$$program ; \ done uninstall-man: @men="$(MEN)" ; \ for man in $$men; do \ instname=`echo $$man | sed 's/\.man$$/\.$(mansuffix)/'` ; \ - echo rm -f $(man1dir)/$$instname ; \ - rm -f $(man1dir)/$$instname ; \ + echo rm -f $(install_prefix)$(man1dir)/$$instname ; \ + rm -f $(install_prefix)$(man1dir)/$$instname ; \ done clean: diff --git a/hacks/glx/extrusion.c b/hacks/glx/extrusion.c index 48e57aeb..86facfb6 100644 --- a/hacks/glx/extrusion.c +++ b/hacks/glx/extrusion.c @@ -15,6 +15,7 @@ * Revision History: * Tue Oct 19 22:24:47 PDT 1999 Initial creation by David Konerding + * * * Notes: * This screensaver requires the GLE ("OpenGL Tubing and Extrusion Library") diff --git a/hacks/glx/glplanet.c b/hacks/glx/glplanet.c index 39ae21bb..d20bb409 100644 --- a/hacks/glx/glplanet.c +++ b/hacks/glx/glplanet.c @@ -424,8 +424,8 @@ void generate_stars(int width, int height) { /* size = (drand48()+size_range[0]) * size_range[1]/2.; */ /* glPointSize(size); */ - x = drand48()*width; - y = drand48()*height; + x = random()*width; + y = random()*height; glVertex2f(x,y); } glEnd(); diff --git a/hacks/glx/pulsar.c b/hacks/glx/pulsar.c index b34ad5da..8d7260d5 100644 --- a/hacks/glx/pulsar.c +++ b/hacks/glx/pulsar.c @@ -654,8 +654,8 @@ void GenerateQuad(void) quads[i].ty = 0.; quads[i].tz = -10; - quads[i].drx = drand48() * 5.; - quads[i].dry = drand48() * 5.; + quads[i].drx = random() * 5.; + quads[i].dry = random() * 5.; quads[i].drz = 0; } } diff --git a/hacks/glx/sierpinski3d.c b/hacks/glx/sierpinski3d.c index 0f8e4df5..9a783a04 100644 --- a/hacks/glx/sierpinski3d.c +++ b/hacks/glx/sierpinski3d.c @@ -184,9 +184,9 @@ pinit(ModeInfo *mi) { gasketstruct *gp = &gasket[MI_SCREEN(mi)]; - gp->xinc = 0.1*(1.0*rand()/RAND_MAX); - gp->yinc = 0.1*(1.0*rand()/RAND_MAX); - gp->zinc = 0.1*(1.0*rand()/RAND_MAX); + gp->xinc = 0.1*(1.0*random()/RAND_MAX); + gp->yinc = 0.1*(1.0*random()/RAND_MAX); + gp->zinc = 0.1*(1.0*random()/RAND_MAX); gp->light_colour[0] = 6.0; gp->light_colour[1] = 6.0; gp->light_colour[2] = 6.0; diff --git a/hacks/imsmap.c b/hacks/imsmap.c index f89f95fe..cb88c10a 100644 --- a/hacks/imsmap.c +++ b/hacks/imsmap.c @@ -77,6 +77,7 @@ init_map (Display *dpy, Window window) if (ncolors <= 2) ncolors = 0; if (ncolors == 0) mono_p = True; + if (ncolors > 255) ncolors = 255; /* too many look bad */ fg_pixel = get_pixel_resource ("background", "Background", dpy, cmap); bg_pixel = get_pixel_resource ("foreground", "Foreground", dpy, cmap); diff --git a/hacks/interference.c b/hacks/interference.c index a7a91956..7f66b01b 100644 --- a/hacks/interference.c +++ b/hacks/interference.c @@ -272,8 +272,6 @@ void inter_init(Display* dpy, Window win, struct inter_context* c) if(!mono) { c->pal = calloc(c->colors, sizeof(XColor)); - srand48(time(NULL)); - gray = get_boolean_resource("gray", "Boolean"); if(!gray) { H[0] = frand(360.0); diff --git a/hacks/lmorph.c b/hacks/lmorph.c index 1d6bee2b..76d56da1 100644 --- a/hacks/lmorph.c +++ b/hacks/lmorph.c @@ -378,7 +378,6 @@ initLMorph(void) gcClear = XCreateGC(dpy, window, GCForeground, &gcv); XClearWindow(dpy, window); - srandom(time(NULL)); initPointArrays(); aCurr = aWork[nWork = 0]; aPrev = NULL; diff --git a/hacks/petri.c b/hacks/petri.c index b4c748f6..78a9de7f 100644 --- a/hacks/petri.c +++ b/hacks/petri.c @@ -69,18 +69,16 @@ typedef struct cell_s { - short x; /* 0 - */ - short y; /* 2 */ - unsigned char col; /* 4 */ - unsigned char isnext; /* 5 */ - unsigned char nextcol; /* 6 */ - /* 7 */ - struct cell_s *next; /* 8 - */ - struct cell_s *prev; /* 12 */ - FLOAT speed; /* 16 - */ - FLOAT growth; /* 20 24 */ - FLOAT nextspeed; /* 24 32 - */ - /* 28 40 */ + unsigned char col; /* 0 */ + unsigned char isnext; /* 1 */ + unsigned char nextcol; /* 2 */ + /* 3 */ + struct cell_s *next; /* 4 */ + struct cell_s *prev; /* 8 - */ + FLOAT speed; /* 12 */ + FLOAT growth; /* 16 20 - */ + FLOAT nextspeed; /* 20 28 */ + /* 24 36 - */ } cell; static int arr_width; @@ -116,6 +114,10 @@ static FLOAT mindeathspeed; static FLOAT maxdeathspeed; static Bool originalcolors; +#define cell_x(c) (((c) - arr) % arr_width) +#define cell_y(c) (((c) - arr) / arr_width) + + static int random_life_value (void) { return (int) ((RAND_FLOAT * (maxlifespan - minlifespan)) + minlifespan); @@ -273,9 +275,16 @@ static void setup_display (void) count = get_integer_resource ("count", "Integer"); if (count < 2) count = 2; + + /* number of colors can't be greater than the half depth of the screen. */ if (count > (1L << (xgwa.depth-1))) count = (1L << (xgwa.depth-1)); + /* Actually, since cell->col is of type char, this has to be small. */ + if (count >= (1L << ((sizeof(arr[0].col) * 8) - 1))) + count = (1L << ((sizeof(arr[0].col) * 8) - 1)); + + if (originalcolors && (count > 8)) { count = 8; @@ -480,8 +489,6 @@ static void setup_arr (void) int row = y * arr_width; for (x = 0; x < arr_width; x++) { - arr[row+x].x = x; - arr[row+x].y = y; arr[row+x].speed = 0.0; arr[row+x].growth = 0.0; arr[row+x].col = 0; @@ -533,7 +540,7 @@ static void killcell (cell *c) c->next->prev = c->prev; c->prev = 0; c->speed = 0.0; - drawblock (c->x, c->y, c->col); + drawblock (cell_x(c), cell_y(c), c->col); } @@ -612,8 +619,8 @@ static void update (void) if (coords) for (i = 0; i < 4; i++) { - int x = a->x + coords[i].x; - int y = a->y + coords[i].y; + int x = cell_x(a) + coords[i].x; + int y = cell_y(a) + coords[i].y; if (x < 0) x = arr_width - 1; else if (x >= arr_width) x = 0; @@ -638,7 +645,7 @@ static void update (void) a->speed = a->nextspeed; a->growth = 0.0; a->col = a->nextcol; - drawblock (a->x, a->y, a->col + count); + drawblock (cell_x(a), cell_y(a), a->col + count); } } } diff --git a/hacks/ripples.c b/hacks/ripples.c index f8996c4e..fd7e4fa7 100644 --- a/hacks/ripples.c +++ b/hacks/ripples.c @@ -19,21 +19,27 @@ * Options * -delay usleep every iteration * -rate Add one drop every "rate" iterations + * -box Add big square splash every "box" iters (not very good) * -water Ripples on a grabbed background image * -foreground Interpolate ripples between these two colors * -background * -oily Psychedelic colours like man * -stir Add a regular pattern of drops * -fluidity Between 0 and 16. 16 = big drops - * -light Hack to add lighting effect (2 for 16bbp, 6 for 32bpp) + * -light Hack to add lighting effect * * Code mainly hacked from xflame and decayscreen. */ /* Version history: - * Speeded up graphics with dirty buffer. Returned to using putpixel for - * greater portability - * Added a variety of methods for splashing screen. + * 13 Oct 1999: Initial hack + * 30 Oct 1999: Speeded up graphics with dirty buffer. Returned to using + * putpixel for greater portability + * Added a variety of methods for splashing screen. + * 31 Oct 1999: Added in lighting hack + * 13 Nov 1999: Speed up tweaks + * Adjust "light" for different bits per colour (-water only) + * */ @@ -70,14 +76,24 @@ static char *dirty_buffer; #define TABLE 256 static double cos_tab[TABLE]; -static double drop_dist[] = +/* Distribution of drops: many little ones and a few big ones. */ +static double drop_dist[] = {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.2, 0.6}; +static void (*draw_transparent)(short *src); + /* How hard to hit the water */ #define SPLASH 512 #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define MAX(x, y) ((x) > (y) ? (x) : (y)) -#define DIRTY 2 /* 2 = dirty, 1 = restore original pixel, 0 = leave alone */ +#define DIRTY 3 /* dirty >= 2, 1 = restore original pixel, 0 = leave alone */ + +/* From fortune(6) */ +/* -- really weird C code to count the number of bits in a word */ +#define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255) +#define BX_(x) ((x) - (((x)>>1)&0x77777777) \ + - (((x)>>2)&0x33333333) \ + - (((x)>>3)&0x11111111)) /* ------------------------------------------- */ @@ -118,7 +134,6 @@ draw_ripple(short *src) if (*dirty > 0) { int dx; if (light > 0) { - /* dx = ((v2 - v1) + (v4 - v3)) << light; */ /* light from left */ dx = ((v3 - v1) + (v4 - v2)) << light; /* light from top */ } else dx = 0; @@ -134,7 +149,68 @@ draw_ripple(short *src) /* ------------------------------------------- */ -static unsigned long (*bright)(int dx, unsigned long color); +/* Uses the horizontal gradient as an offset to create a warp effect */ +static void +draw_transparent_vanilla(short *src) +{ + int across, down, pixel; + char *dirty = dirty_buffer; + + pixel = 0; + for (down = 0; down < height - 2; down++, pixel += 2) + for (across = 0; across < width-2; across++, pixel++) { + int gradx, grady, gradx1, grady1; + int x0, x1, x2, y1, y2; + + x0 = src[pixel]; + x1 = src[pixel + 1]; + x2 = src[pixel + 2]; + y1 = src[pixel + width]; + y2 = src[pixel + 2*width]; + + gradx = (x1 - x0); + grady = (y1 - x0); + gradx1= (x2 - x1); + grady1= (y2 - y1); + gradx1 = 1 + (gradx + gradx1) / 2; + grady1 = 1 + (grady + grady1) / 2; + + if ((2*across+MIN(gradx,gradx1) < 0) || + (2*across+MAX(gradx,gradx1) >= bigwidth)) { + gradx = 0; + gradx1= 1; + } + if ((2*down+MIN(grady,grady1) < 0) || + (2*down+MAX(grady,grady1) >= bigheight)) { + grady = 0; + grady1 = 1; + } + + if ((gradx == 0 && gradx1 == 1 && grady == 0 && grady1 == 1)) { + if (dirty[pixel] > 0) + dirty[pixel]--; + } else + dirty[pixel] = DIRTY; + + if (dirty[pixel] > 0) { + XPutPixel(buffer_map, (across<<1), (down<<1), + XGetPixel(orig_map, (across<<1) + gradx, (down<<1) + grady)); + XPutPixel(buffer_map, (across<<1)+1,(down<<1), + XGetPixel(orig_map, (across<<1) + gradx1,(down<<1) + grady)); + XPutPixel(buffer_map, (across<<1), (down<<1)+1, + XGetPixel(orig_map, (across<<1) + gradx, (down<<1) + grady1)); + XPutPixel(buffer_map, (across<<1)+1,(down<<1)+1, + XGetPixel(orig_map, (across<<1) + gradx1,(down<<1) + grady1)); + } + } +} + + +/* ------------------------------------------- */ + + +/* This builds on the above warp effect by adding in a lighting effect: */ +/* brighten pixels by an amount corresponding to the vertical gradient */ static unsigned long rmask; static unsigned long gmask; static unsigned long bmask; @@ -143,7 +219,7 @@ static int gshift; static int bshift; -static void +static void set_mask(unsigned long color, unsigned long *mask, int *shift) { *shift = 0; @@ -170,7 +246,7 @@ cadd(unsigned long color, int dx, unsigned long mask, int shift) static unsigned long -dobright(int dx, unsigned long color) +bright(int dx, unsigned long color) { return (cadd(color, dx, rmask, rshift) | cadd(color, dx, gmask, gshift) | @@ -178,15 +254,8 @@ dobright(int dx, unsigned long color) } -static unsigned long -nobright(int dx, unsigned long color) -{ - return color; -} - - static void -draw_transparent(short *src) +draw_transparent_light(short *src) { int across, down, pixel; char *dirty = dirty_buffer; @@ -229,21 +298,33 @@ draw_transparent(short *src) if (dirty[pixel] > 0) { int dx; - if (light > 0) { - if (4-light >= 0) - dx = (grady + (src[pixel+width+1]-x1)) >> (4-light); /* light from top */ - else - dx = (grady + (src[pixel+width+1]-x1)) << (light-4); /* light from top */ - } else - dx = 0; - XPutPixel(buffer_map, (across<<1), (down<<1), - bright(dx, XGetPixel(orig_map, (across<<1) + gradx, (down<<1) + grady))); - XPutPixel(buffer_map, (across<<1)+1,(down<<1), - bright(dx, XGetPixel(orig_map, (across<<1) + gradx1,(down<<1) + grady))); - XPutPixel(buffer_map, (across<<1), (down<<1)+1, - bright(dx, XGetPixel(orig_map, (across<<1) + gradx, (down<<1) + grady1))); - XPutPixel(buffer_map, (across<<1)+1,(down<<1)+1, - bright(dx, XGetPixel(orig_map, (across<<1) + gradx1,(down<<1) + grady1))); + + /* light from top */ + if (4-light >= 0) + dx = (grady + (src[pixel+width+1]-x1)) >> (4-light); + else + dx = (grady + (src[pixel+width+1]-x1)) << (light-4); + + if (dx != 0) { + XPutPixel(buffer_map, (across<<1), (down<<1), + bright(dx, XGetPixel(orig_map, (across<<1) + gradx, (down<<1) + grady))); + XPutPixel(buffer_map, (across<<1)+1,(down<<1), + bright(dx, XGetPixel(orig_map, (across<<1) + gradx1,(down<<1) + grady))); + XPutPixel(buffer_map, (across<<1), (down<<1)+1, + bright(dx, XGetPixel(orig_map, (across<<1) + gradx, (down<<1) + grady1))); + XPutPixel(buffer_map, (across<<1)+1,(down<<1)+1, + bright(dx, XGetPixel(orig_map, (across<<1) + gradx1,(down<<1) + grady1))); + } else { + /* Could use XCopyArea, but XPutPixel is faster */ + XPutPixel(buffer_map, (across<<1), (down<<1), + XGetPixel(orig_map, (across<<1) + gradx, (down<<1) + grady)); + XPutPixel(buffer_map, (across<<1)+1,(down<<1), + XGetPixel(orig_map, (across<<1) + gradx1,(down<<1) + grady)); + XPutPixel(buffer_map, (across<<1), (down<<1)+1, + XGetPixel(orig_map, (across<<1) + gradx, (down<<1) + grady1)); + XPutPixel(buffer_map, (across<<1)+1,(down<<1)+1, + XGetPixel(orig_map, (across<<1) + gradx1,(down<<1) + grady1)); + } } } } @@ -252,34 +333,86 @@ draw_transparent(short *src) /* ------------------------------------------- */ -/* +#if 0 +/* Doesn't go any faster and doesn't work at all colour depths */ static void -draw_ripple16(short *src) +draw_transparent16l(short *src) { - int across, down; - unsigned short *dest; + int across, down, bigpix, pixel; + char *dirty = dirty_buffer; + unsigned short *buffer, *orig; - dest = (unsigned short *) buffer_map->data; + buffer = (unsigned short *) buffer_map->data; + orig = (unsigned short *) orig_map->data; - for (down = 0; down < height - 1; down++, src += 1, dest += bigwidth+2) - for (across = 0; across < width - 1; across++, src++) { - int v1, v2, v3, v4; - v1 = (int)*src; - v2 = (int)*(src + 1); - v3 = (int)*(src + width); - v4 = (int)*(src + width + 1); - if (!(v1 == 0 && v2 == 0 && v3 == 0 && v4 == 0)) { - *dest++ = map_color(v1); - *dest = map_color((v1 + v2) >> 1); - dest += bigwidth - 1; - *dest++ = map_color((v1 + v3) >> 1); - *dest = map_color((v1 + v4) >> 1); - dest -= bigwidth - 1; + for (pixel = bigpix = down = 0; + down < height - 2; + down++, pixel += 2, bigpix += bigwidth+4) + for (across = 0; across < width-2; across++, pixel++, bigpix+=2) { + int gradx, grady, gradx1, grady1; + int x0, x1, x2, y1, y2; + + x0 = src[pixel]; + x1 = src[pixel + 1]; + x2 = src[pixel + 2]; + y1 = src[pixel + width]; + y2 = src[pixel + 2*width]; + + gradx = (x1 - x0); + grady = (y1 - x0); + gradx1= (x2 - x1); + grady1= (y2 - y1); + gradx1 = 1 + (gradx + gradx1) / 2; + grady1 = 1 + (grady + grady1) / 2; + + if ((2*across+MIN(gradx,gradx1) < 0) || + (2*across+MAX(gradx,gradx1) >= bigwidth)) { + gradx = 0; + gradx1= 1; + } + if ((2*down+MIN(grady,grady1) < 0) || + (2*down+MAX(grady,grady1) >= bigheight)) { + grady = 0; + grady1 = 1; + } + + if ((gradx == 0 && gradx1 == 1 && grady == 0 && grady1 == 1)) { + if (dirty[pixel] > 0) + dirty[pixel]--; } else - dest += 2; + dirty[pixel] = DIRTY; + + if (dirty[pixel] > 0) { + unsigned short *dest = buffer + bigpix; + unsigned short *image = orig + bigpix; + int dx; + + /* light from top */ + if (4-light >= 0) + dx = (grady + (src[pixel+width+1]-x1)) >> (4-light); + else + dx = (grady + (src[pixel+width+1]-x1)) << (light-4); + + grady *= bigwidth; + grady1*= bigwidth; + + if (dx != 0) { + *dest++ = dobright(dx, *(image + gradx + grady)); + *dest = dobright(dx, *(image + gradx1 + grady)); + dest += bigwidth - 1; + *dest++ = dobright(dx, *(image + gradx + grady1)); + *dest = dobright(dx, *(image + gradx1 + grady1)); + } else { + *dest++ = *(image + gradx + grady); + *dest = *(image + gradx1 + grady); + dest += bigwidth - 1; + *dest++ = *(image + gradx + grady1); + *dest = *(image + gradx1 + grady1); + } + } } } -*/ +#endif /* ------------------------------------------- */ @@ -319,6 +452,7 @@ setup_X(Display * disp, Window win) gcflags = GCForeground | GCFunction; if (use_subwindow_mode_p(xwa.screen, window)) /* see grabscreen.c */ gcflags |= GCSubwindowMode; + gc = XCreateGC(display, window, gcflags, &gcv); grab_screen_image(xwa.screen, window); @@ -329,14 +463,14 @@ setup_X(Display * disp, Window win) XGCValues gcv; gc = XCreateGC(display, window, 0, &gcv); - if (!gc) { - fprintf(stderr, "XCreateGC failed\n"); - exit(1); - } - orig_map = 0; } + if (!gc) { + fprintf(stderr, "XCreateGC failed\n"); + exit(1); + } + buffer_map = 0; #ifdef HAVE_XSHM_EXTENSION @@ -371,6 +505,9 @@ DisplayImage(void) #endif /* HAVE_XSHM_EXTENSION */ XPutImage(display, window, gc, buffer_map, 0, 0, 0, 0, bigwidth, bigheight); + + XSync(display,False); + screenhack_handle_events(display); } @@ -480,11 +617,21 @@ init_oily_colors(void) /* ------------------------------------------- */ +static void +init_cos_tab(void) +{ + int i; + for (i = 0; i < TABLE; i++) + cos_tab[i] = cos(i * M_PI/2 / TABLE); +} + + /* Shape of drop to add */ static double sinc(double x) { #if 1 + /* cosine hump */ int i; i = (int)(x * TABLE + 0.5); if (i >= TABLE) i = (TABLE-1) - (i-(TABLE-1)); @@ -526,7 +673,7 @@ add_drop(ripple_mode mode, int drop) int newx, newy, dheight; int radius = MIN(width, height) / 50; /* Don't put drops too near the edge of the screen or they get stuck */ - int border = 6; + int border = 8; switch (mode) { default: @@ -593,23 +740,15 @@ init_ripples(int ndrops, int splash) bufferB = (short *)calloc(width * height, sizeof(*bufferB)); temp = (short *)calloc(width * height, sizeof(*temp)); - dirty_buffer = (char *)malloc(width * height); - memset(dirty_buffer, DIRTY, width * height); + dirty_buffer = (char *)calloc(width * height, sizeof(*dirty_buffer)); for (i = 0; i < ndrops; i++) add_drop(ripple_blob, splash); if (transparent) { /* There's got to be a better way of doing this XCopyArea? */ - int across, down; - for (down = 0; down < bigheight-4; down++) - for (across = bigwidth-4; across < bigwidth; across++) - XPutPixel(buffer_map, across, down, - XGetPixel(orig_map, across, down)); - for (down = bigheight-4; down < bigheight; down++) - for (across = 0; across < bigwidth; across++) - XPutPixel(buffer_map, across, down, - XGetPixel(orig_map, across, down)); + memcpy(buffer_map->data, orig_map->data, + bigheight * buffer_map->bytes_per_line); } else { int across, down, color; @@ -635,7 +774,7 @@ init_ripples(int ndrops, int splash) [ u(t+1)-2u(t)+u(t-1) ] / dt = a [ u(x+1)+u(x-1)+u(y+1)+u(y-1)-4u ] / h - where dt = time step squared, h= dx*dy = mesh resolution squared. + where dt = time step squared, h = dx*dy = mesh resolution squared. From where u(t+1) may be calculated as: @@ -677,8 +816,6 @@ ripple(int fluidity) toggle = 0; } -#if 1 - /* Traditional, squarer ripples */ switch (count) { case 0: case 1: pixel = 1 * width + 1; @@ -693,13 +830,16 @@ ripple(int fluidity) pixel = 1 * width + 1; for (down = 1; down < height - 1; down++, pixel += 2 * 1) for (across = 1; across < width - 1; across++, pixel++) { - int damp = - (temp[pixel - 1] + temp[pixel + 1] + - temp[pixel - width] + temp[pixel + width] + - temp[pixel - width - 1] + temp[pixel - width + 1] + - temp[pixel + width - 1] + temp[pixel + width + 1] + - temp[pixel]) / 9; - dest[pixel] = damp - (damp >> fluidity); + if (temp[pixel] != 0) { /* Close enough for government work */ + int damp = + (temp[pixel - 1] + temp[pixel + 1] + + temp[pixel - width] + temp[pixel + width] + + temp[pixel - width - 1] + temp[pixel - width + 1] + + temp[pixel + width - 1] + temp[pixel + width + 1] + + temp[pixel]) / 9; + dest[pixel] = damp - (damp >> fluidity); + } else + dest[pixel] = 0; } break; case 2: case 3: @@ -714,21 +854,6 @@ ripple(int fluidity) break; } if (++count > 3) count = 0; -#else - /* Rounder ripples, but with strange cross effect in center */ - pixel = 1 * width + 1; - for (down = 1; down < height - 1; down++, pixel += 2 * 1) - for (across = 1; across < width - 1; across++, pixel++) { - int grad; - grad = - (src[pixel - 1] + src[pixel + 1] + - src[pixel - width] + src[pixel + width] + - src[pixel - width - 1] + src[pixel - width + 1] + - src[pixel + width - 1] + src[pixel + width + 1]) / 2; - dest[pixel] = grad/2 - dest[pixel]; - dest[pixel] -= (dest[pixel] >> fluidity); - } -#endif if (transparent) draw_transparent(dest); @@ -792,39 +917,48 @@ void screenhack(Display *disp, Window win) int stir = get_boolean_resource("stir", "Boolean"); int fluidity = get_integer_resource("fluidity", "Integer"); transparent = get_boolean_resource("water", "Boolean"); +#ifdef HAVE_XSHM_EXTENSION use_shm = get_boolean_resource("useSHM", "Boolean"); +#endif /* HAVE_XSHM_EXTENSION */ light = get_integer_resource("light", "Integer"); if (fluidity <= 1) fluidity = 1; if (fluidity > 16) fluidity = 16; /* 16 = sizeof(short) */ if (light < 0) light = 0; - { int i; - for (i = 0; i < TABLE; i++) - cos_tab[i] = cos(i * M_PI/2 / TABLE); - } - + init_cos_tab(); setup_X(disp, win); ncolors = get_integer_resource ("colors", "Colors"); if (0 == ncolors) /* English spelling? */ ncolors = get_integer_resource ("colours", "Colors"); + + if (ncolors > sizeof(ctab)/sizeof(*ctab)) + ncolors = sizeof(ctab)/sizeof(*ctab); + if (oily) init_oily_colors(); else init_linear_colors(); if (transparent && light > 0) { - bright = dobright; + int maxbits; + draw_transparent = draw_transparent_light; set_mask(visual->red_mask, &rmask, &rshift); set_mask(visual->green_mask, &gmask, &gshift); set_mask(visual->blue_mask, &bmask, &bshift); - if (rmask == 0) bright = nobright; + if (rmask == 0) draw_transparent = draw_transparent_vanilla; + + /* Adjust the shift value "light" when we don't have 8 bits per colour */ + maxbits = MIN(MIN(BITCOUNT(rmask), BITCOUNT(gmask)), BITCOUNT(bmask)); + light -= 8-maxbits; + if (light < 0) light = 0; } else - bright = nobright; + draw_transparent = draw_transparent_vanilla; init_ripples(0, -SPLASH); /* Start off without any drops */ + /* Main drawing loop */ while (1) { if (rate > 0 && (iterations % rate) == 0) add_drop(ripple_blob, -SPLASH); @@ -836,8 +970,6 @@ void screenhack(Display *disp, Window win) ripple(fluidity); DisplayImage(); - XSync(display,False); - screenhack_handle_events(display); if (delay) usleep(delay); diff --git a/hacks/screenhack.c b/hacks/screenhack.c index 786d24b4..9664f803 100644 --- a/hacks/screenhack.c +++ b/hacks/screenhack.c @@ -301,7 +301,16 @@ visual_warning (Screen *screen, Window window, Visual *visual, Colormap cmap, if (visual_string && *visual_string) { - if (visual != desired_visual) + char *s; + for (s = visual_string; *s; s++) + if (isupper (*s)) *s = _tolower (*s); + + if (!strcmp (visual_string, "default") || + !strcmp (visual_string, "default") || + !strcmp (visual_string, "best")) + /* don't warn about these, just silently DWIM. */ + ; + else if (visual != desired_visual) { fprintf (stderr, "%s: ignoring `-visual %s' because of `%s'.\n", progname, visual_string, why); @@ -486,6 +495,7 @@ main (int argc, char **argv) XtNcolormap, cmap, XtNbackground, (Pixel) bg, XtNborderColor, (Pixel) bd, + XtNinput, True, /* for WM_HINTS */ 0); XtDestroyWidget (toplevel); toplevel = new; @@ -494,7 +504,10 @@ main (int argc, char **argv) } else { - XtVaSetValues (toplevel, XtNmappedWhenManaged, False, 0); + XtVaSetValues (toplevel, + XtNmappedWhenManaged, False, + XtNinput, True, /* for WM_HINTS */ + 0); XtRealizeWidget (toplevel); window = XtWindow (toplevel); @@ -551,7 +564,13 @@ main (int argc, char **argv) XIfEvent (dpy, &event, MapNotify_event_p, (XPointer) window); XSync (dpy, False); - srandom ((int) time ((time_t *) 0)); + + /* This is the one and only place that the random-number generator is + seeded in any screenhack. You do not need to seed the RNG again, + it is done for you before your code is invoked. */ +# undef ya_rand_init + ya_rand_init ((int) time ((time_t *) 0)); + screenhack (dpy, window); /* doesn't return */ return 0; } diff --git a/hacks/webcollage b/hacks/webcollage index 587bb416..0092da3b 100755 --- a/hacks/webcollage +++ b/hacks/webcollage @@ -27,7 +27,7 @@ require POSIX; use Fcntl ':flock'; # import LOCK_* constants -my $version = q{ $Revision: 1.41 $ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/; +my $version = q{ $Revision: 1.42 $ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/; my $copyright = "WebCollage $version, Copyright (c) 1999" . " Jamie Zawinski \n" . " http://www.jwz.org/xscreensaver/\n"; @@ -163,6 +163,9 @@ sub get_document_1 { $paddr = sockaddr_in($port2, $iaddr); + my $head = ""; + my $body = ""; + @_ = eval { local $SIG{ALRM} = sub { @@ -200,8 +203,6 @@ sub get_document_1 { "\n"); my $http = ; - my $head = ""; - my $body = ""; while () { $head .= $_; last if m@^[\r\n]@; @@ -221,6 +222,8 @@ sub get_document_1 { die if ($@ && $@ ne "alarm\n"); # propagate errors if ($@) { # timed out + $head = undef; + $body = undef; return (); } else { # didn't @@ -287,11 +290,13 @@ sub get_document { print STDERR "$progname: too many redirects " . "($max_loop_count) from $orig_url\n"; } + $body = undef; return (); } } elsif ( $http =~ m@HTTP/[0-9.]+ [4-9][0-9][0-9]@ ) { # http errors -- return nothing. + $body = undef; return (); } else { @@ -374,6 +379,8 @@ sub pick_image_from_body { " \"$url\": rejecting.\n"; } $rejected_urls{$url} = -1; + $body = undef; + $_ = undef; return (); } @@ -396,6 +403,8 @@ sub pick_image_from_body { " length $L in $url: rejecting.\n"; } $rejected_urls{$url} = $L; + $body = undef; + $_ = undef; return (); } elsif ( $verbose > 2 ) { print STDERR "$progname: keywords of length $L" . @@ -494,6 +503,9 @@ sub pick_image_from_body { } } + $_ = undef; + $body = undef; + if ( $#urls == 0 ) { if ( $verbose > 2 ) { print STDERR "$progname: no images on $base\n"; @@ -528,8 +540,12 @@ sub pick_from_url_randomizer { my ( $base, $body ) = get_document ($random_redirector, undef, $timeout); - return if (!$base || !$body); + if (!$base || !$body) { + $body = undef; + return; + } my $img = pick_image_from_body ($base, $body); + $body = undef; if ($img) { return ($base, $img, "yahoo"); @@ -607,7 +623,10 @@ sub pick_from_image_randomizer { my ( $base, $body ) = get_document ($search_url, undef, $timeout); if (defined ($timeout)) { $timeout -= (time - $start); - return () if ($timeout <= 0); + if ($timeout <= 0) { + $body = undef; + return (); + } } return () if (! $body); @@ -691,6 +710,8 @@ sub pick_from_image_randomizer { print STDERR "$progname: found nothing on $base " . "($length bytes, $href_count links).\n"; } + $body = undef; + $_ = undef; return (); } @@ -703,12 +724,18 @@ sub pick_from_image_randomizer { } + $body = undef; + $_ = undef; my ( $base2, $body2 ) = get_document ($subpage, $base, $timeout); - return () if (!$base2 || !$body2); + if (!$base2 || !$body2) { + $body2 = undef; + return (); + } my $img = pick_image_from_body ($base2, $body2); + $body2 = undef; if ($img) { return ($base2, $img, @@ -1007,12 +1034,14 @@ sub image_to_pnm { } kill ('TERM', $pid) if ($pid); $timed_out = 1; + $body = undef; }; if (($pid = open(PIPE, "| $cmd2 > $output"))) { $timed_out = 0; alarm $cvt_timeout; print PIPE $body; + $body = undef; close PIPE; if ($verbose > 3) { print STDERR "$progname: awaiting $pid\n"; } @@ -1041,10 +1070,12 @@ sub image_to_pnm { die if ($@ && $@ ne "alarm\n"); # propagate errors if ($@) { # timed out + $body = undef; return (); } else { # didn't alarm 0; + $body = undef; return @_; } } @@ -1156,6 +1187,7 @@ sub x_output { $cmd .= "pnmpaste - $x $y $image_ppm > $image_tmp1"; open (IMG, "| $cmd") || die ("running $cmd: $!\n"); print IMG $body; + $body = undef; close (IMG); if ($verbose > 1) { print STDERR "$progname: subproc exited normally.\n"; @@ -1170,6 +1202,7 @@ sub x_output { my ($headers, $body) = get_document ($img, $base); if ($body) { handle_image ($base, $img, $body, $source); + $body = undef; } } unlink $image_tmp1, $image_tmp2; @@ -1185,6 +1218,7 @@ sub handle_image { } my ($iw, $ih) = image_to_pnm ($img, $body, $image_tmp1); + $body = undef; return 0 unless ($iw && $ih); my $ow = $iw; # used only for error messages @@ -1493,7 +1527,7 @@ sub main { if (!$root_p && !$no_output_p) { die "$copyright" . - "$progname: the -root argument is manditory (for now.)\n"; + "$progname: the -root argument is mandatory (for now.)\n"; } if (!$no_output_p && !$ENV{DISPLAY}) { diff --git a/hacks/xlockmore.c b/hacks/xlockmore.c index 62c2dc79..9927d6ee 100644 --- a/hacks/xlockmore.c +++ b/hacks/xlockmore.c @@ -24,6 +24,8 @@ #define countof(x) (sizeof((x))/sizeof(*(x))) +#define MAX_COLORS (1L<<13) + extern ModeSpecOpt xlockmore_opts[]; extern const char *app_defaults; @@ -249,8 +251,8 @@ xlockmore_screenhack (Display *dpy, Window window, mi.npixels = get_integer_resource ("ncolors", "Integer"); if (mi.npixels <= 0) mi.npixels = 64; - else if (mi.npixels > 256) - mi.npixels = 256; + else if (mi.npixels > MAX_COLORS) + mi.npixels = MAX_COLORS; mi.colors = (XColor *) calloc (mi.npixels, sizeof (*mi.colors)); diff --git a/hacks/xsublim.c b/hacks/xsublim.c index b4cd5ba2..9f93758a 100644 --- a/hacks/xsublim.c +++ b/hacks/xsublim.c @@ -458,8 +458,10 @@ int main(int argc,char* argv[]) signal(sig_Number,xsublim_Sig_Catch); } - /* Randomize */ - srandom((int)time((time_t*)0)); + /* Randomize -- only need to do this here because this program + doesn't use the `screenhack.h' or `lockmore.h' APIs. */ +# undef ya_rand_init + ya_rand_init ((int) time ((time_t *) 0)); /* Handle all the X nonsense */ #if defined(__sgi) diff --git a/utils/version.h b/utils/version.h index e061b98b..b236ff42 100644 --- a/utils/version.h +++ b/utils/version.h @@ -1,2 +1,2 @@ static const char screensaver_id[] = - "@(#)xscreensaver 3.20 (12-Nov-99), by Jamie Zawinski (jwz@jwz.org)"; + "@(#)xscreensaver 3.21 (17-Nov-99), by Jamie Zawinski (jwz@jwz.org)"; diff --git a/utils/visual.c b/utils/visual.c index 1bf49421..57b73151 100644 --- a/utils/visual.c +++ b/utils/visual.c @@ -135,7 +135,7 @@ get_visual (Screen *screen, const char *string, Bool prefer_writable_cells, if (visual) result = visual; else if (verbose_p) - fprintf (stderr, "%s: no visual suitable for GL.\n", progname, v); + fprintf (stderr, "%s: no visual suitable for GL.\n", progname); } else if (vclass == SPECIFIC_VISUAL) { @@ -326,7 +326,7 @@ pick_best_gl_visual (Screen *screen) result = vi_out[0].visual; } - if (result) + if (!result) /* No half-depth TrueColor? Ok, try for any TrueColor (the deepest.) */ result = pick_best_visual_of_class (screen, TrueColor); diff --git a/utils/yarandom.c b/utils/yarandom.c index 63958e24..3d24943e 100644 --- a/utils/yarandom.c +++ b/utils/yarandom.c @@ -51,6 +51,7 @@ #include /* for gettimeofday() */ #include "yarandom.h" +# undef ya_rand_init /* The following 'random' numbers are taken from CRC, 18th Edition, page 622. diff --git a/utils/yarandom.h b/utils/yarandom.h index abea226d..0e1dfcfb 100644 --- a/utils/yarandom.h +++ b/utils/yarandom.h @@ -25,12 +25,22 @@ # include "vms-gtod.h" #endif +extern unsigned int ya_random (void); +extern void ya_rand_init (unsigned int); + #define random() ya_random() -#define srandom(i) ya_rand_init(0) #define RAND_MAX 0x7FFFFFFF -extern unsigned int ya_random (void); -extern void ya_rand_init (unsigned int); +/*#define srandom(i) ya_rand_init(0)*/ + +/* Define these away to keep people from using the wrong APIs in xscreensaver. + */ +#define rand __ERROR_use_random_not_rand_in_xscreensaver__ +#define drand48 __ERROR_use_random_not_drand48_in_xscreensaver__ +#define srandom __ERROR_do_not_call_srandom_in_xscreensaver__ +#define srand __ERROR_do_not_call_srand_in_xscreensaver__ +#define srand48 __ERROR_do_not_call_srand48_in_xscreensaver__ +#define ya_rand_init __ERROR_do_not_call_ya_rand_init_in_xscreensaver__ #if defined (__GNUC__) && (__GNUC__ >= 2) diff --git a/xscreensaver.lsm b/xscreensaver.lsm index 89eb4b6a..7b8c1172 100644 --- a/xscreensaver.lsm +++ b/xscreensaver.lsm @@ -1,7 +1,7 @@ Begin3 Title: xscreensaver -Version: 3.20 -Entered-date: 12NOV99 +Version: 3.21 +Entered-date: 18NOV99 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. @@ -10,16 +10,16 @@ Keywords: screen saver, screen lock, lock, xlock, X11 Author: jwz@jwz.org (Jamie Zawinski) Maintained-by: jwz@jwz.org (Jamie Zawinski) Primary-site: http://www.jwz.org/xscreensaver/ - 1257K xscreensaver-3.20.tar.gz - 38K xscreensaver.README + 1261K xscreensaver-3.21.tar.gz + 39K xscreensaver.README 1K xscreensaver.lsm Alternate-site: sunsite.unc.edu /pub/Linux/X11/screensavers/ - 1257K xscreensaver-3.20.tar.gz - 38K xscreensaver.README + 1261K xscreensaver-3.21.tar.gz + 39K xscreensaver.README 1K xscreensaver.lsm Alternate-site: ftp.x.org /contrib/applications/ - 1257K xscreensaver-3.20.tar.gz - 38K xscreensaver.README + 1261K xscreensaver-3.21.tar.gz + 39K xscreensaver.README 1K xscreensaver.lsm Platforms: Linux, Irix, SunOS, Solaris, HPUX, AIX, FreeBSD, NetBSD, BSDI, SCO, OSF1, Ultrix, VMS. diff --git a/xscreensaver.spec b/xscreensaver.spec index 63a1ad84..82f719f0 100644 --- a/xscreensaver.spec +++ b/xscreensaver.spec @@ -1,74 +1,121 @@ -Name: xscreensaver -Summary: X screen saver and locker -Vendor: Jamie Zawinski -Version: 3.20 -Release: 1 -URL: http://www.jwz.org/xscreensaver/ -Source: xscreensaver-%{version}.tar.gz -Copyright: BSD -Group: X11/Utilities -Buildroot: /var/tmp/xscreensaver-root +%define name xscreensaver +%define version 3.21 +%define release 1 +%define serial 1 +%define prefix /usr/X11R6 + +# By default, builds the basic, non-GL package. +# To build both the basic and GL-add-on packages: +# rpm --define "USE_GL yes" ... + +Summary: X screen saver and locker +Name: %{name} +Version: %{version} +Release: %{release} +Serial: %{serial} +Group: Amusements/Graphics +Copyright: BSD +URL: http://www.jwz.org/xscreensaver +Vendor: Jamie Zawinski +Source: %{name}-%{version}.tar.gz +Buildroot: /var/tmp/%{name}-%{version}-root %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. More than 100 display modes are included in this package. +%{?USE_GL:See also the xscreensaver-gl package, which} +%{?USE_GL:includes optional OpenGL display modes.} + +%{?USE_GL:%package gl} +%{?USE_GL:Group: Amusements/Graphics} +%{?USE_GL:Requires: xscreensaver = %{version}} +%{?USE_GL:Summary: A set of GL screensavers} +%{?USE_GL:%description gl} +%{?USE_GL:The xscreensaver-gl package contains even more screensavers for your} +%{?USE_GL:mind-numbing, ambition-eroding, time-wasting, hypnotized viewing} +%{?USE_GL:pleasure. These screensavers require OpenGL or Mesa support.} +%{?USE_GL: } +%{?USE_GL:Install the xscreensaver-gl package if you need more screensavers} +%{?USE_GL:for use with the X Window System and you have OpenGL or Mesa} +%{?USE_GL:installed.} %prep - %setup -q %build +RPMOPTS="" + +# Is this really needed? If so, why? +# %ifarch alpha +# RPMOPTS="$RPMOPTS --without-xshm-ext" +# %endif + +# On Solaris, build without PAM and with Shadow. +# On other systems, build with PAM and without Shadow. +# +%ifos solaris + RPMOPTS="$RPMOPTS --without-pam" +%else + RPMOPTS="$RPMOPTS --with-pam --without-shadow" +%endif + +%{?USE_GL:RPMOPTS="$RPMOPTS --with-gl"} +%{!?USE_GL:RPMOPTS="$RPMOPTS --without-gl"} -./configure --prefix=/usr/X11R6 \ - --enable-subdir=/usr/X11R6/lib/xscreensaver -make all +CFLAGS="$RPM_OPT_FLAGS" \ + ./configure --prefix=%{prefix} \ + --enable-subdir=../lib/xscreensaver \ + $RPMOPTS + +make %install -# This is the only directory that "make install" won't make as needed +# This is a directory that "make install" won't make as needed # (since Linux uses /etc/pam.d/* and Solaris uses /etc/pam.conf). # mkdir -p $RPM_BUILD_ROOT/etc/pam.d -make prefix=$RPM_BUILD_ROOT/usr/X11R6 \ - AD_DIR=$RPM_BUILD_ROOT/usr/X11R6/lib/X11/app-defaults \ - HACKDIR=$RPM_BUILD_ROOT/usr/X11R6/lib/xscreensaver \ - PAM_DIR=$RPM_BUILD_ROOT/etc/pam.d \ - install-strip +# This is another (since "make install" doesn't try to install +# the xscreensaver.kss file unless $KDEDIR is set.) +# +if [ -z "$KDEDIR" ]; then export KDEDIR=/usr; fi +mkdir -p $RPM_BUILD_ROOT$KDEDIR/bin + +make install_prefix=$RPM_BUILD_ROOT \ + AD_DIR=%{prefix}/lib/X11/app-defaults \ + install-strip + +# Make a pair of lists, of the GL and non-GL hacks. +# Do this by parsing the output of a dummy run of "make install" +# in the hacks/ and hacks/glx/ directories. +# +list_files() { + make -s install_prefix=$RPM_BUILD_ROOT INSTALL=true install | + sed -n -e 's@.* /\([^ ]*\)$@/\1@p' | + sed -e "s@^$RPM_BUILD_ROOT@@" \ + -e "s@/bin/..@@" | + sort +} + +( cd hacks ; list_files > $RPM_BUILD_DIR/xscreensaver-%{version}/hacks-non-gl ) +( cd hacks/glx ; list_files > $RPM_BUILD_DIR/xscreensaver-%{version}/hacks-gl ) + + # This line is redundant, except that it causes the "xscreensaver" # executable to be installed unstripped (while all others are stripped.) # You should install it this way so that jwz gets useful bug reports. # -install -m 4755 driver/xscreensaver $RPM_BUILD_ROOT/usr/X11R6/bin +install -m 4755 driver/xscreensaver $RPM_BUILD_ROOT%{prefix}/bin # Even if we weren't compiled with PAM support, make sure to include # the PAM module file in the RPM anyway, just in case. # -( cd driver; make PAM_DIR=$RPM_BUILD_ROOT/etc/pam.d install-pam ) - -# If we built multiple versions of xscreensaver-demo (because multiple -# toolkits were available) then install them all. -# -( cd driver; - exes=`echo xscreensaver-demo-*` - count=`echo $exes | wc -w` - if [ $count -gt 1 ]; then - for exe in $exes; do - install -c -s $exe $RPM_BUILD_ROOT/usr/X11R6/bin - done - cd $RPM_BUILD_ROOT/usr/X11R6/bin - if [ -x xscreensaver-demo-Xaw ]; then target=Xaw; fi - if [ -x xscreensaver-demo-Xaw3d ]; then target=Xaw3d; fi - if [ -x xscreensaver-demo-Xm ]; then target=Xm; fi - if [ -x xscreensaver-demo-Gtk ]; then target=Gtk; fi - rm -f xscreensaver-demo - ln -s xscreensaver-demo-$target xscreensaver-demo - fi - ) - +( cd driver ; + make install_prefix=$RPM_BUILD_ROOT PAM_DIR=/etc/pam.d install-pam ) # This is for wmconfig, a tool that generates init files for window managers. # @@ -95,16 +142,24 @@ EOF chmod -R a+r,u+w,og-w $RPM_BUILD_ROOT %clean -rm -rf $RPM_BUILD_ROOT +if [ -d $RPM_BUILD_ROOT ]; then rm -r $RPM_BUILD_ROOT ; fi +if [ -d $RPM_BUILD_ROOT-gl ]; then rm -r $RPM_BUILD_ROOT-gl ; fi -%files +%files -f hacks-non-gl %defattr(-,root,root) +# Files for the "xscreensaver" package: +# %doc README README.debugging - /usr/X11R6/bin/* - /usr/X11R6/lib/xscreensaver/* -%config /usr/X11R6/lib/X11/app-defaults/* - /usr/X11R6/man/man1/* + %{prefix}/bin/* +%dir %{prefix}/lib/xscreensaver +%config %{prefix}/lib/X11/app-defaults/* + %{prefix}/man/man1/xscreensaver* /etc/pam.d/* +%config(missingok) /usr/bin/*.kss %config(missingok) /etc/X11/wmconfig/* %config(missingok) "/usr/share/apps/Amusements/Screen Savers/*" + +# Files for the "xscreensaver-gl" package: +# +%{?USE_GL:%files -f hacks-gl gl}