-/* xscreensaver, Copyright (c) 1992, 1994 Jamie Zawinski <jwz@mcom.com>
+/* xscreensaver, Copyright (c) 1992, 1994, 1996, 1998
+ * Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
static struct projectile *projectiles, *free_projectiles;
static struct projectile *
-get_projectile ()
+get_projectile (void)
{
struct projectile *p;
if (free_projectiles)
}
static void
-free_projectile (p)
- struct projectile *p;
+free_projectile (struct projectile *p)
{
p->next_free = free_projectiles;
free_projectiles = p;
}
static void
-launch (xlim, ylim, g, dpy, cmap)
- int xlim, ylim, g;
- Display *dpy;
- Colormap cmap;
+launch (int xlim, int ylim, int g,
+ Display *dpy, Colormap cmap)
{
struct projectile *p = get_projectile ();
int x, dx, xxx;
if (!XAllocColor (dpy, cmap, &p->color))
{
p->color.pixel = WhitePixel (dpy, DefaultScreen (dpy));
- p->color.red = p->color.green = p->color.blue = 0;
+ p->color.red = p->color.green = p->color.blue = 0xFFFF;
}
}
}
static struct projectile *
-shrapnel (parent, dpy, cmap)
- struct projectile *parent;
- Display *dpy;
- Colormap cmap;
+shrapnel (struct projectile *parent, Display *dpy, Colormap cmap)
{
struct projectile *p = get_projectile ();
if (! p) return 0;
static int how_many, frequency, scatter;
static Colormap
-init_pyro (dpy, window)
- Display *dpy;
- Window window;
+init_pyro (Display *dpy, Window window)
{
int i;
Colormap cmap;
}
static void
-pyro (dpy, window, cmap)
- Display *dpy;
- Window window;
- Colormap cmap;
+pyro (Display *dpy, Window window, Colormap cmap)
{
XWindowAttributes xgwa;
static int xlim, ylim, real_xlim, real_ylim;
launch (xlim, ylim, g, dpy, cmap);
}
- XSync (dpy, True);
+ XSync (dpy, False);
+ screenhack_handle_events (dpy);
usleep (10000);
for (i = 0; i < how_many; i++)
else
{
free_projectile (p);
- if (! mono_p) XFreeColors (dpy, cmap, &p->color.pixel, 1, 0);
+ if (! mono_p)
+ if (p->color.pixel != WhitePixel (dpy, DefaultScreen (dpy)))
+ XFreeColors (dpy, cmap, &p->color.pixel, 1, 0);
}
if (p->primary && p->fuse <= 0)
{
- int i = (random () % scatter) + (scatter/2);
- while (i--)
+ int j = (random () % scatter) + (scatter/2);
+ while (j--)
shrapnel (p, dpy, cmap);
}
}
char *progclass = "Pyro";
char *defaults [] = {
- "Pyro.background: black", /* to placate SGI */
- "Pyro.foreground: white",
+ ".background: black",
+ ".foreground: white",
"*count: 100",
"*frequency: 30",
"*scatter: 20",
XrmOptionDescRec options [] = {
{ "-count", ".count", XrmoptionSepArg, 0 },
{ "-frequency", ".frequency", XrmoptionSepArg, 0 },
- { "-scatter", ".scatter", XrmoptionSepArg, 0 }
+ { "-scatter", ".scatter", 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)
{
Colormap cmap = init_pyro (dpy, window);
while (1)