From: Zygo Blaxell Date: Mon, 2 Mar 2009 05:42:18 +0000 (-0500) Subject: ftp://ftp.uniovi.es/pub/X11R6/graphics/misc/lock/xscreensaver-1.22.tar.gz X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=88134d551a9911995c013c5ed06a32c2b1044b85;p=xscreensaver ftp://ftp.uniovi.es/pub/X11R6/graphics/misc/lock/xscreensaver-1.22.tar.gz -rw-r--r-- 1 zblaxell zblaxell 125136 Jul 10 1994 xscreensaver-1.22.tar.gz 22d23c52eeb73529c798c184039202d0834f40e8 xscreensaver-1.22.tar.gz --- diff --git a/Imakefile b/Imakefile index fd1901de..0377de1f 100644 --- a/Imakefile +++ b/Imakefile @@ -1,5 +1,5 @@ /* - * Imakefile file for xscreensaver, Copyright (c) 1991-1993 Jamie Zawinski. + * Imakefile file for xscreensaver, Copyright (c) 1991-1994 Jamie Zawinski. * * You should not need to edit this file; edit config.h instead. * @@ -11,8 +11,8 @@ TAR = gnutar COMPRESS = compress COMPRESS_EXT = Z -# COMPRESS = gzip --verbose --best -# COMPRESS_EXT = gz +/**/# COMPRESS = gzip --verbose --best +/**/# COMPRESS_EXT = gz all:: utils/Makefile driver/Makefile hacks/Makefile cd utils ; $(MAKE) $@ CC="$(CC)" CCOPTIONS="$(CCOPTIONS)" CDEBUGFLAGS="$(CDEBUGFLAGS)" @@ -33,7 +33,7 @@ driver/Makefile: driver/Imakefile config.h hacks/Makefile: hacks/Imakefile config.h cd hacks ; $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)/hacks -# This really makes me sick... +/* This really makes me sick... */ tar: utils/Makefile driver/Makefile hacks/Makefile @NAME=`sed -n \ 's/[^0-9]*\([0-9]\.[0-9][0-9]*\).*/xscreensaver-\1/p' utils/version.h` ; \ diff --git a/README b/README index 17a50260..e7302b8f 100644 --- a/README +++ b/README @@ -75,9 +75,18 @@ You can get all of these from the contrib directory on ftp.x.org. If you know of (or write) any other interesting programs that can be used as screensavers, please let me know! +This program should be updated to take advantage of the new R6 `screensaver' +server extension instead of XIdle. I didn't have time to do this before the +deadline for the R6 contrib tape, but by the time you read this, maybe it's +done - check a later release. + +The latest version of xscreensaver is on LUCID.COM and FTP.X.ORG. + -- Jamie Zawinski +Changes since 1.21: Minor tweaks for X11R6. + Fixes for non-default visuals. Changes since 1.20: Fixed bug in color blitspin; added default image. Added diagnostics to noseguy. Fixed off-by-one error in flame. Added some missing casts. diff --git a/config.h b/config.h index 691c98c6..d275fc11 100644 --- a/config.h +++ b/config.h @@ -1,14 +1,19 @@ /* - * Config file for xscreensaver, Copyright (c) 1991-1993 Jamie Zawinski. + * Config file for xscreensaver, Copyright (c) 1991-1994 Jamie Zawinski. * This file is included by the various Imakefiles. */ /* Uncomment the following line if you have the XIdle extension installed. - * XIdle comes on the X11r5 contrib tape, in .../contrib/extensions/xidle/. + * XIdle comes on the X11r5 contrib tape, in .../contrib/extensions/xidle/ + * (and maybe it will be on the r6 tape as well but I'm not sure where.) * Installing it is the morally superior thing to do, but xscreensaver will * work without it. + * + * Actually it's likely that the R6 `screensaver' server extension will turn + * out to be the better thing to use, but I haven't had time to add support + * for it yet. (See README to find the latest version of this program.) */ -#define HAVE_XIDLE +/* #define HAVE_XIDLE */ /* Uncomment the following line if you have the XPM library installed. * Some of the demos can make use of this. diff --git a/driver/XScreenSaver.ad b/driver/XScreenSaver.ad index 5ec4249a..221ffb62 100644 --- a/driver/XScreenSaver.ad +++ b/driver/XScreenSaver.ad @@ -95,7 +95,7 @@ *demoDialog.maxWidth: 600 *label1.labelString: XScreenSaver %s -*label2.labelString: Copyright © 1991-1993 by Jamie Zawinski +*label2.labelString: Copyright © 1991-1994 by Jamie Zawinski *demoList.visibleItemCount: 10 *demoList.automaticSelection: True *next.labelString: Run Next diff --git a/driver/demo.c b/driver/demo.c index 0603a03a..eed5c207 100644 --- a/driver/demo.c +++ b/driver/demo.c @@ -185,7 +185,7 @@ pop_up_dialog_box (dialog, form, where) It's important that the screensaver dialogs not get decorated or otherwise reparented by the window manager, because they need to be children of the *real* root window, not the WM's virtual root, in - order for us to guarentee tha they are visible above the screensaver + order for us to guarentee that they are visible above the screensaver window itself. */ Arg av [100]; diff --git a/driver/dialogs.xd b/driver/dialogs.xd index 6e563335..3bbd713b 100644 --- a/driver/dialogs.xd +++ b/driver/dialogs.xd @@ -424,7 +424,7 @@ object 'label1' : XmLabel { object 'label2' : XmLabel { arguments { name = 'label2'; - XmNlabelString= 'Copyright © 1991-1993 by Jamie Zawinski '; + XmNlabelString= 'Copyright © 1991-1994 by Jamie Zawinski '; }; }; object 'text_area' : XmScrolledList { diff --git a/driver/subprocs.c b/driver/subprocs.c index d8cc3309..23eb0e44 100644 --- a/driver/subprocs.c +++ b/driver/subprocs.c @@ -80,12 +80,13 @@ extern int putenv (/* const char * */); /* getenv() is in stdlib.h... */ extern int kill (pid_t, int); /* signal() is in sys/signal.h... */ #endif -# if defined(SVR4) || defined(SYSV) -# define random() rand() -# else /* !totally-losing-SYSV */ -extern long random(); /* rand() is in stdlib.h... */ -# endif /* !totally-losing-SYSV */ - +# ifndef random +# if defined(SVR4) || defined(SYSV) +# define random() rand() +# else /* !totally-losing-SYSV */ + extern long random(); /* rand() is in stdlib.h... */ +# endif /* !totally-losing-SYSV */ +# endif /* random defined */ #include "xscreensaver.h" diff --git a/driver/visual.c b/driver/visual.c index b9d18970..74e77051 100644 --- a/driver/visual.c +++ b/driver/visual.c @@ -113,6 +113,24 @@ get_visual_depth (dpy, visual) } +int +get_visual_class (dpy, visual) + Display *dpy; + Visual *visual; +{ + XVisualInfo vi_in, *vi_out; + int out_count, c; + vi_in.screen = DefaultScreen (dpy); + vi_in.visualid = XVisualIDFromVisual (visual); + vi_out = XGetVisualInfo (dpy, VisualScreenMask|VisualIDMask, + &vi_in, &out_count); + if (! vi_out) abort (); + c = vi_out [0].class; + XFree ((char *) vi_out); + return c; +} + + Visual * get_visual_resource (dpy, name, class) Display *dpy; diff --git a/driver/windows.c b/driver/windows.c index 690f1fd6..fb459ace 100644 --- a/driver/windows.c +++ b/driver/windows.c @@ -465,13 +465,17 @@ initialize_screensaver_window () fade_p = unfade_p = 0; } - attrmask = CWOverrideRedirect | CWEventMask | CWBackingStore | CWColormap; + attrmask = (CWOverrideRedirect | CWEventMask | CWBackingStore | CWColormap | + CWBackPixel | CWBackingPixel | CWBorderPixel); attrs.override_redirect = True; attrs.event_mask = (KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask); attrs.backing_store = NotUseful; attrs.colormap = cmap; + attrs.background_pixel = black_pixel; + attrs.backing_pixel = black_pixel; + attrs.border_pixel = black_pixel; /* if (demo_mode_p || lock_p) width = width / 2; #### */ @@ -565,7 +569,8 @@ raise_window (inhibit_fade, between_hacks_p) fade_colormap (dpy, current_map, cmap2, fade_seconds, fade_ticks, True); XClearWindow (dpy, screensaver_window); XMapRaised (dpy, screensaver_window); - /* Once the saver window is up, restore the colormap. */ + /* Once the saver window is up, restore the colormap. + (The "black" pixels of the two colormaps are compatible.) */ XInstallColormap (dpy, cmap); if (grabbed == GrabSuccess) XUngrabPointer (dpy, CurrentTime); diff --git a/driver/xscreensaver-command.c b/driver/xscreensaver-command.c index e0e40e33..2a33799c 100644 --- a/driver/xscreensaver-command.c +++ b/driver/xscreensaver-command.c @@ -1,4 +1,4 @@ -/* xscreensaver-command, Copyright (c) 1991-1993 Jamie Zawinski +/* xscreensaver-command, Copyright (c) 1991-1994 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -26,7 +26,7 @@ static char *screensaver_version; static char *usage = "usage: %s -\n\ \n\ This program provides external control of a running xscreensaver process.\n\ - Version %s, copyright (c) 1991-1993 Jamie Zawinski .\n\ + Version %s, copyright (c) 1991-1994 Jamie Zawinski .\n\ \n\ -demo Enter interactive demo mode.\n\ -deactivate Turns off the screensaver if it is on, as user input would.\n\ diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c index eb0bd64e..dbe34c85 100644 --- a/driver/xscreensaver.c +++ b/driver/xscreensaver.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1991-1993 Jamie Zawinski +/* xscreensaver, Copyright (c) 1991-1994 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -256,7 +256,7 @@ static void do_help () { printf ("\ -xscreensaver %s, copyright (c) 1991-1993 by Jamie Zawinski .\n\ +xscreensaver %s, copyright (c) 1991-1994 by Jamie Zawinski .\n\ The standard Xt command-line options are accepted; other options include:\n\ \n\ -timeout when the screensaver should activate\n\ @@ -580,7 +580,7 @@ initialize (argc, argv) if (verbose_p) printf ("\ -%s %s, copyright (c) 1991-1993 by Jamie Zawinski .\n\ +%s %s, copyright (c) 1991-1994 by Jamie Zawinski .\n\ pid = %d.\n", progname, screensaver_version, getpid ()); ensure_no_screensaver_running (); diff --git a/driver/xscreensaver.man b/driver/xscreensaver.man index f8ce6160..8c0903fa 100644 --- a/driver/xscreensaver.man +++ b/driver/xscreensaver.man @@ -11,7 +11,7 @@ .if n .sp 1 .if t .sp .5 .. -.TH XScreenSaver 1 "30-oct-93" "X Version 11" +.TH XScreenSaver 1 "12-May-94" "X Version 11" .SH NAME xscreensaver - run graphics hacks after the user has been idle for a while .SH SYNOPSIS @@ -400,9 +400,12 @@ in code intended for use as a screensaver. This prevents too much graphics activity from being buffered up. .PP The screensaver only runs on the default screen of the display. If you have -more than one screen, you must run multiple screensaver processes, one for -each screen. (I don't actually know whether this works, because I don't -have access to a multi-screen machine. Comments welcome.) +more than one screen, you can run multiple screensaver processes, one for +each screen. This interacts poorly with locking. In an ideal world, the +screensaver would save (and lock) both screens simultaniously, and any activity +would restore both screens. It would be nice if one could run different hacks +on each screen simultaniously. However, I don't have access to a multi-headed +workstation, so it would be hard for me to implement something like this. .PP If you don't have Motif, you can't compile with support for locking or demo mode. @@ -457,13 +460,13 @@ are sent to the screensaver window instead. This could be solved by making xscreensaver forward all unrecognised ClientMessages to the real root window, but there may be other problems as well. .SH COPYRIGHT -Copyright \(co 1992, 1993 by Jamie Zawinski. Permission to use, copy, modify, -distribute, and sell this software and its documentation for any purpose is -hereby granted without fee, provided that the above copyright notice appear -in all copies and that both that copyright notice and this permission notice -appear in supporting documentation. No representations are made about the -suitability of this software for any purpose. It is provided "as is" without -express or implied warranty. +Copyright \(co 1992, 1993, 1994 by Jamie Zawinski. Permission to use, copy, +modify, distribute, and sell this software and its documentation for any +purpose is hereby granted without fee, provided that the above copyright +notice appear in all copies and that both that copyright notice and this +permission notice appear in supporting documentation. No representations are +made about the suitability of this software for any purpose. It is provided +"as is" without express or implied warranty. .SH AUTHOR Jamie Zawinski , 13-aug-92. Please let me know if you find any bugs or make any improvements. diff --git a/hacks/Imakefile b/hacks/Imakefile index cf6b3e19..30cd49c2 100644 --- a/hacks/Imakefile +++ b/hacks/Imakefile @@ -9,7 +9,7 @@ #ifdef HAVE_XPM /* Yeah, this means that all hacks link against libXpm even though only - one hack actually use it. It doesn't matter: it's a library. */ + one hack actually uses it. It doesn't matter: it's a library. */ # define XPMDEFS -DHAVE_XPM # define XPMLIB -lXpm #else diff --git a/hacks/attraction.c b/hacks/attraction.c index d178b214..1f93781d 100644 --- a/hacks/attraction.c +++ b/hacks/attraction.c @@ -184,7 +184,7 @@ init_balls (dpy, window) { XColor color; color.pixel = default_fg_pixel; - if (!XQueryColor (dpy, cmap, &color)) abort (); + XQueryColor (dpy, cmap, &color); if (!XAllocColor (dpy, cmap, &color)) abort (); pixel_stack [i] = color.pixel; } diff --git a/hacks/flame.man b/hacks/flame.man index f0f360e5..0135215a 100644 --- a/hacks/flame.man +++ b/hacks/flame.man @@ -2,7 +2,7 @@ .SH NAME flame - draw weird cosmic fractals .SH SYNOPSIS -.B hopalong +.B flame [\-display \fIhost:display.screen\fP] [\-foreground \fIcolor\fP] [\-background \fIcolor\fP] [\-window] [\-root] [\-mono] [\-ncolors \fIinteger\fP] [\-iterations \fIinteger\fP] [\-points \fIinteger\fP] [\-delay \fImicroseconds\fP] [\-delay2 \fImicroseconds\fP] .SH DESCRIPTION The \fIflame\fP program generates colorful fractal displays. diff --git a/hacks/imsmap.c b/hacks/imsmap.c index d8b1c088..716be3e4 100644 --- a/hacks/imsmap.c +++ b/hacks/imsmap.c @@ -139,12 +139,10 @@ initwin (dsp, win) } else { + XQueryColor (dsp, cmap, &fg_color); + XQueryColor (dsp, cmap, &bg_color); fg_color.pixel = fg_pixel; - if (! XQueryColor (dsp, cmap, &fg_color)) - abort (); bg_color.pixel = bg_pixel; - if (! XQueryColor (dsp, cmap, &bg_color)) - abort (); } fg_color.flags = DoRed|DoGreen|DoBlue; bg_color.flags = DoRed|DoGreen|DoBlue; diff --git a/hacks/qix.c b/hacks/qix.c index 7c70574a..d6146bb0 100644 --- a/hacks/qix.c +++ b/hacks/qix.c @@ -71,8 +71,7 @@ init_one_qix (dpy, window, nlines) if (!XAllocColor (dpy, cmap, &qix->lines[0].color)) { qix->lines[0].color.pixel = default_fg_pixel; - if (!XQueryColor (dpy, cmap, &qix->lines[0].color)) - abort (); + XQueryColor (dpy, cmap, &qix->lines[0].color); if (!XAllocColor (dpy, cmap, &qix->lines[0].color)) abort (); } diff --git a/hacks/screenhack.h b/hacks/screenhack.h index 12506b32..14e9a16c 100644 --- a/hacks/screenhack.h +++ b/hacks/screenhack.h @@ -74,13 +74,21 @@ extern char *defaults []; #if __STDC__ # if defined(SVR4) || defined(SYSV) -extern int rand (void); -extern void srand (unsigned int); -# define random() rand() -# define srandom(i) srand((unsigned int)(i)) +# ifndef random + extern int rand (void); +# define random() rand() +# endif +# ifndef srandom + extern void srand (unsigned int); +# define srandom(i) srand((unsigned int)(i)) +# endif # else /* !totally-losing-SYSV */ -extern long random (void); -extern void srandom (int); +# ifndef random + extern long random (void); +# endif +# ifndef srandom + extern void srandom (int); +# endif # endif /* !totally-losing-SYSV */ #endif /* __STDC__ */ diff --git a/utils/fade.c b/utils/fade.c index c6c77a0c..170cd39e 100644 --- a/utils/fade.c +++ b/utils/fade.c @@ -17,6 +17,7 @@ #include #include +extern int get_visual_class (); extern void screenhack_usleep (); #define usleep screenhack_usleep @@ -31,13 +32,23 @@ copy_colormap (dpy, cmap, into_cmap) Colormap cmap, into_cmap; { int i; - ncolors = CellsOfScreen (DefaultScreenOfDisplay (dpy)); + Screen *screen = DefaultScreenOfDisplay (dpy); + Visual *visual = DefaultVisualOfScreen (screen); + Window window = RootWindowOfScreen (screen); + int vclass = get_visual_class (dpy, visual); + + ncolors = CellsOfScreen (screen); + + /* If this is a colormap on a mono visual, or one with insanely many + color cells, bug out. */ if (ncolors <= 2 || ncolors > MAX_COLORS) return 0; + /* If this is a non-writable visual, bug out. */ + if (vclass == StaticGray || vclass == StaticColor || vclass == TrueColor) + return 0; + if (! into_cmap) - into_cmap = XCreateColormap (dpy, RootWindow (dpy, DefaultScreen (dpy)), - DefaultVisual (dpy, DefaultScreen (dpy)), - AllocAll); + into_cmap = XCreateColormap (dpy, window, visual, AllocAll); if (! cmap) cmap = DefaultColormap (dpy, DefaultScreen (dpy)); for (i = 0; i < ncolors; i++) diff --git a/utils/version.h b/utils/version.h index 9c7c324d..1e040469 100644 --- a/utils/version.h +++ b/utils/version.h @@ -1,2 +1,2 @@ static char *screensaver_id = - "@(#)xscreensaver 1.21, by Jamie Zawinski (jwz@lucid.com)"; + "@(#)xscreensaver 1.22, by Jamie Zawinski (jwz@lucid.com)";