http://ftp.x.org/contrib/applications/xscreensaver-2.23.tar.gz
[xscreensaver] / hacks / pedal.c
index 8cde8d53666bd617bf224b809a5a682016174faa..4306f8a2a2395270e1767cb35542112d7e9ee818 100644 (file)
@@ -9,7 +9,7 @@
  *  Dale Moore  <Dale.Moore@cs.cmu.edu>
  *  24-Jun-1994
  *
- *  Copyright \(co 1994, by Carnegie Mellon University.  Permission to use,
+ *  Copyright (c) 1994, by Carnegie Mellon University.  Permission to use,
  *  copy, modify, distribute, and sell this software and its documentation
  *  for any purpose is hereby granted without fee, provided fnord that the
  *  above copyright notice appear in all copies and that both that copyright
@@ -72,12 +72,8 @@ static Bool fade_p;
 #define rand_range(a, b) (a + random() % (b - a))
 
 
-static int gcd (m, n)
-    int m;
-    int n;
-/* 
- * Greatest Common Divisor (also Greates common factor).
- */
+static int
+gcd(int m, int n) /* Greatest Common Divisor (also Greates common factor). */
 {
     int r;
 
@@ -89,10 +85,7 @@ static int gcd (m, n)
     }
 }
 
-static int numlines (a, b, d)
-    int a;
-    int b;
-    int d;
+static int numlines (int a, int b, int d)
 /*
  * Description:
  *
@@ -123,9 +116,7 @@ static int numlines (a, b, d)
 }
 
 static int
-compute_pedal(points, maxpoints)
-XPoint *points;
-int maxpoints;
+compute_pedal(XPoint *points, int maxpoints)
 /*
  * Description:
  *
@@ -199,9 +190,7 @@ int maxpoints;
 }
 
 static void
-init_pedal (dpy, window)
-     Display *dpy;
-     Window window;
+init_pedal (Display *dpy, Window window)
 {
   XGCValues gcv;
   XWindowAttributes xgwa;
@@ -230,14 +219,9 @@ init_pedal (dpy, window)
   cmap = xgwa.colormap;
 
   gcv.function = GXcopy;
-  gcv.subwindow_mode = IncludeInferiors;
   gcv.foreground = get_pixel_resource ("foreground", "Foreground", dpy, cmap);
   gcv.background = get_pixel_resource ("background", "Background", dpy, cmap);
-  gc = XCreateGC (
-       dpy,
-       window,
-       GCForeground | GCBackground |GCFunction | GCSubwindowMode ,
-       &gcv);
+  gc = XCreateGC (dpy, window, GCForeground | GCBackground |GCFunction, &gcv);
 
   if (fade_p)
   {
@@ -272,12 +256,8 @@ init_pedal (dpy, window)
 }
 
 static void
-fade_foreground (dpy, cmap, from, to, steps)
-    Display *dpy;
-    Colormap cmap;
-    XColor from;
-    XColor to;
-    int steps;
+fade_foreground (Display *dpy, Colormap cmap,
+                XColor from, XColor to, int steps)
 /*
  * This routine assumes that we have a writeable colormap.
  * That means that the default colormap is not full, and that
@@ -302,9 +282,7 @@ fade_foreground (dpy, cmap, from, to, steps)
 }
 
 static void
-pedal (dpy, window)
-     Display *dpy;
-     Window window;
+pedal (Display *dpy, Window window)
 /*
  *    Since the XFillPolygon doesn't require that the last
  *    point == first point, the number of points is the same
@@ -345,7 +323,8 @@ pedal (dpy, window)
           foreground.red = color.red;
           foreground.green = color.green;
           foreground.blue = color.blue;
-          XStoreColor (dpy, cmap, &foreground);
+          /* don't do this here -- let fade_foreground() bring it up! */
+          /* XStoreColor (dpy, cmap, &foreground); */
         }
        else if (XAllocColor (dpy, cmap, &color))
         {
@@ -372,8 +351,8 @@ char *progclass = "Pedal";
  * should be dark.
  */
 char *defaults [] = {
-  "Pedal.background:           black",         /* to placate SGI */
-  "Pedal.foreground:           white",
+  ".background:                        black",
+  ".foreground:                        white",
   "*delay:                     5",
   "*fadedelay:                 200000",
   "*maxlines:                  1000",
@@ -386,14 +365,11 @@ XrmOptionDescRec options [] = {
   { "-maxlines",       ".maxlines",            XrmoptionSepArg, 0 },
   { "-foreground",      ".foreground",          XrmoptionSepArg, 0 },
   { "-background",      ".background",          XrmoptionSepArg, 0 },
+  { 0, 0, 0, 0 }
 };
 
-int options_size = (sizeof (options) / sizeof (options[0]));
-
 void
-screenhack (dpy, window)
-     Display *dpy;
-     Window window;
+screenhack (Display *dpy, Window window)
 {
     init_pedal (dpy, window);
     for (;;) {