ftp://ftp.uni-heidelberg.de/pub/X11/contrib/applications/xscreensaver-1.27.tar.Z
authorZygo Blaxell <zblaxell@hungrycats.org>
Mon, 2 Mar 2009 05:42:20 +0000 (00:42 -0500)
committerZygo Blaxell <zblaxell@hungrycats.org>
Mon, 2 Mar 2009 05:42:20 +0000 (00:42 -0500)
-rw-r--r-- 1 zblaxell zblaxell 397914 Feb 27 13:23 xscreensaver-1.27.tar.Z
bb695f5dda88d958add243351dae25e3fc87c42f  xscreensaver-1.27.tar.Z

35 files changed:
README
config.h
driver/.gdbinit
driver/Imakefile
driver/XScreenSaver.ad
driver/demo.c
driver/dialogs.c
driver/lock.c
driver/timers.c
driver/windows.c
driver/xscreensaver.c
driver/xscreensaver.h
driver/xscreensaver.man
hacks/Imakefile
hacks/blitspin.c
hacks/bubbles-samples/blood.bub.gz [new file with mode: 0644]
hacks/bubbles-samples/blue.bub.gz [new file with mode: 0644]
hacks/bubbles-samples/jade.bub.gz [new file with mode: 0644]
hacks/bubbles-sources/blood.pov [new file with mode: 0644]
hacks/bubbles-sources/blue.pov [new file with mode: 0644]
hacks/bubbles-sources/glass.pov [new file with mode: 0644]
hacks/bubbles-sources/jade.pov [new file with mode: 0644]
hacks/bubbles-tools/bubblestodefault [new file with mode: 0755]
hacks/bubbles-tools/bubblestofile [new file with mode: 0755]
hacks/bubbles-tools/xpm2default [new file with mode: 0755]
hacks/bubbles.README [new file with mode: 0644]
hacks/bubbles.c [new file with mode: 0644]
hacks/bubbles.h [new file with mode: 0644]
hacks/bubbles.man [new file with mode: 0644]
hacks/bubbles_default.c [new file with mode: 0644]
hacks/noseguy.c
hacks/noses/CVS/Entries [deleted file]
hacks/noses/CVS/Repository [deleted file]
utils/fade.c
utils/version.h

diff --git a/README b/README
index 55b1ae208d46845fbca13a34719f6222fc238c38..3a755b33f2eaf30ceb3e18cc4195c6a812cb4e10 100644 (file)
--- a/README
+++ b/README
@@ -26,7 +26,8 @@ now be used as a screensaver without modification.  The programs that
 are being run as screensavers don't need to have any special knowledge
 about what it means to be a screensaver.
 
-The XIDLE or MIT-SCREEN-SAVER server extensions will be used if you have them.
+The XIDLE, MIT-SCREEN-SAVER, and/or SGI SCREEN_SAVER server extensions
+will be used if you have them.
 
 Unfortunately, locking doesn't work if you don't have Motif.
 
@@ -57,6 +58,7 @@ window, which are pointed at by the screensaver's default resource settings.
    maze                - This is the X maze demo modified to take a -root option
                  so that it works with xscreensaver.
    lmorph      - morphing line drawings.
+   bubbles     - condensation forms on your monitor, then pops.
 
 All of these will pop up their own window unless given that -root option.
 See their man pages for more details.
@@ -67,11 +69,12 @@ Other reasonable things to use as screensavers, if you have them, are
   xswarm -r 2>&-               - swimming sperm
   xwave -root                  - random 3d graphs
   xbouncebits                  - bounce arbitrary bitmaps around
-  ico -r                       - it's dull, but it's there
+  ico -r -p8 -faces -sleep 1   - it's dull, but it's there
   xv -root file.gif -quit      - they don't all have to animate!
   xsplinefun                   - bouncing splines
   kaleid -root                 - qix-like kaleidescope patterns
   xfishtank -c black -d -r 1   - fish (use version 2.0 or later)
+  xtacy -root                  - various eye candy
 
 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
@@ -83,6 +86,10 @@ also get it from my web page at http://www.netscape.com/people/jwz/.
        -- Jamie Zawinski <jwz@netscape.com>
 
 \f
+Changes since 1.26:    Added support for SGI SCREEN_SAVER extension.
+                       Made `fade' and `unfade' work on 8-bit SGIs.
+                       Made the dialog boxes more Motify.
+                       Added `bubbles' hack.
 Changes since 1.25:    Added `lmorph' hack.
                        Added viscosity and mouse-control to attraction.
                        Fixed possible bad color choices in qix and attraction.
@@ -122,7 +129,7 @@ Changes since 1.14: Broke the driver up into more source files.
                        Moved the hacks into their own directory.
                        Made all `time' parameters accept the 00:00:00 syntax,
                        so that even the parameters which are normally read as
-                       `minutes' can be specified in seconds.
+                       minutes can be specified in seconds.
                        Added colormap cycling to `imsmap'.
                        Made hyper work with K&R compilers.
 Changes since 1.13:    Added `orbit' option to `attraction' hack.
index 17517dc801f3f5a2da4cc2c635bd5be9a6d81355..6230a79a70ea0344bbde17bb5ae43ba8ed21710b 100644 (file)
--- a/config.h
+++ b/config.h
@@ -1,46 +1,13 @@
-/*
- * Config file for xscreensaver, Copyright (c) 1991-1995 Jamie Zawinski.
+/* Config file for xscreensaver, Copyright (c) 1991-1996 Jamie Zawinski.
  * This file is included by the various Imakefiles.
  */
 
-/*  Uncomment the following line if you have the XIDLE extension installed.
- *  This extension resides in .../contrib/extensions/xidle/ on the X11R5
- *  contrib tape.  (Turning on this flag lets XScreenSaver work better with
- *  servers which support this extension; but it will still work with servers
- *  which do not suport this extension, so it's a good idea to compile in
- *  support for it if you can.)
- */
-/* #define HAVE_XIDLE_EXTENSION */
-
-/*  Uncomment the following line if you have the MIT-SCREEN-SAVER extension
- *  installed.  This extension resides in .../contrib/extensions/screensaver/
- *  on the X11R6 contrib tape.
- *
- *  This extension does basically the same thing that the XIDLE extension does,
- *  but there are two things wrong with it: first, because of the way the 
- *  extension was designed, the `fade' option to XScreenSaver will be uglier:
- *  just before the screen fades out, there will be an unattractive flicker to
- *  black, because this extension blanks the screen *before* telling us that it
- *  is time to do so.  Second, this extension is known to be buggy; on the
- *  systems I use, it works, but some people have reported X server crashes as
- *  a result of using it.  XScreenSaver uses this extension rather
- *  conservatively, because when I tried to use any of its more complicated
- *  features, I could get it to crash the server at the drop of a hat.
- *
- *  I wish someone would port the XIDLE extension to R6.  Or I wish someone
- *  would make the MIT-SCREEN-SAVER extension not be such a piece of junk.
- *
- *  Note that the SGI X server also has an extension called SCREEN_SAVER.
- *  That is a completely different extension, and XScreenSaver contains no
- *  support for it (though it probably wouldn't be hard.)
- */
-/* #define HAVE_SAVER_EXTENSION */
-
 /*  Uncomment the following line if you have the XPM library installed.
  *  Some of the demos can make use of this if it is available.
  */
 #define HAVE_XPM
 
+
 /*  Uncomment the following line if you don't have Motif.  If you don't have
  *  Motif, then the screensaver won't have any dialog boxes, which means
  *  that it won't be compiled with support for demo-mode or display-locking.
  */
 /* #define NO_MOTIF */
 
+
 /*  Uncomment the following line if for some reason the locking code doesn't
  *  work (for example, if you don't have the crypt() system call, or if you
  *  don't use standard passwd files.)  If you need to do this, please let me
  *  know.
+ *
+ *  I'm told that locking doesn't work for sites which run AFS.  I don't know
+ *  anything about how one codes authentication for AFS; if you do, please let
+ *  me know...
  */
 /* #define NO_LOCKING */
 
+
+/*  Select supported server extensions.
+ *  There are three distinct server extensions which are useful with 
+ *  XScreenSaver: XIDLE, MIT-SCREEN-SAVER, and SCREEN_SAVER.
+ *
+ *  The XIDLE extension resides in .../contrib/extensions/xidle/ on the X11R5
+ *  contrib tape.  This extension lets the client get accurate idle-time 
+ *  information from the X server in a potentially more reliable way than by
+ *  simply watching for keyboard and mouse activity.  However, the XIDLE 
+ *  extension has apparently not been ported to X11R6.
+ *
+ *  The SCREEN_SAVER extension is found (as far as I know) only in the SGI
+ *  X server, and it exists in all releases since (at least) Irix 5.  The
+ *  relevant header file is /usr/include/X11/extensions/XScreenSaver.h.
+ *
+ *  The similarly-named MIT-SCREEN-SAVER extension came into existence long
+ *  after the SGI SCREEN_SAVER extension was already in use, and resides in
+ *  .../contrib/extensions/screensaver/ on the X11R6 contrib tape.  It is
+ *  also found in certain recent X servers built in to NCD X terminals.
+ *
+ *     The MIT extension does basically the same thing that the XIDLE extension
+ *     does, but there are two things wrong with it: first, because of the way
+ *     the extension was designed, the `fade' option to XScreenSaver will be
+ *     uglier: just before the screen fades out, there will be an unattractive
+ *     flicker to black, because this extension blanks the screen *before*
+ *     telling us that it is time to do so.  Second, this extension is known to
+ *     be buggy; on the systems I use, it works, but some people have reported
+ *     X server crashes as a result of using it.  XScreenSaver uses this
+ *     extension rather conservatively, because when I tried to use any of its
+ *     more complicated features, I could get it to crash the server at the
+ *     drop of a hat.
+ *
+ *     In short, the MIT-SCREEN-SAVER extension is a piece of junk.  The older
+ *     SGI SCREEN_SAVER extension works great, as does XIDLE.  It would be nice
+ *     If those two existed on more systems, that is, would be adopted by the
+ *     X Consortium in favor of their inferior "not-invented-here" entry.
+ */
+
+/*  Uncomment the following line if you have the XIDLE extension installed.
+ *  If you have the XIDLE extension, this is recommended.  (You have this
+ *  extension if the file /usr/include/X11/extensions/xidle.h exists.)
+ *  Turning on this flag lets XScreenSaver work better with servers which 
+ *  support this extension; but it will still work with servers which do not 
+ *  suport it, so it's a good idea to compile in support for it if you can.
+ */
+/* #define HAVE_XIDLE_EXTENSION */
+
+/*  Uncomment the following line if you have the MIT-SCREEN-SAVER extension
+ *  installed.  This is NOT RECOMMENDED.  See the caveats about this extension,
+ *  above.  (It's available if the file /usr/include/X11/extensions/scrnsaver.h
+ *  exists.)
+ */
+/* #define HAVE_MIT_SAVER_EXTENSION */
+
+
+/*  Use the following line if you have the SGI SCREEN_SAVER extension; the
+ *  default below should be correct (use it if and only if running on an SGI.)
+ *  Compiling in support for this extension is recommended, if possible.
+ */
+#ifdef SGIArchitecture
+# define HAVE_SGI_SAVER_EXTENSION
+#endif
+
+
 /*  Uncomment the following line if your system doesn't have the select()
- *  system call.  If you need to do this, please let me know.
+ *  system call.  If you need to do this, please let me know.  (I don't really
+ *  think that any such systems exist in this day and age...)
  */
 /* #define NO_SELECT */
 
+
 /*  Uncomment the following line if your system doesn't have the setuid(),
  *  setregid(), and getpwnam() library routines.
  *
  */
 /* #define NO_SETUID */
 
+
 /*  Uncomment the following line if your system uses `shadow' passwords,
  *  that is, the passwords live in /etc/shadow instead of /etc/passwd,
- *  and one reads them with getspnam() instead of getpwnam().
+ *  and one reads them with getspnam() instead of getpwnam().  (Note that
+ *  SCO systems do some random other thing; others might as well.  See the
+ *  ifdefs in driver/lock.c if you're having trouble related to reading
+ *  passwords.)
  */
 /* #define HAVE_SHADOW */
 
-/*  You may need to edit these to correspond to where Motif is installed.
+
+/*  You may need to edit these to correspond to where Motif is installed,
+ *  if your site has Motif installed in a nonstandard place.
  */
 #ifndef NO_MOTIF
   MOTIFINCLUDES = -I/usr/local/include/
       MOTIFLIBS = -lXm
 #endif
 
+
 /*  On some systems, only programs running as root can use the getpwent()
     library routine.  This means that, in order for locking to work, the
     screensaver must be installed as setuid to root.  Define this to make
     that happen.  (You must run "make install" as root for it to work.)
-    (What systems other than HP and AIX need this?  Let me know.)
+    (If your system needs this, and the default below is not correct,
+    please let me know.)
  */
-#if defined(HPArchitecture) || defined(AIXArchitecture) || defined(HAVE_SHADOW)
+#if defined(HPArchitecture) || defined(AIXArchitecture) || defined(HAVE_SHADOW) || defined(NetBSDArchitecture)
 # define INSTALL_SETUID
 #endif
 
index e04c4922cc9d14a8222f90f63ce8b39a42873de0..ab329236499bc65c300b4ca11c3d6f024ed42245 100644 (file)
@@ -21,5 +21,5 @@
 #handle 15 pass nostop
 #handle 19 pass nostop
 b exit
-set args -verbose -idelay 0
+set args -sync -verbose -idelay 0
 #b purify_stop_here
index 5444939a938163186e2e0a19cf06dbfd1c44588b..722d284aafe9792bad645e8b9319b47bdb167575 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Imakefile file for xscreensaver, Copyright (c) 1993-1995 Jamie Zawinski.
+ * Imakefile file for xscreensaver, Copyright (c) 1993-1996 Jamie Zawinski.
  *
  * You should not need to edit this file; edit ../config.h instead.
  *
 # define XIDLE_DEF
 #endif
 
-#ifdef HAVE_SAVER_EXTENSION
-# define SAVER_DEF -DHAVE_SAVER_EXTENSION
+#ifdef HAVE_MIT_SAVER_EXTENSION
+# define MIT_SAVER_DEF -DHAVE_MIT_SAVER_EXTENSION
 #else
-# define SAVER_DEF
+# define MIT_SAVER_DEF
+#endif
+
+#ifdef HAVE_SGI_SAVER_EXTENSION
+# define SGI_SAVER_DEF -DHAVE_SGI_SAVER_EXTENSION
+#else
+# define SGI_SAVER_DEF
 #endif
 
 #ifdef NO_LOCKING
@@ -62,9 +68,9 @@
 
          UTILS = ../utils
       INCLUDES = -I$(UTILS) MOTIF_INC
-       DEFINES = SETUID_DEF XIDLE_DEF SAVER_DEF MOTIF_DEF LOCKING_DEF SHADOW_DEF R5ISMS
-     SAVERLIBS = $(XMULIB) $(XTOOLLIB) $(EXTENSIONLIB) $(XLIB) -lm
-      COMMLIBS = $(XLIB) -lm
+       DEFINES = SETUID_DEF XIDLE_DEF MIT_SAVER_DEF SGI_SAVER_DEF MOTIF_DEF LOCKING_DEF SHADOW_DEF R5ISMS
+     SAVERLIBS = $(XMULIB) $(XTOOLLIB) $(EXTENSIONLIB) $(XLIB)
+      COMMLIBS = $(XLIB)
      UTIL_SRCS = $(UTILS)/resources.c $(UTILS)/fade.c $(UTILS)/visual.c $(UTILS)/usleep.c $(UTILS)/yarandom.c
      UTIL_OBJS = $(UTILS)/resources.o $(UTILS)/fade.o $(UTILS)/visual.o $(UTILS)/usleep.o $(UTILS)/yarandom.o
      DBOX_SRCS = dialogs.c demo.c
 EXTRA_LIBRARIES = -lXhp11      /* for XHPDisableReset() */
 #endif
 
+#if defined(NetBSDArchitecture) && !defined(NO_LOCKING)
+EXTRA_LIBRARIES = -lcrypt
+#endif
+
 #if defined(i386ScoArchitecture)
-        SCOLIBS = -lintl -lprot -lx -lcrypt_i
+EXTRA_LIBRARIES = -lintl -lprot -lx -lcrypt_i
 #endif
 
 all:: xscreensaver xscreensaver-command
@@ -104,7 +114,7 @@ PROGRAMS = xscreensaver xscreensaver-command
 #define InstallProgram(p,d) InstallProgramWithFlags(p,d,$(INSTUIDFLAGS))
 #endif
 
-ComplexProgramTarget_1(xscreensaver,MOTIF_LIB $(SAVERLIBS),$(SCOLIBS) $(HP_NULL_STR))
+ComplexProgramTarget_1(xscreensaver,MOTIF_LIB $(SAVERLIBS), $(HP_NULL_STR))
 
 #ifdef INSTALL_SETUID
 #undef  InstallProgram
index da72eff8906e5a31f88adb1c6ee18eae28714bd2..01401a4bdeaaafa56a66f8a208d1482f3c220c3e 100644 (file)
@@ -1,16 +1,18 @@
 ! app-defaults file for XScreenSaver by Jamie Zawinski.
-
-*timeout:      10
-*cycle:                10
-*lockTimeout:  0
-*passwdTimeout:        30
-*nice:         10
-*lock:         False
-*verbose:      False
-*fade:         True
-*unfade:       False
-*fadeSeconds:  1
-*fadeTicks:    75
+! See "man xscreensaver" for more info.  If you don't have that,
+! see http://www.netscape.com/people/jwz/ to get the latest version.
+
+*timeout:              10
+*cycle:                        10
+*lockTimeout:          0
+*passwdTimeout:                30
+*nice:                 10
+*lock:                 False
+*verbose:              False
+*fade:                 True
+*unfade:               False
+*fadeSeconds:          1
+*fadeTicks:            75
 
 *captureStderr:        True
 *captureStdout:        True
 ! Turning on "installColormap" interacts erratically with twm and tvtwm,
 ! but seems to work fine with mwm and olwm.  Try it and see.
 !
-*installColormap: False
+*installColormap:      True
+
+
+! Any program which can draw on the root window will work as a screensaver.
+! The following three resources enumerate them.
 
-! Programs on this list apply all the time.
 *programs:     qix -root                                               \n\
                qix -root -solid -delay 0 -segments 100                 \n\
                qix -root -linear -count 10 -size 100 -segments 200     \n\
                lmorph -root                                            \n
 
 ! Programs on this list are run only for monochrome screens.
+! (These are in addition to those listed in "*programs".)
 *monoPrograms: qix -root -linear -count 5 -size 200 -spread 30         \
                        -segments 75 -solid -xor                        \n\
                rocks -root                                             \n\
                noseguy -root                                           \n
 
 ! Programs on this list are run only for color (really, non-mono) screens.
+! (These are in addition to those listed in "*programs".)
 *colorPrograms:        qix -root -count 4 -solid -transparent                  \n\
                qix -root -count 5 -solid -transparent -linear          \
                        -segments 250 -size 100                         \n\
                attraction -root -mode filled-splines -segments 0       \n\
                attraction -root -glow -points 10                       \n\
                rocks -root -fg darksalmon                              \n\
-               noseguy -root -fg yellow -bg gray30                     \n
+               noseguy -root -fg yellow -bg black                      \n\
+               bubbles -root                                           \n
 
 
-! Some other screenhacks that you might want to track down:
-!
+! 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                                                  \n\
+!              ico -r -faces -sleep 1 -obj ico                         \n\
 !              xsplinefun                                              \n\
 !              kaleid -root                                            \n\
 !              xfishtank -c black -d -r 2                              \n\
+!              xtacy -root -delay 100 -gravity                         \n\
+
+
+! To display a slideshow of images, add commands like this to *programs:
+!
+!              xv -root -rmode 5  image-1.gif  -quit
+!              xv -root -rmode 5  image-2.gif  -quit
+!              xv -root -rmode 5  image-3.gif  -quit
+!              ...and so on...
+!
+! however, for this to work, you must also have started the screensaver so
+! that it uses the default colormap (the "-no-install" command-line option, or
+! the "installColormap: False" resource) because when XV is running in "-root"
+! mode, it always assumes that the default colormap is being used, rather than
+! examining the window it is drawing on to see what colormap it has.
+
+
+! Some SGI GL programs work with XScreenSaver; most don't.
+!
+! Bongo works fine:
+!
+!      /usr/demos/bin/bongo -wbongo
+!
+! ElectroPaint sort-of works; XScreenSaver will launch it, and it will run
+! properly, but when it's time to turn off the screensaver, you need to hit
+! the Escape key, rather than just moving the mouse.  Apparently GL programs
+! are able to intercept the keyboard even when X has the keyboard grabbed!
+!
+!      /usr/demos/bin/ep
+!
+! None of the other GL demos I've tried worked, because none of them seem to
+! have command-line options that will make them take up the whole screen; so
+! all you get is a miniscule 100x100 image, which is worthless.  This is a
+! shame, since many of those demos would make fine screensavers.
+!
+! If anyone who understands how "haven" works would like to send me the code
+! necessary to do what it does, I would be much obliged.
+
+
+
+!=============================================================================
+!
+!      You probably don't want to change anything after this point.
+!
+!=============================================================================
 
 
 ! Resources for the dialog boxes:
 *demoDialog.maxWidth:          600
 
 *label1.labelString:           XScreenSaver %s
-*label2.labelString: Copyright Â© 1991-1995 by Jamie Zawinski <jwz@netscape.com>
+*label2.labelString: Copyright Â© 1991-1996 by Jamie Zawinski <jwz@netscape.com>
 *demoList.visibleItemCount:    10
 *demoList.automaticSelection:  True
 *next.labelString:             Run Next
 *passwdLabel3.alignment:       ALIGNMENT_BEGINNING
 *rogerLabel.width:             150
 
-! You probably won't need to change these.  They aren't consulted if the
-! XIdle extension is being used.
+! You probably won't need to change these.  They are only used if no server
+! extension is in use.
 !
 *pointerPollTime:      5
 *initialDelay:         30
index b7823400dd5d200c4bd09d589049f2632cb7e7ef..4d4a7b073eb63357e654f10d9d8131b254ca5d7b 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1993-1995 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1993-1996 Jamie Zawinski <jwz@netscape.com>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
 #include "xscreensaver.h"
 #include <stdio.h>
 
-#ifdef HAVE_SAVER_EXTENSION
-extern int saver_ext_event_number;
-extern Window server_saver_window;
-#endif /* HAVE_SAVER_EXTENSION */
+#ifdef HAVE_MIT_SAVER_EXTENSION
+extern int mit_saver_ext_event_number;
+extern Window server_mit_saver_window;
+#endif /* HAVE_MIT_SAVER_EXTENSION */
+
+#ifdef HAVE_SGI_SAVER_EXTENSION
+/* extern int sgi_saver_ext_event_number; */
+#endif /* HAVE_SGI_SAVER_EXTENSION */
+
+extern Bool use_mit_saver_extension;
+extern Bool use_sgi_saver_extension;
 
 extern Time timeout, cycle, lock_timeout;
 #ifndef NO_LOCKING
@@ -420,9 +427,10 @@ res_done_cb (button, client_data, call_data)
 {
   res_cancel_cb (button, client_data, call_data);
 
-  if (res.timeout < 10) res.timeout = 10;
+  /* Throttle the timeouts to minimum sane values. */
+  if (res.timeout < 5) res.timeout = 5;
   if (res.cycle < 2) res.cycle = 2;
-  if (res.passwd_time < 2) res.passwd_time = 30;
+  if (res.passwd_time < 10) res.passwd_time = 10;
 
   timeout = res.timeout * 1000;
   cycle = res.cycle * 1000;
@@ -437,6 +445,28 @@ res_done_cb (button, client_data, call_data)
   fade_p = res.fade;
   unfade_p = res.unfade;
   lock_p = res.lock_p;
+
+#if defined(HAVE_MIT_SAVER_EXTENSION) || defined(HAVE_SGI_SAVER_EXTENSION)
+  if (use_mit_saver_extension || use_sgi_saver_extension)
+    {
+      /* Need to set the server timeout to the new one the user has picked.
+       */
+      int server_timeout, server_interval, prefer_blank, allow_exp;
+      XGetScreenSaver (dpy, &server_timeout, &server_interval,
+                      &prefer_blank, &allow_exp);
+      if (server_timeout != (timeout / 1000))
+       {
+         server_timeout = (timeout / 1000);
+         if (verbose_p)
+           fprintf (stderr,
+                  "%s: configuring server for saver timeout of %d seconds.\n",
+                    progname, server_timeout);
+         /* Leave all other parameters the same. */
+         XSetScreenSaver (dpy, server_timeout, server_interval,
+                          prefer_blank, allow_exp);
+       }
+    }
+#endif /* HAVE_MIT_SAVER_EXTENSION || HAVE_SGI_SAVER_EXTENSION */
 }
 
 
@@ -561,7 +591,8 @@ Bool demo_mode_p = False;
 extern XtAppContext app;
 extern Widget toplevel_shell;
 extern Bool use_xidle_extension;
-extern Bool use_saver_extension;
+extern Bool use_mit_saver_extension;
+extern Bool use_sgi_saver_extension;
 extern Time notice_events_timeout;
 
 extern char **screenhacks;
@@ -591,7 +622,9 @@ demo_mode ()
          break;
 
        case CreateNotify:
-         if (!use_xidle_extension && !use_saver_extension)
+         if (!use_xidle_extension &&
+             !use_mit_saver_extension &&
+             !use_sgi_saver_extension)
            {
              XtAppAddTimeOut (app, notice_events_timeout, notice_events_timer,
                               (XtPointer) event.xcreatewindow.window);
@@ -612,17 +645,17 @@ demo_mode ()
          /* fall through */
 
        default:
-#ifdef HAVE_SAVER_EXTENSION
-         if (event.type == saver_ext_event_number)
+#ifdef HAVE_MIT_SAVER_EXTENSION
+         if (event.type == mit_saver_ext_event_number)
            {
              /* Get the "real" server window out of the way as soon
                 as possible. */
-             if (server_saver_window &&
-                 window_exists_p (dpy, server_saver_window))
-               XUnmapWindow (dpy, server_saver_window);
+             if (server_mit_saver_window &&
+                 window_exists_p (dpy, server_mit_saver_window))
+               XUnmapWindow (dpy, server_mit_saver_window);
            }
          else
-#endif /* HAVE_SAVER_EXTENSION */
+#endif /* HAVE_MIT_SAVER_EXTENSION */
 
          XtDispatchEvent (&event);
          break;
@@ -643,6 +676,7 @@ demo_mode_hack (hack)
     blank_screen ();
   demo_hack = hack;
   spawn_screenhack (False);
+  /* raise_screenhack_dialog(); */
 }
 
 static void
index a403c1b81f796dfb70255341e67988f687838c6b..1fe9a45db5f26d3dafb7be074f85b3e6a0089e07 100644 (file)
@@ -1,10 +1,18 @@
+/*    xscreensaver, Copyright (c) 1993-1996 Jamie Zawinski <jwz@netscape.com>
+ *
+ * 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.
+ */
+
+/* The code in this file started off its life as the output of XDesigner,
+   but I've since hacked it by hand...  It's a mess, avert your eyes.
+ */
 
-/*
-** Generated by X-Designer 
-*/
-/*
-**LIBS: -lXm -lXt -lX11
-*/
 
 #if !__STDC__
 # define _NO_PROTO
@@ -26,7 +34,8 @@
 #include <Xm/TextF.h>
 #include <Xm/ToggleB.h>
 
-/* #### Hacked by hand, not generated by XDesigner */
+#include <Xm/SelectioB.h>
+
 extern Visual *visual;
 extern int visual_depth;
 extern Colormap cmap;
@@ -77,135 +86,114 @@ void
 create_passwd_dialog( parent )
 Widget parent;
 {
-       Widget children[8];      /* Children to manage */
-       Arg al[64];           /* Arg List */
-       register int ac = 0;      /* Arg Count */
-       Widget widget4;
-       Widget widget7;
-
-
-       /* #### Hacked by hand, not generated by XDesigner */
-       ac = 0;
-       XtSetArg (al[ac], XmNvisual, visual); ac++;
-       XtSetArg (al[ac], XmNcolormap, cmap); ac++;
-       XtSetArg (al[ac], XmNdepth, visual_depth); ac++;
-
-
-       passwd_dialog = XmCreateDialogShell ( parent, "passwdDialog", al, ac );
-       passwd_form = XmCreateForm ( passwd_dialog, "passwdForm", al, ac );
-       roger_label = XmCreateDrawnButton ( passwd_form, "rogerLabel", al, ac );
-       passwd_label1 = XmCreateLabel ( passwd_form, "passwdLabel1", al, ac );
-       widget4 = XmCreateLabel ( passwd_form, "passwdLabel2", al, ac );
-       passwd_label3 = XmCreateLabel ( passwd_form, "passwdLabel3", al, ac );
-       passwd_text = XmCreateTextField ( passwd_form, "passwdText", al, ac );
-       widget7 = XmCreateSeparator ( passwd_form, "widget7", al, ac );
-       passwd_done = XmCreatePushButton ( passwd_form, "passwdDone", al, ac );
-       passwd_cancel = XmCreatePushButton ( passwd_form, "passwdCancel", al, ac );
-
-       /* #### Hacked by hand, not generated by XDesigner */
-       ac = 0;
-
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 4); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( roger_label,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 4); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, widget4); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftWidget, roger_label); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-        XtSetValues ( passwd_label1,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, passwd_label3); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftWidget, roger_label); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-        XtSetValues ( widget4,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, passwd_text); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftWidget, roger_label); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 30); ac++;
-        XtSetValues ( passwd_label3,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, widget7); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftWidget, roger_label); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-        XtSetValues ( passwd_text,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, passwd_done); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 0); ac++;
-       XtSetArg(al[ac], XmNleftWidget, roger_label); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 0); ac++;
-        XtSetValues ( widget7,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftWidget, roger_label); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( passwd_done,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftWidget, passwd_done); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( passwd_cancel,al, ac );
-       ac = 0;
-       children[ac++] = roger_label;
-       children[ac++] = passwd_label1;
-       children[ac++] = widget4;
-       children[ac++] = passwd_label3;
-       children[ac++] = passwd_text;
-       children[ac++] = widget7;
-       children[ac++] = passwd_done;
-       children[ac++] = passwd_cancel;
-       XtManageChildren(children, ac);
-       ac = 0;
+  Widget shell;
+  Widget  form1;
+  Widget   roger;
+  Widget   dialog;
+  Widget    form2;
+  Widget     label1, label2, label3;
+  Widget    text;
+  Widget    ok, cancel;
+  Widget w;
+
+  shell = XmCreateDialogShell (parent, "passwdDialog", 0, 0);
+
+  form1 = XmCreateForm (shell, "form", 0, 0);
+
+  roger = XmCreateDrawnButton (form1, "rogerLabel", 0, 0);
+
+  dialog = XmCreateSelectionBox (form1, "passwdForm", 0, 0);
+
+  form2 = XmCreateForm ( dialog, "form", 0, 0);
+  label1 = XmCreateLabel ( form2, "passwdLabel1", 0, 0);
+  label2 = XmCreateLabel ( form2, "passwdLabel2", 0, 0);
+  label3 = XmCreateLabel ( form2, "passwdLabel3", 0, 0);
+
+  text = XmSelectionBoxGetChild (dialog, XmDIALOG_TEXT);
+  ok = XmSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON);
+  cancel = XmSelectionBoxGetChild (dialog, XmDIALOG_CANCEL_BUTTON);
+
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_LIST_LABEL);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_LIST);
+  if (w) XtUnmanageChild (XtParent(w));
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_SELECTION_LABEL);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_SEPARATOR);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_APPLY_BUTTON);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON);
+  if (w) XtUnmanageChild (w);
+
+  XtVaSetValues(label1,
+               XmNtopAttachment, XmATTACH_FORM,
+               XmNleftAttachment, XmATTACH_FORM,
+               XmNrightAttachment, XmATTACH_FORM,
+               XmNbottomAttachment, XmATTACH_NONE,
+               0);
+  XtVaSetValues(label2,
+               XmNtopAttachment, XmATTACH_WIDGET,
+               XmNtopWidget, label1,
+               XmNleftAttachment, XmATTACH_FORM,
+               XmNrightAttachment, XmATTACH_FORM,
+               XmNbottomAttachment, XmATTACH_NONE,
+               0);
+  XtVaSetValues(label3,
+               XmNtopAttachment, XmATTACH_WIDGET,
+               XmNtopWidget, label2,
+               XmNleftAttachment, XmATTACH_FORM,
+               XmNrightAttachment, XmATTACH_FORM,
+               XmNbottomAttachment, XmATTACH_FORM,
+               0);
+
+  XtVaSetValues(roger,
+               XmNsensitive, FALSE,
+               XmNtopAttachment, XmATTACH_FORM,
+               XmNleftAttachment, XmATTACH_FORM,
+               XmNrightAttachment, XmATTACH_NONE,
+               XmNbottomAttachment, XmATTACH_FORM,
+               0);
+  XtVaSetValues(dialog,
+               XmNtopAttachment, XmATTACH_FORM,
+               XmNleftAttachment, XmATTACH_WIDGET,
+               XmNleftWidget, roger,
+               XmNrightAttachment, XmATTACH_FORM,
+               XmNbottomAttachment, XmATTACH_FORM,
+               0);
+
+  XtManageChild(label1);
+  XtManageChild(label2);
+  XtManageChild(label3);
+
+  XtManageChild(form2);
+  XtManageChild(text);
+  XtManageChild(ok);
+  XtManageChild(cancel);
+
+  XtManageChild(roger);
+  XtManageChild(dialog);
+
+  {
+    Dimension w = 0, h = 0;
+    XtRealizeWidget(form1);
+    XtVaGetValues(roger, XmNwidth, &w, XmNheight, &h, 0);
+    if (w == h)
+      ;
+    else if (w > h)
+      XtVaSetValues(roger, XmNwidth, w, XmNheight, w, 0);
+    else
+      XtVaSetValues(roger, XmNwidth, h, XmNheight, h, 0);
+  }
+
+  passwd_dialog = shell;
+  passwd_form = form1;
+  roger_label = roger;
+  passwd_label1 = label1;
+  passwd_label3 = label3;
+  passwd_text = text;
+  passwd_done = ok;
+  passwd_cancel = cancel;
 }
 
 
@@ -214,369 +202,374 @@ void
 create_resources_dialog( parent )
 Widget parent;
 {
-       Widget children[22];      /* Children to manage */
-       Arg al[64];           /* Arg List */
-       register int ac = 0;      /* Arg Count */
-       Widget widget12;
-       Widget widget13;
-       Widget widget14;
-       Widget widget15;
-       Widget widget16;
-       Widget widget17;
-       Widget widget18;
-       Widget widget48;
-       Widget widget29;
-
-
-       /* #### Hacked by hand, not generated by XDesigner */
-       ac = 0;
-       XtSetArg (al[ac], XmNvisual, visual); ac++;
-       XtSetArg (al[ac], XmNcolormap, cmap); ac++;
-       XtSetArg (al[ac], XmNdepth, visual_depth); ac++;
-
-
-       resources_dialog = XmCreateDialogShell ( parent, "resourcesDialog", al, ac );
-       resources_form = XmCreateForm ( resources_dialog, "resourcesForm", al, ac );
-
-       /* #### Hacked by hand, not generated by XDesigner */
-       ac = 0;
-
-       widget12 = XmCreateLabel ( resources_form, "resourcesLabel", al, ac );
-       widget13 = XmCreateSeparator ( resources_form, "widget13", al, ac );
-       XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
-       widget14 = XmCreateLabel ( resources_form, "timeoutLabel", al, ac );
-       ac = 0;
-       XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
-       widget15 = XmCreateLabel ( resources_form, "cycleLabel", al, ac );
-       ac = 0;
-       XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
-       widget16 = XmCreateLabel ( resources_form, "fadeSecondsLabel", al, ac );
-       ac = 0;
-       XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
-       widget17 = XmCreateLabel ( resources_form, "fadeTicksLabel", al, ac );
-       ac = 0;
-       XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
-       widget18 = XmCreateLabel ( resources_form, "lockLabel", al, ac );
-       ac = 0;
-       XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
-       widget48 = XmCreateLabel ( resources_form, "passwdLabel", al, ac );
-       ac = 0;
-       timeout_text = XmCreateTextField ( resources_form, "timeoutText", al, ac );
-       cycle_text = XmCreateTextField ( resources_form, "cycleText", al, ac );
-       fade_text = XmCreateTextField ( resources_form, "fadeSecondsText", al, ac );
-       ticks_text = XmCreateTextField ( resources_form, "fadeTicksText", al, ac );
-       lock_time_text = XmCreateTextField ( resources_form, "passwdText", al, ac );
-       passwd_time_text = XmCreateTextField ( resources_form, "lockText", al, ac );
-       XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
-       verbose_toggle = XmCreateToggleButton ( resources_form, "verboseToggle", al, ac );
-       ac = 0;
-       XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
-       cmap_toggle = XmCreateToggleButton ( resources_form, "cmapToggle", al, ac );
-       ac = 0;
-       XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
-       fade_toggle = XmCreateToggleButton ( resources_form, "fadeToggle", al, ac );
-       ac = 0;
-       XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
-       unfade_toggle = XmCreateToggleButton ( resources_form, "unfadeToggle", al, ac );
-       ac = 0;
-       XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
-       lock_toggle = XmCreateToggleButton ( resources_form, "lockToggle", al, ac );
-       ac = 0;
-       widget29 = XmCreateSeparator ( resources_form, "widget29", al, ac );
-       res_done = XmCreatePushButton ( resources_form, "resourcesDone", al, ac );
-       res_cancel = XmCreatePushButton ( resources_form, "resourcesCancel", al, ac );
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-        XtSetValues ( widget12,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 4); ac++;
-       XtSetArg(al[ac], XmNtopWidget, widget12); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 0); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 0); ac++;
-        XtSetValues ( widget13,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 4); ac++;
-       XtSetArg(al[ac], XmNtopWidget, widget13); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, timeout_text); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 20); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-       XtSetArg(al[ac], XmNrightWidget, timeout_text); ac++;
-        XtSetValues ( widget14,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, cycle_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, cycle_text); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 20); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-       XtSetArg(al[ac], XmNrightWidget, cycle_text); ac++;
-        XtSetValues ( widget15,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, fade_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, fade_text); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 20); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-       XtSetArg(al[ac], XmNrightWidget, fade_text); ac++;
-        XtSetValues ( widget16,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, ticks_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, ticks_text); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 20); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-       XtSetArg(al[ac], XmNrightWidget, ticks_text); ac++;
-        XtSetValues ( widget17,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, lock_time_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, lock_time_text); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 19); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-       XtSetArg(al[ac], XmNrightWidget, lock_time_text); ac++;
-        XtSetValues ( widget18,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, passwd_time_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, passwd_time_text); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 14); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-       XtSetArg(al[ac], XmNrightWidget, passwd_time_text); ac++;
-        XtSetValues ( widget48,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 4); ac++;
-       XtSetArg(al[ac], XmNtopWidget, widget13); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 141); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( timeout_text,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 2); ac++;
-       XtSetArg(al[ac], XmNtopWidget, timeout_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 0); ac++;
-       XtSetArg(al[ac], XmNleftWidget, timeout_text); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( cycle_text,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 2); ac++;
-       XtSetArg(al[ac], XmNtopWidget, cycle_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 0); ac++;
-       XtSetArg(al[ac], XmNleftWidget, cycle_text); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( fade_text,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 2); ac++;
-       XtSetArg(al[ac], XmNtopWidget, fade_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 0); ac++;
-       XtSetArg(al[ac], XmNleftWidget, fade_text); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( ticks_text,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 2); ac++;
-       XtSetArg(al[ac], XmNtopWidget, ticks_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 0); ac++;
-       XtSetArg(al[ac], XmNleftWidget, ticks_text); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( lock_time_text,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 4); ac++;
-       XtSetArg(al[ac], XmNtopWidget, lock_time_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 0); ac++;
-       XtSetArg(al[ac], XmNleftWidget, lock_time_text); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( passwd_time_text,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 4); ac++;
-       XtSetArg(al[ac], XmNtopWidget, widget13); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, timeout_text); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 20); ac++;
-       XtSetArg(al[ac], XmNleftWidget, timeout_text); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 20); ac++;
-        XtSetValues ( verbose_toggle,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, cycle_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, cycle_text); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 0); ac++;
-       XtSetArg(al[ac], XmNleftWidget, verbose_toggle); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 20); ac++;
-        XtSetValues ( cmap_toggle,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, fade_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, fade_text); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 0); ac++;
-       XtSetArg(al[ac], XmNleftWidget, cmap_toggle); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 20); ac++;
-        XtSetValues ( fade_toggle,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, ticks_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, ticks_text); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 0); ac++;
-       XtSetArg(al[ac], XmNleftWidget, fade_toggle); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 20); ac++;
-        XtSetValues ( unfade_toggle,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, lock_time_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, lock_time_text); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 0); ac++;
-       XtSetArg(al[ac], XmNleftWidget, unfade_toggle); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 20); ac++;
-        XtSetValues ( lock_toggle,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, passwd_time_text); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, res_done); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-        XtSetValues ( widget29,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( res_done,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftWidget, res_done); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( res_cancel,al, ac );
-       ac = 0;
-       children[ac++] = widget12;
-       children[ac++] = widget13;
-       children[ac++] = widget14;
-       children[ac++] = widget15;
-       children[ac++] = widget16;
-       children[ac++] = widget17;
-       children[ac++] = widget18;
-       children[ac++] = widget48;
-       children[ac++] = timeout_text;
-       children[ac++] = cycle_text;
-       children[ac++] = fade_text;
-       children[ac++] = ticks_text;
-       children[ac++] = lock_time_text;
-       children[ac++] = passwd_time_text;
-       children[ac++] = verbose_toggle;
-       children[ac++] = cmap_toggle;
-       children[ac++] = fade_toggle;
-       children[ac++] = unfade_toggle;
-       children[ac++] = lock_toggle;
-       children[ac++] = widget29;
-       children[ac++] = res_done;
-       children[ac++] = res_cancel;
-       XtManageChildren(children, ac);
-       ac = 0;
+  Widget children[22];      /* Children to manage */
+  Arg al[64];           /* Arg List */
+  register int ac = 0;      /* Arg Count */
+  Widget widget12;
+  Widget widget13;
+  Widget widget14;
+  Widget widget15;
+  Widget widget16;
+  Widget widget17;
+  Widget widget18;
+  Widget widget48;
+  Widget widget29;
+
+  Widget real_dialog;
+  Widget w;
+
+
+  ac = 0;
+  XtSetArg (al[ac], XmNvisual, visual); ac++;
+  XtSetArg (al[ac], XmNcolormap, cmap); ac++;
+  XtSetArg (al[ac], XmNdepth, visual_depth); ac++;
+
+  real_dialog = XmCreatePromptDialog (parent, "resourcesForm", al, ac);
+  resources_dialog = XtParent(real_dialog);
+
+  w = XmSelectionBoxGetChild (real_dialog, XmDIALOG_SEPARATOR);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (real_dialog, XmDIALOG_TEXT);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (real_dialog, XmDIALOG_SELECTION_LABEL);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (real_dialog, XmDIALOG_HELP_BUTTON);
+  if (w) XtUnmanageChild (w);
+
+  ac = 0;
+  XtSetArg (al [ac], XmNtopAttachment, XmATTACH_FORM); ac++;
+  XtSetArg (al [ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
+  XtSetArg (al [ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg (al [ac], XmNrightAttachment, XmATTACH_FORM); ac++;
+  resources_form = XmCreateForm (real_dialog, "form", al, ac);
+  XtManageChild (resources_form);
+
+  ac = 0;
+
+  widget12 = XmCreateLabel ( resources_form, "resourcesLabel", al, ac );
+  widget13 = XmCreateSeparator ( resources_form, "widget13", al, ac );
+  XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
+  widget14 = XmCreateLabel ( resources_form, "timeoutLabel", al, ac );
+  ac = 0;
+  XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
+  widget15 = XmCreateLabel ( resources_form, "cycleLabel", al, ac );
+  ac = 0;
+  XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
+  widget16 = XmCreateLabel ( resources_form, "fadeSecondsLabel", al, ac );
+  ac = 0;
+  XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
+  widget17 = XmCreateLabel ( resources_form, "fadeTicksLabel", al, ac );
+  ac = 0;
+  XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
+  widget18 = XmCreateLabel ( resources_form, "lockLabel", al, ac );
+  ac = 0;
+  XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
+  widget48 = XmCreateLabel ( resources_form, "passwdLabel", al, ac );
+  ac = 0;
+  timeout_text = XmCreateTextField ( resources_form, "timeoutText", al, ac );
+  cycle_text = XmCreateTextField ( resources_form, "cycleText", al, ac );
+  fade_text = XmCreateTextField ( resources_form, "fadeSecondsText", al, ac );
+  ticks_text = XmCreateTextField ( resources_form, "fadeTicksText", al, ac );
+  lock_time_text = XmCreateTextField ( resources_form, "passwdText", al, ac );
+  passwd_time_text = XmCreateTextField ( resources_form, "lockText", al, ac );
+  XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
+  verbose_toggle = XmCreateToggleButton ( resources_form, "verboseToggle", al, ac );
+  ac = 0;
+  XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
+  cmap_toggle = XmCreateToggleButton ( resources_form, "cmapToggle", al, ac );
+  ac = 0;
+  XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
+  fade_toggle = XmCreateToggleButton ( resources_form, "fadeToggle", al, ac );
+  ac = 0;
+  XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
+  unfade_toggle = XmCreateToggleButton ( resources_form, "unfadeToggle", al, ac );
+  ac = 0;
+  XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
+  lock_toggle = XmCreateToggleButton ( resources_form, "lockToggle", al, ac );
+  ac = 0;
+  widget29 = XmCreateSeparator ( resources_form, "widget29", al, ac );
+
+  res_done = XmSelectionBoxGetChild (real_dialog, XmDIALOG_OK_BUTTON);
+  res_cancel = XmSelectionBoxGetChild (real_dialog, XmDIALOG_CANCEL_BUTTON);
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 4); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 4); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 4); ac++;
+  XtSetValues ( widget12,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 4); ac++;
+  XtSetArg(al[ac], XmNtopWidget, widget12); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 0); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 0); ac++;
+  XtSetValues ( widget13,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 4); ac++;
+  XtSetArg(al[ac], XmNtopWidget, widget13); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNbottomWidget, timeout_text); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 20); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 4); ac++;
+  XtSetArg(al[ac], XmNrightWidget, timeout_text); ac++;
+  XtSetValues ( widget14,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 0); ac++;
+  XtSetArg(al[ac], XmNtopWidget, cycle_text); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
+  XtSetArg(al[ac], XmNbottomWidget, cycle_text); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 20); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 4); ac++;
+  XtSetArg(al[ac], XmNrightWidget, cycle_text); ac++;
+  XtSetValues ( widget15,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 0); ac++;
+  XtSetArg(al[ac], XmNtopWidget, fade_text); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
+  XtSetArg(al[ac], XmNbottomWidget, fade_text); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 20); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 4); ac++;
+  XtSetArg(al[ac], XmNrightWidget, fade_text); ac++;
+  XtSetValues ( widget16,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 0); ac++;
+  XtSetArg(al[ac], XmNtopWidget, ticks_text); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
+  XtSetArg(al[ac], XmNbottomWidget, ticks_text); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 20); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 4); ac++;
+  XtSetArg(al[ac], XmNrightWidget, ticks_text); ac++;
+  XtSetValues ( widget17,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 0); ac++;
+  XtSetArg(al[ac], XmNtopWidget, lock_time_text); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
+  XtSetArg(al[ac], XmNbottomWidget, lock_time_text); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 19); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 4); ac++;
+  XtSetArg(al[ac], XmNrightWidget, lock_time_text); ac++;
+  XtSetValues ( widget18,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 0); ac++;
+  XtSetArg(al[ac], XmNtopWidget, passwd_time_text); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
+  XtSetArg(al[ac], XmNbottomWidget, passwd_time_text); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 14); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 4); ac++;
+  XtSetArg(al[ac], XmNrightWidget, passwd_time_text); ac++;
+  XtSetValues ( widget48,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 4); ac++;
+  XtSetArg(al[ac], XmNtopWidget, widget13); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 141); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
+  XtSetValues ( timeout_text,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 2); ac++;
+  XtSetArg(al[ac], XmNtopWidget, timeout_text); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 0); ac++;
+  XtSetArg(al[ac], XmNleftWidget, timeout_text); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
+  XtSetValues ( cycle_text,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 2); ac++;
+  XtSetArg(al[ac], XmNtopWidget, cycle_text); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 0); ac++;
+  XtSetArg(al[ac], XmNleftWidget, cycle_text); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
+  XtSetValues ( fade_text,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 2); ac++;
+  XtSetArg(al[ac], XmNtopWidget, fade_text); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 0); ac++;
+  XtSetArg(al[ac], XmNleftWidget, fade_text); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
+  XtSetValues ( ticks_text,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 2); ac++;
+  XtSetArg(al[ac], XmNtopWidget, ticks_text); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 0); ac++;
+  XtSetArg(al[ac], XmNleftWidget, ticks_text); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
+  XtSetValues ( lock_time_text,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 4); ac++;
+  XtSetArg(al[ac], XmNtopWidget, lock_time_text); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 0); ac++;
+  XtSetArg(al[ac], XmNleftWidget, lock_time_text); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
+  XtSetValues ( passwd_time_text,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 4); ac++;
+  XtSetArg(al[ac], XmNtopWidget, widget13); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
+  XtSetArg(al[ac], XmNbottomWidget, timeout_text); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 20); ac++;
+  XtSetArg(al[ac], XmNleftWidget, timeout_text); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 20); ac++;
+  XtSetValues ( verbose_toggle,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 0); ac++;
+  XtSetArg(al[ac], XmNtopWidget, cycle_text); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
+  XtSetArg(al[ac], XmNbottomWidget, cycle_text); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 0); ac++;
+  XtSetArg(al[ac], XmNleftWidget, verbose_toggle); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 20); ac++;
+  XtSetValues ( cmap_toggle,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 0); ac++;
+  XtSetArg(al[ac], XmNtopWidget, fade_text); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
+  XtSetArg(al[ac], XmNbottomWidget, fade_text); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 0); ac++;
+  XtSetArg(al[ac], XmNleftWidget, cmap_toggle); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 20); ac++;
+  XtSetValues ( fade_toggle,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 0); ac++;
+  XtSetArg(al[ac], XmNtopWidget, ticks_text); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
+  XtSetArg(al[ac], XmNbottomWidget, ticks_text); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 0); ac++;
+  XtSetArg(al[ac], XmNleftWidget, fade_toggle); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 20); ac++;
+  XtSetValues ( unfade_toggle,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 0); ac++;
+  XtSetArg(al[ac], XmNtopWidget, lock_time_text); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNbottomOffset, 0); ac++;
+  XtSetArg(al[ac], XmNbottomWidget, lock_time_text); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 0); ac++;
+  XtSetArg(al[ac], XmNleftWidget, unfade_toggle); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 20); ac++;
+  XtSetValues ( lock_toggle,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 0); ac++;
+  XtSetArg(al[ac], XmNtopWidget, passwd_time_text); ac++;
+
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
+
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
+  XtSetValues ( widget29,al, ac );
+  ac = 0;
+
+
+
+  ac = 0;
+  children[ac++] = widget12;
+  children[ac++] = widget13;
+  children[ac++] = widget14;
+  children[ac++] = widget15;
+  children[ac++] = widget16;
+  children[ac++] = widget17;
+  children[ac++] = widget18;
+  children[ac++] = widget48;
+  children[ac++] = timeout_text;
+  children[ac++] = cycle_text;
+  children[ac++] = fade_text;
+  children[ac++] = ticks_text;
+  children[ac++] = lock_time_text;
+  children[ac++] = passwd_time_text;
+  children[ac++] = verbose_toggle;
+  children[ac++] = cmap_toggle;
+  children[ac++] = fade_toggle;
+  children[ac++] = unfade_toggle;
+  children[ac++] = lock_toggle;
+  children[ac++] = widget29;
+
+  XtManageChildren(children, ac);
+  ac = 0;
+
+  resources_form = real_dialog;
 }
 
 
@@ -585,181 +578,99 @@ void
 create_demo_dialog( parent )
 Widget parent;
 {
-       Widget children[11];      /* Children to manage */
-       Arg al[64];           /* Arg List */
-       register int ac = 0;      /* Arg Count */
-       XmString xmstrings[15];    /* temporary storage for XmStrings */
-
-
-       /* #### Hacked by hand, not generated by XDesigner */
-       ac = 0;
-       XtSetArg (al[ac], XmNvisual, visual); ac++;
-       XtSetArg (al[ac], XmNcolormap, cmap); ac++;
-       XtSetArg (al[ac], XmNdepth, visual_depth); ac++;
-
-
-       demo_dialog = XmCreateDialogShell ( parent, "demoDialog", al, ac );
-       demo_form = XmCreateForm ( demo_dialog, "demoForm", al, ac );
-       label1 = XmCreateLabel ( demo_form, "label1", al, ac );
-       label2 = XmCreateLabel ( demo_form, "label2", al, ac );
-       demo_list = XmCreateScrolledList ( demo_form, "demoList", al, ac );
-       text_area = XtParent ( demo_list );
-
-       /* #### Hacked by hand, not generated by XDesigner */
-       ac = 0;
-
-
-       text_line = XmCreateTextField ( demo_form, "textLine", al, ac );
-       vline = XmCreateSeparator ( demo_form, "vline", al, ac );
-       next = XmCreatePushButton ( demo_form, "next", al, ac );
-       prev = XmCreatePushButton ( demo_form, "prev", al, ac );
-       edit = XmCreatePushButton ( demo_form, "edit", al, ac );
-       done = XmCreatePushButton ( demo_form, "done", al, ac );
-       restart = XmCreatePushButton ( demo_form, "restart", al, ac );
-       xmstrings[0] = XmStringCreateLtoR(" ", (XmStringCharSet)XmSTRING_DEFAULT_CHARSET);
-       XtSetArg(al[ac], XmNlabelString, xmstrings[0]); ac++;
-       spacer = XmCreateLabel ( demo_form, "spacer", al, ac );
-       ac = 0;
-       XmStringFree ( xmstrings [ 0 ] );
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 5); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-        XtSetValues ( label1,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 4); ac++;
-       XtSetArg(al[ac], XmNtopWidget, label1); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-        XtSetValues ( label2,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 4); ac++;
-       XtSetArg(al[ac], XmNtopWidget, label2); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, text_line); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-        XtSetValues ( text_area,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, vline); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-        XtSetValues ( text_line,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNbottomWidget, next); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-        XtSetValues ( vline,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 3); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( next,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, next); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftWidget, next); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( prev,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, prev); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftWidget, prev); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( edit,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, edit); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftWidget, edit); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( done,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, done); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftWidget, done); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
-        XtSetValues ( restart,al, ac );
-       ac = 0;
-
-       XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
-       XtSetArg(al[ac], XmNtopOffset, 0); ac++;
-       XtSetArg(al[ac], XmNtopWidget, restart); ac++;
-       XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNbottomOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
-       XtSetArg(al[ac], XmNleftOffset, 4); ac++;
-       XtSetArg(al[ac], XmNleftWidget, restart); ac++;
-       XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
-       XtSetArg(al[ac], XmNrightOffset, 4); ac++;
-        XtSetValues ( spacer,al, ac );
-       ac = 0;
-       XtManageChild(demo_list);
-       children[ac++] = label1;
-       children[ac++] = label2;
-       children[ac++] = text_line;
-       children[ac++] = vline;
-       children[ac++] = next;
-       children[ac++] = prev;
-       children[ac++] = edit;
-       children[ac++] = done;
-       children[ac++] = restart;
-       children[ac++] = spacer;
-       XtManageChildren(children, ac);
-       ac = 0;
+  Widget children[11];      /* Children to manage */
+  Arg al[64];           /* Arg List */
+  register int ac = 0;      /* Arg Count */
+  XmString xmstrings[15];    /* temporary storage for XmStrings */
+
+  Widget real_dialog;
+  Widget w;
+
+
+  ac = 0;
+  XtSetArg (al[ac], XmNvisual, visual); ac++;
+  XtSetArg (al[ac], XmNcolormap, cmap); ac++;
+  XtSetArg (al[ac], XmNdepth, visual_depth); ac++;
+
+
+  real_dialog = XmCreatePromptDialog (parent, "demoForm", al, ac);
+  demo_dialog = XtParent(real_dialog);
+
+  w = XmSelectionBoxGetChild (real_dialog, XmDIALOG_SEPARATOR);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (real_dialog, XmDIALOG_TEXT);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (real_dialog, XmDIALOG_SELECTION_LABEL);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (real_dialog, XmDIALOG_OK_BUTTON);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (real_dialog, XmDIALOG_CANCEL_BUTTON);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (real_dialog, XmDIALOG_HELP_BUTTON);
+  if (w) XtUnmanageChild (w);
+
+  ac = 0;
+  XtSetArg (al [ac], XmNtopAttachment, XmATTACH_FORM); ac++;
+  XtSetArg (al [ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
+  XtSetArg (al [ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg (al [ac], XmNrightAttachment, XmATTACH_FORM); ac++;
+  demo_form = XmCreateForm (real_dialog, "form", al, ac);
+  XtManageChild (demo_form);
+
+  label1 = XmCreateLabel ( demo_form, "label1", al, ac );
+  label2 = XmCreateLabel ( demo_form, "label2", al, ac );
+  demo_list = XmCreateScrolledList ( demo_form, "demoList", al, ac );
+  text_area = XtParent ( demo_list );
+
+  ac = 0;
+  text_line = XmSelectionBoxGetChild (real_dialog, XmDIALOG_TEXT);
+  XtManageChild(text_line);
+
+  next = XmCreatePushButton ( real_dialog, "next", al, ac );
+  prev = XmCreatePushButton ( real_dialog, "prev", al, ac );
+  edit = XmCreatePushButton ( real_dialog, "edit", al, ac );
+  done = XmCreatePushButton ( real_dialog, "done", al, ac );
+  restart = XmCreatePushButton ( real_dialog, "restart", al, ac );
+  XtManageChild(next);
+  XtManageChild(prev);
+  XtManageChild(edit);
+  XtManageChild(done);
+  XtManageChild(restart);
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 5); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 4); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 4); ac++;
+  XtSetValues ( label1,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 4); ac++;
+  XtSetArg(al[ac], XmNtopWidget, label1); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 4); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 4); ac++;
+  XtSetValues ( label2,al, ac );
+  ac = 0;
+
+  XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
+  XtSetArg(al[ac], XmNtopOffset, 4); ac++;
+  XtSetArg(al[ac], XmNtopWidget, label2); ac++;
+  XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNleftOffset, 4); ac++;
+  XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
+  XtSetArg(al[ac], XmNrightOffset, 4); ac++;
+  XtSetValues ( text_area,al, ac );
+
+  XtManageChild(demo_list);
+  XtManageChild(label1);
+  XtManageChild(label2);
+
+  demo_form = real_dialog;
 }
-
-
index e4ef9824cfda5223fd5a6cbae9e18ea0e95c35c3..3fe3a1c2bc2f2a9fa64aad697e01e79bbcc38f1a 100644 (file)
@@ -499,7 +499,7 @@ passwd_idle_timer (junk1, junk2)
      XtPointer junk2;
 {
   Display *dpy = XtDisplay (passwd_form);
-  Window window = XtWindow (passwd_form);
+  Window window = XtWindow (XtParent(passwd_done));
   static Dimension x, y, d, s, ss;
   static GC gc = 0;
   int max = passwd_timeout / 1000;
@@ -511,18 +511,33 @@ passwd_idle_timer (junk1, junk2)
       Arg av [10];
       int ac = 0;
       XGCValues gcv;
-      unsigned long fg, bg;
-      XtSetArg (av [ac], XtNheight, &d); ac++;
-      XtGetValues (passwd_done, av, ac);
-      ac = 0;
-      XtSetArg (av [ac], XtNwidth, &x); ac++;
-      XtSetArg (av [ac], XtNheight, &y); ac++;
-      XtSetArg (av [ac], XtNforeground, &fg); ac++;
-      XtSetArg (av [ac], XtNbackground, &bg); ac++;
-      XtGetValues (passwd_form, av, ac);
-      x -= d;
-      y -= d;
-      d -= 4;
+      unsigned long fg, bg, ts, bs;
+      Dimension w = 0, h = 0;
+      XtVaGetValues(XtParent(passwd_done),
+                   XmNwidth, &w,
+                   0);
+      XtVaGetValues(passwd_done,
+                   XmNheight, &h,
+                   XmNy, &y,
+                   XtNforeground, &fg,
+                   XtNbackground, &bg,
+                   XmNtopShadowColor, &ts,
+                   XmNbottomShadowColor, &bs,
+                   0);
+
+      if (ts != bg && ts != fg)
+       fg = ts;
+      if (bs != bg && bs != fg)
+       fg = bs;
+
+      d = h / 2;
+      if (d & 1) d++;
+
+      x = (w / 2);
+
+      x -= d/2;
+      y += d/2;
+
       gcv.foreground = fg;
       if (gc) XFreeGC (dpy, gc);
       gc = XCreateGC (dpy, window, GCForeground, &gcv);
@@ -537,7 +552,8 @@ passwd_idle_timer (junk1, junk2)
 
   if (--passwd_idle_timer_tick)
     {
-      id = XtAppAddTimeOut (app, 1000, passwd_idle_timer, 0);
+      id = XtAppAddTimeOut (app, 1000,
+                           (XtTimerCallbackProc) passwd_idle_timer, 0);
       XFillArc (dpy, window, gc, x, y, d, d, ss, s);
       ss += s;
     }
@@ -578,7 +594,7 @@ pop_passwd_dialog (parent)
 #endif
 
   passwd_idle_timer_tick = passwd_timeout / 1000;
-  id = XtAppAddTimeOut (app, 1000, passwd_idle_timer, 0);
+  id = XtAppAddTimeOut (app, 1000, (XtTimerCallbackProc) passwd_idle_timer, 0);
 
 
   XGrabServer (dpy);                           /* ############ DANGER! */
@@ -619,7 +635,8 @@ pop_passwd_dialog (parent)
        {
          text_field_set_string (passwd_text, lose, strlen (lose) + 1);
          passwd_idle_timer_tick = 1;
-         id = XtAppAddTimeOut (app, 3000, passwd_idle_timer, 0);
+         id = XtAppAddTimeOut (app, 3000,
+                               (XtTimerCallbackProc) passwd_idle_timer, 0);
          while (1)
            {
              XEvent event;
index bb950d8133ab2e5c7fe1367c2ca44d90ec1a0a0a..41b712582f1c7b01f2c2c06643407785216987f9 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1991-1995 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1991-1996 Jamie Zawinski <jwz@netscape.com>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
 #include <X11/extensions/xidle.h>
 #endif /* HAVE_XIDLE_EXTENSION */
 
-#ifdef HAVE_SAVER_EXTENSION
+#ifdef HAVE_MIT_SAVER_EXTENSION
 #include <X11/extensions/scrnsaver.h>
-extern int saver_ext_event_number;
-extern Window server_saver_window;
-#endif /* HAVE_SAVER_EXTENSION */
+extern int mit_saver_ext_event_number;
+extern Window server_mit_saver_window;
+#endif /* HAVE_MIT_SAVER_EXTENSION */
+
+#ifdef HAVE_SGI_SAVER_EXTENSION
+#include <X11/extensions/XScreenSaver.h>
+extern int sgi_saver_ext_event_number;
+#endif /* HAVE_SGI_SAVER_EXTENSION */
 
 #include "xscreensaver.h"
 
@@ -43,7 +48,8 @@ Time pointer_timeout;
 Time notice_events_timeout;
 
 extern Bool use_xidle_extension;
-extern Bool use_saver_extension;
+extern Bool use_mit_saver_extension;
+extern Bool use_sgi_saver_extension;
 extern Bool dbox_up_p;
 extern Bool locked_p;
 extern Window screensaver_window;
@@ -184,7 +190,8 @@ cycle_timer (junk1, junk2)
       kill_screenhack ();
       spawn_screenhack (False);
     }
-  cycle_id = XtAppAddTimeOut (app, how_long, cycle_timer, 0);
+  cycle_id = XtAppAddTimeOut (app, how_long,
+                             (XtTimerCallbackProc) cycle_timer, 0);
 
 #ifdef DEBUG_TIMERS
   if (verbose_p)
@@ -210,7 +217,7 @@ activate_lock_timer (junk1, junk2)
 static void
 reset_timers P((void))
 {
-  if (use_saver_extension)
+  if (use_mit_saver_extension || use_sgi_saver_extension)
     return;
 
 #ifdef DEBUG_TIMERS
@@ -219,7 +226,8 @@ reset_timers P((void))
            progname, timeout, timer_id);
 #endif
   XtRemoveTimeOut (timer_id);
-  timer_id = XtAppAddTimeOut (app, timeout, idle_timer, 0);
+  timer_id = XtAppAddTimeOut (app, timeout,
+                             (XtTimerCallbackProc) idle_timer, 0);
   if (cycle_id) abort ();
 
 #ifdef DEBUG_TIMERS
@@ -249,10 +257,13 @@ check_pointer_timer (closure, this_timer)
   unsigned int mask;
   XtIntervalId *timerP = (XtIntervalId *) closure;
 
-  if (use_xidle_extension || use_saver_extension)
+  if (use_xidle_extension ||
+      use_mit_saver_extension ||
+      use_sgi_saver_extension)
     abort ();
 
-  *timerP = XtAppAddTimeOut (app, pointer_timeout, check_pointer_timer,
+  *timerP = XtAppAddTimeOut (app, pointer_timeout,
+                            (XtTimerCallbackProc) check_pointer_timer,
                             closure);
 
   XQueryPointer (dpy, screensaver_window, &root, &child,
@@ -286,10 +297,11 @@ sleep_until_idle (until_idle_p)
 
   if (until_idle_p)
     {
-      if (!use_saver_extension)
+      if (!use_mit_saver_extension && !use_sgi_saver_extension)
        {
          /* Wake up periodically to ask the server if we are idle. */
-         timer_id = XtAppAddTimeOut (app, timeout, idle_timer, 0);
+         timer_id = XtAppAddTimeOut (app, timeout,
+                                     (XtTimerCallbackProc) idle_timer, 0);
 #ifdef DEBUG_TIMERS
          if (verbose_p)
            printf ("%s: starting idle_timer (%ld, %ld)\n",
@@ -297,7 +309,9 @@ sleep_until_idle (until_idle_p)
 #endif
        }
 
-      if (!use_xidle_extension && !use_saver_extension)
+      if (!use_xidle_extension &&
+         !use_mit_saver_extension &&
+         !use_sgi_saver_extension)
        /* start polling the mouse position */
        check_pointer_timer (&check_pointer_timer_id, 0);
     }
@@ -323,8 +337,8 @@ sleep_until_idle (until_idle_p)
              }
            else
 #endif /* HAVE_XIDLE_EXTENSION */
-#ifdef HAVE_SAVER_EXTENSION
-             if (use_saver_extension)
+#ifdef HAVE_MIT_SAVER_EXTENSION
+             if (use_mit_saver_extension)
                {
                  /* We don't need to do anything in this case - the synthetic
                     event isn't necessary, as we get sent specific events
@@ -332,17 +346,28 @@ sleep_until_idle (until_idle_p)
                  idle = 0;
                }
            else
-#endif /* HAVE_SAVER_EXTENSION */
+#endif /* HAVE_MIT_SAVER_EXTENSION */
+#ifdef HAVE_SGI_SAVER_EXTENSION
+             if (use_sgi_saver_extension)
+               {
+                 /* We don't need to do anything in this case - the synthetic
+                    event isn't necessary, as we get sent specific events
+                    to wake us up. */
+                 idle = 0;
+               }
+           else
+#endif /* HAVE_SGI_SAVER_EXTENSION */
              {
                idle = 1000 * (last_activity_time - time ((time_t *) 0));
              }
            
            if (idle >= timeout)
              goto DONE;
-           else if (!use_saver_extension)
+           else if (!use_mit_saver_extension && !use_sgi_saver_extension)
              {
                timer_id = XtAppAddTimeOut (app, timeout - idle,
-                                           idle_timer, 0);
+                                           (XtTimerCallbackProc) idle_timer,
+                                           0);
 #ifdef DEBUG_TIMERS
                if (verbose_p)
                  printf ("%s: starting idle_timer (%ld, %ld)\n",
@@ -358,9 +383,12 @@ sleep_until_idle (until_idle_p)
        break;
 
       case CreateNotify:
-       if (!use_xidle_extension && !use_saver_extension)
+       if (!use_xidle_extension &&
+           !use_mit_saver_extension &&
+           !use_sgi_saver_extension)
          {
-           XtAppAddTimeOut (app, notice_events_timeout, notice_events_timer,
+           XtAppAddTimeOut (app, notice_events_timeout,
+                            (XtTimerCallbackProc) notice_events_timer,
                             (XtPointer) event.xcreatewindow.window);
 #ifdef DEBUG_TIMERS
            if (verbose_p)
@@ -398,8 +426,8 @@ sleep_until_idle (until_idle_p)
 
       default:
 
-#ifdef HAVE_SAVER_EXTENSION
-       if (event.type == saver_ext_event_number)
+#ifdef HAVE_MIT_SAVER_EXTENSION
+       if (event.type == mit_saver_ext_event_number)
          {
            XScreenSaverNotifyEvent *sevent =
              (XScreenSaverNotifyEvent *) &event;
@@ -413,9 +441,9 @@ sleep_until_idle (until_idle_p)
 
                /* Get the "real" server window out of the way as soon
                   as possible. */
-               if (server_saver_window &&
-                   window_exists_p (dpy, server_saver_window))
-                 XUnmapWindow (dpy, server_saver_window);
+               if (server_mit_saver_window &&
+                   window_exists_p (dpy, server_mit_saver_window))
+                 XUnmapWindow (dpy, server_mit_saver_window);
 
                if (sevent->kind != ScreenSaverExternal)
                  {
@@ -441,13 +469,39 @@ sleep_until_idle (until_idle_p)
              }
 # ifdef DEBUG_TIMERS
            else if (verbose_p)
-             printf ("%s: unknown ScreenSaver event received at %s\n",
+             printf ("%s: unknown MIT-SCREEN-SAVER event received at %s\n",
                      progname, timestring ());
 # endif /* DEBUG_TIMERS */
          }
        else
 
-#endif /* HAVE_SAVER_EXTENSION */
+#endif /* HAVE_MIT_SAVER_EXTENSION */
+
+
+#ifdef HAVE_SGI_SAVER_EXTENSION
+       if (event.type == (sgi_saver_ext_event_number + ScreenSaverStart))
+         {
+# ifdef DEBUG_TIMERS
+           if (verbose_p)
+             printf ("%s: ScreenSaverStart event received at %s\n",
+                     progname, timestring ());
+# endif /* DEBUG_TIMERS */
+
+           if (until_idle_p)
+             goto DONE;
+         }
+       else if (event.type == (sgi_saver_ext_event_number + ScreenSaverEnd))
+         {
+# ifdef DEBUG_TIMERS
+           if (verbose_p)
+             printf ("%s: ScreenSaverEnd event received at %s\n",
+                     progname, timestring ());
+# endif /* DEBUG_TIMERS */
+           if (!until_idle_p)
+             goto DONE;
+         }
+       else
+#endif /* HAVE_SGI_SAVER_EXTENSION */
 
          XtDispatchEvent (&event);
       }
index 084bce737cf1f84535fc7f712d93123620296972..fa782b4241a1296a9da0c4be10c75d6dbad7791c 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1991-1995 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1991-1996 Jamie Zawinski <jwz@netscape.com>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
 
 #include "xscreensaver.h"
 
-#ifdef HAVE_SAVER_EXTENSION
+#ifdef HAVE_MIT_SAVER_EXTENSION
 #include <X11/extensions/scrnsaver.h>
-extern Bool use_saver_extension;
-#endif /* HAVE_SAVER_EXTENSION */
+#endif /* HAVE_MIT_SAVER_EXTENSION */
+
+#ifdef HAVE_SGI_SAVER_EXTENSION
+#include <X11/extensions/XScreenSaver.h>
+#endif /* HAVE_SGI_SAVER_EXTENSION */
+
+extern Bool use_mit_saver_extension;
+extern Bool use_sgi_saver_extension;
 
 #if __STDC__
 extern int kill (pid_t, int);          /* signal() is in sys/signal.h... */
@@ -51,9 +57,9 @@ int fade_seconds, fade_ticks;
 static unsigned long black_pixel;
 static Window real_vroot, real_vroot_value;
 
-#ifdef HAVE_SAVER_EXTENSION
-Window server_saver_window = 0;
-#endif /* HAVE_SAVER_EXTENSION */
+#ifdef HAVE_MIT_SAVER_EXTENSION
+Window server_mit_saver_window = 0;
+#endif /* HAVE_MIT_SAVER_EXTENSION */
 
 #define ALL_POINTER_EVENTS \
        (ButtonPressMask | ButtonReleaseMask | EnterWindowMask | \
@@ -165,14 +171,18 @@ disable_builtin_screensaver ()
   XGetScreenSaver (dpy, &server_timeout, &server_interval,
                   &prefer_blank, &allow_exp);
 
-#ifdef HAVE_SAVER_EXTENSION
-  if (use_saver_extension)
+#if defined(HAVE_MIT_SAVER_EXTENSION) || defined(HAVE_SGI_SAVER_EXTENSION)
+  if (use_mit_saver_extension || use_sgi_saver_extension)
     {
       /* Override the values specified with "xset" with our own parameters. */
-      prefer_blank = False;
       allow_exp = True;
       server_interval = 0;
       server_timeout = (timeout / 1000);
+
+      /* The SGI extension won't give us events unless blanking is on.
+        I think (unsure right now) that the MIT extension is the opposite. */
+      prefer_blank = (use_sgi_saver_extension ? True : False);
+
       if (verbose_p)
        fprintf (stderr,
                 "%s: configuring server for saver timeout of %d seconds.\n",
@@ -181,7 +191,7 @@ disable_builtin_screensaver ()
                       prefer_blank, allow_exp);
     }
   else
-#endif /* HAVE_SAVER_EXTENSION */
+#endif /* HAVE_MIT_SAVER_EXTENSION || HAVE_SGI_SAVER_EXTENSION */
   if (server_timeout != 0)
     {
       server_timeout = 0;
@@ -532,9 +542,15 @@ initialize_screensaver_window P((void))
   attrmask = (CWOverrideRedirect | CWEventMask | CWBackingStore | CWColormap |
              CWBackPixel | CWBackingPixel | CWBorderPixel);
   attrs.override_redirect = True;
+
+  /* When use_mit_saver_extension or use_sgi_saver_extension is true, we won't
+     actually be reading these events during normal operation; but we still
+     need to see Button events for demo-mode to work properly.
+   */
   attrs.event_mask = (KeyPressMask | KeyReleaseMask |
                      ButtonPressMask | ButtonReleaseMask |
                      PointerMotionMask);
+
   attrs.backing_store = NotUseful;
   attrs.colormap = cmap;
   attrs.background_pixel = black_pixel;
@@ -560,8 +576,8 @@ initialize_screensaver_window P((void))
       describe_visual (stderr, dpy, DefaultVisualOfScreen (screen));
     }
 
-#ifdef HAVE_SAVER_EXTENSION
-  if (use_saver_extension)
+#ifdef HAVE_MIT_SAVER_EXTENSION
+  if (use_mit_saver_extension)
     {
       XScreenSaverInfo *info;
       Window root = RootWindowOfScreen (screen);
@@ -604,11 +620,11 @@ initialize_screensaver_window P((void))
 
       info = XScreenSaverAllocInfo ();
       XScreenSaverQueryInfo (dpy, root, info);
-      server_saver_window = info->window;
-      if (! server_saver_window) abort ();
+      server_mit_saver_window = info->window;
+      if (! server_mit_saver_window) abort ();
       XFree (info);
     }
-#endif /* HAVE_SAVER_EXTENSION */
+#endif /* HAVE_MIT_SAVER_EXTENSION */
 
   if (screensaver_window)
     {
@@ -631,15 +647,15 @@ initialize_screensaver_window P((void))
                       &attrs);
     }
 
-#ifdef HAVE_SAVER_EXTENSION
-  if (!use_saver_extension ||
+#ifdef HAVE_MIT_SAVER_EXTENSION
+  if (!use_mit_saver_extension ||
       window_exists_p (dpy, screensaver_window))
     /* When using the MIT-SCREEN-SAVER extension, the window pointed to
        by screensaver_window only exists while the saver is active.
        So we must be careful to only try and manipulate it while it
        exists...
      */
-#endif /* HAVE_SAVER_EXTENSION */
+#endif /* HAVE_MIT_SAVER_EXTENSION */
     {
       class_hints.res_name = progname;
       class_hints.res_class = progclass;
@@ -689,19 +705,23 @@ raise_window (inhibit_fade, between_hacks_p)
                              ? cmap
                              : DefaultColormapOfScreen (screen));
       copy_colormap (dpy, current_map, cmap2);
+      if (verbose_p) fprintf (stderr, "%s: fading... ", progname);
       XGrabServer (dpy);
       /* grab and blacken mouse on the root window (saver not mapped yet) */
       grabbed = grab_mouse (RootWindowOfScreen (screen));
       /* fade what's on the screen to black */
       XInstallColormap (dpy, cmap2);
-      fade_colormap (dpy, current_map, cmap2, fade_seconds, fade_ticks, True);
+      fade_colormap (dpy, current_map, cmap2, fade_seconds, fade_ticks,
+                    True, True);
+      if (verbose_p) fprintf (stderr, "fading done.\n");
       XClearWindow (dpy, screensaver_window);
       XMapRaised (dpy, screensaver_window);
 
-#ifdef HAVE_SAVER_EXTENSION
-      if (server_saver_window && window_exists_p (dpy, server_saver_window))
-       XUnmapWindow (dpy, server_saver_window);
-#endif /* HAVE_SAVER_EXTENSION */
+#ifdef HAVE_MIT_SAVER_EXTENSION
+      if (server_mit_saver_window &&
+         window_exists_p (dpy, server_mit_saver_window))
+       XUnmapWindow (dpy, server_mit_saver_window);
+#endif /* HAVE_MIT_SAVER_EXTENSION */
 
       /* Once the saver window is up, restore the colormap.
         (The "black" pixels of the two colormaps are compatible.) */
@@ -714,10 +734,11 @@ raise_window (inhibit_fade, between_hacks_p)
     {
       XClearWindow (dpy, screensaver_window);
       XMapRaised (dpy, screensaver_window);
-#ifdef HAVE_SAVER_EXTENSION
-      if (server_saver_window && window_exists_p (dpy, server_saver_window))
-       XUnmapWindow (dpy, server_saver_window);
-#endif /* HAVE_SAVER_EXTENSION */
+#ifdef HAVE_MIT_SAVER_EXTENSION
+      if (server_mit_saver_window &&
+         window_exists_p (dpy, server_mit_saver_window))
+       XUnmapWindow (dpy, server_mit_saver_window);
+#endif /* HAVE_MIT_SAVER_EXTENSION */
     }
 
   if (install_cmap_p)
@@ -752,13 +773,16 @@ unblank_screen ()
       int grabbed;
       Colormap default_map = DefaultColormapOfScreen (screen);
       blacken_colormap (dpy, cmap2);
+      if (verbose_p) fprintf (stderr, "%s: unfading... ", progname);
       XGrabServer (dpy);
       /* grab and blacken mouse on the root window. */
       grabbed = grab_mouse (RootWindowOfScreen (screen));
       XInstallColormap (dpy, cmap2);
       XUnmapWindow (dpy, screensaver_window);
-      fade_colormap (dpy, default_map, cmap2, fade_seconds, fade_ticks, False);
+      fade_colormap (dpy, default_map, cmap2, fade_seconds, fade_ticks,
+                    False, True);
       XInstallColormap (dpy, default_map);
+      if (verbose_p) fprintf (stderr, "unfading done.\n");
       if (grabbed == GrabSuccess)
        XUngrabPointer (dpy, CurrentTime);
       XUngrabServer (dpy);
@@ -772,9 +796,35 @@ unblank_screen ()
        }
       XUnmapWindow (dpy, screensaver_window);
     }
+
+
+  /* If the focus window does has a non-default colormap, then install
+     that colormap as well.  (On SGIs, this will cause both the root map
+     and the focus map to be installed simultaniously.  It'd be nice to
+     pick up the other colormaps that had been installed, too; perhaps
+     XListInstalledColormaps could be used for that?)
+   */
+  {
+    Window focus = 0;
+    int revert_to;
+    XGetInputFocus (dpy, &focus, &revert_to);
+    if (focus && focus != PointerRoot && focus != None)
+      {
+       XWindowAttributes xgwa;
+       Colormap default_map = DefaultColormapOfScreen (screen);
+       xgwa.colormap = 0;
+       XGetWindowAttributes (dpy, focus, &xgwa);
+       if (xgwa.colormap &&
+           xgwa.colormap != default_map)
+         XInstallColormap (dpy, xgwa.colormap);
+      }
+  }
+
+
   kill_xsetroot_data ();
   ungrab_keyboard_and_mouse ();
   restore_real_vroot ();
+
 #ifdef __hpux
   if (lock_p && hp_locked_p)
     XHPEnableReset (dpy);      /* turn C-Sh-Reset back on */
index 76f68c2eaf05b7b975be07cec23524adb87d5d15..b0811c3ec0bbbf8a4739c4675c7ef81b28de54ef 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1991-1995 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1991-1996 Jamie Zawinski <jwz@netscape.com>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
  *   and a few other things.  The included "xscreensaver_command" program
  *   sends these messsages.
  *
- *   If we don't have the XIdle or MIT-SCREENSAVER extensions, then we do the
- *   XAutoLock trick: notice every window that gets created, and wait 30
- *   seconds or so until its creating process has settled down, and then
- *   select KeyPress events on those windows which already select for
- *   KeyPress events.  It's important that we not select KeyPress on windows
- *   which don't select them, because that would interfere with event
- *   propagation.  This will break if any program changes its event mask to
- *   contain KeyRelease or PointerMotion more than 30 seconds after creating
- *   the window, but that's probably pretty rare.
+ *   If we don't have the XIdle, MIT-SCREEN-SAVER, or SGI SCREEN_SAVER
+ *   extensions, then we do the XAutoLock trick: notice every window that
+ *   gets created, and wait 30 seconds or so until its creating process has
+ *   settled down, and then select KeyPress events on those windows which
+ *   already select for KeyPress events.  It's important that we not select
+ *   KeyPress on windows which don't select them, because that would
+ *   interfere with event propagation.  This will break if any program
+ *   changes its event mask to contain KeyRelease or PointerMotion more than
+ *   30 seconds after creating the window, but that's probably pretty rare.
  *   
  *   The reason that we can't select KeyPresses on windows that don't have
  *   them already is that, when dispatching a KeyPress event, X finds the
  *   one of them if the description above sounds just too flaky to live.  It
  *   is, but those are your choices.
  *
- *   A third idle-detection option could be implement (but is not): when
+ *   A third idle-detection option could be implemented (but is not): when
  *   running on the console display ($DISPLAY is `localhost`:0) and we're on a
  *   machine where /dev/tty and /dev/mouse have reasonable last-modification
- *   times, we could just stat those.  But the incremental benefit of
+ *   times, we could just stat() those.  But the incremental benefit of
  *   implementing this is really small, so forget I said anything.
  *
  *   Debugging hints:
  *     - you probably can't set breakpoints in functions that are called on
  *       the other side of a call to fork() -- if your clients are dying 
  *       with signal 5, Trace/BPT Trap, you're losing in this way.
- *     - If you aren't using XIdle, don't leave this stopped under the
- *       debugger for very long, or the X input buffer will get huge because
- *       of the keypress events it's selecting for.  This can make your X
- *       server wedge with "no more input buffers."
+ *     - If you aren't using a server extension, don't leave this stopped
+ *       under the debugger for very long, or the X input buffer will get
+ *       huge because of the keypress events it's selecting for.  This can
+ *       make your X server wedge with "no more input buffers."
  *       
- *   ======================================================================== */
+ * ======================================================================== */
 
 #if __STDC__
 #include <stdlib.h>
 #include <X11/extensions/xidle.h>
 #endif /* HAVE_XIDLE_EXTENSION */
 
-#ifdef HAVE_SAVER_EXTENSION
+#ifdef HAVE_MIT_SAVER_EXTENSION
 #include <X11/extensions/scrnsaver.h>
-#endif /* HAVE_SAVER_EXTENSION */
+#endif /* HAVE_MIT_SAVER_EXTENSION */
+
+#ifdef HAVE_SGI_SAVER_EXTENSION
+#include <X11/extensions/XScreenSaver.h>
+#endif /* HAVE_SGI_SAVER_EXTENSION */
 
 #include "yarandom.h"
 #include "xscreensaver.h"
@@ -193,7 +197,8 @@ extern Time notice_events_timeout;
 extern XtIntervalId lock_id, cycle_id;
 
 Bool use_xidle_extension;
-Bool use_saver_extension;
+Bool use_mit_saver_extension;
+Bool use_sgi_saver_extension;
 Bool verbose_p;
 Bool lock_p, locked_p;
 
@@ -213,10 +218,15 @@ extern Bool demo_mode_p;
 extern Bool dbox_up_p;
 extern int next_mode_p;
 
-#ifdef HAVE_SAVER_EXTENSION
-int saver_ext_event_number = 0;
-int saver_ext_error_number = 0;
-#endif /* HAVE_SAVER_EXTENSION */
+#ifdef HAVE_MIT_SAVER_EXTENSION
+int mit_saver_ext_event_number = 0;
+int mit_saver_ext_error_number = 0;
+#endif /* HAVE_MIT_SAVER_EXTENSION */
+
+#ifdef HAVE_SGI_SAVER_EXTENSION
+int sgi_saver_ext_event_number = 0;
+int sgi_saver_ext_error_number = 0;
+#endif /* HAVE_SGI_SAVER_EXTENSION */
 
 static time_t initial_delay;
 
@@ -252,8 +262,10 @@ static XrmOptionDescRec options [] = {
   { "-silent",            ".verbose",          XrmoptionNoArg, "off" },
   { "-xidle-extension",           ".xidleExtension",   XrmoptionNoArg, "on" },
   { "-no-xidle-extension", ".xidleExtension",  XrmoptionNoArg, "off" },
-  { "-ss-extension",      ".saverExtension",   XrmoptionNoArg, "on" },
-  { "-no-ss-extension",           ".saverExtension",   XrmoptionNoArg, "off" },
+  { "-mit-extension",     ".mitSaverExtension",XrmoptionNoArg, "on" },
+  { "-no-mit-extension",   ".mitSaverExtension",XrmoptionNoArg, "off" },
+  { "-sgi-extension",     ".sgiSaverExtension",XrmoptionNoArg, "on" },
+  { "-no-sgi-extension",   ".sgiSaverExtension",XrmoptionNoArg, "off" },
   { "-lock",              ".lock",             XrmoptionNoArg, "on" },
   { "-no-lock",                   ".lock",             XrmoptionNoArg, "off" }
 };
@@ -267,7 +279,7 @@ static void
 do_help P((void))
 {
   printf ("\
-xscreensaver %s, copyright (c) 1991-1995 by Jamie Zawinski <jwz@netscape.com>.\n\
+xscreensaver %s, copyright (c) 1991-1996 by Jamie Zawinski <jwz@netscape.com>.\n\
 The standard Xt command-line options are accepted; other options include:\n\
 \n\
     -timeout <minutes>         When the screensaver should activate.\n\
@@ -281,8 +293,10 @@ The standard Xt command-line options are accepted; other options include:\n\
     -silent                    Don't.\n\
     -xidle-extension           Use the R5 XIdle server extension.\n\
     -no-xidle-extension        Don't.\n\
-    -ss-extension              Use the R6 MIT-SCREEN-SAVER server extension.\n\
-    -no-ss-extension           Don't.\n\
+    -mit-extension             Use the R6 MIT_SCREEN_SAVER server extension.\n\
+    -no-mit-extension          Don't.\n\
+    -sgi-extension             Use the SGI SCREEN-SAVER server extension.\n\
+    -no-sgi-extension          Don't.\n\
     -lock                      Require a password before deactivating.\n\
     -no-lock                   Don't.\n\
     -lock-timeout <minutes>    Grace period before locking; default 0.\n\
@@ -301,10 +315,10 @@ more details.\n\n",
 #ifdef NO_DEMO_MODE
   printf ("Support for demo mode was not enabled at compile-time.\n");
 #endif
-#if !defined(HAVE_XIDLE_EXTENSION) && !defined(HAVE_SAVER_EXTENSION)
-  printf ("Support for the XIDLE and MIT-SCREEN-SAVER server extensions\
was not\nenabled at compile-time.\n");
-#endif /* !HAVE_XIDLE_EXTENSION && !HAVE_SAVER_EXTENSION */
+#if !defined(HAVE_XIDLE_EXTENSION) && !defined(HAVE_MIT_SAVER_EXTENSION) && !defined(HAVE_SGI_SAVER_EXTENSION)
+  printf ("Support for the XIDLE, SCREEN_SAVER, and MIT-SCREEN-SAVER server\
extensions\nwas not enabled at compile-time.\n");
+#endif /* !HAVE_XIDLE_EXTENSION && !HAVE_MIT_SAVER_EXTENSION && !HAVE_SGI_SAVER_EXTENSION */
 
   fflush (stdout);
   exit (1);
@@ -469,15 +483,26 @@ get_resources P((void))
 #endif /* !HAVE_XIDLE_EXTENSION */
 
   /* don't set use_saver_extension unless it is explicitly specified */
-  if (get_string_resource ("saverExtension", "Boolean"))
-    use_saver_extension = get_boolean_resource ("saverExtension", "Boolean");
+  if (get_string_resource ("mitSaverExtension", "Boolean"))
+    use_mit_saver_extension = get_boolean_resource ("mitSaverExtension",
+                                                   "Boolean");
   else
-#ifdef HAVE_SAVER_EXTENSION    /* pick a default */
-    use_saver_extension = True;
-#else  /* !HAVE_SAVER_EXTENSION */
-    use_saver_extension = False;
-#endif /* !HAVE_SAVER_EXTENSION */
+#ifdef HAVE_MIT_SAVER_EXTENSION        /* pick a default */
+    use_mit_saver_extension = True;
+#else  /* !HAVE_MIT_SAVER_EXTENSION */
+    use_mit_saver_extension = False;
+#endif /* !HAVE_MIT_SAVER_EXTENSION */
 
+  /* don't set use_saver_extension unless it is explicitly specified */
+  if (get_string_resource ("sgiSaverExtension", "Boolean"))
+    use_sgi_saver_extension = get_boolean_resource ("sgiSaverExtension",
+                                                   "Boolean");
+  else
+#ifdef HAVE_SGI_SAVER_EXTENSION        /* pick a default */
+    use_sgi_saver_extension = True;
+#else  /* !HAVE_SGI_SAVER_EXTENSION */
+    use_sgi_saver_extension = False;
+#endif /* !HAVE_SGI_SAVER_EXTENSION */
 
   get_screenhacks ();
 }
@@ -576,7 +601,7 @@ initialize_connection (argc, argv)
   XA_LOCK = XInternAtom (dpy, "LOCK", False);
 }
 
-#ifdef HAVE_SAVER_EXTENSION
+#ifdef HAVE_MIT_SAVER_EXTENSION
 
 static int
 ignore_all_errors_ehandler (dpy, error)
@@ -587,12 +612,11 @@ ignore_all_errors_ehandler (dpy, error)
 }
 
 static void
-init_saver_extension ()
+init_mit_saver_extension ()
 {
   XID kill_id;
   Atom kill_type;
   Window root = RootWindowOfScreen (screen);
-  XScreenSaverInfo *info;
   Pixmap blank_pix = XCreatePixmap (dpy, root, 1, 1, 1);
 
   /* Kill off the old MIT-SCREEN-SAVER client if there is one.
@@ -613,24 +637,26 @@ init_saver_extension ()
 
   XScreenSaverRegister (dpy, XScreenNumberOfScreen (screen),
                        (XID) blank_pix, XA_PIXMAP);
-  info = XScreenSaverAllocInfo ();
+}
+#endif /* HAVE_MIT_SAVER_EXTENSION */
 
-#if 0
-  /* #### I think this is noticing that the saver is on, and replacing it
-     without turning it off first. */
-  saver = info->window;
-  if (info->state == ScreenSaverOn)
+
+#ifdef HAVE_SGI_SAVER_EXTENSION
+
+static void
+init_sgi_saver_extension ()
+{
+  if (! XScreenSaverEnable (dpy, XScreenNumberOfScreen(screen)))
     {
-      if (info->kind != ScreenSaverExternal) 
-       {
-         XResetScreenSaver (display);
-         XActivateScreenSaver (display);
-       }
-      StartSaver ();
+      fprintf (stderr,
+       "%s: %sSGI SCREEN_SAVER extension exists, but can't be initialized;\n\
+               perhaps some other screensaver program is already running?\n",
+              progname, (verbose_p ? "## " : ""));
+      use_sgi_saver_extension = False;
     }
-#endif
 }
-#endif /* HAVE_SAVER_EXTENSION */
+
+#endif /* HAVE_SGI_SAVER_EXTENSION */
 
 
 extern void init_sigchld P((void));
@@ -687,30 +713,63 @@ initialize (argc, argv)
 
   if (verbose_p)
     printf ("\
-%s %s, copyright (c) 1991-1995 by Jamie Zawinski <jwz@netscape.com>.\n\
+%s %s, copyright (c) 1991-1996 by Jamie Zawinski <jwz@netscape.com>.\n\
  pid = %d.\n", progname, screensaver_version, getpid ());
   ensure_no_screensaver_running ();
 
   demo_mode_p = initial_demo_mode_p;
   screensaver_window = 0;
   cursor = 0;
-  initialize_screensaver_window ();
   srandom ((int) time ((time_t *) 0));
   cycle_id = 0;
   lock_id = 0;
   locked_p = False;
 
-  if (use_saver_extension)
+  if (use_sgi_saver_extension)
     {
-#ifdef HAVE_SAVER_EXTENSION
+#ifdef HAVE_SGI_SAVER_EXTENSION
       if (! XScreenSaverQueryExtension (dpy,
-                                       &saver_ext_event_number,
-                                       &saver_ext_error_number))
+                                       &sgi_saver_ext_event_number,
+                                       &sgi_saver_ext_error_number))
+       {
+         fprintf (stderr,
+        "%s: %sdisplay %s does not support the SGI SCREEN_SAVER extension.\n",
+                  progname, (verbose_p ? "## " : ""), DisplayString (dpy));
+         use_sgi_saver_extension = False;
+       }
+      else if (use_mit_saver_extension)
+       {
+         fprintf (stderr, "%s: %sSGI SCREEN_SAVER extension used instead\
+ of MIT-SCREEN-SAVER extension.\n",
+                  progname, (verbose_p ? "## " : ""));
+         use_mit_saver_extension = False;
+       }
+      else if (use_xidle_extension)
+       {
+         fprintf (stderr,
+        "%s: %sSGI SCREEN_SAVER extension used instead of XIDLE extension.\n",
+                  progname, (verbose_p ? "## " : ""));
+         use_xidle_extension = False;
+       }
+#else  /* !HAVE_MIT_SAVER_EXTENSION */
+      fprintf (stderr,
+       "%s: %snot compiled with support for the SGI SCREEN_SAVER extension.\n",
+              progname, (verbose_p ? "## " : ""));
+      use_sgi_saver_extension = False;
+#endif /* !HAVE_SGI_SAVER_EXTENSION */
+    }
+
+  if (use_mit_saver_extension)
+    {
+#ifdef HAVE_MIT_SAVER_EXTENSION
+      if (! XScreenSaverQueryExtension (dpy,
+                                       &mit_saver_ext_event_number,
+                                       &mit_saver_ext_error_number))
        {
          fprintf (stderr,
         "%s: %sdisplay %s does not support the MIT-SCREEN-SAVER extension.\n",
                   progname, (verbose_p ? "## " : ""), DisplayString (dpy));
-         use_saver_extension = False;
+         use_mit_saver_extension = False;
        }
       else if (use_xidle_extension)
        {
@@ -719,12 +778,12 @@ initialize (argc, argv)
                   progname, (verbose_p ? "## " : ""));
          use_xidle_extension = False;
        }
-#else  /* !HAVE_SAVER_EXTENSION */
+#else  /* !HAVE_MIT_SAVER_EXTENSION */
       fprintf (stderr,
        "%s: %snot compiled with support for the MIT-SCREEN-SAVER extension.\n",
               progname, (verbose_p ? "## " : ""));
-      use_saver_extension = False;
-#endif /* !HAVE_SAVER_EXTENSION */
+      use_mit_saver_extension = False;
+#endif /* !HAVE_MIT_SAVER_EXTENSION */
     }
 
   if (use_xidle_extension)
@@ -745,18 +804,29 @@ initialize (argc, argv)
 #endif /* !HAVE_XIDLE_EXTENSION */
     }
 
+  /* Call this only after having probed for presence of desired extension. */
+  initialize_screensaver_window ();
+
   init_sigchld ();
 
   disable_builtin_screensaver ();
 
-#ifdef HAVE_SAVER_EXTENSION
-  if (use_saver_extension)
-    init_saver_extension ();
-#endif /* HAVE_SAVER_EXTENSION */
+#ifdef HAVE_MIT_SAVER_EXTENSION
+  if (use_mit_saver_extension)
+    init_mit_saver_extension ();
+#endif /* HAVE_MIT_SAVER_EXTENSION */
 
-  if (verbose_p && use_saver_extension)
+#ifdef HAVE_SGI_SAVER_EXTENSION
+  if (use_sgi_saver_extension)
+    init_sgi_saver_extension ();
+#endif /* HAVE_SGI_SAVER_EXTENSION */
+
+  if (verbose_p && use_mit_saver_extension)
     fprintf (stderr, "%s: using MIT-SCREEN-SAVER server extension.\n",
             progname);
+  if (verbose_p && use_sgi_saver_extension)
+    fprintf (stderr, "%s: using SGI SCREEN_SAVER server extension.\n",
+            progname);
   if (verbose_p && use_xidle_extension)
     fprintf (stderr, "%s: using XIdle server extension.\n",
             progname);
@@ -768,7 +838,9 @@ initialize (argc, argv)
     /* If the user wants demo mode, don't wait around before doing it. */
     initial_delay = 0;
 
-  if (!use_xidle_extension && !use_saver_extension)
+  if (!use_xidle_extension &&
+      !use_mit_saver_extension &&
+      !use_sgi_saver_extension)
     {
       if (initial_delay)
        {
@@ -924,7 +996,7 @@ handle_clientmessage (event, until_idle_p)
        {
          if (verbose_p)
            printf ("%s: ACTIVATE ClientMessage received.\n", progname);
-         if (use_saver_extension)
+         if (use_mit_saver_extension || use_sgi_saver_extension)
            {
              XForceScreenSaver (dpy, ScreenSaverActive);
              return False;
@@ -944,7 +1016,7 @@ handle_clientmessage (event, until_idle_p)
        {
          if (verbose_p)
            printf ("%s: DEACTIVATE ClientMessage received.\n", progname);
-         if (use_saver_extension)
+         if (use_mit_saver_extension || use_sgi_saver_extension)
            {
              XForceScreenSaver (dpy, ScreenSaverReset);
              return False;
@@ -1079,7 +1151,7 @@ handle_clientmessage (event, until_idle_p)
 
          if (until_idle_p)
            {
-             if (use_saver_extension)
+             if (use_mit_saver_extension || use_sgi_saver_extension)
                {
                  XForceScreenSaver (dpy, ScreenSaverActive);
                  return False;
index ea792e2dfa39fb5703bb9c4cba0a7ca787d9811e..9b933347b79773ebf6961fb6cc86268262f1a511 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1993, 1995 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1993-1996 Jamie Zawinski <jwz@netscape.com>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -61,7 +61,7 @@ extern void spawn_screenhack P((Bool));
 extern void kill_screenhack P((void));
 
 extern Colormap copy_colormap P((Display *, Colormap, Colormap));
-extern void fade_colormap P((Display*, Colormap, Colormap, int, int, Bool));
+extern void fade_colormap P((Display*,Colormap,Colormap,int,int,Bool,Bool));
 extern void blacken_colormap P((Display *, Colormap));
 
 extern int BadWindow_ehandler P((Display *dpy, XErrorEvent *error));
index 18bf571a02e8fe0b230ee60efe51d94ff55ece8f..7ebf76c3ecec360428d7ccaff445daae19bb9b5c 100644 (file)
@@ -16,7 +16,7 @@
 xscreensaver - graphics hack and screen locker, launched when the user is idle
 .SH SYNOPSIS
 .B xscreensaver
-[\-display \fIhost:display.screen\fP] [\-timeout \fIint\fP] [\-cycle \fIint\fP] [\-nice \fIint\fP] [\-verbose] [\-silent] [\-xidle] [\-no-xidle] [\-lock] [\-no-lock] [\-lock\-timeout \fIint\fP] [\-demo] [\-visual \fIvisual\fP] [\-install] [\-no-install] [\-xrm \fIresources\fP]
+[\-display \fIhost:display.screen\fP] [\-timeout \fIint\fP] [\-cycle \fIint\fP] [\-nice \fIint\fP] [\-verbose] [\-silent] [\-lock] [\-no\-lock] [\-lock\-timeout \fIint\fP] [\-demo] [\-visual \fIvisual\fP] [\-install] [\-no\-install] [\-xidle\-extension] [\-no\-xidle\-extension] [\-sgi\-extension] [\-no\-sgi\-extension] [\-mit\-extension] [\-no\-mit\-extension] [\-xrm \fIresources\fP]
 .SH DESCRIPTION
 The \fIxscreensaver\fP program waits until the keyboard and mouse have been 
 idle for a period, and then runs a graphics demo chosen at random.  It 
@@ -66,14 +66,23 @@ and more reliable than what will be done otherwise, so use it if you can.
 .B \-no\-xidle\-extension
 Don't use the \fBXIDLE\fP server extension.
 .TP 8
-.B \-ss\-extension
-Use the \fBMIT\-SCREEN\-SAVER\fP server extension to decide whether the user
+.B \-sgi\-extension
+Use the SGI \fBSCREEN_SAVER\fP server extension to decide whether the user
 is idle.  This is the default if \fIxscreensaver\fP has been compiled with
-support for this extension.  On X11R6 systems, the  \fBMIT\-SCREEN\-SAVER\fP 
+support for this extension.  On SGI systems, the \fBSCREEN_SAVER\fP 
 method is faster and more reliable than what will be done otherwise, so use
 it if you can.
 .TP 8
-.B \-no\-ss\-extension
+.B \-no\-sgi\-extension
+Don't use the SGI \fBSCREEN_SAVER\fP server extension.
+.TP 8
+.B \-mit\-extension
+Use the \fBMIT\-SCREEN\-SAVER\fP server extension to decide whether the user
+is idle.  This is the default if \fIxscreensaver\fP has been compiled with
+support for this extension.  This extension is flaky, so it's use is not
+really recommended.
+.TP 8
+.B \-no\-mit\-extension
 Don't use the \fBMIT\-SCREEN\-SAVER\fP server extension.
 .TP 8
 .B \-lock
@@ -272,17 +281,18 @@ This must be whatever your local variant of \fB/bin/sh\fP is -- in particular,
 it must not be \fBcsh\fP.
 .TP 8
 .B windowCreationTimeout \fR(class \fBTime\fP)
-When \fIXIdle\fP is not in use, this controls the delay between when 
+When server extensions are not in use, this controls the delay between when 
 windows are created and when \fIxscreensaver\fP selects events on them.
 Default 30 seconds.
 .TP 8
 .B pointerPollTime \fR(class \fBTime\fP)
-When \fIXIdle\fP is not in use, this controls how frequently \fIxscreensaver\fP
-checks to see if the mouse position or buttons have changed.  Default 5 seconds.
+When server extensions are not in use, this controls how 
+frequently \fIxscreensaver\fP checks to see if the mouse position or buttons
+have changed.  Default 5 seconds.
 .TP 8
 .B initialDelay \fR(class \fBTime\fP)
-When \fIXIdle\fP is not in use, \fIxscreensaver\fP will wait this many seconds
-before selecting events on existing windows, under the assumption that 
+When server extensions are not in use, \fIxscreensaver\fP will wait this many
+seconds before selecting events on existing windows, under the assumption that 
 \fIxscreensaver\fP is started during your login procedure, and the window 
 state may be in flux.  Default 30 seconds.
 .SH "HOW IT WORKS"
@@ -414,6 +424,7 @@ automatically return to demo mode after restarting.
 .BR decayscreen (1),
 .BR hypercube (1),
 .BR flame (1),
+.BR bubbles (1),
 .BR maze (1),
 .BR ico (1),
 .BR xdaliclock (1),
@@ -428,9 +439,9 @@ the \fBcolorPrograms\fP and/or \fBmonoPrograms\fP resources as well.
 (This is not a bug, but I mention it here because people think that
 it is with great regularity.)
 .PP
-If you are not making use of one of the server extensions (\fBXIDLE\fP
-or \fBMIT-SCREEN-SAVER\fP), then it is possible, in rare situations,
-for \fIxscreensaver\fP to interfere with event propagation and make
+If you are not making use of one of the server extensions (\fBXIDLE\fP,
+\fBSCREEN_SAVER\fP, or \fBMIT-SCREEN-SAVER\fP), then it is possible, in rare
+situations, for \fIxscreensaver\fP to interfere with event propagation and make
 another X program malfunction.  For this to occur, that other application
 would need to \fInot\fP select \fBKeyPress\fP events on its non-leaf windows
 within the first 30 seconds of their existence, but then select for them later.
@@ -502,7 +513,8 @@ The \fBinstallColormap\fP option doesn't work very well with the
 window manager and its descendants.  There is a race condition between the
 screensaver and this window manager, which can result in the screensaver's
 colormap not getting installed properly, meaning the graphics hacks will
-appear in essentially random colors.  The
+appear in essentially random colors.  (If the screen goes white instead of
+black, this is probably why.)  The
 .BR mwm (1)
 and
 .BR olwm (1)
@@ -529,18 +541,22 @@ the \fBfade\fP option, you may notice an unattractive flicker just before
 the fade begins.  This is because the server maps a black window just before 
 it tells the \fIxscreensaver\fP process to activate.  The \fIxscreensaver\fP 
 process immediately unmaps that window, but this results in a flicker.  I 
-haven't figured out how to get around this yet.
+haven't figured a way  to get around this; it seems to be a fundamental
+property of the (mis-) design of this server extension.
 .PP
 There need to be a lot more graphics hacks.  In particular, there should be
 a simulation of a Lavalite (tm).
+.SH UPGRADES
+The latest version can always be found at http://www.netscape.com/people/jwz/.
+There is also usually an up-to-date copy at ftp://ftp.x.org/.
 .SH COPYRIGHT
-Copyright \(co 1992, 1993, 1994, 1995 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, 1995, 1996 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 <jwz@netscape.com>, 13-aug-92.
 Please let me know if you find any bugs or make any improvements.
index d2276c49b6125866df8d42d436a1f33851c091ff..e9e6ed87423e8ca783aad3562d7929b1a95f3d12 100644 (file)
@@ -17,6 +17,7 @@
 # define XPMLIB
 #endif
 
+          STAR = *
           UTILS = ../utils
        INCLUDES = -I$(UTILS)
         DEFINES = R5ISMS XPMDEFS
@@ -24,14 +25,21 @@ LOCAL_LIBRARIES = $(XMULIB) $(XTOOLLIB) XPMLIB $(EXTENSIONLIB) $(XLIB) -lm
           HACKS = attraction.c greynetic.c helix.c hopalong.c xroger-hack.c \
                   noseguy.c pyro.c qix.c rocks.c rorschach.c blitspin.c \
                   imsmap.c slidescreen.c decayscreen.c maze.c hypercube.c \
-                  halo.c flame.c pedal.c lmorph.c
+                  halo.c flame.c pedal.c lmorph.c \
+                 bubbles.c bubbles.h bubbles_default.c
             MEN = attraction.man greynetic.man helix.man hopalong.man \
                   noseguy.man pyro.man xroger.man qix.man rocks.man \
                   rorschach.man blitspin.man imsmap.man slidescreen.man \
                   decayscreen.man maze.man hypercube.man halo.man flame.man \
-                  pedal.man lmorph.man
+                  pedal.man lmorph.man \
+                 bubbles.man bubbles.README
        TARFILES = README Imakefile screenhack.c $(HACKS) screenhack.h \
-                  vroot.h xlock.h default.xbm $(MEN) .gdbinit noses/\*
+                  vroot.h xlock.h default.xbm $(MEN) .gdbinit \
+                 noses/nose.$(STAR) \
+                 bubbles-tools/bubbles$(STAR) \
+                 bubbles-tools/xpm$(STAR) \
+                 bubbles-sources/$(STAR).pov \
+                 bubbles-samples/$(STAR).bub.gz
 
 all::
 
@@ -73,3 +81,4 @@ ScreenhackTarget (halo, halo, $(HOBJS) $(UTILS)/hsv.o)
 ScreenhackTarget (flame, flame, $(HOBJS) $(UTILS)/hsv.o)
 ScreenhackTarget (pedal, pedal, $(HOBJS) $(UTILS)/hsv.o)
 ScreenhackTarget (lmorph, lmorph, $(HOBJS))
+ScreenhackTarget (bubbles, bubbles, bubbles_default.o $(HOBJS))
index debdbaea58a5bf0328644d3b30a96dcb432597b2..9a72b302d7ccba7d496877a921f85cd3a291a8b9 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1992-1996 Jamie Zawinski <jwz@netscape.com>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -97,6 +97,12 @@ read_bitmap (bitmap_name, widthP, heightP)
   int result;
   xpmattrs.valuemask = 0;
   bitmap = 0;
+
+#ifdef XpmCloseness
+  xpmattrs.valuemask |= XpmCloseness;
+  xpmattrs.closeness = 40000;
+#endif
+
   result = XpmReadFileToPixmap (dpy, window, bitmap_name, &bitmap, 0,
                                &xpmattrs);
   switch (result)
diff --git a/hacks/bubbles-samples/blood.bub.gz b/hacks/bubbles-samples/blood.bub.gz
new file mode 100644 (file)
index 0000000..b98e855
Binary files /dev/null and b/hacks/bubbles-samples/blood.bub.gz differ
diff --git a/hacks/bubbles-samples/blue.bub.gz b/hacks/bubbles-samples/blue.bub.gz
new file mode 100644 (file)
index 0000000..f656079
Binary files /dev/null and b/hacks/bubbles-samples/blue.bub.gz differ
diff --git a/hacks/bubbles-samples/jade.bub.gz b/hacks/bubbles-samples/jade.bub.gz
new file mode 100644 (file)
index 0000000..48424f0
Binary files /dev/null and b/hacks/bubbles-samples/jade.bub.gz differ
diff --git a/hacks/bubbles-sources/blood.pov b/hacks/bubbles-sources/blood.pov
new file mode 100644 (file)
index 0000000..8166f4e
--- /dev/null
@@ -0,0 +1,24 @@
+#include "colors.inc"
+#include "shapes.inc"
+#include "textures.inc"
+
+/* The following make the field of view as wide as it is high
+ * Thus, you should have the -W and -H command line options
+ * equal to each other. */
+camera {
+        location <5.8, 0, 0>
+       up <0, 1, 0>
+       right <1, 0, 0>
+        look_at <0, 0, 0>
+}
+
+sphere {
+        <0,0,0>, 2.5
+       texture { Blood_Marble
+       scale <2, 2, 2> 
+       rotate <0, 20, 0> }
+       finish { Dull }
+}
+
+light_source {<6, 1, 0> color White}
+/* light_source {<6.1, 1, 0> color White} */
diff --git a/hacks/bubbles-sources/blue.pov b/hacks/bubbles-sources/blue.pov
new file mode 100644 (file)
index 0000000..86d1ff8
--- /dev/null
@@ -0,0 +1,22 @@
+#include "colors.inc"
+#include "shapes.inc"
+#include "textures.inc"
+
+/* The following make the field of view as wide as it is high
+ * Thus, you should have the -W and -H command line options
+ * equal to each other. */
+camera {
+        location <5.8, 0, 0>
+       up <0, 1, 0>
+       right <1, 0, 0>
+        look_at <0, 0, 0>
+}
+
+sphere {
+        <0,0,0>, 2.5
+       texture { Blue_Agate 
+       scale <0.7, 0.7, 0.7> }
+       finish { phong 1 }
+}
+
+light_source {<6, 1, 0> color White}
diff --git a/hacks/bubbles-sources/glass.pov b/hacks/bubbles-sources/glass.pov
new file mode 100644 (file)
index 0000000..c189771
--- /dev/null
@@ -0,0 +1,27 @@
+#include "colors.inc"
+#include "shapes.inc"
+#include "textures.inc"
+
+/* The following make the field of view as wide as it is high
+ * Thus, you should have the -W and -H command line options
+ * equal to each other. */
+camera {
+        location <5.8, 0, 0>
+       up <0, 1, 0>
+       right <1, 0, 0>
+        look_at <0, 0, 0>
+}
+
+sphere {
+        <0,0,0>, 2.5
+       texture { Glass
+               scale <0.7, 0.7, 0.7> 
+               rotate y*clock
+               normal {bumps 0.4   scale 0.1}  
+               finish { Shiny }
+#              finish { phong 0.4 }
+       }
+}
+
+light_source {<6, 7, 0> color White}
+light_source {<6.1, 1, 0> color Blue}
diff --git a/hacks/bubbles-sources/jade.pov b/hacks/bubbles-sources/jade.pov
new file mode 100644 (file)
index 0000000..7c1cb02
--- /dev/null
@@ -0,0 +1,24 @@
+#include "colors.inc"
+#include "shapes.inc"
+#include "textures.inc"
+
+/* The following make the field of view as wide as it is high
+ * Thus, you should have the -W and -H command line options
+ * equal to each other. */
+camera {
+        location <5.8, 0, 0>
+       up <0, 1, 0>
+       right <1, 0, 0>
+        look_at <0, 0, 0>
+}
+
+sphere {
+        <0,0,0>, 2.5
+       texture { Jade
+       scale <0.7, 0.7, 0.7> 
+       rotate y*clock }
+       finish { phong 0.4 }
+}
+
+light_source {<6, 1, 0> color White}
+light_source {<6.1, 1, 0> color White}
diff --git a/hacks/bubbles-tools/bubblestodefault b/hacks/bubbles-tools/bubblestodefault
new file mode 100755 (executable)
index 0000000..3ad718b
--- /dev/null
@@ -0,0 +1,115 @@
+#!/usr/bin/perl
+#
+# $Id: bubblestodefault,v 1.1 1996/09/08 01:35:51 jwz Exp $
+#
+#----------------------------------------------------------------------------
+#  Copyright (C) 1995-1996 James Macnicol
+#
+#   This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2, or (at your option) any later
+# version.
+#
+#   This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#-----------------------------------------------------------------------------
+#
+# Contact me (J.Macnicol@student.anu.edu.au) if you have problems.
+#
+# [ The moral of this story is use a version of rm which safely backs up
+# files when you delete them in case you do something stupid like
+# "rm * xpm" which trashed all the scripts in this directory so I had
+# to write them again.  Grrrrrr..... ]
+#
+#-----------------------------------------------------------------------------
+# 
+# This script takes a set of XPM files (from povbubbles, for example)
+# whose names are listed in file with extension .names (of same format
+# as output by povbubbles) and puts them together into a file which can
+# be used in place of the source file bubbles_default.c which comes with
+# bubbles/xscreensaver.
+#
+# To use it, provide as an argument the base-name of the .names file,
+# i.e. if you ran povbubbles on the file foo.pov by typing "povbubbles foo"
+# then this created a file "foo.names" so you can now make a new
+# bubbles_default.c by typing "bubblestodefault foo".
+#
+
+sub die_help {
+    print STDERR "Usage: $0 [-help] base-name\n";
+    print STDERR "  -help gives this message.\n";
+    print STDERR "  base-name is the name of the file used to generate\n";
+    print STDERR "  the XPM files, e.g. if you invoked povbubbles with\n";
+    print STDERR "            \"povbubbles foo\"\n";
+    print STDERR "  then you should invoke $0 with\n";
+    die("            \"$0 foo\"\n");
+}
+
+sub die_usage {
+    die "Usage: $0 [-help] base-name\n";
+}
+
+$infile = undef;
+
+# Process command line arguments
+while ($op = shift) {
+    if ($op eq "-help") {
+        &die_help;
+    } else {
+        $infile = $op;
+        # Ignore further arguments
+        break;
+    }
+}
+if ($infile eq undef) {
+    &die_usage;
+}
+
+$namesfile = $infile . ".names";
+
+if (! -f $namesfile) {
+    die("File list $namesfile doesn't exist\n");
+}
+
+if (-f "bubbles_default.c") {
+    print "Backing up bubbles_default.c...\n";
+    system("mv -f bubbles_default.c bubbles_default.c.bak");
+}
+
+open(OUT, ">bubbles_default.c") || die("Couldn't open bubbles_default.c\n");
+print OUT "#include <stdio.h>\n";
+print OUT "#include \"bubbles.h\"\n";
+print OUT "\n";
+print OUT "#ifndef NO_DEFAULT_BUBBLE\n";
+print OUT "\n";
+
+open(NAMES, $namesfile) || die ("Couldn't open $namesfile\n");
+$numbubbles = 0;
+while (<NAMES>) {
+    if (/\s*(\S+)\:(\S+)\s*/) {
+       $filename = $1;
+       $xpmname = $2;
+       $xpmlist = $xpmlist . $xpmname . ", ";
+       open(CAT, $filename) || die("Couldn't open file $filename listed in\
+$namesfile\n");
+       while (<CAT>) {
+           print OUT;
+       }
+       close(CAT);
+       $numbubbles++;
+    } else {
+       print STDERR "Can't understand the line \"$_\"\n";
+       print STDERR "  in $namesfile.  Ignoring...\n";
+    }
+}
+print OUT "char **default_bubbles[] = {$xpmlist";
+print OUT "(char **)0};\n";
+print OUT "\n";
+print OUT "int num_default_bubbles = $numbubbles;\n";
+print OUT "\n";
+print OUT "#endif /* NO_DEFAULT_BUBBLE */\n";
+
+close(NAMES);
+close(OUT);
diff --git a/hacks/bubbles-tools/bubblestofile b/hacks/bubbles-tools/bubblestofile
new file mode 100755 (executable)
index 0000000..4eaf5c9
--- /dev/null
@@ -0,0 +1,107 @@
+#!/usr/bin/perl
+#
+# $Id: bubblestofile,v 1.1 1996/09/08 01:35:52 jwz Exp $
+#
+#----------------------------------------------------------------------------
+#  Copyright (C) 1995-1996 James Macnicol
+#
+#   This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2, or (at your option) any later
+# version.
+#
+#   This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#-----------------------------------------------------------------------------
+#
+# Contact me (J.Macnicol@student.anu.edu.au) if you have problems.
+#
+# [ The moral of this story is use a version of rm which safely backs up
+# files when you delete them in case you do something stupid like
+# "rm * xpm" which trashed all the scripts in this directory so I had
+# to write them again.  Grrrrrr..... ]
+#
+#-----------------------------------------------------------------------------
+#
+# This script takes a set of XPM files (from povbubbles, for example)
+# whose names are listed in file with extension .names (of same format
+# as output by povbubbles) and puts them together into a file which can
+# loaded with the -file option or place in a directory suitable for
+# use with the -directory option to bubbles.  Note that neither of these
+# options are available if you have just compiled bubbles as provided.
+# You must edit bubbles.h to enable these.  Files generated by this script
+# have by default the extension ".bub".
+#
+# To use it, provide as an argument the base-name of the .names file,
+# i.e. if you ran povbubbles on the file foo.pov by typing "povbubbles foo"
+# then this created a file "foo.names" so you can now make the loadable file
+# "foo.bub" by typing "bubblestofile foo".
+#
+
+sub die_help {
+    print STDERR "Usage: $0 [-help] base-name\n";
+    print STDERR "  -help\n";
+    print STDERR "    gives this message.\n";
+    print STDERR "  base-name is the name of the file used to generate\n";
+    print STDERR "    the XPM files, e.g. if you invoked povbubbles with\n";
+    print STDERR "              \"povbubbles foo\"\n";
+    print STDERR "    then you should invoke $0 with\n";
+    die("              \"$0 foo\"\n");
+}
+
+sub die_usage {
+    die "Usage: $0 [-help] base-name\n";
+}
+
+$infile = undef;
+
+# Process command line arguments
+while ($op = shift) {
+    if ($op eq "-help") {
+        &die_help;
+    } else {
+        $infile = $op;
+        # Ignore further arguments
+        break;
+    }
+}
+if ($infile eq undef) {
+    &die_usage;
+}
+
+$namesfile = $infile . ".names";
+$outfile = $infile . ".bub";
+
+if (! -f $namesfile) {
+    die("File list $namesfile doesn't exist\n");
+}
+
+if (-f $outfile) {
+    print "Backing up $outfile\n";
+    system("mv -f $outfile $outfile.bak");
+}
+
+open(OUT, ">$outfile") || die("Couldn't open $outfile\n");
+open(NAMES, $namesfile) || die ("Couldn't open $namesfile\n");
+$numbubbles = 0;
+while (<NAMES>) {
+    if (/\s*(\S+)\:(\S+)\s*/) {
+       $filename = $1;
+       $xpmname = $2;
+       open(CAT, $filename) || die("Couldn't open file $filename listed in\
+$namesfile\n");
+       while (<CAT>) {
+           print OUT;
+       }
+       close(CAT);
+    } else {
+       print STDERR "Can't understand the line \"$_\"\n";
+       print STDERR "  in $namesfile.  Ignoring...\n";
+    }
+}
+close(NAMES);
+close(OUT);
+
+
diff --git a/hacks/bubbles-tools/xpm2default b/hacks/bubbles-tools/xpm2default
new file mode 100755 (executable)
index 0000000..b423608
--- /dev/null
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+#----------------------------------------------------------------------------
+#  Copyright (C) 1995-1996 James Macnicol
+#
+#   This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 1, or (at your option) any later
+# version.
+#
+#   This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#-----------------------------------------------------------------------------
+#
+# Prints to the stdout a file suitable for use as bubbles_default.c for the
+# bubbles screensaver (i.e. the default bubble which is compiled into the
+# executable).  A list of XPMs is expected as input, e.g. output from the 
+# pov2xpm script in this directory.
+#
+# Remember to change the path to your perl executable at the top of the
+# script if it is wrong.
+#
+# Examples of usage:
+#
+#       pov2xpm sample.pov | xpm2default > bubbles_default.c
+#
+#  A new set of bubbles is first created with pov2xpm then passed to this
+# script which places the C wrapper around the data and finally dumps the
+# output into bubbles_default.c.
+#
+#       xpm2default < sample.xpm > bubbles_default.c
+#
+#  Same as the previous example except the XPM data came from a file rather
+# than a pipe.
+#
+$numargs = @ARGV;
+print "#include \"bubbles.h\"\n";
+print "\n";
+print "#ifndef NO_DEFAULT_BUBBLE\n";
+print "\n";
+print "char *default_ball_data[] = {\n";
+while (<STDIN>) {
+       chop;
+       s/"/\\"/g;
+       print "\"$_\",\n";      
+}
+print "(char *)0\n";
+print "};\n";
+print "\n";
+print "#endif\n";
diff --git a/hacks/bubbles.README b/hacks/bubbles.README
new file mode 100644 (file)
index 0000000..b82d808
--- /dev/null
@@ -0,0 +1,86 @@
+First of all, you should read and possibly change the options in
+bubbles.h.  Things should work without you having to change anything.
+
+Most of the stuff below is of no use to you if you do not have the
+XPM library and thus cannot use rendered bubbles.  The same goes for
+monochrome displays, whether you have XPM or not.
+
+The most interesting #define here is BUBBLES_IO.  If this is set then
+the -file and -directory options become available to you, which means
+that you can use bubbles with the program other than just the one that
+is used by default (see below).  The problem is that there is code in
+the routines that implement this which arenot portable across the
+various flavours of UNIX.  Therefore, this #define is not set out of
+the box.  Chances are that it will work for you fine, however.  I have
+personally seen it work under Linux 1.3.x and Solaris 2.x.  IRIX has
+problems, from what I hear.  If you do need to hack the code in order
+to get these features to work, please send e-mail to the address at
+the bottom of this file and detail your changes.  They will be
+incorporated in a future release.  
+
+If you are compiling with the XPM library you have the option of
+putting in or leaving out a "default" bubble in your binary, i.e. if
+no -file or -directory options are specified on the command line then
+this bubble will be used.  Things are setup to include this by
+default, so that people can happily run the program without there
+being any compulsory options.  If you use very large bubbles or are
+low on memory you might like to take the option of not compiling in
+the default bubble and thus saving some space should you wish to use
+more than one bubble (to make life more interesting, or whatever).
+This can be done by removing the comments around #define
+NO_DEFAULT_BUBBLE in bubbles.h.  
+
+If you are hacking the bubbles code then you might like to switch on
+extra checks and messages with the DEBUG flag in bubbles.h, but
+otherwise you can leave it commented out.  The sanity checks enables
+there will slow things down.
+
+There are also some configuration options to help you compile and run
+bubbles properly.  These are explained in bubbles.h.  All changes
+affecting portability will end up in here.  If you need to change
+anything to get bubbles to compile on your system, please tell me what
+they are.
+
+Apart from the source files, there are also some other directories
+here which contain things you might use if loading bubbles at runtime
+or developing new ones :
+
+
+bubbles-tools/
+                 Contains several perl scripts to help you make new
+sets of bubbles easily.  povbubbles runs povray on a scene description
+file and outputs a series of XPM files which you can then postprocess
+if need be.  To turn these files into a new instance of the default
+bubble source file bubbles_default.c, use the script bubblestodefault.
+To put all the files together into a single file which can be loaded
+with the -file or -directory options (if available), use the script
+bubblestofile.
+
+       Read the comments at the top of each script to find out more.
+
+bubbles-samples/
+                 This directory contains some compressed bubbles
+files which can be used with the -directory option (or the -file
+option on individual files there).  The files will be automatically
+uncompressed before use.
+
+bubbles-sources/
+                 The povray sources used to make some of the bubbles
+in the bubbles-samples directory.  You can use these as templates for
+making new bubbles.
+
+
+I'm not much good with povray so the examples are probably pretty
+boring.  If you make some nice bubbles yourself, I'd like to see them.
+Send your _sources_ to J.Macnicol@student.anu.edu.au (please don't
+fill my inbox with XPM files, there is a limit on the amount of
+waiting e-mail I can have).
+
+
+Enjoy.
+
+
+--
+James Macnicol
+e-mail: J.Macnicol@student.anu.edu.au
+http://goblet.anu.edu.au/~m9305357/home.html
diff --git a/hacks/bubbles.c b/hacks/bubbles.c
new file mode 100644 (file)
index 0000000..2033130
--- /dev/null
@@ -0,0 +1,1902 @@
+/* bubbles.c - frying pan / soft drink in a glass simulation */
+
+/*$Id: bubbles.c,v 1.1 1996/09/08 01:35:40 jwz Exp $*/
+
+/*
+ *  Copyright (C) 1995-1996 James Macnicol
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any later
+ * version.
+ *
+ *   This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details. 
+ */
+
+/*
+ * I got my original inspiration for this by looking at the bottom of a 
+ * frying pan while something was cooking and watching the little bubbles
+ * coming off the bottom of the pan as the oil was boiling joining together
+ * to form bigger bubbles and finally to *pop* and disappear.  I had some
+ * time on my hands so I wrote this little xscreensaver module to imitate
+ * it.  Now that it's done it reminds me more of the bubbles you get in
+ * a glass of fizzy soft drink.....
+ *
+ * The problem seemed to be that the position/size etc. of all the bubbles
+ * on the screen had to be remembered and searched through to find when
+ * bubbles hit each other and combined.  To do this more efficiently, the
+ * window/screen is divided up into a square mesh of side length mesh_length
+ * and separate lists of bubbles contained in each cell of the mesh are
+ * kept.  Only the cells in the immediate vicinity of the bubble in question
+ * are searched.  This should make things more efficient although the whole
+ * thing seems to use up too much CPU, but then I'm using an ancient PC so
+ * perhaps it's not surprising .
+ * (Six months after I wrote the above I now have a Pentium with PCI graphics 
+ * and things are _much_ nicer.)
+ *
+ * Author:           James Macnicol 
+ * Internet E-mail : J.Macnicol@student.anu.edu.au
+ */
+
+#include "bubbles.h"
+
+#ifdef BUBBLES_IO
+#include <dirent.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#endif /* BUBBLES_IO */
+
+#include <limits.h>
+#include <math.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include "screenhack.h"
+#include "../utils/yarandom.h"
+
+#ifdef HAVE_XPM
+#include <X11/xpm.h>
+#endif
+
+/* 
+ * Public variables 
+ */
+
+#ifndef NO_DEFAULT_BUBBLE
+extern int num_default_bubbles;
+extern char **default_bubbles[];
+#endif /* NO_DEFAULT_BUBBLE */
+
+char *progclass = "Bubbles";
+
+char *defaults [] = {
+  "*background: black",
+  "*foreground: white",
+  "*simple:     false",
+  "*broken:     false",
+  "*delay:      2000",
+#ifdef BUBBLES_IO
+  "*file:       (default)",
+  "*directory:  (default)",
+#endif /* BUBBLES_IO */
+  "*quiet:      false", 
+  "*nodelay:    false",
+  "*3D:     false",
+  "*geometry:   400x300",
+  0
+};
+
+XrmOptionDescRec options [] = {
+  { "-simple",          ".simple",      XrmoptionNoArg, "true" },
+#ifdef HAVE_XPM
+  { "-broken",          ".broken",      XrmoptionNoArg, "true" },
+#endif /* HAVE_XPM */
+  { "-quiet",           ".quiet",       XrmoptionNoArg, "true" },
+  { "-nodelay",         ".nodelay",     XrmoptionNoArg, "true" },
+  { "-3D",          ".3D",      XrmoptionNoArg, "true" },
+#ifdef BUBBLES_IO
+  { "-file",            ".file",        XrmoptionSepArg, 0 },
+  { "-directory",       ".directory",   XrmoptionSepArg, 0 },
+#endif /* BUBBLES_IO */
+  { "-delay",           ".delay",       XrmoptionSepArg, 0 }
+};
+int options_size = (sizeof (options) / sizeof (options[0]));
+
+/* 
+ * Private variables 
+ */
+
+static Bubble **mesh;
+static int mesh_length;
+static int mesh_width;
+static int mesh_height;
+static int mesh_cells;
+
+static int **adjacent_list;
+
+static int screen_width;
+static int screen_height;
+static int screen_depth;
+static unsigned int default_fg_pixel, default_bg_pixel;
+/* 
+ * I know it's not elegant to save this stuff in global variables
+ * but we need it for the signal handler.
+ */
+static Display *defdsp;
+static Window defwin;
+static Colormap defcmap;
+
+/* For simple mode only */
+static int bubble_min_radius;
+static int bubble_max_radius;
+static long *bubble_areas;
+static GC draw_gc, erase_gc;
+
+#ifdef HAVE_XPM
+static int num_bubble_pixmaps;
+static Bubble_Step **step_pixmaps;
+#ifdef BUBBLES_IO
+static char *pixmap_file;
+#endif /* BUBBLES_IO */
+static int use_default_bubble;
+#endif /* HAVE_XPM */
+
+/* Options stuff */
+#ifdef HAVE_XPM
+static Bool simple = False;
+#else
+static Bool simple = True;
+#endif
+static Bool broken = False;
+static Bool quiet = False;
+static Bool threed = False;
+static int delay;
+
+/* 
+ * To prevent forward references, some stuff is up here 
+ */
+
+static long
+calc_bubble_area(r)
+     int r;
+/* Calculate the area of a bubble of radius r */
+{
+#ifdef DEBUG
+  printf("%d %g\n", r,
+        10.0 * PI * (double)r * (double)r * (double)r);
+#endif /* DEBUG */
+  if (threed)
+    return (long)(10.0 * PI * (double)r * (double)r * (double)r);
+  else
+    return (long)(10.0 * PI * (double)r * (double)r);
+}
+
+static void *
+xmalloc(size)
+     size_t size;
+/* Safe malloc */
+{
+  void *ret;
+
+  if ((ret = malloc(size)) == NULL) {
+    fprintf(stderr, "%s: out of memory\n", progname);
+    exit(1);
+  }
+  return ret;
+}
+
+#ifdef DEBUG
+static void 
+die_bad_bubble(bb)
+     Bubble *bb;
+/* This is for use with GDB */
+{
+  fprintf(stderr, "Bad bubble detected at 0x%x!\n", (int)bb);
+  exit(1);
+}
+#endif
+
+static int
+null_bubble(bb)
+     Bubble *bb;
+/* Returns true if the pointer passed is NULL.  If not then this checks to
+see if the bubble is valid (i.e. the (x,y) position is valid and the magic
+number is set correctly.  This only a sanity check for debugging and is
+turned off if DEBUG isn't set. */
+{
+  if (bb == (Bubble *)NULL)
+    return 1;
+#ifdef DEBUG
+  if ((bb->cell_index < 0) || (bb->cell_index > mesh_cells)) {
+    fprintf(stderr, "cell_index = %d\n", bb->cell_index);
+    die_bad_bubble(bb);
+  }
+  if (bb->magic != BUBBLE_MAGIC)  {
+    fprintf(stderr, "Magic = %d\n", bb->magic);
+    die_bad_bubble(bb);
+  }
+  if (simple) {
+    if ((bb->x < 0) || (bb->x > screen_width) ||
+       (bb->y < 0) || (bb->y > screen_height) ||
+       (bb->radius < bubble_min_radius) || (bb->radius >
+                                            bubble_max_radius)) {
+      fprintf(stderr,
+             "radius = %d, x = %d, y = %d, magic = %d, \
+cell index = %d\n", bb->radius, bb->x, bb->y, bb->magic, bb->cell_index);
+      die_bad_bubble(bb);  
+    }
+#ifdef HAVE_XPM
+  } else {
+    if ((bb->x < 0) || (bb->x > screen_width) ||
+       (bb->y < 0) || (bb->y > screen_height) ||
+       (bb->radius < step_pixmaps[0]->radius) || 
+       (bb->radius > step_pixmaps[num_bubble_pixmaps-1]->radius)) {
+      fprintf(stderr,
+             "radius = %d, x = %d, y = %d, magic = %d, \
+cell index = %d\n", bb->radius, bb->x, bb->y, bb->magic, bb->cell_index);
+      die_bad_bubble(bb);  
+    }
+#endif /* HAVE_XPM */
+  }
+#endif /* DEBUG */
+  return 0;
+}
+
+#ifdef DEBUG
+static void 
+print_bubble_list(bb)
+     Bubble *bb;
+/* Print list of where all the bubbles are.  For debugging purposes only. */
+{
+  if (! null_bubble(bb)) {
+    printf("  (%d, %d) %d\n", bb->x, bb->y, bb->radius);
+    print_bubble_list(bb->next);
+  }
+}
+#endif /* DEBUG */
+
+static void 
+add_bubble_to_list(list, bb)
+     Bubble **list;
+     Bubble *bb;
+/* Take a pointer to a list of bubbles and stick bb at the head of the
+ list. */
+{
+  Bubble *head = *list;
+
+  if (null_bubble(head)) {
+    bb->prev = (Bubble *)NULL;
+    bb->next = (Bubble *)NULL;
+  } else {
+    bb->next = head;
+    bb->prev = (Bubble *)NULL;
+    head->prev = bb;
+  }
+  *list = bb;
+}
+
+
+/* 
+ * Mesh stuff 
+ */
+
+
+static void 
+init_mesh()
+/* Setup the mesh of bubbles */
+{
+  int i;
+
+  mesh = (Bubble **)xmalloc(mesh_cells * sizeof(Bubble *));
+  for (i = 0; i < mesh_cells; i++)
+    mesh[i] = (Bubble *)NULL;
+}
+
+static int
+cell_to_mesh(x, y)
+     int x;
+     int y;
+/* convert cell coordinates to mesh index */
+{
+#ifdef DEBUG
+  if ((x < 0) || (y < 0)) {
+    fprintf(stderr, "cell_to_mesh: x = %d, y = %d\n", x, y);
+    exit(1);
+  }
+#endif
+  return ((mesh_width * y) + x);
+}
+
+static void 
+mesh_to_cell(mi, cx, cy)
+     int mi;
+     int *cx;
+     int *cy;
+/* convert mesh index into cell coordinates */
+{
+  *cx = mi % mesh_width;
+  *cy = mi / mesh_width;
+}
+
+static int
+pixel_to_mesh(x, y)
+     int x;
+     int y;
+/* convert screen coordinates into mesh index */
+{
+  return cell_to_mesh((x / mesh_length), (y / mesh_length));
+}
+
+static int
+verify_mesh_index(x, y)
+     int x;
+     int y;
+/* check to see if (x,y) is in the mesh */
+{
+  if ((x < 0) || (y < 0) || (x >= mesh_width) || (y >= mesh_height))
+    return (-1);
+  return (cell_to_mesh(x, y));
+}
+
+#ifdef DEBUG
+static void 
+print_adjacents(adj)
+    int *adj;
+/* Print a list of the cells calculated above.  For debugging only. */
+{
+  int i;
+
+  printf("(");
+  for (i = 0; i < 8; i++)
+    printf("%d ", adj[i]);
+  printf(")\n");
+}
+#endif /* DEBUG */
+
+static void 
+add_to_mesh(bb)
+     Bubble *bb;
+/* Add the given bubble to the mesh by sticking it on the front of the
+list.  bb is already allocated so no need to malloc() anything, just
+adjust pointers. */
+{
+#ifdef DEBUG
+  if (null_bubble(bb)) {
+    fprintf(stderr, "Bad bubble passed to add_to_mesh()!\n");
+    exit(1);
+  }
+#endif /* DEBUG */
+
+  add_bubble_to_list(&mesh[bb->cell_index], bb);
+}
+
+#ifdef DEBUG
+static void 
+print_mesh()
+/* Print the contents of the mesh */
+{
+  int i;
+
+  for (i = 0; i < mesh_cells; i++) {
+    if (! null_bubble(mesh[i])) {
+      printf("Mesh cell %d\n", i);
+      print_bubble_list(mesh[i]);
+    }
+  }
+}
+
+static void 
+valid_mesh()
+/* Check to see if the mesh is Okay.  For debugging only. */
+{
+  int i;
+  Bubble *b;
+
+  for (i = 0; i < mesh_cells; i++) {
+    b = mesh[i];
+    while (! null_bubble(b))
+      b = b->next;
+  }
+}
+
+static int
+total_bubbles()
+/* Count how many bubbles there are in total.  For debugging only. */
+{
+  int rv = 0;
+  int i;
+  Bubble *b;
+
+  for (i = 0; i < mesh_cells; i++) {
+    b = mesh[i];
+    while (! null_bubble(b)) {
+      rv++;
+      b = b->next;
+    } 
+  }
+
+  return rv;
+}
+#endif /* DEBUG */
+
+static void 
+calculate_adjacent_list()
+/* Calculate the list of cells adjacent to a particular cell for use
+   later. */
+{
+  int i; 
+  int ix, iy;
+
+  adjacent_list = (int **)xmalloc(mesh_cells * sizeof(int *));
+  for (i = 0; i < mesh_cells; i++) {
+    adjacent_list[i] = (int *)xmalloc(9 * sizeof(int));
+    mesh_to_cell(i, &ix, &iy);
+    adjacent_list[i][0] = verify_mesh_index(--ix, --iy);
+    adjacent_list[i][1] = verify_mesh_index(++ix, iy);
+    adjacent_list[i][2] = verify_mesh_index(++ix, iy);
+    adjacent_list[i][3] = verify_mesh_index(ix, ++iy);
+    adjacent_list[i][4] = verify_mesh_index(ix, ++iy);
+    adjacent_list[i][5] = verify_mesh_index(--ix, iy);
+    adjacent_list[i][6] = verify_mesh_index(--ix, iy);
+    adjacent_list[i][7] = verify_mesh_index(ix, --iy);
+    adjacent_list[i][8] = i;
+  }
+}
+
+static void
+adjust_areas()
+/* Adjust areas of bubbles so we don't get overflow in weighted_mean() */
+{
+  double maxvalue;
+  long maxarea;
+  long factor;
+  int i;
+
+#ifdef HAVE_XPM
+  if (simple)
+    maxarea = bubble_areas[bubble_max_radius+1];
+  else
+    maxarea = step_pixmaps[num_bubble_pixmaps]->area;
+#else
+  maxarea = bubble_areas[bubble_max_radius+1];
+#endif /* HAVE_XPM */
+  maxvalue = (double)screen_width * 2.0 * (double)maxarea;
+  factor = (long)ceil(maxvalue / (double)LONG_MAX);
+  if (factor > 1) {
+    /* Overflow will occur in weighted_mean().  We must divide areas
+       each by factor so it will never do so. */
+#ifdef HAVE_XPM
+    if (simple) {
+      for (i = bubble_min_radius; i <= bubble_max_radius+1; i++) {
+       bubble_areas[i] /= factor;
+       if (bubble_areas[i] == 0)
+         bubble_areas[i] = 1;
+      }
+    } else {
+      for (i = 0; i <= num_bubble_pixmaps; i++) {
+#ifdef DEBUG
+       printf("area = %ld", step_pixmaps[i]->area);
+#endif /* DEBUG */
+       step_pixmaps[i]->area /= factor;
+       if (step_pixmaps[i]->area == 0)
+         step_pixmaps[i]->area = 1;
+#ifdef DEBUG
+       printf("-> %ld\n", step_pixmaps[i]->area);
+#endif /* DEBUG */
+      }
+    }
+#else
+    for (i = bubble_min_radius; i <= bubble_max_radius+1; i++) {
+      bubble_areas[i] /= factor;
+      if (bubble_areas[i] == 0)
+       bubble_areas[i] = 1;
+    }
+#endif /* HAVE_XPM */
+  }
+#ifdef DEBUG
+  printf("maxarea = %ld\n", maxarea);
+  printf("maxvalue = %g\n", maxvalue);
+  printf("LONG_MAX = %ld\n", LONG_MAX);
+  printf("factor = %ld\n", factor);
+#endif /* DEBUG */
+}
+
+/* 
+ * Bubbles stuff 
+ */
+
+static Bubble *
+new_bubble()
+/* Add a new bubble at some random position on the screen of the smallest
+size. */
+{
+  Bubble *rv = (Bubble *)xmalloc(sizeof(Bubble));
+
+  /* Can't use null_bubble() here since magic number hasn't been set */
+  if (rv == (Bubble *)NULL) {
+    fprintf(stderr, "Ran out of memory!\n");
+    exit(1);
+  }
+
+  if (simple) {
+    rv->radius = bubble_min_radius;
+    rv->area = bubble_areas[bubble_min_radius];
+#ifdef HAVE_XPM
+  } else {
+    rv->step = 0;
+    rv->radius = step_pixmaps[0]->radius;
+    rv->area = step_pixmaps[0]->area;
+#endif /* HAVE_XPM */
+  }
+  rv->visible = 0;
+  rv->magic = BUBBLE_MAGIC;
+  rv->x = ya_random() % screen_width;
+  rv->y = ya_random() % screen_height;
+  rv->cell_index = pixel_to_mesh(rv->x, rv->y);
+
+  return rv;
+}
+
+static void 
+show_bubble(bb)
+     Bubble *bb;
+/* paint the bubble on the screen */
+{
+  if (null_bubble(bb)) {
+    fprintf(stderr, "NULL bubble passed to show_bubble\n");
+    exit(1);
+  }
+
+  if (! bb->visible) {
+    bb->visible = 1;
+
+    if (simple) {
+      XDrawArc(defdsp, defwin, draw_gc, (bb->x - bb->radius),
+              (bb->y - bb->radius), bb->radius*2, bb->radius*2, 0,
+              360*64);  
+    } else {
+#ifdef HAVE_XPM
+      XSetClipOrigin(defdsp, step_pixmaps[bb->step]->draw_gc, 
+                    (bb->x - bb->radius),
+                    (bb->y - bb->radius));
+      
+      XCopyArea(defdsp, step_pixmaps[bb->step]->ball, defwin, 
+               step_pixmaps[bb->step]->draw_gc,
+               0, 0, (bb->radius * 2), 
+               (bb->radius * 2),  
+               (bb->x - bb->radius),
+               (bb->y - bb->radius));
+#endif /* HAVE_XPM */
+    }
+  }
+}
+
+static void 
+hide_bubble(bb)
+     Bubble *bb;
+/* erase the bubble */
+{
+  if (null_bubble(bb)) {
+    fprintf(stderr, "NULL bubble passed to hide_bubble\n");
+    exit(1);
+  }
+
+  if (bb->visible) {
+    bb->visible = 0;
+
+    if (simple) {
+      XDrawArc(defdsp, defwin, erase_gc, (bb->x - bb->radius),
+              (bb->y - bb->radius), bb->radius*2, bb->radius*2, 0,
+              360*64);
+    } else {
+#ifdef HAVE_XPM
+      if (! broken) {
+       XSetClipOrigin(defdsp, step_pixmaps[bb->step]->erase_gc, 
+                      (bb->x - bb->radius), (bb->y - bb->radius));
+       
+       XFillRectangle(defdsp, defwin, step_pixmaps[bb->step]->erase_gc,
+                      (bb->x - bb->radius),
+                      (bb->y - bb->radius),
+                      (bb->radius * 2),
+                      (bb->radius * 2));
+      }
+#endif /* HAVE_XPM */
+    }
+  }
+}
+
+static void 
+delete_bubble_in_mesh(bb, keep_bubble)
+     Bubble *bb;
+     int keep_bubble;
+/* Delete an individual bubble, adjusting list of bubbles around it.
+   If keep_bubble is true then the bubble isn't actually deleted.  We
+   use this to allow bubbles to change mesh cells without reallocating,
+   (it needs this when two bubbles collide and the centre position is
+   recalculated, and this may stray over a mesh boundary). */
+{
+  if ((!null_bubble(bb->prev)) && (!null_bubble(bb->next))) {
+    bb->prev->next = bb->next;
+    bb->next->prev = bb->prev;
+  } else if ((!null_bubble(bb->prev)) &&
+            (null_bubble(bb->next))) {
+    bb->prev->next = (Bubble *)NULL;
+    bb->next = mesh[bb->cell_index];
+  } else if ((null_bubble(bb->prev)) &&
+            (!null_bubble(bb->next))) {
+    bb->next->prev = (Bubble *)NULL;
+    mesh[bb->cell_index] = bb->next;
+    bb->next = mesh[bb->cell_index];
+  } else {
+    /* Only item on list */
+    mesh[bb->cell_index] = (Bubble *)NULL;
+  }             
+  if (! keep_bubble)
+    free(bb);
+}
+
+static unsigned long 
+ulongsqrint(x)
+     int x;
+/* Saves ugly inline code */
+{
+  return ((unsigned long)x * (unsigned long)x);
+}
+
+static Bubble *
+get_closest_bubble(bb)
+     Bubble *bb;
+/* Find the closest bubble touching the this bubble, NULL if none are
+   touching. */
+{
+  Bubble *rv = (Bubble *)NULL;
+  Bubble *tmp;
+  unsigned long separation2, touchdist2;
+  int dx, dy;
+  unsigned long closest2 = ULONG_MAX;
+  int i;
+
+#ifdef DEBUG 
+  if (null_bubble(bb)) {
+    fprintf(stderr, "NULL pointer 0x%x passed to get_closest_bubble()!", 
+           (int)bb);
+    exit(1);
+  }
+#endif /* DEBUG */
+
+  for (i = 0; i < 9; i++) {
+    /* There is a bug here where bb->cell_index is negaitve.. */
+#ifdef DEBUG
+    if ((bb->cell_index < 0) || (bb->cell_index >= mesh_cells)) {
+      fprintf(stderr, "bb->cell_index = %d\n", bb->cell_index);
+      exit(1);
+    }
+#endif /* DEBUG */
+/*    printf("%d,", bb->cell_index); */
+    if (adjacent_list[bb->cell_index][i] != -1) {
+      tmp = mesh[adjacent_list[bb->cell_index][i]];
+      while (! null_bubble(tmp)) {
+       if (tmp != bb) {
+         dx = tmp->x - bb->x;
+         dy = tmp->y - bb->y;
+         separation2 = ulongsqrint(dx) + ulongsqrint(dy);
+         /* Add extra leeway so circles _never_ overlap */
+         touchdist2 = ulongsqrint(tmp->radius + bb->radius + 2);
+         if ((separation2 <= touchdist2) && (separation2 <
+                                             closest2)) {
+           rv = tmp;
+           closest2 = separation2;
+         }
+       }
+       tmp = tmp->next;
+      }
+    }
+  }
+
+  return rv;
+}
+
+#ifdef DEBUG
+static void
+ldr_barf()
+{
+}
+#endif /* DEBUG */
+
+static long
+long_div_round(num, dem)
+     long num;
+     long dem;
+{
+  long divvie, moddo;
+
+#ifdef DEBUG
+  if ((num < 0) || (dem < 0)) {
+    fprintf(stderr, "long_div_round: %ld, %ld\n", num, dem);
+    ldr_barf();
+    exit(1);
+  }
+#endif /* DEBUG */
+
+  divvie = num / dem;
+  moddo = num % dem;
+  if (moddo > (dem / 2))
+    ++divvie;
+
+#ifdef DEBUG
+  if ((divvie < 0) || (moddo < 0)) {
+    fprintf(stderr, "long_div_round: %ld, %ld\n", divvie, moddo);
+    ldr_barf();
+    exit(1);
+  }
+#endif /* DEBUG */
+
+  return divvie;
+}
+
+static int
+weighted_mean(n1, n2, w1, w2)
+     int n1;
+     int n2;
+     long w1;
+     long w2;
+/* Mean of n1 and n2 respectively weighted by weights w1 and w2. */
+{
+#ifdef DEBUG
+  if ((w1 <= 0) || (w2 <= 0)) {
+    fprintf(stderr, "Bad weights passed to weighted_mean() - \
+(%d, %d, %ld, %ld)!\n", n1, n2, w1, w2);
+    exit(1);
+  }
+#endif /* DEBUG */
+  return ((int)long_div_round((long)n1 * w1 + (long)n2 * w2,
+                           w1 + w2));
+}
+
+static int
+bubble_eat(diner, food)
+     Bubble *diner;
+     Bubble *food;
+/* The diner eats the food.  Returns true (1) if the diner still exists */
+{ 
+  int i;
+  int newmi;
+
+#ifdef DEBUG
+  if ((null_bubble(diner)) || (null_bubble(food))) {
+    fprintf(stderr, "Bad bubbles passed to bubble_eat()!\n");
+    exit(1);
+  }
+#endif /* DEBUG */
+
+  /* We hide the diner even in the case that it doesn't grow so that
+     if the food overlaps its boundary it is replaced. This could
+     probably be solved by letting bubbles eat others which are close
+     but not quite touching.  It's probably worth it, too, since we
+     would then not have to redraw bubbles which don't change in
+     size. */
+
+  hide_bubble(diner);
+  hide_bubble(food);
+  diner->x = weighted_mean(diner->x, food->x, diner->area, food->area);
+  diner->y = weighted_mean(diner->y, food->y, diner->area, food->area);
+  newmi = pixel_to_mesh(diner->x, diner->y);
+  diner->area += food->area;
+  delete_bubble_in_mesh(food, DELETE_BUBBLE);
+
+  if ((simple) && (diner->area > bubble_areas[bubble_max_radius])) {
+    delete_bubble_in_mesh(diner, DELETE_BUBBLE);
+    return 0;
+  }
+#ifdef HAVE_XPM
+  if ((! simple) && (diner->area > 
+                    step_pixmaps[num_bubble_pixmaps]->area)) {
+    delete_bubble_in_mesh(diner, DELETE_BUBBLE);
+    return 0;
+  }
+#endif /* HAVE_XPM */
+
+  if (simple) {
+    if (diner->area > bubble_areas[diner->radius + 1]) {
+      /* Move the bubble to a new radius */
+      i = diner->radius;
+      while (diner->area > bubble_areas[i+1])
+       ++i;
+      diner->radius = i;
+    }
+    show_bubble(diner);
+#ifdef HAVE_XPM
+  } else {
+    if (diner->area > step_pixmaps[diner->step+1]->area) {
+      i = diner->step;
+      while (diner->area > step_pixmaps[i+1]->area)
+       ++i;
+      diner->step = i;
+      diner->radius = step_pixmaps[diner->step]->radius;
+    }
+    show_bubble(diner);
+#endif /* HAVE_XPM */
+  }
+
+  /* Now adjust locations and cells if need be */
+  if (newmi != diner->cell_index) {
+    delete_bubble_in_mesh(diner, KEEP_BUBBLE);
+    diner->cell_index = newmi;
+    add_to_mesh(diner);
+  }
+
+  return 1;
+}
+
+static int
+merge_bubbles(b1, b2)
+     Bubble *b1;
+     Bubble *b2;
+/* These two bubbles merge into one.  If the first one wins out return
+1 else return 2.  If there is no winner (it explodes) then return 0 */
+{
+  int b1size, b2size;
+
+  b1size = b1->area;
+  b2size = b2->area;
+
+#ifdef DEBUG
+  if ((null_bubble(b1) || null_bubble(b2))) {
+    fprintf(stderr, "NULL bubble passed to merge_bubbles()!\n");
+    exit(1);
+  }
+#endif /* DEBUG */
+
+  if (b1 == b2) {
+    hide_bubble(b1);
+    delete_bubble_in_mesh(b1, DELETE_BUBBLE);
+    return 0;
+  }
+
+  if (b1size > b2size) {
+    switch (bubble_eat(b1, b2)) {
+    case 0:
+      return 0;
+      break;
+    case 1:
+      return 1;
+      break;
+    default:
+      break;
+    }
+  } else if (b1size < b2size) {
+    switch (bubble_eat(b2, b1)) {
+    case 0:
+      return 0;
+      break;
+    case 1:
+      return 2;
+      break;
+    default:
+      break;
+    }
+  } else {
+    if ((ya_random() % 2) == 0) {
+      switch (bubble_eat(b1, b2)) {
+      case 0:
+       return 0;
+       break;
+      case 1:
+       return 1;
+       break;
+      default:
+       break;
+      }
+    } else {
+      switch (bubble_eat(b2, b1)) {
+      case 0:
+       return 0;
+       break;
+      case 1:
+       return 2;
+       break;
+      default:
+       break;
+      }
+    }
+  }
+  fprintf(stderr, "An error occurred in merge_bubbles()\n");
+  exit(1);
+}
+
+static void 
+insert_new_bubble(tmp)
+     Bubble *tmp;
+/* Calculates which bubbles are eaten when a new bubble tmp is
+   inserted.  This is called recursively in case when a bubble grows
+   it eats others.  Careful to pick out disappearing bubbles. */
+{
+  Bubble *nextbub;
+  Bubble *touch;
+
+#ifdef DEBUG
+  if (null_bubble(tmp)) {
+    fprintf(stderr, "Bad bubble passed to insert_new_bubble()!\n");
+    exit(1);
+  }
+#endif /* DEBUG */
+  
+  nextbub = tmp;
+  touch = get_closest_bubble(nextbub);
+  while (! null_bubble(touch)) {
+    switch (merge_bubbles(nextbub, touch)) {
+    case 2:
+      /* touch ate nextbub and survived */
+      nextbub = touch;
+      break;
+    case 1:
+      /* nextbub ate touch and survived */
+      break;
+    case 0:
+      /* somebody ate someone else but they exploded */
+      nextbub = (Bubble *)NULL;
+      break;
+    default:
+      /* something went wrong */
+      fprintf(stderr, "Error occurred in insert_new_bubble()\n");
+      exit(1);
+    }
+    /* Check to see if there are any other bubbles still in the area
+       and if we need to do this all over again for them. */
+    if (! null_bubble(nextbub))
+      touch = get_closest_bubble(nextbub);
+    else
+      touch = (Bubble *)NULL;
+  }
+}
+
+#ifdef DEBUG
+static int
+get_length_of_bubble_list(bb)
+     Bubble *bb;
+{
+  Bubble *tmp = bb;
+  int rv = 0;
+
+  while (! null_bubble(tmp)) {
+    rv++;
+    tmp = tmp->next;
+  }
+
+  return rv;
+}
+#endif /* DEBUG */
+
+/*
+ * Pixmap stuff used regardless of whether file I/O is available.  Must
+ * still check for XPM, though!
+ */
+
+#ifdef HAVE_XPM
+
+static void 
+free_pixmaps()
+/* Free resources associated with XPM */
+{
+  int i;
+
+#ifdef DEBUG
+  if (simple) {
+    fprintf(stderr, "free_pixmaps() called in simple mode\n");
+    exit(1);
+  }
+  printf("free_pixmaps()\n");
+#endif /* DEBUG */
+
+  for(i = 0; i < (num_bubble_pixmaps - 1); i++) {
+    XFreePixmap(defdsp, step_pixmaps[i]->ball);
+    XFreePixmap(defdsp, step_pixmaps[i]->shape_mask);
+    XFreeGC(defdsp, step_pixmaps[i]->draw_gc);
+    XFreeGC(defdsp, step_pixmaps[i]->erase_gc);
+    XFreeColors(defdsp, defcmap, step_pixmaps[i]->xpmattrs.pixels, 
+               step_pixmaps[i]->xpmattrs.npixels, 0);
+    XpmFreeAttributes(&step_pixmaps[i]->xpmattrs);
+  }
+}
+
+static void 
+onintr(a)
+     int a;
+/* This gets called when SIGINT or SIGTERM is received */
+{
+  free_pixmaps();
+  exit(0);
+}
+
+#ifdef DEBUG
+static void
+onsegv(a)
+     int a;
+/* Called when SEGV detected.   Hmmmmm.... */
+{
+  fflush(stdout);
+  fprintf(stderr, "SEGV detected! : %d\n", a);
+  exit(1);
+}
+#endif /* DEBUG */
+
+
+/*
+ * Pixmaps without file I/O (but do have XPM)
+ */
+
+static void 
+pixmap_sort(head, numelems)
+     Bubble_Step **head;
+     int numelems;
+/* Couldn't get qsort to work right with this so I wrote my own.  This puts
+the numelems length array with first element at head into order of radius.
+*/
+{
+  Bubble_Step tmp;
+  Bubble_Step *least = 0;
+  int minradius = INT_MAX;
+  int i;
+
+  for (i = 0; i < numelems; i++) {
+    if (head[i]->radius < minradius) {
+      least = head[i];
+      minradius = head[i]->radius;
+    }
+  }
+  if (*head != least) {
+    memcpy(&tmp, least, sizeof(Bubble_Step));
+    memcpy(least, *head, sizeof(Bubble_Step));
+    memcpy(*head, &tmp, sizeof(Bubble_Step));
+  }
+
+  if (numelems > 2)
+    pixmap_sort(&head[1], numelems-1);
+}
+
+static int
+extrapolate(i1, i2)
+     int i1;
+     int i2;
+{
+  return (i2 + (i2 - i1));
+}
+
+static void 
+make_pixmap_array(list)
+     Bubble_Step *list;
+/* From a linked list of bubbles construct the array step_pixmaps */
+{
+  Bubble_Step *tmp = list;
+  int ind;
+#ifdef DEBUG
+  int prevrad = -1;
+#endif
+  
+  if (list == (Bubble_Step *)NULL) {
+    fprintf(stderr, "NULL list passed to make_pixmap_array\n");
+    exit(1);
+  }
+
+  num_bubble_pixmaps = 1;
+  while(tmp->next != (Bubble_Step *)NULL) {
+    tmp = tmp->next;
+    ++num_bubble_pixmaps;
+  }
+
+  if (num_bubble_pixmaps < 2) {
+    fprintf(stderr, "Must be at least two bubbles in file\n");
+    exit(1);
+  }
+
+  step_pixmaps = (Bubble_Step **)xmalloc((num_bubble_pixmaps + 1) * 
+                                        sizeof(Bubble_Step *));
+
+  /* Copy them blindly into the array for sorting. */
+  ind = 0;
+  tmp = list;
+  do {
+    step_pixmaps[ind++] = tmp;
+    tmp = tmp->next;
+  } while(tmp != (Bubble_Step *)NULL);
+
+  /* We make another bubble beyond the ones with pixmaps so that the final
+     bubble hangs around and doesn't pop immediately.  It's radius and area
+     are found by extrapolating from the largest two bubbles with pixmaps. */
+
+  step_pixmaps[num_bubble_pixmaps] = 
+    (Bubble_Step *)xmalloc(sizeof(Bubble_Step));
+  step_pixmaps[num_bubble_pixmaps]->radius = INT_MAX;
+
+  pixmap_sort(step_pixmaps, (num_bubble_pixmaps + 1));
+
+#ifdef DEBUG
+  if (step_pixmaps[num_bubble_pixmaps]->radius != INT_MAX) {
+    fprintf(stderr, "pixmap_sort() screwed up make_pixmap_array\n");
+  }
+#endif /* DEBUG */
+
+  step_pixmaps[num_bubble_pixmaps]->radius = 
+    extrapolate(step_pixmaps[num_bubble_pixmaps-2]->radius,
+               step_pixmaps[num_bubble_pixmaps-1]->radius);
+  step_pixmaps[num_bubble_pixmaps]->area = 
+    calc_bubble_area(step_pixmaps[num_bubble_pixmaps]->radius);
+  
+
+#ifdef DEBUG
+  /* Now check for correct order */
+  for (ind = 0; ind < num_bubble_pixmaps; ind++) {
+    if (prevrad > 0) {
+      if (step_pixmaps[ind]->radius < prevrad) {
+       fprintf(stderr, "Pixmaps not in ascending order of radius\n");
+       exit(1);
+      }
+    }
+    prevrad = step_pixmaps[ind]->radius;
+  }
+#endif /* DEBUG */
+}
+
+#ifndef NO_DEFAULT_BUBBLE
+static void
+make_pixmap_from_default(pixmap_data, bl)
+     char **pixmap_data;
+     Bubble_Step *bl;
+/* Read pixmap data which has been compiled into the program and a pointer
+ to which has been passed. 
+
+ This is virtually copied verbatim from make_pixmap_from_file() above and
+changes made to either should be propagated onwards! */
+{
+  int result;
+  XGCValues gcv;
+
+#ifdef DEBUG
+  if (pixmap_data == (char **)0) {
+    fprintf(stderr, "make_pixmap_from_default(): NULL passed\n");
+    exit(1);
+  }
+#endif
+
+  if (bl == (Bubble_Step *)NULL) {
+    fprintf(stderr, "NULL pointer passed to make_pixmap()\n");
+    exit(1);
+  }
+
+  bl->xpmattrs.closeness = 40000;
+  bl->xpmattrs.valuemask = XpmColormap | XpmCloseness;
+  bl->xpmattrs.colormap = defcmap;
+
+  /* This is the only line which is different from make_pixmap_from_file() */
+  result = XpmCreatePixmapFromData(defdsp, defwin, pixmap_data, &bl->ball, 
+                                  &bl->shape_mask, &bl->xpmattrs);
+
+  switch(result) {
+  case XpmColorError:
+    fprintf(stderr, "xpm: color substitution performed\n");
+    /* fall through */
+  case XpmSuccess:
+    bl->radius = MAX(bl->xpmattrs.width, bl->xpmattrs.height) / 2;
+    bl->area = calc_bubble_area(bl->radius);
+    break;
+  case XpmColorFailed:
+    fprintf(stderr, "xpm: color allocation failed\n");
+    exit(1);
+  case XpmNoMemory:
+    fprintf(stderr, "xpm: out of memory\n");
+    exit(1);
+  default:
+    fprintf(stderr, "xpm: unknown error code %d\n", result);
+    exit(1);
+  }
+  
+  gcv.plane_mask = AllPlanes;
+  gcv.foreground = default_fg_pixel;
+  gcv.function = GXcopy;
+  bl->draw_gc = XCreateGC (defdsp, defwin, GCForeground, &gcv);
+  XSetClipMask(defdsp, bl->draw_gc, bl->shape_mask);
+  
+  gcv.foreground = default_bg_pixel;
+  gcv.function = GXcopy;
+  bl->erase_gc = XCreateGC (defdsp, defwin, GCForeground, &gcv);
+  XSetClipMask(defdsp, bl->erase_gc, bl->shape_mask);  
+}
+
+static void 
+default_to_pixmaps(void)
+/* Make pixmaps out of default ball data stored in bubbles_default.c */
+{
+  int i;
+  Bubble_Step *pixmap_list = (Bubble_Step *)NULL;
+  Bubble_Step *newpix, *tmppix;
+  char **pixpt;
+
+  /* Make sure pixmaps are freed when program is terminated */
+  /* This is when I hit ^C */
+  if (signal(SIGINT, SIG_IGN) != SIG_IGN)
+    signal(SIGINT, onintr);
+  /* xscreensaver sends SIGTERM */
+  if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
+    signal(SIGTERM, onintr);
+#ifdef DEBUG
+  if (signal(SIGSEGV, SIG_IGN) != SIG_IGN) {
+    printf("Setting signal handler for SIGSEGV\n");
+    signal(SIGSEGV, onsegv);
+  } else {
+    printf("Didn't set signal hanlder for SIGSEGV\n");
+  }
+#endif /* DEBUG */
+
+  for (i = 0; i < num_default_bubbles; i++) {
+    pixpt = default_bubbles[i];
+    newpix = (Bubble_Step *)xmalloc(sizeof(Bubble_Step));
+    make_pixmap_from_default(pixpt, newpix);
+    /* Now add to list */
+    if (pixmap_list == (Bubble_Step *)NULL) {
+      pixmap_list = newpix;
+    } else {
+      tmppix = pixmap_list;
+      while (tmppix->next != (Bubble_Step *)NULL)
+       tmppix = tmppix->next;
+      tmppix->next = newpix;
+    }
+    newpix->next = (Bubble_Step *)NULL;
+  }
+  
+  /* Finally construct step_pixmaps[] */
+  make_pixmap_array(pixmap_list);
+}
+
+#endif /* NO_DEFAULT_BUBBLE */
+
+#endif /* HAVE_XPM */
+
+/* 
+ * File I/O stuff
+ */
+
+#ifdef BUBBLES_IO
+
+static DIR *
+my_opendir(name)
+     char *name;
+/* Like opendir() but checks for things so we don't have to do it multiple
+times in the code. */
+{
+  DIR *rv;
+
+  if (name == (char *)NULL) {
+    fprintf(stderr, "NULL directory name\n");
+    return (DIR *)NULL;
+  }
+  
+  if ((rv = opendir(name)) == NULL) {
+    perror(name);
+    return (DIR *)NULL;
+  }
+
+  return rv;
+}
+
+static int
+regular_file(name)
+     char *name;
+/* Check to see if we can use the named file.  This was broken under Linux
+1.3.45 but seems to be okay under 1.3.54.  The parameter "name" was being
+trashed if the file didn't exist.  Yeah, I know 1.3.x are development
+kernels....
+*/
+{
+  int fd;
+
+  if ((fd = open(name, O_RDONLY)) == -1) {
+    perror(name);
+    return 0;
+  } else {
+    close(fd);
+    return 1;
+  }
+}
+
+static char *
+get_random_name(dir)
+     char *dir;
+/* Pick an appropriate file at random out of the files in the directory dir */
+{
+  STRUCT_DIRENT *dp;
+  DIR *dfd;
+  int numentries = 0;
+  int entnum;
+  int x;
+  char buf[PATH_BUF_SIZE];
+  char *rv;
+
+  if ((dfd = my_opendir(dir)) == (DIR *)NULL)
+    return (char *)NULL;
+
+  while ((dp = readdir(dfd)) != NULL) {
+    if ((strcmp(DIRENT_NAME, ".") == 0) || (strcmp(DIRENT_NAME, "..") == 0))
+      continue;
+    if ((strlen(dir)+strlen(DIRENT_NAME)+2) > 1024) {
+      fprintf(stderr, "name %s/%s too long\n", dir, DIRENT_NAME);
+      continue;
+    }
+    if (sprintf(buf, "%s/%s", dir, DIRENT_NAME) > (PATH_BUF_SIZE-1)) {
+      fprintf(stderr, "path buffer overflowed in get_random_name()\n");
+      continue;
+    }
+    if (regular_file(buf))
+      ++numentries;
+  }
+  closedir(dfd);
+  if (numentries == 0) {
+    fprintf(stderr, "No suitable files found in %s\n", dir);
+    return (char *)NULL;
+  }
+  entnum = ya_random() % numentries;
+  x = 0;
+
+  if ((dfd = my_opendir(dir)) == (DIR *)NULL)
+    return (char *)NULL;
+  while ((dp = readdir(dfd)) != NULL) {
+    if ((strcmp(DIRENT_NAME, ".") == 0) || (strcmp(DIRENT_NAME, "..") == 0))
+      continue;
+    if ((strlen(dir)+strlen(DIRENT_NAME)+2) > 1024) {
+      /* We warned about this previously */
+      continue;
+    }
+    if (sprintf(buf, "%s/%s", dir, DIRENT_NAME) > (PATH_BUF_SIZE-1)) {
+      fprintf(stderr, "path buffer overflowed in get_random_name()\n");
+      continue;
+    }
+    if (regular_file(buf)) {
+      if (x == entnum) {
+       rv = (char *)xmalloc(1024 * sizeof(char));
+       strcpy(rv, buf);
+       closedir(dfd);
+       return rv;
+      }
+      ++x;
+    }
+  }
+  /* We've screwed up if we reach here - someone must have deleted all the
+     files while we were counting them... */
+  fprintf(stderr, "get_random_name(): Oops!\n");
+  exit(1);
+}
+
+static int
+read_line(fd, buf, bufsize)
+     int fd;
+     char **buf;
+     int bufsize;
+/* A line is read from fd until a '\n' is found or EOF is reached.  (*buf)
+is initially of length bufsize and is extended by bufsize chars if need
+be (for as many times as it takes). */
+{
+  char x;
+  int pos = 0;
+  int size = bufsize;
+  int rv;
+  char *newbuf;
+
+  while (1) {
+    rv = read(fd, &x, 1);
+    if (rv == -1) {
+      perror("read_line(): ");
+      return IO_ERROR;
+    } else if (rv == 0) {
+      (*buf)[pos] = '\0';
+      return EOF_REACHED;
+    } else if (x == '\n') {
+      (*buf)[pos] = '\0';
+      return LINE_READ;
+    } else {
+      (*buf)[pos++] = x;
+      if (pos == (size - 1)) {
+       /* We've come to the end of the space */
+       newbuf = (char *)xmalloc((size+bufsize) * sizeof(char));
+       strncpy(newbuf, *buf, (size - 1));
+       free(*buf);
+       *buf = newbuf;
+       size += bufsize;
+      }
+    }
+  }
+}
+
+static int
+create_temp_file(name)
+     char **name;
+/* Create a temporary file in /tmp and return a filedescriptor to it */
+{
+  int rv;
+  if (*name != (char *)NULL)
+    free(*name);
+
+  if ((*name = tempnam("/tmp", "abxdfes")) == (char *)NULL) {
+    fprintf(stderr, "Couldn't make new temporary file\n");
+    exit(1);
+  }
+/*   printf("Temp file created : %s\n", *name); */
+  if ((rv = creat(*name, 0644)) == -1) {
+    fprintf(stderr, "Couldn't open temporary file\n");
+    exit(1);
+  }
+  
+  return rv;
+}
+
+
+#ifdef BUBBLES_IO
+static void 
+make_pixmap_from_file(fname, bl)
+     char *fname;
+     Bubble_Step *bl;
+/* Read the pixmap in file fname into structure bl which must already
+ be allocated. */
+{
+  int result;
+  XGCValues gcv;
+
+  if (bl == (Bubble_Step *)NULL) {
+    fprintf(stderr, "NULL pointer passed to make_pixmap()\n");
+    exit(1);
+  }
+
+  bl->xpmattrs.closeness = 40000;
+  bl->xpmattrs.valuemask = XpmColormap | XpmCloseness;
+  bl->xpmattrs.colormap = defcmap;
+
+  result = XpmReadFileToPixmap(defdsp, defwin, fname, &bl->ball, 
+                              &bl->shape_mask, &bl->xpmattrs);
+
+  switch(result) {
+  case XpmColorError:
+    fprintf(stderr, "xpm: color substitution performed\n");
+    /* fall through */
+  case XpmSuccess:
+    bl->radius = MAX(bl->xpmattrs.width, bl->xpmattrs.height) / 2;
+    bl->area = calc_bubble_area(bl->radius);
+    break;
+  case XpmColorFailed:
+    fprintf(stderr, "xpm: color allocation failed\n");
+    exit(1);
+  case XpmNoMemory:
+    fprintf(stderr, "xpm: out of memory\n");
+    exit(1);
+  default:
+    fprintf(stderr, "xpm: unknown error code %d\n", result);
+    exit(1);
+  }
+  
+  gcv.plane_mask = AllPlanes;
+  gcv.foreground = default_fg_pixel;
+  gcv.function = GXcopy;
+  bl->draw_gc = XCreateGC (defdsp, defwin, GCForeground, &gcv);
+  XSetClipMask(defdsp, bl->draw_gc, bl->shape_mask);
+  
+  gcv.foreground = default_bg_pixel;
+  gcv.function = GXcopy;
+  bl->erase_gc = XCreateGC (defdsp, defwin, GCForeground, &gcv);
+  XSetClipMask(defdsp, bl->erase_gc, bl->shape_mask);  
+}
+#endif /* BUBBLES_IO */
+
+static void 
+read_file_to_pixmaps(fname)
+     char *fname;
+/* Read the pixmaps contained in the file fname into memory.  THESE SHOULD
+BE UNCOMPRESSED AND READY TO GO! */
+{
+  int fd, tmpfd=0, rv;
+  int inxpm = 0;
+  int xpmseen = 0;
+  char *buf = (char *)NULL;
+  char *tmpname = (char *)NULL;
+  Bubble_Step *pixmap_list = (Bubble_Step *)NULL;
+  Bubble_Step *newpix, *tmppix;
+
+  /* We first create a linked list of pixmaps before allocating
+     memory for the array */
+
+  if ((fd = open(fname, O_RDONLY)) == -1) {
+    fprintf(stderr, "Couldn't open %s\n", fname);
+    exit(1);
+  }
+
+  /* Make sure pixmaps are freed when program is terminated */
+  /* This is when I hit ^C */
+  if (signal(SIGINT, SIG_IGN) != SIG_IGN)
+    signal(SIGINT, onintr);
+  /* xscreensaver sends SIGTERM */
+  if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
+    signal(SIGTERM, onintr);
+#ifdef DEBUG
+  if (signal(SIGSEGV, SIGN_IGN) != SIG_IGN)
+    signal(SIGSEGV, onsegv);
+#endif /* DEBUG */
+  
+  while (1) {
+    if (inxpm == 2)
+      break;
+
+    buf = (char *)malloc(READ_LINE_BUF_SIZE * sizeof(char));
+
+    switch ((rv = read_line(fd, &buf, READ_LINE_BUF_SIZE))) {
+    case IO_ERROR:
+      fprintf(stderr, "An I/O error occurred\n");
+      exit(1);
+    case EOF_REACHED:
+      if (inxpm) {
+       fprintf(stderr, "EOF occurred inside an XPM block\n");
+       exit(1);
+      } else
+       inxpm = 2;
+      break;
+    case LINE_READ:
+      if (inxpm) {
+       if (strncmp("};", buf, 2) == 0) {
+         inxpm = 0;
+         write(tmpfd, buf, strlen(buf));
+         write(tmpfd, "\n", 1);
+         close(tmpfd);
+         /* Now process the tmpfile */
+         newpix = (Bubble_Step *)xmalloc(sizeof(Bubble_Step));
+         make_pixmap_from_file(tmpname, newpix);
+         /* Now add to list */
+         if (pixmap_list == (Bubble_Step *)NULL) {
+           pixmap_list = newpix;
+         } else {
+           tmppix = pixmap_list;
+           while (tmppix->next != (Bubble_Step *)NULL)
+             tmppix = tmppix->next;
+           tmppix->next = newpix;
+         }
+         newpix->next = (Bubble_Step *)NULL;
+         unlink(tmpname);
+       } else {
+         write(tmpfd, buf, strlen(buf));
+         write(tmpfd, "\n", 1);
+       }
+      } else {
+       if (strncmp("/* XPM */", buf, 9) == 0) {
+         tmpfd = create_temp_file(&tmpname);
+/* This proves XPM's performance is kinda pathetic */
+#ifdef DEBUG
+         printf("New XPM detected : %s, fd=%d\n", tmpname, tmpfd); 
+#endif /* DEBUG */
+         inxpm = 1;
+         xpmseen = 1;
+       }
+       write(tmpfd, buf, strlen(buf));
+       write(tmpfd, "\n", 1);
+      }
+      break;
+    default:
+      fprintf(stderr, "read_line returned unknown code %d\n", rv);
+      exit(1);
+    }
+
+    free(buf);
+  }
+
+  close(fd);
+  if (buf != (char *)NULL)
+    free(buf);
+  if (tmpname != (char *)NULL)
+    free(tmpname);
+
+  if (! xpmseen) {
+    fprintf(stderr, "There was no XPM data in the file %s\n", fname);
+    exit(1);
+  }
+
+  /* Finally construct step_pixmaps[] */
+  make_pixmap_array(pixmap_list);
+}
+
+static void 
+shell_exec(command)
+     char *command;
+/* Forks a shell to execute "command" then waits for command to finish */
+{
+  int pid, status, wval;
+
+  switch(pid=fork()) {
+  case 0:
+    if (execlp(BOURNESH, BOURNESH, "-c", command, (char *)NULL) == -1) {
+      fprintf(stderr, "Couldn't exec shell %s\n", BOURNESH);
+      exit(1);
+    }
+    /* fall through if execlp() fails */
+  case -1:
+    /* Couldn't fork */
+    perror(progname);
+    exit(1);
+  default:
+    while ((wval = wait(&status)) != pid)
+      if (wval == -1) {
+       perror(progname);
+       exit(1);
+      }    
+  }
+}
+
+static void 
+uncompress_file(current, namebuf)
+     char *current;
+     char *namebuf;
+/* If the file current is compressed (i.e. its name ends in .gz or .Z,
+no check is made to see if it is actually a compressed file...) then a
+new temporary file is created for it and it is decompressed into there,
+returning the name of the file to namebuf, else current is returned in
+namebuf */
+{
+  int fd;
+  char *tname = (char *)NULL;
+  char argbuf[COMMAND_BUF_SIZE];
+
+  if (((strlen(current) >=4) && 
+       (strncmp(&current[strlen(current)-3], ".gz", 3) == 0)) || 
+      ((strlen(current) >=3) && 
+       (strncmp(&current[strlen(current)-2], ".Z", 2) == 0))) {
+    fd = create_temp_file(&tname);
+    /* close immediately but don't unlink so we should have a zero length
+       file in /tmp which we can append to */
+    close(fd);
+    if (sprintf(argbuf, "%s -dc %s > %s", GZIP, current, tname) > 
+       (COMMAND_BUF_SIZE-1)) {
+      fprintf(stderr, "command buffer overflowed in uncompress_file()\n");
+      exit(1);
+    }
+    shell_exec(argbuf);
+    strcpy(namebuf, tname);
+  } else {
+    strcpy(namebuf, current);
+  }
+  return;
+}
+
+#endif /* BUBBLES_IO */
+
+/* 
+ * Main stuff 
+ */
+
+
+static void 
+get_resources(dpy)
+     Display *dpy;
+/* Get the appropriate X resources and warn about any inconsistencies. */
+{
+  Bool nodelay;
+#ifdef BUBBLES_IO
+#ifdef HAVE_XPM
+  char *dirname;
+#else
+  char *foo, *bar;
+#endif /* HAVE_XPM */
+#endif /* BUBBLES_IO */
+
+  threed = get_boolean_resource("3D", "Boolean");
+  quiet = get_boolean_resource("quiet", "Boolean");
+  simple = get_boolean_resource("simple", "Boolean");
+  /* Forbid rendered bubbles on monochrome displays */
+  if ((mono_p) && (! simple)) {
+    if (! quiet)
+      fprintf(stderr, "Rendered bubbles not supported on monochrome \
+displays\n");
+    simple = True;
+  }
+  delay = get_integer_resource("delay", "Integer");
+  nodelay = get_boolean_resource("nodelay", "Boolean");
+  if (nodelay)
+    delay = 0;
+  if (delay < 0)
+    delay = 0;
+
+  default_fg_pixel = get_pixel_resource ("foreground", "Foreground", dpy,
+                                        DefaultColormap(dpy, 
+                                                        DefaultScreen(dpy)));
+  default_bg_pixel = get_pixel_resource ("background", "Background", dpy,
+                                        DefaultColormap(dpy, 
+                                                        DefaultScreen(dpy)));
+
+  if (simple) {
+    /* This is easy */
+    broken = get_boolean_resource("broken", "Boolean");
+    if (broken)
+      if (! quiet)
+       fprintf(stderr, "-broken not available in simple mode\n");
+  } else {
+#ifndef HAVE_XPM
+    simple = 1;
+#else
+    broken = get_boolean_resource("broken", "Boolean");
+#ifdef BUBBLES_IO
+    pixmap_file = get_string_resource("file", "File");
+    dirname = get_string_resource("directory", "Directory");    
+#ifdef NO_DEFAULT_BUBBLE
+    /* Must specify -file or -directory if no default bubble compiled in */
+    if (strcmp(pixmap_file, "(default)") != 0) {
+    } else if (strcmp(dirname, "(default)") != 0) {
+      if ((pixmap_file = get_random_name(dirname)) == (char *)NULL) {
+       /* Die if we can't open directory - make it consistent with -file
+          when it fails, rather than falling back to default. */
+       exit(1);
+      }
+    } else {
+      fprintf(stderr, "No default bubble compiled in - use -file or \
+-directory\n");
+      exit(1);
+    }
+#else
+    if (strcmp(pixmap_file, "(default)") != 0) {
+    } else if (strcmp(dirname, "(default)") != 0) {
+      if ((pixmap_file = get_random_name(dirname)) == (char *)NULL) {
+       exit(1);
+      }
+    } else {
+      /* Use default bubble */
+      use_default_bubble = 1;
+    }
+#endif /* NO_DEFAULT_BUBBLE */
+#else 
+    use_default_bubble = 1;
+#endif /* BUBBLES_IO */
+#endif /* HAVE_XPM */
+  }
+}
+
+static void
+init_bubbles (dpy, window)
+     Display *dpy;
+     Window window;
+{
+  XGCValues gcv;
+  XWindowAttributes xgwa;
+  int i;
+#ifdef BUBBLES_IO
+  char uncompressed[1024];
+#endif /* BUBBLES_IO */
+
+  defdsp = dpy;
+  defwin = window;
+
+  ya_rand_init(0);
+
+  get_resources(dpy);
+
+  XGetWindowAttributes (dpy, window, &xgwa);
+
+#ifdef DEBUG
+  printf("sizof(int) on this platform is %d\n", sizeof(int));
+  printf("sizof(long) on this platform is %d\n", sizeof(long));
+#endif /* DEBUG */
+
+  screen_width = xgwa.width;
+  screen_height = xgwa.height;
+  screen_depth = xgwa.depth;
+  defcmap = xgwa.colormap;
+
+  if (simple) {
+    /* These are pretty much plucked out of the air */
+    bubble_min_radius = (int)(0.006*(double)(MIN(screen_width, 
+                                                screen_height)));
+    bubble_max_radius = (int)(0.045*(double)(MIN(screen_width,
+                                                screen_height)));
+    /* Some trivial values */
+    if (bubble_min_radius < 1)
+      bubble_min_radius = 1;
+    if (bubble_max_radius <= bubble_min_radius)
+      bubble_max_radius = bubble_min_radius + 1;
+
+    mesh_length = (2 * bubble_max_radius) + 3;
+
+    /* store area of each bubble of certain radius as number of 1/10s of
+       a pixel area.  PI is defined in <math.h> */
+    bubble_areas = (long *)xmalloc((bubble_max_radius + 2) * sizeof(int));
+    for (i = 0; i < bubble_min_radius; i++)
+      bubble_areas[i] = 0;
+    for (i = bubble_min_radius; i <= (bubble_max_radius+1); i++)
+      bubble_areas[i] = calc_bubble_area(i);
+
+    mesh_length = (2 * bubble_max_radius) + 3;
+  } else {
+#ifndef HAVE_XPM
+    fprintf(stderr, "Bug: simple mode code not set but HAVE_XPM not \
+defined\n");
+    exit(1);
+#else
+    /* Make sure all #ifdef sort of things have been taken care of in
+       get_resources(). */
+    if (use_default_bubble) {
+#ifdef NO_DEFAULT_BUBBLE
+      fprintf(stderr, "Bug: use_default_bubble and NO_DEFAULT_BUBBLE both \
+defined\n");
+      exit(1);
+#else
+      default_to_pixmaps();
+#endif /* NO_DEFAULT_BUBBLE */
+
+      /* Set mesh length */
+      mesh_length = (2 * step_pixmaps[num_bubble_pixmaps-1]->radius) + 3;
+    } else {
+#ifdef BUBBLES_IO
+      if (! regular_file(pixmap_file)) {
+       /* perror() in regular_file printed error message */
+       exit(1);
+      }
+      uncompress_file(pixmap_file, uncompressed);
+      read_file_to_pixmaps(uncompressed);
+      if (strcmp(pixmap_file, uncompressed))
+       unlink(uncompressed);
+
+      mesh_length = (2 * step_pixmaps[num_bubble_pixmaps-1]->radius) + 3;
+#else
+      fprintf(stderr, "Bug: use_default_bubble is not defined yet I/O is not \
+compiled in\n");
+      exit(1);
+#endif /* BUBBLES_IO */
+    }
+#endif /* HAVE_XPM */
+
+    /* Am I missing something in here??? */
+  }
+
+  mesh_width = (screen_width / mesh_length) + 1;
+  mesh_height = (screen_height / mesh_length) + 1;
+  mesh_cells = mesh_width * mesh_height;
+  init_mesh();
+
+  calculate_adjacent_list();
+
+  adjust_areas();
+
+  /* Graphics contexts for simple mode */
+  if (simple) {
+    gcv.foreground = default_fg_pixel;
+    draw_gc = XCreateGC (dpy, window, GCForeground, &gcv);
+    gcv.foreground = default_bg_pixel;
+    erase_gc = XCreateGC (dpy, window, GCForeground, &gcv);
+  }
+
+  XClearWindow (dpy, window);
+}
+
+static void 
+bubbles (dpy, window)
+     Display *dpy;
+     Window window;
+{
+  Bubble *tmp;
+
+  tmp = new_bubble();
+  add_to_mesh(tmp);
+  insert_new_bubble(tmp);
+
+  XSync (dpy, True);
+}
+
+
+void 
+screenhack (dpy, window)
+     Display *dpy;
+     Window window;
+{
+  init_bubbles (dpy, window);
+  while (1) {
+    bubbles (dpy, window);
+    if (delay)
+      usleep(delay);
+  }
+}
+
diff --git a/hacks/bubbles.h b/hacks/bubbles.h
new file mode 100644 (file)
index 0000000..43f1940
--- /dev/null
@@ -0,0 +1,217 @@
+/* bubbles.h - definitions for bubbles screensaver */
+
+/* $Id: bubbles.h,v 1.1 1996/09/08 01:35:40 jwz Exp $ */
+
+#ifndef _BUBBLES_H_
+#define _BUBBLES_H_
+
+#ifdef HAVE_XPM
+#include <X11/xpm.h>
+#endif
+
+/***************************************************************************
+ *   Options you might like to change to affect the program's behaviour    *
+ ***************************************************************************/
+
+/*
+ *   Uncommenting the following will enable support for reading bubbles from 
+ * files (using the -file and -directory options to bubbles).  This is
+ * disabled by default since such operations are inherently non-portable
+ * and we want the program to compile on as many systems as possible.  
+ *
+ *   If you uncomment this and you figure out how to get it working, please
+ * let me (J.Macnicol@student.anu.edu.au) know.  Diffs against the standard
+ * distribution would be appreciated.  Possible sources of problems are
+ * dirent and possibly the use of tmpnam().
+ */
+
+/* #define BUBBLES_IO */
+
+/*
+ *   The following only makes sense if BUBBLES_IO above is defined.
+ * 
+ *   Uncomment the following if you always want to use the -file or
+ * -directory options on the command line and never to use a default bubble
+ * compiled into the program.  This way you would save memory and disk space
+ * since if you do use -file or -directory only one bubble will be loaded
+ * into memory at any one time (and remember the default bubble is really
+ * uncompressed, unlike bubbles in files which can be compressed).  This
+ * is disabled by default only so people running the program for the first
+ * time with no knowldege of the command line options don't get error
+ * messages ;)
+ *
+ * NOTE: You will still need to have a bubbles_default.c file, else the
+ * build sequence will fail.  Well constructed bubbles_default.c files
+ * have #ifdef's which simply exclude everything else in the file at
+ * compile time.  The bubblestodefault script does this.
+ */
+
+/* #define NO_DEFAULT_BUBBLE */
+
+/*
+ * This turns on any debugging messages and sanity checks.  Hopefully you
+ * won't need this :)  It slows things down a bit, too.
+ *
+ * NOTE: If you uncomment this you will get some messages about unused
+ * functions when you compile.  You can ignore these - they refer to 
+ * convenient checking routines which simply aren't called but are left
+ * in case someone wants to use them.
+ */
+
+/* #define DEBUG */
+
+/***************************************************************************
+ *      Things you might need to change to get things working right        *
+ ***************************************************************************/
+
+/*
+ *  Name of the gzip binary.  You shouldn't need to change this unless it's
+ * not in your PATH when the program is run, in which case you will need to
+ * substitute the full path here.  Keep the double quotes else things won't
+ * compile!
+ */
+
+#define GZIP               "gzip"
+
+/*
+ *  Likewise for the Bourne shell.
+ */
+
+#define BOURNESH           "sh"
+
+/*
+ * The name of the directory entry structure is different under Linux
+ * (under which this code is being developed) than other systems.  The case
+ * alternate form here is that given in Kernighan & Ritchie's C book (which
+ * must be authoratitive, no?) 
+ *
+ * 04/07/96 : People will have to hack this to get it working on some
+ * systems.  I believe it doesn't work on SGI, for example.
+ */
+
+#ifdef _POSIX_SOURCE
+#define STRUCT_DIRENT      struct dirent
+#else
+#define STRUCT_DIRENT      Dirent
+#endif
+
+/* 
+ * The naming of fields in struct dirent also seems to differ from system to
+ * system.  This may have to be extended to make things truly portable.
+ * What we want here is the name field from a dirent struct pointed to
+ * by "dp". 
+ *
+ * 04/07/96 : See above.  This may need to be changed too.
+ */
+
+#ifdef _POSIX_SOURCE
+#define DIRENT_NAME       dp->d_name
+#else
+#define DIRENT_NAME       dp->name
+#endif
+
+/*
+ * I don't know why this isn't defined.
+ */
+#ifdef linux
+extern char *tempnam(char *, char *);
+#endif
+
+/****************************************************************************
+ *      Buffer lengths and things you probably won't need to touch          *
+ ****************************************************************************/
+
+/* Maximum length of a full path name we can deal with */
+#define PATH_BUF_SIZE      1024
+
+/* Size of string passed to shell as command */
+#define COMMAND_BUF_SIZE   2500
+
+/* Size increments for read_line() buffers */
+#define READ_LINE_BUF_SIZE 24
+
+/****************************************************************************
+ *                        End of options                                    *
+ ****************************************************************************/
+
+/* Some machines define M_PI and not PI.  If they don't define either, use
+own own.  Really, the accuracy of this is _not_ very important. */
+#ifndef PI
+#define PI  M_PI
+#ifndef M_PI
+#define M_PI 3.1415926535
+#endif
+#endif
+
+/* for delete_bubble_in_mesh() */
+#define DELETE_BUBBLE      0
+#define KEEP_BUBBLE        1
+
+/* Status codes for read_line */
+#define LINE_READ          0
+#define EOF_REACHED        1
+#define IO_ERROR           2
+
+/* 
+ * Magic number for Bubble struct, in case it's trashed when debugging code
+ * (which happened to me often.... :(  
+ */
+
+#define BUBBLE_MAGIC       5674
+
+/* Useful macros */
+#define MAX(A, B) ((A) > (B) ? (A) : (B))
+#define MIN(A, B) ((A) < (B) ? (A) : (B))
+
+/* How we represent bubbles */
+struct bub {
+  int radius;
+  int step;  /* for rendered bubbles */
+  long area;
+  int x;
+  int y;
+  int magic;
+  int cell_index;
+  int visible;
+  struct bub *next;
+  struct bub *prev;
+};
+
+typedef struct bub Bubble;
+
+/*
+ * How we represent pixmaps of rendered bubbles.  Because the range of radii
+ * available may not be continuous, we call each a step (for the lack of a
+ * better name...)
+ */
+
+#ifdef HAVE_XPM
+struct bub_step {
+  int radius;
+  long area;
+  Pixmap ball, shape_mask;
+  GC draw_gc, erase_gc;
+  XpmAttributes xpmattrs;
+  struct bub_step *next;
+};
+
+typedef struct bub_step Bubble_Step;
+#endif /* HAVE_XPM */
+
+/* Make sure default bubble isn't compiled when we don't have XPM
+Disable file I/O code too. */
+#ifndef HAVE_XPM
+#define NO_DEFAULT_BUBBLE
+#ifdef BUBBLES_IO
+#undef BUBBLES_IO
+#endif /* BUBBLES_IO */
+#endif /* HAVE_XPM */
+
+/* Make sure default bubble is compiled in when we have XPM and no file I/O */
+#ifdef HAVE_XPM
+#ifndef BUBBLES_IO
+#undef NO_DEFAULT_BUBBLE
+#endif /* BUBBLES_IO */
+#endif /* HAVE_XPM */
+
+#endif /* _BUBBLES_H_ */
diff --git a/hacks/bubbles.man b/hacks/bubbles.man
new file mode 100644 (file)
index 0000000..c9016e6
--- /dev/null
@@ -0,0 +1,142 @@
+.de EX         \"Begin example
+.ne 5
+.if n .sp 1
+.if t .sp .5
+.nf
+.in +.5i
+..
+.de EE
+.fi
+.in -.5i
+.if n .sp 1
+.if t .sp .5
+..
+.TH XScreenSaver 1 "14-Dec-95" "X Version 11"
+.SH NAME
+bubbles - frying pan / soft drink simulation
+.SH SYNOPSIS
+.B bubbles
+[\-display \fIhost:display.screen\fP] [\-foreground \fIcolor\fP] [\-background \fIcolor\fP] [\-window] [\-root] [\-mono] [\-install] [\-visual \fIvisual\fP] [\-simple] [\-broken] [\-3D] [\-file filename] [\-directory directoryname]
+.SH DESCRIPTION
+\fIBubbles\fP sprays lots of little random bubbles all over the window which
+then grow until they reach their maximum size and go pop.  The inspiration
+for this was watching little globules of oil on the bottom of a frying pan
+and it also looks a little like bubbles in fizzy soft drink.  The default
+mode uses fancy ray-traced bubbles but there is also a mode which just draws 
+circles in case the default mode is too taxing on your hardware.
+.SH OPTIONS
+Depending on how your
+.I bubbles
+was compiled, it accepts the following options:
+.TP 8
+.B \-foreground
+Colour of circles if \fI\-simple\fP mode is selected.
+.TP 8
+.B \-background
+Colour of window background.
+.TP 8
+.B \-window
+Draw on a newly-created window.  This is the default.
+.TP 8
+.B \-root
+Draw on the root window.
+.TP 8
+.B \-mono 
+If on a color display, pretend we're on a monochrome display.
+.TP 8
+.B \-install
+Install a private colormap for the window.
+.TP 8
+.B \-visual \fIvisual\fP
+Specify which visual to use.  Legal values are the name of a visual class,
+or the id number (decimal or hex) of a specific visual.
+.TP 8
+.B \-delay microseconds
+How much of a delay should be introduced between steps of the animation.
+Default 1, or about 1 microsecond.  Actually, this is the delay between each
+group of 15 new bubbles since such a delay between each step results in a
+very slow animation rate.
+.TP 8
+.B \-nodelay
+Same as \fI\-delay 0\fP.
+.TP 8
+.B \-simple
+Don't use the default fancy pixmap bubbles.  Just draw circles instead.
+This may give more bearable performance if your hardware wasn't made for
+this sort of thing.
+.TP 8
+.B \-broken
+Don't hide bubbles when they pop.  This was a bug during development
+but the results were actually quite attractive.  (This option is only
+available if you have the XPM library available and the imake generated
+Makefile has defined HAVE_XPM).
+.TP 8
+.B \-3D
+Normally, the simulation is done completely in two dimensions.  When a
+bubble swallows up another bubble, the areas of each are added to get
+the area of the resulting bubble.  This option changes the algorithm
+to instead add volume (imagining each to be a sphere in 3D space).  The
+whole thing looks more realistic but I find it attracts attention to
+the flickering of each bubble as they are move and are redrawn.  Your
+mileage may vary.
+.TP 8
+.B \-file filename
+Use the pixmap definitions in the given file, instead of the default (if
+one is compiled in).  This is ignored if \fI\-simple\fP is specified.  If
+the file is compressed (either with compress or gzip), it is decompressed
+before use.  (This option only works if you have XPM compiled into your
+binary and you have compiled with BUBBLES_IO set in bubbles.h.  This is
+\fBnot\fP the default).
+.TP 8
+.B \-directory directoryname
+Similar to \fI-file\fP except the file is taken randomly from the
+contents of the specified directory.  (Again, this option is only available
+if you have XPM and BUBBLES_IO was set when compiling.  See above).
+.TP 8
+.B \-quiet
+Don't print messages explaining why one or several command line options
+were ignored.  This is disabled by default.
+.SH NOTES
+If you find the pace of things too slow, remember that there is a delay
+even though you specify no \fI\-delay\fP option.  Try using \fI\-nodelay\fP
+although beware of the effects of irritation of other users if you're on a 
+shared system as you bleed their CPU time away.
+
+Some tools to assist in creation of new bubbles are included in the source
+distribution.  These can either be loaded with the \fI\-file\fP or
+\fI\-directory\fP options (if available) or they can be used in place
+of the distributed default bubble (bubble_default.c).
+You might like to copy these scripts to a permanent location and
+use them.  Read bubbles.README.
+
+Rendered bubbles are not supported on monochrome displays.  I'm not
+convinced that small bubbles, even dithered properly are going to look
+like anything more than a jumble of random dots.
+.SH BUGS
+There is a delay before something appears on the screen when using
+rendered bubbles.  The XPM library seems to take a \fBlong\fP time to make
+pixmaps out of raw data.  This can be irritating on slower systems.
+
+The movement of the bubbles looks jerky if an incomplete set of bubbles
+is used.  
+
+The hide/display algorithm could do with some work to avoid flickering
+when \fI\-nodelay\fP is set.
+.SH ENVIRONMENT
+.PP
+.TP 8
+.B DISPLAY
+to get the default host and display number.
+.TP 8
+.B XENVIRONMENT
+to get the name of a resource file that overrides the global resources
+stored in the RESOURCE_MANAGER property.
+.SH SEE ALSO
+.BR X (1),
+.BR xscreensaver (1)
+.SH DISTRIBUTION POLICY
+This work is Copyright \(co 1995, 1996 by James Macnicol.  Distribution is
+allowed under the terms of the GNU General Public License.  Look at the
+sources for the legalese.
+.SH AUTHOR
+James Macnicol <J.Macnicol@student.anu.edu.au>.  
diff --git a/hacks/bubbles_default.c b/hacks/bubbles_default.c
new file mode 100644 (file)
index 0000000..fe6be92
--- /dev/null
@@ -0,0 +1,2123 @@
+#include <stdio.h>
+#include "bubbles.h"
+
+#ifndef NO_DEFAULT_BUBBLE
+
+/* XPM */
+static char *glass1[] = {
+/* width height ncolors chars_per_pixel */
+"10 10 61 2",
+/* colors */
+"`` c None",
+"`a c #27274E",
+"`b c #29293F",
+"`c c #2C2C63",
+"`d c #353579",
+"`e c #242447",
+"`f c #222245",
+"`g c #25253E",
+"`h c #1C1C3F",
+"`i c #2B2B47",
+"`j c #252544",
+"`k c #222251",
+"`l c #323264",
+"`m c #212146",
+"`n c #37374B",
+"`o c #22223D",
+"`p c #252536",
+"`q c #232337",
+"`r c #34346C",
+"`s c #303068",
+"`t c #26264A",
+"`u c #5D5D97",
+"`v c #363674",
+"`w c #2C2C6A",
+"`x c #2E2E5B",
+"`y c #242451",
+"`z c #343464",
+"a` c #3C3C6F",
+"aa c #353572",
+"ab c #38386B",
+"ac c #242454",
+"ad c #181831",
+"ae c #28285B",
+"af c #37377A",
+"ag c #20203F",
+"ah c #26265C",
+"ai c #4C4C60",
+"aj c #383874",
+"ak c #333379",
+"al c #444458",
+"am c #272756",
+"an c #32326E",
+"ao c #30306C",
+"ap c #40407F",
+"aq c #292944",
+"ar c #212150",
+"as c #323271",
+"at c #2D2D76",
+"au c #21213F",
+"av c #25255A",
+"aw c #35356D",
+"ax c #313169",
+"ay c #2C2C6E",
+"az c #18182C",
+"b` c #232344",
+"ba c #292961",
+"bb c #202037",
+"bc c #1C1C33",
+"bd c #242452",
+"be c #45456F",
+"bf c #242455",
+/* pixels */
+"``````aibebebeal````",
+"`````n`zaw`ua``l`n``",
+"```i`xab`wasaj`r`x`q",
+"``auaean`daf`vao`c`t",
+"```haxahayatakbaaeb`",
+"``adbfav`wapao`sam`m",
+"``azagaracaaae`k`fbc",
+"````bb`ybd`aar`e`o``",
+"```````paq`j`b`g````",
+"````````````````````"
+};
+/* XPM */
+static char *glass2[] = {
+/* width height ncolors chars_per_pixel */
+"12 12 75 2",
+/* colors */
+"`` c None",
+"`a c #25254C",
+"`b c #23234A",
+"`c c #212148",
+"`d c #2E2E62",
+"`e c #29293F",
+"`f c #272754",
+"`g c #414188",
+"`h c #20202C",
+"`i c #2E2E68",
+"`j c #242447",
+"`k c #25253E",
+"`l c #B9B9ED",
+"`m c #6767A3",
+"`n c #2B2B47",
+"`o c #29295C",
+"`p c #252544",
+"`q c #29295F",
+"`r c #1F1F3E",
+"`s c #2F2F68",
+"`t c #2D2D66",
+"`u c #30305F",
+"`v c #4C4C6D",
+"`w c #2B2B53",
+"`x c #2F2F6E",
+"`y c #34346C",
+"`z c #3B3B55",
+"a` c #303068",
+"aa c #2C2C64",
+"ab c #26264A",
+"ac c #5D5D97",
+"ad c #363674",
+"ae c #3C3C66",
+"af c #252556",
+"ag c #30306E",
+"ah c #3E3E54",
+"ai c #2C2C6A",
+"aj c #4C4C68",
+"ak c #20204A",
+"al c #2E2E5B",
+"am c #343464",
+"an c #16162C",
+"ao c #292938",
+"ap c #333384",
+"aq c #3C3C6F",
+"ar c #1E1E37",
+"as c #38386B",
+"at c #242454",
+"au c #31316E",
+"av c #181831",
+"aw c #232349",
+"ax c #272739",
+"ay c #23234C",
+"az c #37377A",
+"b` c #1E1E3D",
+"ba c #313174",
+"bb c #3C3C78",
+"bc c #383874",
+"bd c #1B1B33",
+"be c #40407F",
+"bf c #292944",
+"bg c #212150",
+"bh c #2D2D76",
+"bi c #191937",
+"bj c #313169",
+"bk c #22224D",
+"bl c #18182C",
+"bm c #2D2D65",
+"bn c #232344",
+"bo c #292961",
+"bp c #27275F",
+"bq c #242452",
+"br c #484868",
+"bs c #262657",
+"bt c #242455",
+/* pixels */
+"`````````vajajajbr``````",
+"````ahaeae`yacasaq`zah``",
+"`````w`f`dagacbb`y`u`u``",
+"```naybm`i`mbabcaaamawar",
+"``bf`ua`adbpaz`gai`ial`j",
+"``bnbgbjaz`xbhapboaa`uav",
+"``b`aybtbcaube`x`s`tbqbd",
+"``anbiakafbb`l`i`q`o`rbl",
+"`````rakbkaf`wbsay`c`k``",
+"````ao`pay`aatab`bar`h``",
+"````````ax`e`n`kax``````",
+"````````````````````````"
+};
+/* XPM */
+static char *glass3[] = {
+/* width height ncolors chars_per_pixel */
+"14 14 90 2",
+/* colors */
+"`` c None",
+"`a c #27274E",
+"`b c #383858",
+"`c c #2E2E62",
+"`d c #292967",
+"`e c #3535A1",
+"`f c #272751",
+"`g c #23234D",
+"`h c #29293F",
+"`i c #353579",
+"`j c #272754",
+"`k c #20202C",
+"`l c #2E2E3D",
+"`m c #242447",
+"`n c #25253E",
+"`o c #3E3E67",
+"`p c #1C1C3F",
+"`q c #6767A3",
+"`r c #2B2B47",
+"`s c #29295C",
+"`t c #2B2B61",
+"`u c #29295F",
+"`v c #1F1F3E",
+"`w c #2F2F68",
+"`x c #2D2D66",
+"`y c #222251",
+"`z c #2D2D69",
+"a` c #33335B",
+"aa c #37374B",
+"ab c #22223D",
+"ac c #28285A",
+"ad c #2B2B53",
+"ae c #2C2C36",
+"af c #424266",
+"ag c #232337",
+"ah c #525265",
+"ai c #32326A",
+"aj c #1B1B2F",
+"ak c #303068",
+"al c #232351",
+"am c #363674",
+"an c #3C3C66",
+"ao c #252556",
+"ap c #27275B",
+"aq c #363663",
+"ar c #4C4C68",
+"as c #2E2E5B",
+"at c #29294C",
+"au c #27274A",
+"av c #252548",
+"aw c #16162C",
+"ax c #292938",
+"ay c #353572",
+"az c #38386B",
+"b` c #4C4C85",
+"ba c #2F2F83",
+"bb c #20203F",
+"bc c #313174",
+"bd c #333379",
+"be c #444458",
+"bf c #272756",
+"bg c #47477C",
+"bh c #32326E",
+"bi c #1B1B33",
+"bj c #30306C",
+"bk c #40407F",
+"bl c #23233E",
+"bm c #141422",
+"bn c #343473",
+"bo c #2D2D76",
+"bp c #2E2E6D",
+"bq c #40406E",
+"br c #21213F",
+"bs c #8080BA",
+"bt c #25255A",
+"bu c #1B1B39",
+"bv c #35356D",
+"bw c #262651",
+"bx c #18182C",
+"by c #373786",
+"bz c #2B2B63",
+"c` c #202037",
+"ca c #1C1C33",
+"cb c #242452",
+"cc c #484868",
+"cd c #1F1F43",
+"ce c #2C2C5D",
+"cf c #3535DD",
+"cg c #262657",
+"ch c #242455",
+/* pixels */
+"``````````arccaharcc````````",
+"``````bea``obqbqbqanafaa````",
+"`````ladaqbv`qbsbgai`ca``b``",
+"````a`a`asaib`bhb`bhakasau``",
+"``c``j`c`d`dbd`eb`am`wce`aca",
+"``bxasaobt`ibdbycf`iay`u`abx",
+"``bl`a`t`ubnbdbocfbcbt`cbwbu",
+"``bi`fch`sbhbkbabp`z`u`w`gaj",
+"``bm`a`a`u`xbjaibgbzcgbf`paw",
+"````agbralazap`t`ucbacbbaj``",
+"`````kbrcdcbcbcgbw`y`vab`k``",
+"``````axbrauatav`r`m`n`n````",
+"``````````ax`h`r`nae````````",
+"````````````````````````````"
+};
+/* XPM */
+static char *glass4[] = {
+/* width height ncolors chars_per_pixel */
+"20 20 151 2",
+/* colors */
+"`` c None",
+"`a c #27274E",
+"`b c #25254C",
+"`c c #383858",
+"`d c #23234A",
+"`e c #212148",
+"`f c #2E2E62",
+"`g c #292967",
+"`h c #3535A1",
+"`i c #29293F",
+"`j c #2C2C63",
+"`k c #2A2A61",
+"`l c #33334C",
+"`m c #353579",
+"`n c #272754",
+"`o c #20202C",
+"`p c #2E2E3D",
+"`q c #2E2E68",
+"`r c #242447",
+"`s c #2C2C66",
+"`t c #222245",
+"`u c #181824",
+"`v c #25253E",
+"`w c #B9B9ED",
+"`x c #1C1C3F",
+"`y c #6767A3",
+"`z c #2B2B47",
+"a` c #272743",
+"aa c #222248",
+"ab c #292931",
+"ac c #29295C",
+"ad c #1D1D39",
+"ae c #252544",
+"af c #2B2B61",
+"ag c #29295F",
+"ah c #1F1F3E",
+"ai c #2F2F68",
+"aj c #2D2D66",
+"ak c #30305F",
+"al c #2C2C5B",
+"am c #11111C",
+"an c #262655",
+"ao c #31316D",
+"ap c #4C4C6D",
+"aq c #222251",
+"ar c #323264",
+"as c #43436E",
+"at c #212146",
+"au c #37374B",
+"av c #22223D",
+"aw c #252536",
+"ax c #1D1D42",
+"ay c #2A2A5C",
+"az c #28285A",
+"b` c #2B2B53",
+"ba c #333372",
+"bb c #2F2F6E",
+"bc c #2B2B3F",
+"bd c #2C2C36",
+"be c #232337",
+"bf c #34346C",
+"bg c #525265",
+"bh c #32326A",
+"bi c #303068",
+"bj c #21214C",
+"bk c #2C2C64",
+"bl c #292957",
+"bm c #232351",
+"bn c #26264A",
+"bo c #2F2F60",
+"bp c #5D5D97",
+"bq c #363674",
+"br c #3C3C66",
+"bs c #252556",
+"bt c #30306E",
+"bu c #414178",
+"bv c #2C2C6A",
+"bw c #20204A",
+"bx c #2E2E5B",
+"by c #29294C",
+"bz c #242451",
+"c` c #27274A",
+"ca c #343464",
+"cb c #4F4F64",
+"cc c #252548",
+"cd c #292938",
+"ce c #333384",
+"cf c #3C3C6F",
+"cg c #353572",
+"ch c #1E1E37",
+"ci c #38386B",
+"cj c #414156",
+"ck c #242454",
+"cl c #181831",
+"cm c #232349",
+"cn c #272739",
+"co c #4C4C85",
+"cp c #2F2F83",
+"cq c #28285B",
+"cr c #36366C",
+"cs c #48486D",
+"ct c #23234C",
+"cu c #37377A",
+"cv c #20203F",
+"cw c #26265C",
+"cx c #313174",
+"cy c #4C4C60",
+"cz c #27273F",
+"d` c #3C3C78",
+"da c #48485C",
+"db c #383874",
+"dc c #333379",
+"dd c #444458",
+"de c #272756",
+"df c #32326E",
+"dg c #1B1B33",
+"dh c #1E1E2C",
+"di c #30306C",
+"dj c #40407F",
+"dk c #292944",
+"dl c #212150",
+"dm c #141422",
+"dn c #323271",
+"do c #2D2D76",
+"dp c #2E2E6D",
+"dq c #21213F",
+"dr c #8080BA",
+"ds c #23232D",
+"dt c #25255A",
+"du c #35356D",
+"dv c #191937",
+"dw c #262651",
+"dx c #313169",
+"dy c #2C2C6E",
+"dz c #22224D",
+"e` c #18182C",
+"ea c #373786",
+"eb c #232344",
+"ec c #2B2B63",
+"ed c #292961",
+"ee c #202037",
+"ef c #1C1C33",
+"eg c #242452",
+"eh c #45456F",
+"ei c #535380",
+"ej c #1F1F43",
+"ek c #2C2C5D",
+"el c #3535DD",
+"em c #262657",
+"en c #393963",
+"eo c #242455",
+/* pixels */
+"``````````````cycyapbgcbcybg````````````",
+"``````````dacycsehcsehapehcsddcj````````",
+"````````au`cenbraseicibucicibrendd``````",
+"``````auau`ccacidudrbpdrcfcrarakau`p````",
+"`````p`lbx`nbhbfdxcobpcodjdu`sakalb`bd``",
+"`````zbybxbocicgbvbbdn`ydbdfbfekbxbybe``",
+"``dh`r`rbl`faidydndn`hd`dnbtecafakdwah`o",
+"``dhdqejcqajdfcg`meacu`hbqdfdibi`jblbndh",
+"``ch`rbxemaidudnbq`geldcbqdbdn`jafbxbnav",
+"``dm`x`bdxdxcwbqdycpdocxdcbvedbkcqalebdg",
+"```uccctdzbsag`qbqdpeacxbtaidiagekdwcvdm",
+"``dmcl`xeoandtdfbv`wdjcediecbiaydectatch",
+"``amdvcm`xaf`kagaodi`qdbbaecanazejdvdv`u",
+"````e``xcvandlcqckdtcgagcq`qaqay`tbjef``",
+"````dsclaxbwdzdebsckb`acegbjeg`eaaadds``",
+"``````eeeeejbzanegdw`abmdl`b`rcnavaw````",
+"````````eeczbc`b`dby`dbya``eae`iaw``````",
+"``````````bdawa`dkc`aeae`i`i`vab````````",
+"``````````````bd`pcdcdbdcdbd````````````",
+"````````````````````````````````````````"
+};
+/* XPM */
+static char *glass5[] = {
+/* width height ncolors chars_per_pixel */
+"24 24 164 2",
+/* colors */
+"`` c None",
+"`a c #27274E",
+"`b c #25254C",
+"`c c #383858",
+"`d c #23234A",
+"`e c #212148",
+"`f c #2E2E62",
+"`g c #292967",
+"`h c #3535A1",
+"`i c #272751",
+"`j c #23234D",
+"`k c #29293F",
+"`l c #2C2C63",
+"`m c #2A2A61",
+"`n c #33334C",
+"`o c #272754",
+"`p c #414188",
+"`q c #20202C",
+"`r c #2E2E3D",
+"`s c #1C1C28",
+"`t c #2E2E68",
+"`u c #242447",
+"`v c #2C2C66",
+"`w c #181824",
+"`x c #25253E",
+"`y c #161622",
+"`z c #B9B9ED",
+"a` c #3E3E67",
+"aa c #1C1C3F",
+"ab c #6767A3",
+"ac c #2B2B47",
+"ad c #222248",
+"ae c #292931",
+"af c #29295C",
+"ag c #252544",
+"ah c #1E1E47",
+"ai c #2B2B61",
+"aj c #29295F",
+"ak c #1F1F3E",
+"al c #2F2F68",
+"am c #2D2D66",
+"an c #30305F",
+"ao c #2C2C5B",
+"ap c #11111C",
+"aq c #262655",
+"ar c #31316D",
+"as c #4C4C6D",
+"at c #323264",
+"au c #2D2D69",
+"av c #33335B",
+"aw c #212146",
+"ax c #37374B",
+"ay c #22223D",
+"az c #252536",
+"b` c #1D1D42",
+"ba c #28285A",
+"bb c #2B2B53",
+"bc c #333372",
+"bd c #2F2F6E",
+"be c #2C2C36",
+"bf c #424266",
+"bg c #232337",
+"bh c #2F2FB0",
+"bi c #34346C",
+"bj c #525265",
+"bk c #32326A",
+"bl c #1B1B2F",
+"bm c #3B3B55",
+"bn c #303068",
+"bo c #21214C",
+"bp c #2C2C64",
+"bq c #292957",
+"br c #26264A",
+"bs c #202044",
+"bt c #5D5D97",
+"bu c #2B2B5C",
+"bv c #363674",
+"bw c #3C3C66",
+"bx c #252556",
+"by c #30306E",
+"bz c #3E3E54",
+"c` c #2C2C6A",
+"ca c #25252E",
+"cb c #27275B",
+"cc c #363663",
+"cd c #4C4C68",
+"ce c #20204A",
+"cf c #2E2E5B",
+"cg c #29294C",
+"ch c #242451",
+"ci c #27274A",
+"cj c #343464",
+"ck c #252548",
+"cl c #16162C",
+"cm c #292938",
+"cn c #333384",
+"co c #3C3C6F",
+"cp c #353572",
+"cq c #1E1E37",
+"cr c #38386B",
+"cs c #414156",
+"ct c #242454",
+"cu c #31316E",
+"cv c #181831",
+"cw c #232349",
+"cx c #272739",
+"cy c #4C4C85",
+"cz c #2F2F83",
+"d` c #28285B",
+"da c #292952",
+"db c #48486D",
+"dc c #23234C",
+"dd c #37377A",
+"de c #1E1E3D",
+"df c #26265C",
+"dg c #313174",
+"dh c #4C4C60",
+"di c #27273F",
+"dj c #3C3C78",
+"dk c #48485C",
+"dl c white",
+"dm c #383874",
+"dn c #333379",
+"do c #444458",
+"dp c #272756",
+"dq c #1B1B33",
+"dr c #1E1E2C",
+"ds c #30306C",
+"dt c #40407F",
+"du c #292944",
+"dv c #212150",
+"dw c #23233E",
+"dx c #343473",
+"dy c #323271",
+"dz c #2D2D76",
+"e` c #2E2E6D",
+"ea c #40406E",
+"eb c #21213F",
+"ec c #8080BA",
+"ed c #23232D",
+"ee c #25255A",
+"ef c #35356D",
+"eg c #191937",
+"eh c #262651",
+"ei c #313169",
+"ej c #2C2C6E",
+"ek c #22224D",
+"el c #18182C",
+"em c #373786",
+"en c #2D2D65",
+"eo c #232344",
+"ep c #2B2B63",
+"eq c #292961",
+"er c #27275F",
+"es c #1C1C33",
+"et c #242452",
+"eu c #45456F",
+"ev c #484868",
+"ew c #1F1F43",
+"ex c #2C2C5D",
+"ey c #3535DD",
+"ez c #262657",
+"f` c #393963",
+"fa c #242455",
+/* pixels */
+"``````````````````dkdhbjbjbjbjdh````````````````",
+"``````````````csasascdevcdascddbevdh````````````",
+"``````````dodobfa`dbeubfeueueacrbfbfcsax````````",
+"````````bzcsbwf`bwcrbicobteccratcof`bmbzbz``````",
+"```````n`navavanefcjbibt`zcrcobicratccf``nax````",
+"``````acbbao`oat`fambycobtdldjbkbialan`can`n````",
+"````dicg`icj`fbi`fefdyauarabbybiefbnaicfbbcg`x``",
+"````ac`udcbqenbk`tdyabczdgdxdmdtbpcpcjeicwcgcq``",
+"```wdq`acfaiefcpe`bydn`hcyeydmc`ambcef`fcf`u`y`s",
+"```ydudaandfbnaubvdgerbhdd`h`pdyc`cu`tezcf`b`ubl",
+"``elad`abqezbndmdsbccncnczeydnbvdmdxamep`fcgcv`w",
+"```weoetdv`leidfdd`gbddzdzdncncneqeebpexan`ucvap",
+"``elcwdaexehd`epaubd`hdz`hcz`gdycucueeba`oekcl`w",
+"``eldebsdcbxfaeedmejcuemdtcnbdbyalafambuet`bdq`w",
+"```yclakboce`fbx`mcper`veccyauei`mbncbaqdpdaesap",
+"````clakegbsceetbxdsdjdt`zbt`tctajdvafahakayel``",
+"````eldqdeebetboenepetezbnbxencb`lbaeteoaabldr``",
+"``````blakb`ceetekambxctbbafezctdcbo`eew`xcq````",
+"``````ed`qakbsawekchchchetd``jboceaddwcxesed````",
+"````````cmazag`xdcek`bchctetbrci`deocqbg`q``````",
+"```````````qbgayckaybr`uacek`beo`x`xazca````````",
+"``````````````aecxdi`kagacag`xcxcxcm````````````",
+"``````````````````ca`rcmbebebeae````````````````",
+"````````````````````````````````````````````````"
+};
+/* XPM */
+static char *glass6[] = {
+/* width height ncolors chars_per_pixel */
+"30 30 181 2",
+/* colors */
+"`` c None",
+"`a c #27274E",
+"`b c #25254C",
+"`c c #383858",
+"`d c #23234A",
+"`e c #212148",
+"`f c #2E2E62",
+"`g c #3535A1",
+"`h c #23234D",
+"`i c #29293F",
+"`j c #2C2C63",
+"`k c #2A2A61",
+"`l c #33334C",
+"`m c #353579",
+"`n c #272754",
+"`o c #20202C",
+"`p c #2E2E3D",
+"`q c #1C1C28",
+"`r c #2E2E68",
+"`s c #242447",
+"`t c #2C2C66",
+"`u c #222245",
+"`v c #181824",
+"`w c #25253E",
+"`x c #161622",
+"`y c #B9B9ED",
+"`z c #3E3E67",
+"a` c #1C1C3F",
+"aa c #6767A3",
+"ab c #2B2B47",
+"ac c #272743",
+"ad c #292931",
+"ae c #29295C",
+"af c #1D1D39",
+"ag c #252544",
+"ah c #1E1E47",
+"ai c #2B2B61",
+"aj c #29295F",
+"ak c #1F1F3E",
+"al c #2F2F68",
+"am c #2D2D66",
+"an c #30305F",
+"ao c #2C2C5B",
+"ap c #11111C",
+"aq c #262655",
+"ar c #31316D",
+"as c #4C4C6D",
+"at c #222251",
+"au c #323264",
+"av c #2D2D69",
+"aw c #33335B",
+"ax c #43436E",
+"ay c #2B2B67",
+"az c #212146",
+"b` c #37374B",
+"ba c #22223D",
+"bb c #252536",
+"bc c #1D1D42",
+"bd c #28285A",
+"be c #2B2B53",
+"bf c #333372",
+"bg c #2F2F6E",
+"bh c #2C2C36",
+"bi c #424266",
+"bj c #232337",
+"bk c #2F2FB0",
+"bl c #34346C",
+"bm c #525265",
+"bn c #32326A",
+"bo c #1B1B2F",
+"bp c #3B3B55",
+"bq c #303068",
+"br c #21214C",
+"bs c #2C2C64",
+"bt c #292957",
+"bu c #232351",
+"bv c #26264A",
+"bw c #2F2F60",
+"bx c #202044",
+"by c #5D5D97",
+"bz c #2B2B5C",
+"c` c #363674",
+"ca c #3C3C66",
+"cb c #252556",
+"cc c #30306E",
+"cd c #3E3E54",
+"ce c #414178",
+"cf c #2C2C6A",
+"cg c #2F2F4F",
+"ch c #25252E",
+"ci c #27275B",
+"cj c #363663",
+"ck c #4C4C68",
+"cl c #20204A",
+"cm c #2E2E5B",
+"cn c #29294C",
+"co c #242451",
+"cp c #27274A",
+"cq c #343464",
+"cr c #4F4F64",
+"cs c #252548",
+"ct c #16162C",
+"cu c #292938",
+"cv c #333384",
+"cw c #3C3C6F",
+"cx c #353572",
+"cy c #1E1E37",
+"cz c #38386B",
+"d` c #414156",
+"da c #242454",
+"db c #31316E",
+"dc c #181831",
+"dd c #232349",
+"de c #272739",
+"df c #393979",
+"dg c #4C4C85",
+"dh c #2F2F83",
+"di c #28285B",
+"dj c #292952",
+"dk c #36366C",
+"dl c #48486D",
+"dm c #23234C",
+"dn c #37377A",
+"do c #20203F",
+"dp c #1E1E3D",
+"dq c #26265C",
+"dr c #313174",
+"ds c #4C4C60",
+"dt c #27273F",
+"du c #3C3C78",
+"dv c #48485C",
+"dw c white",
+"dx c #383874",
+"dy c #333379",
+"dz c #444458",
+"e` c #272756",
+"ea c #47477C",
+"eb c #32326E",
+"ec c #1E1E2C",
+"ed c #30306C",
+"ee c #40407F",
+"ef c #292944",
+"eg c #212150",
+"eh c #23233E",
+"ei c #141422",
+"ej c #343473",
+"ek c #323271",
+"el c #2D2D76",
+"em c #2E2E6D",
+"en c #40406E",
+"eo c #21213F",
+"ep c #272731",
+"eq c #8080BA",
+"er c #23232D",
+"es c #25255A",
+"et c #1B1B39",
+"eu c #35356D",
+"ev c #191937",
+"ew c #262651",
+"ex c #313169",
+"ey c #2C2C6E",
+"ez c #22224D",
+"f` c #18182C",
+"fa c #373786",
+"fb c #2D2D65",
+"fc c #232344",
+"fd c #2B2B63",
+"fe c #292961",
+"ff c #27275F",
+"fg c #202037",
+"fh c #1C1C33",
+"fi c #242452",
+"fj c #45456F",
+"fk c #484868",
+"fl c #535380",
+"fm c #1F1F43",
+"fn c #2C2C5D",
+"fo c #353573",
+"fp c #262657",
+"fq c #393963",
+"fr c #242455",
+/* pixels */
+"````````````````````````bmbmbmbmbmbmbm``````````````````````",
+"``````````````````dscrasasascrckasasasfkckbm````````````````",
+"````````````````dsdsdzbifjfjfjfjaxaxfjfjckdzdv``````````````",
+"````````````d`dvfqdzenfkfjencaendlaxaxcabibi`zdvb```````````",
+"``````````cd`zaw`cfqcacaceflczbydg`zencjcwca`cbpbpcd````````",
+"````````d`cdb``cawcqczdkeubycwbyczdwcwczcqaucaawb`b`b```````",
+"````````b``lcmcqaoczaublbndgeqdfeqczdgbn`jcmanfnawcg`l``````",
+"``````cu`w`wcmcmcqblardxeu`yceareqdueualbleuexdjcmbeba`p````",
+"````chabcg`acmbwbqczaiebcfdfdgekeqdudxebcxblbncmcm`ababjer``",
+"`````o`aeodmaobdalbn`rcfdf`mdhdrdyeaejdubscxffbwbwdd`b`w`q``",
+"````fhbadjcmbq`jcxcxekemeydr`gdy`geeekek`t`rexe`e``ndjdcdc``",
+"```q`veocnbtdialbleb`rfo`medfadnelbkc`bffeedeufn`jcmfmbvfg`x",
+"``ecbo`sbze`feaeayexavbgej`gbkdyeydhdudnemdbfdal`kfna``udc`v",
+"```xeieodjbtfpexfbc`avekbg`gbkelfa`g`gdxcxcfdxamfpbtcpfcdoap",
+"```vcya`btegex`kbldqdncfeycvdyelcv`gdycvfefeebaedianfmfcdc`q",
+"``fhcyetahfncobdbs`tbncfdybgcf`gdhcfavavav`tfraifnbtbteteoei",
+"```xdpaz`bbtcl`fesfbedfdekelbkdhaaavbgcf`jfe`fesbwez`bbxdcei",
+"```xfhdcbx`hfratbresfdedcfee`meedffded`t`tbqdiaee``nazazdcap",
+"`````vdp`sew`bbqaifpfpdbbsccdxdfekbyee`j`jdialbzfidmazafct``",
+"`````vbodpevbcaqbdatcb`tfdamar`ydg`taicbaje`dadaahaketevbo``",
+"`````qf`bjakdobdezegfbaidacibncxdgbddiajalatfibz`ubccyfh`q``",
+"``````chbjbcbcfmbdaediatcbfpfpajfpdaesfpbudmco`h`eewfhf`````",
+"`````````ocydp`waz`e`baqfiesfpdjfpfiaidacpewah`wafdpbb``````",
+"````````chfgfgfmddcofibdfi`bfi`ada`hegbu`h`seodtbafhec``````",
+"``````````cuepdo`wefdmfidd`b`hdae``bbvcn`dagakbabj`o````````",
+"````````````erbbdeefcsefcpabezcp`habef`sbx`wehbber``````````",
+"````````````````chbbba`ief`iacagabef`i`wba`wcu``````````````",
+"``````````````````chbb`p`p`w`w`pcu`p`icucuch````````````````",
+"````````````````````````adadcudeepadbh``````````````````````",
+"````````````````````````````````````````````````````````````"
+};
+/* XPM */
+static char *glass7[] = {
+/* width height ncolors chars_per_pixel */
+"36 36 187 2",
+/* colors */
+"`` c None",
+"`a c #27274E",
+"`b c #25254C",
+"`c c #383858",
+"`d c #23234A",
+"`e c #212148",
+"`f c #2E2E62",
+"`g c #292967",
+"`h c #3535A1",
+"`i c #272751",
+"`j c #23234D",
+"`k c #29293F",
+"`l c #2C2C63",
+"`m c #2A2A61",
+"`n c #33334C",
+"`o c #353579",
+"`p c #272754",
+"`q c #414188",
+"`r c #20202C",
+"`s c #2E2E3D",
+"`t c #1C1C28",
+"`u c #2E2E68",
+"`v c #242447",
+"`w c #2C2C66",
+"`x c #222245",
+"`y c #181824",
+"`z c #25253E",
+"a` c #161622",
+"aa c #B9B9ED",
+"ab c #3E3E67",
+"ac c #1C1C3F",
+"ad c #6767A3",
+"ae c #2B2B47",
+"af c #272743",
+"ag c #222248",
+"ah c #292931",
+"ai c #29295C",
+"aj c #1D1D39",
+"ak c #252544",
+"al c #1E1E47",
+"am c #2B2B61",
+"an c #29295F",
+"ao c #1F1F3E",
+"ap c #2F2F68",
+"aq c #2D2D66",
+"ar c #30305F",
+"as c #2C2C5B",
+"at c #11111C",
+"au c #262655",
+"av c #31316D",
+"aw c #4C4C6D",
+"ax c #222251",
+"ay c #323264",
+"az c #2D2D69",
+"b` c #33335B",
+"ba c #43436E",
+"bb c #2B2B67",
+"bc c #212146",
+"bd c #37374B",
+"be c #22223D",
+"bf c #252536",
+"bg c #1D1D42",
+"bh c #2A2A5C",
+"bi c #28285A",
+"bj c #2B2B53",
+"bk c #333372",
+"bl c #2F2F6E",
+"bm c #2B2B3F",
+"bn c #2C2C36",
+"bo c #424266",
+"bp c #232337",
+"bq c #2F2FB0",
+"br c #34346C",
+"bs c #525265",
+"bt c #32326A",
+"bu c #1B1B2F",
+"bv c #3B3B55",
+"bw c #303068",
+"bx c #21214C",
+"by c #2C2C64",
+"bz c #292957",
+"c` c #232351",
+"ca c #26264A",
+"cb c #2F2F60",
+"cc c #202044",
+"cd c #5D5D97",
+"ce c #2B2B5C",
+"cf c #363674",
+"cg c #3C3C66",
+"ch c #252556",
+"ci c #30306E",
+"cj c #3E3E54",
+"ck c #414178",
+"cl c #2C2C6A",
+"cm c #2F2F4F",
+"cn c #25252E",
+"co c #27275B",
+"cp c #363663",
+"cq c #4C4C68",
+"cr c #20204A",
+"cs c #2E2E5B",
+"ct c #29294C",
+"cu c #242451",
+"cv c #27274A",
+"cw c #343464",
+"cx c #4F4F64",
+"cy c #252548",
+"cz c #16162C",
+"d` c #292938",
+"da c #333384",
+"db c #3C3C6F",
+"dc c #353572",
+"dd c #1E1E37",
+"de c #38386B",
+"df c #414156",
+"dg c #242454",
+"dh c #31316E",
+"di c #181831",
+"dj c #232349",
+"dk c #272739",
+"dl c #393979",
+"dm c #4C4C85",
+"dn c #2F2F83",
+"do c #28285B",
+"dp c #292952",
+"dq c #48486D",
+"dr c #23234C",
+"ds c #37377A",
+"dt c #1E1E3D",
+"du c #26265C",
+"dv c #313174",
+"dw c #4C4C60",
+"dx c #27273F",
+"dy c #3C3C78",
+"dz c #48485C",
+"e` c white",
+"ea c #383874",
+"eb c #333379",
+"ec c #444458",
+"ed c #272756",
+"ee c #47477C",
+"ef c #32326E",
+"eg c #1B1B33",
+"eh c #1E1E2C",
+"ei c #30306C",
+"ej c #40407F",
+"ek c #292944",
+"el c #212150",
+"em c #23233E",
+"en c #141422",
+"eo c #343473",
+"ep c #323271",
+"eq c #2D2D76",
+"er c #2E2E6D",
+"es c #40406E",
+"et c #21213F",
+"eu c #272731",
+"ev c #8080BA",
+"ew c #23232D",
+"ex c #25255A",
+"ey c #1B1B39",
+"ez c #35356D",
+"f` c #191937",
+"fa c #262651",
+"fb c #313169",
+"fc c #2C2C6E",
+"fd c #22224D",
+"fe c #18182C",
+"ff c #373786",
+"fg c #2D2D65",
+"fh c #232344",
+"fi c #2B2B63",
+"fj c #292961",
+"fk c #27275F",
+"fl c #202037",
+"fm c #1C1C33",
+"fn c #242452",
+"fo c #45456F",
+"fp c #484868",
+"fq c #535380",
+"fr c #1F1F43",
+"fs c #2C2C5D",
+"ft c #3535DD",
+"fu c #353573",
+"fv c #262657",
+"fw c #393963",
+"fx c #242455",
+/* pixels */
+"````````````````````````````````bsbsbsdwbs``````````````````````````````",
+"````````````````````````dwbsdwcqcxbscqdwcqcxdzcxbs``````````````````````",
+"````````````````````fpcxawcqawcqawawcqawfocqcqawfpcqcx``````````````````",
+"``````````````````ececfpfpbofodqdqdqesbababadqfobafpeccj````````````````",
+"``````````````dfeccjabcgesbobaabadcgabbaeefobaesbob`cgdfcjcj````````````",
+"````````````cjdfbvcgfwfwcgcgesbrevdbcdeeesdedbfwdbcgcpbvbvdfcj``````````",
+"``````````bdbvbvcg`ccpcwdecwayckcdeecddydcbrezdecpayfwb`ar`ncjbd````````",
+"```````````saecmcscpcscwbwaqayeaevfqdyckbtdefbcpeicscbcscpb`cmae````````",
+"`````````scvbjcmar`pcsfb`fbt`fcidmdecdcdefdyezaqbraz`farasasarek`s``````",
+"``````bnaecmdjayb`fscsbwaqfbbwdyaacddheacdfudbfbbrbtfbaqbzcsdpafcmcn````",
+"```````s`zbj`basfs`fbr`f`wdcepeqcfcdfue`dmdvcdbkbkbrfb`fbwbjcaaect`z````",
+"`````taeaoccdrcsfdfgbwbr`ubb`oadebdndvebe`eadsejbyavfgcwbtcsdjbjaeddbf``",
+"````eudidjbzdp`pbzbwbbefeperfjdabldadada`qcfdveofi`wfb`fay`ped`aeteg`k``",
+"`````yflfadpcsfs`lbrdcav`wcfeoepdsda`qbqebdydsepfiaveabwbz`maybc`abufe``",
+"````fmek`aararaiambwbyefcfcfbqfkeqejds`gft`qeofuclfkbw`ubibtcs`bcv`vfe``",
+"```ydi`v`xdpbzamaxaqfkavererbkfffcfc`hdaeqdscffudcclbkfgapanayaodpczeg`t",
+"``atbpao`adpbzdo`mfgbtepereperfcbqft`g`hffbqbkdlfucleiaqfbdg`bctfrfmfea`",
+"```yetfh`xdpelfbfsfbaz`mdsci`gblffdneqftebda`hdafjfjfgbybwdgardr`xdia`at",
+"``ateheycccredfsaxfgcibbeffjejdafc`g`heqblfjepclazazap`wfscbbz`jacfrflat",
+"``atczey`v`afsacfsdgco`lbb`gebffereqft`qffdaer`wfgfifififjbzcu`i`adda`at",
+"````a`dtcy`xdrcrexfxfvfgeabkbbdhffadejdndnblclepapdubhaqfvcefn`xdtegfe``",
+"````a`dieybxfnbx`jfsfxfkfgfgdheoev`qdncdfcdlfjfi`wfiapcuchaubzaceydiat``",
+"````atdifr`abz`bbzbranaifneifufidyckejepckffepfibyaianancu`bbgbgagegen``",
+"````atczegeyf`bgascrcrelchanefdyfieaaa`qaq`uexduanbhfxaicecraoemajfea```",
+"```````tfebedtccaled`dcoaqdoamdeaiandydyaifi`mfbaqfdfnbh`pagfrddfmfe````",
+"```````t`reydidjagbzaxchanfnaianchch`lbhcoaichauc`chdoelbgbgbcegfm`r````",
+"`````````reyaoacetcrfn`afd`ffvchc`fvbjaianfvco`bdrdgbz`e`vbe`zeyeg``````",
+"```````````regacem`vccfnbxc`cu`jbifnfvcoc`bi`ich`adjac`xflajemew````````",
+"``````````ewbpbpdtaobcbc`jchbic``ac``afafafnfd`jfncybcdxdkbedd`r````````",
+"````````````d`ddbeakfh`kdrfd`b`b`jcudged`bcacvct`dcyccddewd``r``````````",
+"``````````````eubndddxdxakaecvcaae`ecaagaecvafcabcfhbp`keucn````````````",
+"``````````````````d`flem`z`s`v`kbc`bekaeagaeetafekd`bmbf````````````````",
+"`````````````````````s`zdk`zae`kdxakaeekek`zekbfdkd`bn``````````````````",
+"````````````````````````bnbmd`dkdk`sbndxd`bmbfbnah``````````````````````",
+"````````````````````````````````cnbneu`sah``````````````````````````````",
+"````````````````````````````````````````````````````````````````````````"
+};
+/* XPM */
+static char *glass8[] = {
+/* width height ncolors chars_per_pixel */
+"44 44 189 2",
+/* colors */
+"`` c None",
+"`a c #27274E",
+"`b c #25254C",
+"`c c #383858",
+"`d c #23234A",
+"`e c #212148",
+"`f c #2E2E62",
+"`g c #292967",
+"`h c #3535A1",
+"`i c #272751",
+"`j c #23234D",
+"`k c #29293F",
+"`l c #2C2C63",
+"`m c #2A2A61",
+"`n c #33334C",
+"`o c #353579",
+"`p c #272754",
+"`q c #414188",
+"`r c #20202C",
+"`s c #2E2E3D",
+"`t c #1C1C28",
+"`u c #2E2E68",
+"`v c #242447",
+"`w c #2C2C66",
+"`x c #222245",
+"`y c #181824",
+"`z c #25253E",
+"a` c #161622",
+"aa c #B9B9ED",
+"ab c #3E3E67",
+"ac c #1C1C3F",
+"ad c #6767A3",
+"ae c #2B2B47",
+"af c #272743",
+"ag c #222248",
+"ah c #292931",
+"ai c #29295C",
+"aj c #1D1D39",
+"ak c #252544",
+"al c #1E1E47",
+"am c #2B2B61",
+"an c #29295F",
+"ao c #1F1F3E",
+"ap c #2F2F68",
+"aq c #2D2D66",
+"ar c #30305F",
+"as c #2C2C5B",
+"at c #11111C",
+"au c #262655",
+"av c #31316D",
+"aw c #4C4C6D",
+"ax c #222251",
+"ay c #323264",
+"az c #2D2D69",
+"b` c #33335B",
+"ba c #43436E",
+"bb c #2B2B67",
+"bc c #212146",
+"bd c #37374B",
+"be c #22223D",
+"bf c #252536",
+"bg c #1D1D42",
+"bh c #2A2A5C",
+"bi c #28285A",
+"bj c #2B2B53",
+"bk c #333372",
+"bl c #2F2F6E",
+"bm c #2B2B3F",
+"bn c #2C2C36",
+"bo c #424266",
+"bp c #232337",
+"bq c #2F2FB0",
+"br c #34346C",
+"bs c #525265",
+"bt c #32326A",
+"bu c #1B1B2F",
+"bv c #3B3B55",
+"bw c #303068",
+"bx c #21214C",
+"by c #2C2C64",
+"bz c #292957",
+"c` c #232351",
+"ca c #26264A",
+"cb c #2F2F60",
+"cc c #202044",
+"cd c #5D5D97",
+"ce c #2B2B5C",
+"cf c #363674",
+"cg c #3C3C66",
+"ch c #252556",
+"ci c #30306E",
+"cj c #3E3E54",
+"ck c #414178",
+"cl c #2C2C6A",
+"cm c #2F2F4F",
+"cn c #25252E",
+"co c #27275B",
+"cp c #363663",
+"cq c #4C4C68",
+"cr c #20204A",
+"cs c #2E2E5B",
+"ct c #29294C",
+"cu c #242451",
+"cv c #27274A",
+"cw c #343464",
+"cx c #4F4F64",
+"cy c #252548",
+"cz c #16162C",
+"d` c #292938",
+"da c #333384",
+"db c #3C3C6F",
+"dc c #353572",
+"dd c #1E1E37",
+"de c #38386B",
+"df c #414156",
+"dg c #242454",
+"dh c #31316E",
+"di c #181831",
+"dj c #232349",
+"dk c #272739",
+"dl c #393979",
+"dm c #4C4C85",
+"dn c #2F2F83",
+"do c #28285B",
+"dp c #292952",
+"dq c #36366C",
+"dr c #48486D",
+"ds c #23234C",
+"dt c #37377A",
+"du c #20203F",
+"dv c #1E1E3D",
+"dw c #26265C",
+"dx c #313174",
+"dy c #4C4C60",
+"dz c #27273F",
+"e` c #3C3C78",
+"ea c #48485C",
+"eb c white",
+"ec c #383874",
+"ed c #333379",
+"ee c #444458",
+"ef c #272756",
+"eg c #47477C",
+"eh c #32326E",
+"ei c #1B1B33",
+"ej c #1E1E2C",
+"ek c #30306C",
+"el c #40407F",
+"em c #292944",
+"en c #212150",
+"eo c #23233E",
+"ep c #141422",
+"eq c #343473",
+"er c #323271",
+"es c #2D2D76",
+"et c #2E2E6D",
+"eu c #40406E",
+"ev c #21213F",
+"ew c #272731",
+"ex c #8080BA",
+"ey c #23232D",
+"ez c #25255A",
+"f` c #1B1B39",
+"fa c #35356D",
+"fb c #191937",
+"fc c #262651",
+"fd c #313169",
+"fe c #2C2C6E",
+"ff c #22224D",
+"fg c #18182C",
+"fh c #373786",
+"fi c #2D2D65",
+"fj c #232344",
+"fk c #2B2B63",
+"fl c #292961",
+"fm c #27275F",
+"fn c #202037",
+"fo c #1C1C33",
+"fp c #242452",
+"fq c #45456F",
+"fr c #484868",
+"fs c #535380",
+"ft c #1F1F43",
+"fu c #2C2C5D",
+"fv c #3535DD",
+"fw c #353573",
+"fx c #262657",
+"fy c #393963",
+"fz c #242455",
+/* pixels */
+"````````````````````````````````````````````bs``````````````````````````````````````````",
+"````````````````````````````````dybseabsawbsbscxawcxbsdybs``````````````````````````````",
+"````````````````````````````eedycqcqcqdrcxawcqawawawawfrfrcxcq``````````````````````````",
+"````````````````````````eadyfrdybafrfqawawfqdrawawfrfrdrawcqeaeeee``````````````````````",
+"````````````````````eeeebofrboawbofqdrbadrfqeufqfqbababafqfrbobobocjee``````````````````",
+"``````````````````dfeebvfybvcgbaboeueueueuababfqdefqegeuabeufybocgdfeacj````````````````",
+"````````````````bvbo`nfydffybocgcgdedbegfsfqeuegexeudbdqdedbdeabfybvcjdfcj``````````````",
+"``````````````bdcjbvfyfyb`defyfydedbckexexebckdmaqdbdbdbayaydeaycpbvab`ccjbd````````````",
+"`````````````s`ccjb`b`b`b`ardededeaydcexadckaddbdbaadqdqbrbtbrayb`cpb``c`ccm`n``````````",
+"```````````n`n`ncmcsb`cpascpegfi`ucwbrcdcdebehaddbbrdmfaayaqcbb`arcscs`ccmb`ae`s````````",
+"``````````aeafcmaeasfu`paraycbbtfd`lavecckegcdcdaaec`qfa`ufa`f`ubwarbzb`cscs`kbm````````",
+"````````ewaectfjbzcsb`arcwbtdcapec`fdcaadmcd`ueqaddmekecav`fapbtecbwdparbjcmaoct`n``````",
+"````````bddzcmbjdparcscb`fdbfdfidcdlcieqbbdlciebexeletegbwbk`ubtbwfufucsdpcm`zctbm``````",
+"```````ycmdjdpctauaramefcsbwapehekereddleledcfdmdmdmerelecaqaqbrehcbbzarfc`vbjcyem`r````",
+"``````bpaobefjccbzasenbw`ufafdblcl`oeldldnbqededdtcdbkdldlet`lekamcbbw`fbjauctdp`zfn````",
+"`````yfoaj`bbzeodsfibhbrekavcfcletfldneddxeddadtdadmbkerercleh`ubwbwcbbzarbhdpfjdiei`t``",
+"````atfoemfcdpbzasfi`ffadcekbkazeqerbkerdadtdmfhbqdldleddxfkfdapdcfdfcam`pbz`e`ifoepa```",
+"````a`dd`v`bbzbjefdw`lbwbtehdceccf`hfeerbqfhedesbqfvdlcifwcifldhbrficbficsefcc`v`xajbp``",
+"````fnfgeo`vfubzbwdwco`ufm`m`ucfbler`ofh`hfveddndnbqdldldtcffmbkbwapbwaiefaybgctczfgei``",
+"`````yczacaodpbjayfxcobwapbkehdhblerdtdnfe`hbqfhbqfedtcfeqecaqeqbwfiapanbhbr`zdjbcaofo``",
+"````atczf``bbzbzbhax`laqbwaqdhciblfeclfhfhdafmbqdabqdacidldtdhflcf`wby`fauef`vccakev`y``",
+"``ata`fnagccbzenbhfiaifdehezdhdlet`geteddnbqesfvedbqesdndabbfmfmbtbyamfufuasbcccdidiepat",
+"````fgfgao`dbg`e`falcobwfkfmdh`o`gcidnesdn`gdabqed`geteretblekazfk`u`fdocb`j`abgf`ev`y``",
+"`````yeicv`v`b`pamfcbhfxfidwetazazdx`q`heted`qfveder`get`wciekehchcodgbhffefeffcczbu`y``",
+"````epdvfjfj`acubzenanbifxbyaqci`w`gereleddnesehdnazdxbkcl`wfmfm`f`lfmayenau`bfceidia```",
+"`````ybuev`xcc`j`pfzaxau`jezekcferblcifhfhdmdmdldtfmblekdhekaq`fbififzbzftbidudvdifgbu``",
+"````atfgfoaobgal`pc`auamaxcoekapdcfwaqe`edeldnele`ekelfm`manapaqficubi`pdjfcacf`bgdvep``",
+"`````ya`f`ag`bdpasbcfubraibifmfmdhcfanekdcdmdtdhflexblcifkbyfiaifian`pau`pagbgbceicza```",
+"``````epdif`dubcefbgauenaxfmco`f`mecekfied`uavexfkbbaqfmdwanapcubifxffbgacftbef`di`y````",
+"``````a`czbuf`ddddbcfffcfcdgdoancofdezbwecfkap`wehaifmbtfiandwaxenbibzagf`ccbpaj`t`y````",
+"`````````yfoeyaceoevenfpffbx`mam`mbifpdwchapehaicocoamaibibtezfxdgfxeffjccfpeiddfg``````",
+"````````ej`rdidvaobzalbzfp`mauchfpfkezfkau`f`fdechchchfzbic`axbxfpauff`ebg`pejej`t``````",
+"```````````tf`f`ajal`zcrfpendsffaycochfzdgfzbjcoancofpdo`ben`affce`edjbcbebef`di````````",
+"```````````t`rf`dvaoeobcdu`ece`bfpencucofxbic`auc`dgficuef`bbxffbg`ebedddvaobfew````````",
+"````````````cnejbpaodvftdj`jcr`pcoen`j`jcu`ifcbifx`jc``jen`bbx`vccbe`z`zddddcn``````````",
+"``````````````ewbpddfbddaccycr`dfp`jfpca`jcu`dc`cacv`dff`d`d`x`dft`z`zbeejcn````````````",
+"````````````````fgfneoduembmfj`vag`act`bds`ac``j`j`acv`bbcagak`xdudvbpcn`t``````````````",
+"``````````````````ewd`fnaeakemcyaecvdjaeaecrcvdsakaeakafcy`jao`zfnd`cn`t````````````````",
+"````````````````````d`dkfndzd``zbm`v`k`b`ecvemaeca`vaedudz`zafew`kbfey``````````````````",
+"````````````````````````bfdkd`dz`kafdzae`vemcyafakakaedzdzbed`dkcn``````````````````````",
+"````````````````````````````ahdkbnbnbm`z`sdk`s`zd`bm`safd`bn`s``````````````````````````",
+"````````````````````````````````bnbn`sd`d`dk`sbmbnah`s`sah``````````````````````````````",
+"````````````````````````````````````````````cn``````````````````````````````````````````",
+"````````````````````````````````````````````````````````````````````````````````````````"
+};
+/* XPM */
+static char *glass9[] = {
+/* width height ncolors chars_per_pixel */
+"50 50 188 2",
+/* colors */
+"`` c None",
+"`a c #27274E",
+"`b c #25254C",
+"`c c #383858",
+"`d c #23234A",
+"`e c #212148",
+"`f c #2E2E62",
+"`g c #292967",
+"`h c #3535A1",
+"`i c #272751",
+"`j c #23234D",
+"`k c #29293F",
+"`l c #2C2C63",
+"`m c #2A2A61",
+"`n c #33334C",
+"`o c #353579",
+"`p c #272754",
+"`q c #414188",
+"`r c #20202C",
+"`s c #2E2E3D",
+"`t c #1C1C28",
+"`u c #2E2E68",
+"`v c #242447",
+"`w c #2C2C66",
+"`x c #222245",
+"`y c #181824",
+"`z c #25253E",
+"a` c #161622",
+"aa c #B9B9ED",
+"ab c #3E3E67",
+"ac c #1C1C3F",
+"ad c #6767A3",
+"ae c #2B2B47",
+"af c #272743",
+"ag c #222248",
+"ah c #292931",
+"ai c #29295C",
+"aj c #1D1D39",
+"ak c #252544",
+"al c #1E1E47",
+"am c #2B2B61",
+"an c #29295F",
+"ao c #1F1F3E",
+"ap c #2F2F68",
+"aq c #2D2D66",
+"ar c #30305F",
+"as c #2C2C5B",
+"at c #11111C",
+"au c #262655",
+"av c #31316D",
+"aw c #4C4C6D",
+"ax c #222251",
+"ay c #323264",
+"az c #2D2D69",
+"b` c #33335B",
+"ba c #43436E",
+"bb c #2B2B67",
+"bc c #212146",
+"bd c #37374B",
+"be c #22223D",
+"bf c #252536",
+"bg c #1D1D42",
+"bh c #2A2A5C",
+"bi c #28285A",
+"bj c #2B2B53",
+"bk c #333372",
+"bl c #2F2F6E",
+"bm c #2B2B3F",
+"bn c #2C2C36",
+"bo c #424266",
+"bp c #232337",
+"bq c #2F2FB0",
+"br c #34346C",
+"bs c #525265",
+"bt c #32326A",
+"bu c #1B1B2F",
+"bv c #3B3B55",
+"bw c #303068",
+"bx c #21214C",
+"by c #292957",
+"bz c #232351",
+"c` c #26264A",
+"ca c #2F2F60",
+"cb c #202044",
+"cc c #5D5D97",
+"cd c #2B2B5C",
+"ce c #363674",
+"cf c #3C3C66",
+"cg c #252556",
+"ch c #30306E",
+"ci c #3E3E54",
+"cj c #414178",
+"ck c #2C2C6A",
+"cl c #2F2F4F",
+"cm c #25252E",
+"cn c #27275B",
+"co c #363663",
+"cp c #4C4C68",
+"cq c #20204A",
+"cr c #2E2E5B",
+"cs c #29294C",
+"ct c #242451",
+"cu c #27274A",
+"cv c #343464",
+"cw c #4F4F64",
+"cx c #252548",
+"cy c #16162C",
+"cz c #292938",
+"d` c #333384",
+"da c #3C3C6F",
+"db c #353572",
+"dc c #1E1E37",
+"dd c #38386B",
+"de c #414156",
+"df c #242454",
+"dg c #31316E",
+"dh c #181831",
+"di c #232349",
+"dj c #272739",
+"dk c #393979",
+"dl c #4C4C85",
+"dm c #2F2F83",
+"dn c #28285B",
+"do c #292952",
+"dp c #36366C",
+"dq c #48486D",
+"dr c #23234C",
+"ds c #37377A",
+"dt c #20203F",
+"du c #1E1E3D",
+"dv c #26265C",
+"dw c #313174",
+"dx c #4C4C60",
+"dy c #27273F",
+"dz c #3C3C78",
+"e` c #48485C",
+"ea c white",
+"eb c #383874",
+"ec c #333379",
+"ed c #444458",
+"ee c #272756",
+"ef c #47477C",
+"eg c #32326E",
+"eh c #1B1B33",
+"ei c #1E1E2C",
+"ej c #30306C",
+"ek c #40407F",
+"el c #292944",
+"em c #212150",
+"en c #23233E",
+"eo c #141422",
+"ep c #343473",
+"eq c #323271",
+"er c #2D2D76",
+"es c #2E2E6D",
+"et c #40406E",
+"eu c #21213F",
+"ev c #272731",
+"ew c #8080BA",
+"ex c #23232D",
+"ey c #25255A",
+"ez c #1B1B39",
+"f` c #35356D",
+"fa c #191937",
+"fb c #262651",
+"fc c #313169",
+"fd c #2C2C6E",
+"fe c #22224D",
+"ff c #18182C",
+"fg c #373786",
+"fh c #2D2D65",
+"fi c #232344",
+"fj c #2B2B63",
+"fk c #292961",
+"fl c #27275F",
+"fm c #202037",
+"fn c #1C1C33",
+"fo c #242452",
+"fp c #45456F",
+"fq c #484868",
+"fr c #535380",
+"fs c #1F1F43",
+"ft c #2C2C5D",
+"fu c #3535DD",
+"fv c #353573",
+"fw c #262657",
+"fx c #393963",
+"fy c #242455",
+/* pixels */
+"````````````````````````````````````````````````````````````````````````````````````````````````````",
+"``````````````````````````````````````e`bscwbscwbsbsbsbsbsbsbscw````````````````````````````````````",
+"````````````````````````````````bse`bscpbse`awawcwbsbsdqawawbsdxdxcwcw``````````````````````````````",
+"````````````````````````````e`eddxfqcwcpfqfqawawdqawdqawawfqcwawawfqfqe`cw``````````````````````````",
+"````````````````````````cie`e`dxfqboboawfpfpdqfpbafpawfpdqbofpabdqfqfqedcfdee```````````````````````",
+"``````````````````````edede`cifqbodqabfpfpbabobaccbabafpbaddbaetfpfqabbobobodee`````````````````````",
+"````````````````````deedbvbvfxfxcfetboetfpcfewetddetetdaefetbaetabetbofxabcfedcici``````````````````",
+"``````````````````bdedbd`cabdefxababfxddetddcccjefbacjeaetddddcfdpdaddababb``cdeedde````````````````",
+"````````````````bvbdbvfx`cb`fxcfcffxdddaddefccaaeaefewbwdldadaddcoayddcvcfb``cbvbdbvci``````````````",
+"```````````````s`cbvbdb`b`b`cocvdddaddayf`braadlfrccdldzewdddaebddfcbwayfxcfb``cbd`cbd`s````````````",
+"````````````bd`sclclbjb`crb`arcofr`ubtbtfcdkaaewewdlcjdabtdabtcvddebayaycadoarb``c`n`ncl`s``````````",
+"``````````bdbv`c`ccub`b`b`ascrdp`fcadzaqbwfjebcjeaccewaaccdlfrdlegbw`f`lcab`crcrcrclclelbpbd````````",
+"``````````bnbmcuclclcrb``pararcv`ff`fcegf`dzewcjcjeqdleabkavf`fc`mbrcaegfcaycabjararcrae`sbm````````",
+"````````evaedycragcacvb`apcrasbwf``faybtavekewaddleqdkccccdkbrdzfcavapbrfhf`biascac`bjcuel`kbf``````",
+"````````aeae`vcldo`acrcacr`fbtddaqapebceckbleqdzdseqaaadekdwebdkavceapbrbt`fftamcrbybjaeclbpbp``````",
+"```````rfnbeakdocubzarfw`faiarbraqegejbkcheqeqekd``oefekewdzchekbkaqfhbtbkapcrcacr`j`vdocbbpfn`t````",
+"``````cz`zdoakbccbbyasdr`fap`uf`fcejck`obkdl`odmfudwecdwaadzbkdzdbaz`legaqftar`fcadofbdobjafdccm````",
+"``````bfehdc`aeefifbftaiambw`gavbkblck`gckd`eqecec`hfgd`addsepbkfvfkapazavf`fw`fbycrcd`a`vehbubp````",
+"`````tbuehdyfbasdocaapayayebebbteq`geqchfvdwecbqdkaddsfudwdzbkckdwfjbrapf`bwf`byfwbyasdr`iezbucy`t``",
+"`````yfnfieu`bdi`abydn`mfcf`f`egdbavdbec`odwcefgecdsd`dmbqepceeqf`az`wejdbbrambi`lcdft`bcbc``va`ei``",
+"````a`eoenfifsaycrbyfl`mfc`uan`webceebdmer`gdwbqdsdsdmdmbqekdkeccechckfkejegfhbiftarby`a`v`vfiffbu``",
+"````fmcycxdidt`iardpdnemanavflejazeqesepcefgblerfud`fgfderfgdkdsdkdzfkeqbkapapbt`lctfceuas`vcydhfn``",
+"````ehdheudtagbybjcabidnapapfcebejblchcheqer`hbqbqerbqfufgecdsebcedkbkbleqf`fjambicaaycu`vcxa`du`y``",
+"````fnfndhdtbgdobybifocnbwameqckdgeqeqfdesfdfgfgdwflfddmfufudwch`odschflejebdvayby`pee`vcbacfndcbu``",
+"````bube`vacfe`iembyfc`f`ufc`wdveqdkeqflfddwfudm`her`hd`fgbqecd`ecbbflfkfjapdvbwdnftas`jfifieh`yeo``",
+"````ffehdhdhdrcqalft`jembtai`wfkdg`obbesbldmfddm`gecfud`dmbbdw`ochbl`ufkap`weganaiar`j`j`ddu`adhff``",
+"````ffdcdrdtbj`a`pfhfebibh`legfkesapaqeq`obqbqfddkfu`hd`dwfkchdw`wcheq`ufjemfyaucdby`peectduezdhbu``",
+"`````tfadhag`v`iee`fcqfweefleyanaqfjazazebfg`g`qfu`hadcher`q`h`gazdwaibbap`lfw`waybxct`aagcbeueofn``",
+"````eoa`ffcbfididr`eaxeybzbhcgaqepdlbkckazeqds`qfueqfdblefeqdzchdg`wfheyamey`laibyalbiagdraodheheo``",
+"````at`ydhdh`dfsal`pfyalfyemeyey`waqdgazckepbkdw`qekepecfjdmejflazfj`ubw`lbiftaxee`beecbcbbcdu`ta```",
+"````a`a`a`ficbalcqeeauct`fcgdffyflejapds`wefdleradewegaaegeseqbr`lfl`u`megamamctfb`vfebc`deudceoat``",
+"``````eofffacb`abyftcbbybtfcanfwaidvapepap`wegazdzdlek`uerfgepdgfj`laqdncn`mbyfoct`p`vbgacezdhbu````",
+"```````yffdhfsficbeealbybxbiemcncnamflch`u`uccew`udgdlf``wdldbcgflanbweefycnaxeeacezfsdyfmdh`y`t````",
+"```````teoeiezajdcdc`ealeeai`jaxaiamcgavaiew`ucc`w`mandzanebflfcamfldvbiemdffw`pfeezcbdcbpeh`yeo````",
+"`````````tfffffmaoakdtalamfbdremfjamaiaidffraiddegdbfhancnbrdn`mamegfwaxfocgftct`x`efeezeifn`t``````",
+"````````ex`tehbeezdubydialcdaxcnbidndfbhfwbweydf`mandfcgdvananfyfofycncgcnaxfoacbg`e`pfadueiex``````",
+"```````````rbufndcajacfscbbycqfofodnaifhfyai`paxcnfweyddcg`pcgfwfofedifeaxbyalfs`j`kduehfmfm````````",
+"```````````yeifndhbefsao`vaxbxbxcsfebyfwbzfybidfcgbjfwaidnambibybzbx`afocdbc`vfidtezajbueha`````````",
+"`````````````y`r`rezduaocxficb`jfw`abz`jct`jdnfwbzfwdnaufofofw`afo`i`ddiducb`zdudcezdu`rex``````````",
+"``````````````evbudjfmajcbagbcctbcfwcgaufoct`afofb`afodf`jbzemfobx`dfe`val`xczdjbebpdccm````````````",
+"````````````````evcmezfneufsaoelcqcxctfeaufecsfectbxbzfeae`b`jdrc``b`x`ecb`zbpfmfmeiev``````````````",
+"``````````````````ffbubpfiafafbmbc`vag`bc`csdr`j`bct`jfefbcxcx`j`xdificxacbeenbfev`t````````````````",
+"````````````````````cmczczdy`zak`kcucucudrcuaecxc`cxdrcxaeelak`vc``jajakbpafbfbf`r``````````````````",
+"``````````````````````cmczbpdjdc`kcxelaoelakagbc`aaeel`bbxakakeu`zdtbm`zdjbpevbf````````````````````",
+"````````````````````````cmbfeibfbmeuel`kelelafelelakaeelaf`k`k`zdjbebm`zbncmah``````````````````````",
+"````````````````````````````czbnczbp`zafbmaedyafelbmdy`zdybeczdjczbf`kbpex``````````````````````````",
+"`````````````````````````````````sevdjbncz`zdj`sczcz`k`k`s`sdjbfahevbn``````````````````````````````",
+"``````````````````````````````````````evah`sbncz`kev`sbnczbnczah````````````````````````````````````",
+"````````````````````````````````````````````````````````````````````````````````````````````````````",
+"````````````````````````````````````````````````````````````````````````````````````````````````````"
+};
+/* XPM */
+static char *glass10[] = {
+/* width height ncolors chars_per_pixel */
+"60 60 189 2",
+/* colors */
+"`` c None",
+"`a c #27274E",
+"`b c #25254C",
+"`c c #383858",
+"`d c #23234A",
+"`e c #212148",
+"`f c #2E2E62",
+"`g c #292967",
+"`h c #3535A1",
+"`i c #272751",
+"`j c #23234D",
+"`k c #29293F",
+"`l c #2C2C63",
+"`m c #2A2A61",
+"`n c #33334C",
+"`o c #353579",
+"`p c #272754",
+"`q c #414188",
+"`r c #20202C",
+"`s c #2E2E3D",
+"`t c #1C1C28",
+"`u c #2E2E68",
+"`v c #242447",
+"`w c #2C2C66",
+"`x c #222245",
+"`y c #181824",
+"`z c #25253E",
+"a` c #161622",
+"aa c #B9B9ED",
+"ab c #3E3E67",
+"ac c #1C1C3F",
+"ad c #6767A3",
+"ae c #2B2B47",
+"af c #272743",
+"ag c #222248",
+"ah c #292931",
+"ai c #29295C",
+"aj c #1D1D39",
+"ak c #252544",
+"al c #1E1E47",
+"am c #2B2B61",
+"an c #29295F",
+"ao c #1F1F3E",
+"ap c #2F2F68",
+"aq c #2D2D66",
+"ar c #30305F",
+"as c #2C2C5B",
+"at c #11111C",
+"au c #262655",
+"av c #31316D",
+"aw c #4C4C6D",
+"ax c #222251",
+"ay c #323264",
+"az c #2D2D69",
+"b` c #33335B",
+"ba c #43436E",
+"bb c #2B2B67",
+"bc c #212146",
+"bd c #37374B",
+"be c #22223D",
+"bf c #252536",
+"bg c #1D1D42",
+"bh c #2A2A5C",
+"bi c #28285A",
+"bj c #2B2B53",
+"bk c #333372",
+"bl c #2F2F6E",
+"bm c #2B2B3F",
+"bn c #2C2C36",
+"bo c #424266",
+"bp c #232337",
+"bq c #2F2FB0",
+"br c #34346C",
+"bs c #525265",
+"bt c #32326A",
+"bu c #1B1B2F",
+"bv c #3B3B55",
+"bw c #303068",
+"bx c #21214C",
+"by c #2C2C64",
+"bz c #292957",
+"c` c #232351",
+"ca c #26264A",
+"cb c #2F2F60",
+"cc c #202044",
+"cd c #5D5D97",
+"ce c #2B2B5C",
+"cf c #363674",
+"cg c #3C3C66",
+"ch c #252556",
+"ci c #30306E",
+"cj c #3E3E54",
+"ck c #414178",
+"cl c #2C2C6A",
+"cm c #2F2F4F",
+"cn c #25252E",
+"co c #27275B",
+"cp c #363663",
+"cq c #4C4C68",
+"cr c #20204A",
+"cs c #2E2E5B",
+"ct c #29294C",
+"cu c #242451",
+"cv c #27274A",
+"cw c #343464",
+"cx c #4F4F64",
+"cy c #252548",
+"cz c #16162C",
+"d` c #292938",
+"da c #333384",
+"db c #3C3C6F",
+"dc c #353572",
+"dd c #1E1E37",
+"de c #38386B",
+"df c #414156",
+"dg c #242454",
+"dh c #31316E",
+"di c #181831",
+"dj c #232349",
+"dk c #272739",
+"dl c #393979",
+"dm c #4C4C85",
+"dn c #2F2F83",
+"do c #28285B",
+"dp c #292952",
+"dq c #36366C",
+"dr c #48486D",
+"ds c #23234C",
+"dt c #37377A",
+"du c #20203F",
+"dv c #1E1E3D",
+"dw c #26265C",
+"dx c #313174",
+"dy c #4C4C60",
+"dz c #27273F",
+"e` c #3C3C78",
+"ea c #48485C",
+"eb c white",
+"ec c #383874",
+"ed c #333379",
+"ee c #444458",
+"ef c #272756",
+"eg c #47477C",
+"eh c #32326E",
+"ei c #1B1B33",
+"ej c #1E1E2C",
+"ek c #30306C",
+"el c #40407F",
+"em c #292944",
+"en c #212150",
+"eo c #23233E",
+"ep c #141422",
+"eq c #343473",
+"er c #323271",
+"es c #2D2D76",
+"et c #2E2E6D",
+"eu c #40406E",
+"ev c #21213F",
+"ew c #272731",
+"ex c #8080BA",
+"ey c #23232D",
+"ez c #25255A",
+"f` c #1B1B39",
+"fa c #35356D",
+"fb c #191937",
+"fc c #262651",
+"fd c #313169",
+"fe c #2C2C6E",
+"ff c #22224D",
+"fg c #18182C",
+"fh c #373786",
+"fi c #2D2D65",
+"fj c #232344",
+"fk c #2B2B63",
+"fl c #292961",
+"fm c #27275F",
+"fn c #202037",
+"fo c #1C1C33",
+"fp c #242452",
+"fq c #45456F",
+"fr c #484868",
+"fs c #535380",
+"ft c #1F1F43",
+"fu c #2C2C5D",
+"fv c #3535DD",
+"fw c #353573",
+"fx c #262657",
+"fy c #393963",
+"fz c #242455",
+/* pixels */
+"````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````",
+"````````````````````````````````````````````````bsbsbsbsbsbsbsbsbsbsbscxbs``````````````````````````````````````````````",
+"``````````````````````````````````````````dycxdydycxawawawbsbsbsawcxcxcqdycxcxbs````````````````````````````````````````",
+"````````````````````````````````````dyeacxfrawcqawfrawcqcxawcqawawawawawawfrfrcxcqeabs``````````````````````````````````",
+"````````````````````````````````dfeadydyawcqawawfrcqawawdrawcqawawfqawcqcqfrawawfrdyeaeadf``````````````````````````````",
+"``````````````````````````````eadyeadyfreedrboawfqfqfqdrfqeufqawbaawbabofqeufqdrcqfreeboeadf````````````````````````````",
+"``````````````````````````dydffrbocjfrfrdrfrfrfqfqbabofrfqfsbaeubafqfqcgeubafqdrbaabbobobocjeedf````````````````````````",
+"````````````````````````dfeeeadffyboeecgeufrfreufqeueueucgbaeubadrdbbacdbaeucgbabocpboboabboeaeebd``````````````````````",
+"``````````````````````bdbdcjbd`cfyeefybaabcgfyeubaabdmfseudbdefsaackdbeudebaeudedebocgbofyfycjcjeecj````````````````````",
+"````````````````````cjdfabbvb`cg`cfyfyfycgabcgdeckbrfscddecdcddmdmfsabdeeucwcpdbdbcgcgcp`cbvbvcjbvbdcj``````````````````",
+"``````````````````bdbddfbv`ccgfyb`cgcgcpfycwdedbdbcdadcdexexckcd`u`uegdedbdbaycpaydecpcpb`bvfybvbdcj`s`s````````````````",
+"````````````````dfbdcjbvbd`c`c`cb`cpcwcgdededqayfabrcdexdbcdcdcddeexebbrdbecdedqcwfdaycpcgarb`b`bd`cbd`sbd``````````````",
+"```````````````sbdbd`n`ncmcscsarcscwcpdbbtbwbwbtbrfaebexegexaddbdeeceldqbrbrdqbtbkaybt`fbjcscpb`b``ncmctbdbd````````````",
+"``````````````aebd`c`ncmcsb`cwayascsdebraybwbrfdbtazdmdeexaddladexckdedmdme`btay`lcbcscwarasfucpb`cmcmae`nbd````````````",
+"`````````````saeeo`nbjcmcsarar`paycsbtcb`fbrbtfkfdciecdmdqebcdaacddmece`elbrazfabr`f`wbwbtarbzcsascsarbjbm`kbn``````````",
+"``````````ewd`ae`z`c`zbjcsb`cscscwcwbrbravbtecbrfackaadmckexavciexdme`bkfabtapanbr`ffabtfdbtdpcscsbjbjdpbeae`s`s````````",
+"``````````ahcm`kcm`bdparaycsay`fcscsfdbrfibwbtbrfdeqcd`qdmelbkeldmexdmeqdce`faerdcapbtbwfa`waucscscvdpdpafcmae`n````````",
+"````````cncmaeakcmct`adpcsarcbcbbwdqdeapamdcehcfclbldlbldmeqeradexade`esecelehehdc`ubrbrbtfucsbhcsas`actbecmbpbpey``````",
+"````````ejbpeo`vctcv`abzb`ef`ffxfucbbwapbldcdheqetesdlfwdmescfcddmdmdmbkbleldldhaq`ubrfabtcbcsbtcs`pcccycm`veobe`t``````",
+"`````````rae`aajevdjdsasas`jbifiapbrbtav`uapclcfdlad`odndnfvdxededexegeceqe`e`cfbybydcbrfmcwcbfdcbbjdjca`bcv`zdd`t``````",
+"``````ej`rbu`vcvcv`vcyfcbzefbz`f`uclapfderfeerclerdldlerdada`hedfhe`aacferdtcfciazapfk`ubramcbfuararbzfc`zaeaofo`t`r````",
+"``````bpfodibedsdp`jcs`abwbh`lfadccidcecerclet`gfe`hdxdx`hededdt`hdaelcfereterer`wbk`ubtfdbtef`fefcb`paudpbcdiczdi`y````",
+"``````ejddddemfcbjefcscs`faycedcececapciazcieqbldterdxdnbqelcdfhfv`h`oe`ererdnetfkfdekfabwbtfubifxfcar`affdpf``yepfo````",
+"`````tej`ycyevcuctftbzefdoaiapaqbrbrehfw`udcfwda`oerekfhfhdxdtdaes`hbqfwcferbkehflfkekcffabwfuco`lbzcsbzftbccaevfneja```",
+"````atddddem`xaocscsar`pdwdwfibwapbyapeccfdlcf`hdnfmbl`hfhdtdt`hclfvbq`qfhdxbkcfcl`gfkehfa`ufufpamaycsaydjcc`v`vfoepat``",
+"````ejfgbucy`vccceaseffdfldgai`ubbfzfdazazcfblereqdt`hdnbq`hedbqfedndndte`dtdtdletfmdhehfkapapbt`mdgfubzacdp`xf`dicz`y``",
+"````budddi`x`vevdpcsbzcwfxai`mapfdflfaavblercibkcffhcl`gfvfvfvdadaedclcfcfdteqecdcfkercfav`lbt`famchfdcsbe`bcaczfjbefg``",
+"````a`buepccevcrdpbzbzcbfxbifdfififacfekazereretblfe`hfhbqesesdnfh`h`hbq`hfwecdldcerclavecaqaqfifxbhbzbzcv`xfjfodufnat``",
+"````atepbufodualfcdp`lauauchfi`lapek`gcicieretfecl`gfhed`hesfm`gfefvfvfvdxbl`oederetfm`wdlfkfxaybzau`d`j`xduf`fgdufga```",
+"`````yepddfjacccbz`benamfd`f`mfdbr`mdwcidtcfclfmfebldadneddnesdadadx`hdaededdaclflfmflfmehbyaiaydofuarasftccfjdidiei`t``",
+"````a``yczczfbbcbc`bacficucraqfdanfkflaz`oehbbesbldndxfefefeesfvbqbqdnbbdtedciciazaqfkazaz`ubw`laicbas`pdjcccc`advddat``",
+"````fo`yddccf`fcalcefucbcufpbi`fbyav`wazbt`ucldxed`hblescldn`hbqdndncl`gazedazazazfw`wekfzanameffucbbzbxbz`jf`fbevbuep``",
+"````at`yfbaccy`a`bdsceaiffbzbichfi`manekaq`uclbkcffheletfvesfh`hesdx`qclci`gfkapap`wekapezanfzaifubxeffcfc`bdubufgepat``",
+"````a`czdvf`bcdv`bffbzbicrax`fbiezcofifiekbkfk`geredeserbqdndndtadfhazcfblfecl`u`laiflaq`f`lez`ucbdgff`j`bdpccdddiepep``",
+"````atczdidvaocy`v`edsbcaxdwbxfzefchameqecdlbl`gazdh`qfhaaadelesfhdaflblbkblerazapfidwbhchaqdobibzalfp`pccbgdveiczepat``",
+"````a`epfoczdi`dccac`jaufzcraxaubxdwez`wfkehekbbclbkelaa`obqeleddldafkdmekfm`wfk`wfibwfidobhaiaxef`j`pdsbcacbcaodiddat``",
+"``````eifgczevccfbau`jefdgffbhamaxfxezfd`w`l`odl`udcbk`wdneldtegadaaazetdlfmanan`waqfkehfifpbic``p`dbzagftao`vdifbfg````",
+"``````a``yfgdv`b`v`ifcbz`b`ibwbtamfxfxfmfxekdhcfby`lciehec`wdlaverapcdecelaz`lby`lfidofiap`mcefxfp`idsagbcagajeicza`````",
+"``````ata`czfbdv`vdjceasac`ibiamfian`maifxanazehave`apekehap`uege`ecazcfbkekdwfkfifiauchefbiencuftbcdvfbfof`fbdi`y`y````",
+"`````````yczbudvdvdvfbcubgfcaucrbicraxfzchco`wekfke`aqflav`uaa`udm`u`w`uamfzchfmanameffpdgaidgfpaldvaoevf``zfbfgbu``````",
+"````````a``tejeif`ajddajdsccbz`pbi`jfpdoanfzanbtai`f`ufkfkdq`lanebexaidcfme`fafiancodgenenbiai`pcracccf`bpddbufg`t``````",
+"`````````t`yfgfgbpacaoakdubgbiauffdsenanfidoamaidgcdcoezbtecdc`mdmanbifidoanan`uapfzaxfpfpbhcecr`xbcbgbxddbufoej`t``````",
+"```````````t`yfoddaodidv`i`xaleffpc`chfxamchezaichezfmfzanbwanfpcb`famfkanfxfzezcoanbifxc`ffefacbgccacf`ddddej`t````````",
+"```````````tcnfobpdvbgdvbgbxftefbibxaiaudofzaxfichanfxfpfxezananfxchdgefezfzfxcuc`crdsfpcubz`jft`eeofcfbfoejfg`r````````",
+"````````````eyfgbudiaoajbgdvbecrfpfpff`bffefbwaichchdgdgbhdgbjbidoaicofxfpaicubxds`afpdgas`e`vduag`z`zajdibuey``````````",
+"```````````````t`rbuddeodvft`zalbccr`ec``bc`auenfp`jezchfxaidpc`fxdgfpfiamfcdgfxcvcrfcfpalcr`zbeajf`dvajbfey````````````",
+"```````````````rbfbpfofbbgdvaffjfjcc`jfxbxfcc``b`bdsbiau`jc`biaibifxfpfcch`afpc``d`d`vdvfjfj`zdvajfbdvbp`tcn````````````",
+"````````````````cnfnfnbpfnaoftftdj`ecuftfpaubidgfp`j`bfcfpfc`afpdgc``jfpencuc``b`j`e`vcrevdkdzewbefnfobfej``````````````",
+"``````````````````bffnfnajfodvddccftaf`e`b`jdgcuai`jcv`jc`fcdj`jbxcvcvdsdsbxbxdjcr`xbxdjft`z`zddbefnbf`r````````````````",
+"````````````````````d`eyewbeduak`zfjemcads`dfp`jdj`b`bcu`jcudgfpefds`bcacacvctct`dagak`xaoddbeeybpfn`r``````````````````",
+"``````````````````````eyfnbpdkdz`z`zbmakfj`bag`v`dctctctctem`d`ecvctaeaeafcu`v`ecc`zakafbp`kbpewbfew````````````````````",
+"````````````````````````eyeybfbpdk`zemcvcyafemakcvcvaeaeffdjcvcv`j`vae`vemaf`vagcc`z`z`zeodkbfd`ey``````````````````````",
+"``````````````````````````cnbnfobe`kbe`kevemdzfj`k`z`b`edjctaeaeemds`eaf`vevdzdjafemd`dk`zbfd`ey````````````````````````",
+"``````````````````````````````bncneybf`kbeaf`kememem`kcvafemakaeaeakemem`kdk`z`kbebm`zd`d`ah````````````````````````````",
+"````````````````````````````````ahcnewd`dk`z`zaeaf`kaf`k`vemaedzcvakak`z`kdzd`dkdkbmbfbnah``````````````````````````````",
+"````````````````````````````````````cncnbf`z`sd``s`k`z`s`zbm`s`kd`d``s`s`k`kd`ahd`bncn``````````````````````````````````",
+"``````````````````````````````````````````bnd``s`s`kbnd`d`bfd``kbnbnd`bnd`ewahbn````````````````````````````````````````",
+"````````````````````````````````````````````````ahbnahbnd`ewdkbfewahahewbn``````````````````````````````````````````````",
+"````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````",
+"````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````"
+};
+/* XPM */
+static char *glass11[] = {
+/* width height ncolors chars_per_pixel */
+"72 72 189 2",
+/* colors */
+"`` c None",
+"`a c #27274E",
+"`b c #25254C",
+"`c c #383858",
+"`d c #23234A",
+"`e c #212148",
+"`f c #2E2E62",
+"`g c #292967",
+"`h c #3535A1",
+"`i c #272751",
+"`j c #23234D",
+"`k c #29293F",
+"`l c #2C2C63",
+"`m c #2A2A61",
+"`n c #33334C",
+"`o c #353579",
+"`p c #272754",
+"`q c #414188",
+"`r c #20202C",
+"`s c #2E2E3D",
+"`t c #1C1C28",
+"`u c #2E2E68",
+"`v c #242447",
+"`w c #2C2C66",
+"`x c #222245",
+"`y c #181824",
+"`z c #25253E",
+"a` c #161622",
+"aa c #B9B9ED",
+"ab c #3E3E67",
+"ac c #1C1C3F",
+"ad c #6767A3",
+"ae c #2B2B47",
+"af c #272743",
+"ag c #222248",
+"ah c #292931",
+"ai c #29295C",
+"aj c #1D1D39",
+"ak c #252544",
+"al c #1E1E47",
+"am c #2B2B61",
+"an c #29295F",
+"ao c #1F1F3E",
+"ap c #2F2F68",
+"aq c #2D2D66",
+"ar c #30305F",
+"as c #2C2C5B",
+"at c #11111C",
+"au c #262655",
+"av c #31316D",
+"aw c #4C4C6D",
+"ax c #222251",
+"ay c #323264",
+"az c #2D2D69",
+"b` c #33335B",
+"ba c #43436E",
+"bb c #2B2B67",
+"bc c #212146",
+"bd c #37374B",
+"be c #22223D",
+"bf c #252536",
+"bg c #1D1D42",
+"bh c #2A2A5C",
+"bi c #28285A",
+"bj c #2B2B53",
+"bk c #333372",
+"bl c #2F2F6E",
+"bm c #2B2B3F",
+"bn c #2C2C36",
+"bo c #424266",
+"bp c #232337",
+"bq c #2F2FB0",
+"br c #34346C",
+"bs c #525265",
+"bt c #32326A",
+"bu c #1B1B2F",
+"bv c #3B3B55",
+"bw c #303068",
+"bx c #21214C",
+"by c #2C2C64",
+"bz c #292957",
+"c` c #232351",
+"ca c #26264A",
+"cb c #2F2F60",
+"cc c #202044",
+"cd c #5D5D97",
+"ce c #2B2B5C",
+"cf c #363674",
+"cg c #3C3C66",
+"ch c #252556",
+"ci c #30306E",
+"cj c #3E3E54",
+"ck c #414178",
+"cl c #2C2C6A",
+"cm c #2F2F4F",
+"cn c #25252E",
+"co c #27275B",
+"cp c #363663",
+"cq c #4C4C68",
+"cr c #20204A",
+"cs c #2E2E5B",
+"ct c #29294C",
+"cu c #242451",
+"cv c #27274A",
+"cw c #343464",
+"cx c #4F4F64",
+"cy c #252548",
+"cz c #16162C",
+"d` c #292938",
+"da c #333384",
+"db c #3C3C6F",
+"dc c #353572",
+"dd c #1E1E37",
+"de c #38386B",
+"df c #414156",
+"dg c #242454",
+"dh c #31316E",
+"di c #181831",
+"dj c #232349",
+"dk c #272739",
+"dl c #393979",
+"dm c #4C4C85",
+"dn c #2F2F83",
+"do c #28285B",
+"dp c #292952",
+"dq c #36366C",
+"dr c #48486D",
+"ds c #23234C",
+"dt c #37377A",
+"du c #20203F",
+"dv c #1E1E3D",
+"dw c #26265C",
+"dx c #313174",
+"dy c #4C4C60",
+"dz c #27273F",
+"e` c #3C3C78",
+"ea c #48485C",
+"eb c white",
+"ec c #383874",
+"ed c #333379",
+"ee c #444458",
+"ef c #272756",
+"eg c #47477C",
+"eh c #32326E",
+"ei c #1B1B33",
+"ej c #1E1E2C",
+"ek c #30306C",
+"el c #40407F",
+"em c #292944",
+"en c #212150",
+"eo c #23233E",
+"ep c #141422",
+"eq c #343473",
+"er c #323271",
+"es c #2D2D76",
+"et c #2E2E6D",
+"eu c #40406E",
+"ev c #21213F",
+"ew c #272731",
+"ex c #8080BA",
+"ey c #23232D",
+"ez c #25255A",
+"f` c #1B1B39",
+"fa c #35356D",
+"fb c #191937",
+"fc c #262651",
+"fd c #313169",
+"fe c #2C2C6E",
+"ff c #22224D",
+"fg c #18182C",
+"fh c #373786",
+"fi c #2D2D65",
+"fj c #232344",
+"fk c #2B2B63",
+"fl c #292961",
+"fm c #27275F",
+"fn c #202037",
+"fo c #1C1C33",
+"fp c #242452",
+"fq c #45456F",
+"fr c #484868",
+"fs c #535380",
+"ft c #1F1F43",
+"fu c #2C2C5D",
+"fv c #3535DD",
+"fw c #353573",
+"fx c #262657",
+"fy c #393963",
+"fz c #242455",
+/* pixels */
+"````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````",
+"``````````````````````````````````````````````````````````````bsbsbsbsbsbsdydybsbsea````````````````````````````````````````````````````````````",
+"``````````````````````````````````````````````````````eabsbsdybsbsbsbsbsbscqcxbsbsbsbsbscxdy````````````````````````````````````````````````````",
+"````````````````````````````````````````````````dydybsbsdycqcqdycxbsbsfrcqcxdyfrcqcxcxbseacxcxbsbs``````````````````````````````````````````````",
+"````````````````````````````````````````````eaeaeafrcqawawawdrdrawcxawawcqcqawawawawawbscqfrfrdycxcxea``````````````````````````````````````````",
+"````````````````````````````````````````frdfcxcqawcqcqawawfrcqdrawfrawawcqawawawfqawcqawcqdrawdrfrdycqdycx``````````````````````````````````````",
+"````````````````````````````````````eeeaeaeadycqdffrboboawfqfqfqdrdrfqbabadrdrdrdrbobodrdrbaawdrdyfreaeaboeeee``````````````````````````````````",
+"``````````````````````````````````eeeefreeeefrbofrfrbofrfqeudrbadrfqdrfqeubabababababafqdreufqfrbafrfreeeeeacjdf````````````````````````````````",
+"``````````````````````````````eecjboeebocjboboababboabdrfsfqfqbabobobafqfqawdrfqawbaeueudrdebafrbocgbobobobodfdfcjbd````````````````````````````",
+"````````````````````````````dfeeeedfcjbvab`ccgfyeuabboabbabaabdbadeucgdeabbabadbegfqfqfqbaeueueubobob`bocgcgdfeacjcjcj``````````````````````````",
+"``````````````````````````cjbddfcjbv`ccgdffycgfqbofyfyabdbeuabfqexbaeueudefqexadckdbbadedebaabdedeeufyboabcpfycjdfdfeecj````````````````````````",
+"````````````````````````cjcjdfdfbvb`cg`cfyfyfyfycgabcgdeeudbbregexdbdbadcddmegexeucgdedbdbayfydbdbabcgfycpb`bv`cbvcjdfbdcj``````````````````````",
+"``````````````````````bdbdcjbvbvfy`c`cb`cpcgfyfyfycpdededbdeegexdmaaebexckaadm`ucddbdedbdbcwcpcpfddedeb`fyb`bvfycjcmbdcj`s`s````````````````````",
+"````````````````````bd`nbvbvbv`ccg`c`ccscpcwcwcgdebrcwbraydqckdbcdegegcdcdade`btdcadbrdqfabrdebrcpbwaycpfyfyb``car`n`nbdcjbnbd``````````````````",
+"```````````````````n`s`n`ncj`nb`b`b`b`b`b`arcpdqfabrbrcwaybtbrexadcddbadaae`dedeexaddbdqdebrdedbdededeayb`b`cpb`b`fy`n`c`ncmbdbd````````````````",
+"```````````````````n`sbdaecmcmcscscscpcscscpcwfsbwfiaqfdaybtecadexaafsexe`exckdbbtecdedqfdaycpbrekcbcsaycb`icsaycpb`b``ncm`naebd````````````````",
+"`````````````````scj`c`ccmctbjcsb`cparasascsdqayaybwecbwbrbrbbe`dee`ebadegcdexadegdbcdade`ecbrbwfk`ffuarcwarcscscscpcscmcmct`nd`bd``````````````",
+"```````````````s`saecv`nbjaecmasarar`parcsayfdcb`fbrbtaq`fbtciecdmdbdeebcdebcdebehece`egfabtaqecbrcbazap`fayarcsas`casbjarcmem`n`sbn````````````",
+"``````````````ew`s`zcv`nevcmbjcscsbzcscwaydedqbwavfafdfadcdcckadebcke`aaehdhadebe`dcehdcbtbran`fbr`fbrfibtayaybzbjarcsb`bjbjafbm`sae````````````",
+"````````````bnaeae`kcmagdjfuaycsb``ffucscsbtbwdcaqfifdfabwave`exaaadcdcddh`oecadcddmfwapdbe`fdaqbrapbtbtfdecaqbhbzarcs`adpcmaf`zcmcncn``````````",
+"````````````dz`n`kctcmct`idparcwaybw`farfubrdqbr`ffdfafaecekerdcfeazeleqavdmexaddmelcibkegbrbtbkfa`uehbwfifiambzfxcscs`abjbjakctcmcm`z``````````",
+"``````````ey`saf`zafbjcv`befascsfuar`ffdbrde`faq`wdcdcbkerclesdlcfdmcdblfwcdebaddmdldxercdecbkavbkapbrbtfdbt`fcbbwcbbjbzcactaebectfn`zey````````",
+"``````````a`bf`zcacvdpcv`icucscsbi`fefbhar`fbr`uekbrekcierdxdxdlcieleqes`odmelelexdmcfere`eldcetaqfibwfadcapcbcscsbtcsfcccakdp`vcv`zfncn````````",
+"`````````tbpaecvao`vcccydsbzcsbzffaifiekbwbtbrap`uekbber`odladdteddndnbqdxeqedeqebeleceqdtelelerbyfkavdcfiancwarbtfdcsbjdjfcbjctaebpddbpbf``````",
+"````````bf`rfodpevcv`vfjcybz`idpefbhayapetblapfdciblcleqeteqeldldxdxdadadaesdadtadcdcfereqdldcekapap`wflbwayamcbbhcbasasdp`pbjakcvfjfo`y`y``````",
+"````````ewdddidvdj`abzagdpcu`p`lbzambwfdbbclehdcerfeetetflfedaedbldxdadndaeddada`qdmcfeqdxdheqblfkap`waqfddq`fdgaycs`pcsefef`afjeveieifo`k``````",
+"```````ybfevei`zft`afubzcsas`fam`fbwfaecdcdcdccfetbbblcieretedesed`h`heldm`qdafvdndleceqercledetaqbrapbkfaayfabwbz`fbiascs`p`j`vftf`a`epbu`t````",
+"```````y`ybufnaefc`bdpcucs`pfubw`lbwbrdqdcehavfw`wcfcfereqfwercidt`hdae``qdtbqbqeddle`cfdtdxercifk`uavavecbwbw`fbz`m`mefay`jbc`d`aaobua`fg`t````",
+"``````epbuddcvfjefca`bdsbzbzbhezbyaqaqbrdqehecdcfddccfeqdaedblazdtfhfhdxdtdnfednfvfvcfdtererdcehfl`wfkbkfafaap`fcefifiasasfudjbc`bcadudda``t````",
+"``````a`foeoemak`adparcsarefaidwamapbwapbyazeheccfeccfdxbqesfmblesbqeldtdtbq`g`hfvbq`q`qeqerfweqclbbfmdhbwfa`ufubifxbtarcscb`b`bcv`v`vfgfgbu````",
+"````atejfgfgcy`v`bbcfuasef`ffiezchco`uazezezap`uekdlererereqeddadnfvfved`ofvesesbqfvdle`dleddtdlclfmfkerbr`mapfibtbi`lbzfufuccfccvccdvfg`yfoat``",
+"`````yfodiaj`v`v`x`bdpcsbzdeamamaxfkaqehfm`wav`ueteretbkbkcffhdxfednfefv`hbqdadxesfedtfwcfdtfwe`dcflcldlbkfdfibtap`fanfpayasao`idpagczfneifg`t``",
+"````atfgfofgagccao`abjasbzcbfufxbibtbwfdapecdlavekerblbkeqeqdaesfedafvdndn`hfvfv`hdxeddtdtcffwdlecdhcleqehbkaqaqfkfkco`f`fayafctdjcadiajdv`yfo``",
+"````atejbpczaocc`aaldpbzbzfudoen`mbtfiambtbtereretererbletetfeesbq`hfv`g`gdn`hdafhdabqfvbkbkdldlfwerclfkekecaqaqfdfidgef`b`pctccftakfoajfgbua```",
+"````ata`befofoft`daldp`p`laubzambi`lby`lehfm`gavciererclfe`g`gfhdtdxed`g`gesfmdnfvfvdndnetdxedblblazfmfmapec`mfzcbarc`bzbxfcaoccftf`fgbcepfgbu``",
+"`````y`yevbefjdv`xfpdp`jenbifd`lfufkfdbtazdw`merdtdtci`g`gfebledfhesdnfeesdafvededfvdaed`hdadaclflfmflezfibtbycobwfudgfuarfuds`v`xaodidia`atat``",
+"````atfgaobudif`acfp`ebxacfu`fc`fxfdfdan`mdw`gaz`ocfekcletesdndxfecletesdn`h`hfvfhedclfheqfherek`gbyazfm`uaz`ubtamanfucbceaufcccccducaevfoatat``",
+"````atfoejfof`fbcc`jcrbheffufualaxamfiancifkbbciehekflcleleqdadxfedn`gbq`hfvesdnblfmflbberedcletazeqazehapfm`w`lfubzcbcsbzcr`jdpacf`ftdvfn`yat``",
+"````atfgbufodjfjdudp`afpfu`l`jfcbiefdoapavfkfketazbyazbldxdt`hes`hesdxdx`h`hesdndaet`gazeler`wazdhdhcidhanbxezfzchbibh`p`pfceffffcf`czfodd`yat``",
+"````atatczdif``b`v`v`afffu`facfcfubidgfmcoez`lapbbap`gbbedecfhedetdaesesfv`h`qcifhfhdadletfl`wekfianfkcifk`lfkchfl`lbzcrcufc`ift`aaodddda`buat``",
+"````at`tdif`dvagcycc`iff`pefcraxfz`fbianezfkap`uehfw`ufl`gcieqcderfh`hdnedeqdcfedmazdldxdl`gazaq`lfmfmdwfi`l`lan`wfdfucrc`fp`b`d`daoddbufnatat``",
+"``````fga`f`dvdvcycc`xffdsdscrchezcrfzeffxezfieqecdlbkfebbcidh`qfhfhad`qelfedndadnfkblcfclcierazapaqdwaibhchaqanfxcecealfpef`x`bdvf`eiczfg`y````",
+"``````at`yeiczeiajftftac`j`pfpaxalaxefbxfzch`maqfkbkerazclblbkdmdtdaaaedexfvaddafe`udmblflfkazbbazaqfiaqanbiamanaxfpbzds`pfcbcccdvftaoei`yep````",
+"``````a`a`didif`f`acbxalfp`pbxax`jcefufzfzfmfmbbfifkfibkdhaveqelexfv`qcddndmcdadfeekdl`hflanfkfm`wfdfkapapbhcuefchcuau`bbz`jacccf``vdidvat`y````",
+"``````a`epfoczdv`baoacefbxbzcscr`pfi`fcochchezez`mavekdcecfmfmdmfa`wdlapexcdcddmaabbazes`wfd`lan`maqaibwehapcofiauauau`befalbcdp`ddvfodieiat````",
+"````````ata`difbftao`a`bbzfu`bagbzfdbrfiandoaiaifp`wekeqfw`wfkeke`apckaqelecerfkckcdfherer`ufk`wbyaqaidoanamanbzcufx`b`pbgbcbgccagdieiczep``````",
+"````````at`yfgf`difbctagbzascrbcefaubififx`lananezdo`mcidhapav`uelcddcecape`dcflfaekbkeqekdwcofkfiapaidgefchbic`ffalftaldvf`bpf`fbdidia`a```````",
+"````````at`yczddeiaof`dvfb`jbgccasc`crbhcrfpenchchcoanekeh`we``wfkelececaaek`qcdaqfk`ufiezdgdwfman`lbhenfzfzaifpcealcraoaodueobeajdifg`ya```````",
+"``````````a`bueibueiajajddddbcbgalbzfcbh`j`pfpdoaichchavapdodmbtbyad`mfkbydweccfckaielfmbybt`l`mcodwanaxaxenbifxbzdsbxf`ftacfndkajfofgfg````````",
+"``````````a``teifgbubeftdvafccbgalamef`j`dbxcofkaqcodo`famdgdeanaidqanape``me`fiaianfk`m`mbwfdapaqfzffenfpc`bhfu`pftagagft`jddddfofofga`````````",
+"````````````fg`tbueibpf`dvevfbevbgfpfpcrenbxaxamfiananfkbiaxfpezezfxfkecbwbifzch`mezfiamdocochfi`lcobibibzfpfpbzcufjevccac`efgbubu`tej``````````",
+"`````````````tbu`rejf`aodidvdjfcagacbzbhaxdochfxanfzfpbiaichanbychchchbt`lfzbhezcofxaiaichchaufzc`fxch`jdoffenefbgalbgbcbccceiddfo`y`r``````````",
+"```````````````rejeifodvdvajacbcccccdgbibxfpdgaufuezfz`manfzanfxaufp`fcodocoezchchenauchfxchefff`jagffbxenbzbi`dftbc`edz`df`buddbudd````````````",
+"```````````````y`rbuf`diaoajacbgevevcrfpfpfp`afffffc`faqfxchchfzc`dgfxdgbjfxaiaiancofxfpcodg`bffds`adgbxbzbz`e`v`vftbeev`zajf`ddei`t````````````",
+"`````````````````yfoeyfbaj`zajbgevakalbxcccu`e`b`bc`efbic`axaxchfxfpezchbjfcdodochfx`fanbzcuaufxcv`bfp`pef`e`eeoeoaof`f`ajdv`rfn`r``````````````",
+"``````````````````cn`rejeidvacdveoak`vccccfffpbibx`ac``jcucu`jfxbifxfpfxfxfxcodgc`aybiai`i`jch`j`a`edjagacbc`x`zfnddajf`eodvey`t````````````````",
+"``````````````````eybfej`rejfoaoevcccc`v`xbcc`c`fffpbicubxcucuffc`cu`pfcfpdgbhdoaucu`jcuffbxbx`bcr`efjagbcfjeodkeodkevddfobpcney````````````````",
+"````````````````````eyejbpejbpdddvaoaodjbcagbcft`jefchfxbiauc``a`ac`c`fc`afcfccufcenfp`jfffp`jdsfpftcycrbcccdz`zdkbebebfddbf`r``````````````````",
+"``````````````````````cnbpeyfofofodudd`eacdjafcr`d`dcufpffef`jca`bff`jfcbxcuc`dsaecv`d`jds`dcy`vag`xagbcfteo`zbpfnbpbfej`r`r````````````````````",
+"````````````````````````d`bpddbfbebgak`zfj`z`kdsdsbxffff`bdj`b`b`jcucucudgcueffp`b`bcacacvcvctct`dagcyfjccevddeoeybpd`ej`r``````````````````````",
+"``````````````````````````eyddbp`r`k`z`zdzem`kfjfj`b`d`vdjcyctctcactctcv`dcr`bcvctaeaecv`b`jfjdsccakcveoakbedz`zd`ahewah````````````````````````",
+"````````````````````````````ewcnbnbndd`kdzfjdzemakemae`zcv`dcaaeaecy`e`acadsag`vaeaecvakaffjcacrbcajfj`zbp`z`kfnewewcn``````````````````````````",
+"```````````````````````````````rewbfbp`z`zbedzafcyakembeafctcaak`d`v`acvaeae`dff`dag`baeakfj`zcy`zbm`z`z`k`zbfd`ahcn````````````````````````````",
+"```````````````````````````````````sd`eyfnbmeobm`zdz`saf`v`k`kcvbcag`bcvemaeaecvagcyaecvevafaf`zem`zd`dkbmd`bfbf````````````````````````````````",
+"````````````````````````````````````ahewfoewbf`k`z`zdz`zafemememcvaf`kdz`vafaeafakemembmbpafdkdkbp`k`zbp`seyah``````````````````````````````````",
+"`````````````````````````````````````````sah`zewdk`z`zdzaeaf`kemdzakakaeae`kemakemeo`z`kemdkbfbpdk`kd`d`bn``````````````````````````````````````",
+"````````````````````````````````````````````ahbnbf`zd`d``sbm`kdz`sdkdk`sae`k`zbmd``k`sbmdz`kbnah`s`sbn``````````````````````````````````````````",
+"````````````````````````````````````````````````bncnbmbnd`dkdkdkdkbm`sbnbnbndzd`d``sbm`sbfd`bnewah``````````````````````````````````````````````",
+"``````````````````````````````````````````````````````cnd``s`s`sahd`dkbmbnbn`sbnd`bnbn`newah````````````````````````````````````````````````````",
+"``````````````````````````````````````````````````````````````ahcn`sbnahewbn`sewahbn````````````````````````````````````````````````````````````",
+"````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````",
+"````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````"
+};
+char **default_bubbles[] = {glass1, glass2, glass3, glass4, glass5, glass6, glass7, glass8, glass9, glass10, glass11, (char **)0};
+
+int num_default_bubbles = 11;
+
+#endif /* NO_DEFAULT_BUBBLE */
index 3a6542c8f3fcbce5a7147ab00f54af5c201a7d13..713ee23821c2db2e52996d436f9a557a65514d80 100644 (file)
@@ -476,7 +476,8 @@ get_words()
            if (! buf[0])
              sprintf (buf, "\"%s\" produced no output!", orig_program);
            else if (!first_time &&
-                    !strcmp (buf, "sh: fortune: not found\n"))
+                    (strstr (buf, ": not found") ||
+                     strstr (buf, ": Not found")))
              switch (random () % 20)
                {
                case 1: strcat (buf, "( Get with the program, bub. )\n");
diff --git a/hacks/noses/CVS/Entries b/hacks/noses/CVS/Entries
deleted file mode 100644 (file)
index 7c60d8f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/nose.0.left/1.1/Fri Mar 17 18:30:19 1995 Thu Aug 25 15:04:28 1994//
-/nose.0.right/1.1/Fri Mar 17 18:30:19 1995 Thu Aug 25 15:04:29 1994//
-/nose.1.left/1.1/Fri Mar 17 18:30:20 1995 Thu Aug 25 15:04:30 1994//
-/nose.1.right/1.1/Fri Mar 17 18:30:20 1995 Thu Aug 25 15:04:31 1994//
-/nose.down/1.1/Fri Mar 17 18:30:20 1995 Thu Aug 25 15:04:32 1994//
-/nose.front/1.1/Fri Mar 17 18:30:20 1995 Thu Aug 25 15:04:33 1994//
-/nose.left.front/1.1/Fri Mar 17 18:30:20 1995 Thu Aug 25 15:04:34 1994//
-/nose.right.front/1.1/Fri Mar 17 18:30:20 1995 Thu Aug 25 15:04:35 1994//
diff --git a/hacks/noses/CVS/Repository b/hacks/noses/CVS/Repository
deleted file mode 100644 (file)
index 5c363df..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/m/src/xscreensaver/hacks/noses
index 40fe9dddc486cff338fca43fd09fcca790b607d9..de6ce0b91fa5dffa5c3b0d30bd4e36f58a523111 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1992-1996 Jamie Zawinski <jwz@netscape.com>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -24,7 +24,7 @@
 #endif
 
 extern int get_visual_class P((Display *, Visual *));
-extern void screenhack_usleep P((int));
+extern void screenhack_usleep P((unsigned long));
 #define usleep screenhack_usleep
 
 #define MAX_COLORS 4096
@@ -80,17 +80,31 @@ blacken_colormap (dpy, cmap)
 }
 
 
+/* The business with `install_p' and `extra_cmaps' is to fake out the SGI
+   8-bit video hardware, which is capable of installing multiple (4) colormaps
+   simultaniously.  We have to install multiple copies of the same set of
+   colors in order to fill up all the available slots in the hardware color
+   lookup table.
+ */
+
 void
-fade_colormap (dpy, cmap, cmap2, seconds, ticks, out_p)
+fade_colormap (dpy, cmap, cmap2, seconds, ticks, out_p, install_p)
      Display *dpy;
      Colormap cmap, cmap2;
      int seconds, ticks;
      Bool out_p;
+     Bool install_p;
 {
   int i;
   int steps = seconds * ticks;
   XEvent dummy_event;
 
+  Screen *screen = DefaultScreenOfDisplay (dpy);
+  Visual *visual = DefaultVisualOfScreen (screen);
+  Window window = RootWindowOfScreen (screen);
+  static Colormap extra_cmaps[4] = { 0, };
+  int n_extra_cmaps = sizeof(extra_cmaps)/sizeof(*extra_cmaps);
+
   if (! cmap2)
     return;
 
@@ -99,6 +113,11 @@ fade_colormap (dpy, cmap, cmap2, seconds, ticks, out_p)
   XQueryColors (dpy, cmap, orig_colors, ncolors);
   memcpy (current_colors, orig_colors, ncolors * sizeof (XColor));
 
+  if (install_p)
+    for (i=0; i < n_extra_cmaps; i++)
+      if (!extra_cmaps[i])
+       extra_cmaps[i] = XCreateColormap (dpy, window, visual, AllocAll);
+
   for (i = (out_p ? steps : 0);
        (out_p ? i > 0 : i < steps);
        (out_p ? i-- : i++))
@@ -111,6 +130,19 @@ fade_colormap (dpy, cmap, cmap2, seconds, ticks, out_p)
          current_colors[j].blue  = orig_colors[j].blue  * i / steps;
        }
       XStoreColors (dpy, cmap2, current_colors, ncolors);
+
+      if (install_p)
+       {
+         for (j=0; j < n_extra_cmaps; j++)
+           if (extra_cmaps[j])
+             XStoreColors (dpy, extra_cmaps[j], current_colors, ncolors);
+
+         for (j=0; j < n_extra_cmaps; j++)
+           if (extra_cmaps[j])
+             XInstallColormap (dpy, extra_cmaps[j]);
+         XInstallColormap (dpy, cmap2);
+       }
+
       XSync (dpy, False);
 
       /* If there is user activity, bug out.
@@ -127,18 +159,28 @@ fade_colormap (dpy, cmap, cmap2, seconds, ticks, out_p)
                           &dummy_event))
        {
          XPutBackEvent (dpy, &dummy_event);
-         return;
+         goto DONE;
        }
 
       usleep (1000000 / (ticks * 2)); /* the 2 is a hack... */
     }
-}
 
-#if 0
+DONE:
+
+  if (install_p)
+    {
+      XInstallColormap (dpy, cmap2);
+/*      for (i=0; i < n_extra_cmaps; i++)
+       if (extra_cmaps[i])
+         XFreeColormap (dpy, extra_cmaps[i]);
+ */
+    }
+}
 
 \f
+#if 0
+#include "../hacks/screenhack.h"
 char *progclass = "foo";
-
 char *defaults [] = {
   0
 };
@@ -158,15 +200,21 @@ screenhack (dpy, w)
   int ticks = 30 * seconds;
   int delay = 1;
 
+  XSynchronize (dpy, True);
+
   while (1)
     {
       XSync (dpy, False);
-      XGrabServer (dpy);
+/*      XGrabServer (dpy); */
+      fprintf(stderr,"out..."); fflush(stderr);
       XInstallColormap (dpy, cmap2);
-      fade_colormap (dpy, cmap, cmap2, seconds, ticks, True);
+      fade_colormap (dpy, cmap, cmap2, seconds, ticks, True, True);
+      fprintf(stderr, "done.\n"); fflush(stderr);
       if (delay) sleep (delay);
-      fade_colormap (dpy, cmap, cmap2, seconds, ticks, False);
+      fprintf(stderr,"in..."); fflush(stderr);
+      fade_colormap (dpy, cmap, cmap2, seconds, ticks, False, True);
       XInstallColormap (dpy, cmap);
+      fprintf(stderr, "done.\n"); fflush(stderr);
       XUngrabServer (dpy);
       XSync (dpy, False);
       if (delay) sleep (delay);
index a56e38a5d20b65d90062ee0bd5ee9decd2bd4d07..b59e68f8937a60edf184cde7b46fb87933136e4f 100644 (file)
@@ -1,2 +1,2 @@
 static char *screensaver_id =
-       "@(#)xscreensaver 1.26, by Jamie Zawinski (jwz@netscape.com)";
+       "@(#)xscreensaver 1.27, by Jamie Zawinski (jwz@netscape.com)";