* 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
#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;
}
}
-static int numlines (a, b, d)
- int a;
- int b;
- int d;
+static int numlines (int a, int b, int d)
/*
* Description:
*
}
static int
-compute_pedal(points, maxpoints)
-XPoint *points;
-int maxpoints;
+compute_pedal(XPoint *points, int maxpoints)
/*
* Description:
*
}
static void
-init_pedal (dpy, window)
- Display *dpy;
- Window window;
+init_pedal (Display *dpy, Window window)
{
XGCValues gcv;
XWindowAttributes xgwa;
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)
{
}
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
inbetween.blue = from.blue + (to.blue - from.blue) * i / steps ;
XStoreColor (dpy, cmap, &inbetween);
/* If we don't sync, these can bunch up */
- XSync(dpy, 0);
+ XSync(dpy, False);
+ screenhack_handle_events (dpy);
usleep(udelay);
}
}
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
XColor color;
hsv_to_rgb (random()%360, 1.0, 1.0,
&color.red, &color.green, &color.blue);
- XSync(dpy, 0);
+ XSync(dpy, False);
if (fade_p)
{
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))
{
foreground.blue = color.blue;
foreground.pixel = color.pixel;
}
- XSync(dpy, 0);
+ XSync(dpy, False);
}
/* Fade in by bringing the foreground back from background */
* should be dark.
*/
char *defaults [] = {
+ ".background: black",
+ ".foreground: white",
"*delay: 5",
"*fadedelay: 200000",
"*maxlines: 1000",
- "*foreground: white",
- "*background: black",
0
};
{ "-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 (;;) {
pedal (dpy, window);
- XSync(dpy, 0);
+ XSync(dpy, False);
+ screenhack_handle_events (dpy);
if (delay) sleep (delay);
}
}