-/* xscreensaver, Copyright (c) 1992, 1995, 1996, 1997, 1998, 2003, 2006
- * Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 1992-2008 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
#include "screenhack.h"
-#ifndef HAVE_COCOA
+#ifndef HAVE_JWXYZ
# define DO_STIPPLE
#endif
unsigned long fg, bg, pixels [512];
int npixels;
int xlim, ylim;
+ Bool grey_p;
Colormap cmap;
};
st->ylim = xgwa.height;
st->cmap = xgwa.colormap;
st->npixels = 0;
+ st->grey_p = get_boolean_resource(st->dpy, "grey", "Boolean");
gcv.foreground= st->fg= get_pixel_resource(st->dpy, st->cmap, "foreground","Foreground");
gcv.background= st->bg= get_pixel_resource(st->dpy, st->cmap, "background","Background");
# ifndef DO_STIPPLE
st->gc = XCreateGC (st->dpy, st->window, GCForeground, &gcv);
-# ifdef HAVE_COCOA /* allow non-opaque alpha components in pixel values */
+# ifdef HAVE_JWXYZ /* allow non-opaque alpha components in pixel values */
jwxyz_XSetAlphaAllowed (st->dpy, st->gc, True);
-# endif /* HAVE_COCOA */
+# endif /* HAVE_JWXYZ */
# else /* DO_STIPPLE */
gcv.fill_style= FillOpaqueStippled;
st->gc = XCreateGC (st->dpy, st->window, GCForeground|GCBackground|GCFillStyle, &gcv);
bgc.blue = random ();
# endif /* DO_STIPPLE */
+ if (st->grey_p)
+ {
+ fgc.green = fgc.blue = fgc.red;
+ bgc.green = bgc.blue = bgc.red;
+ }
+
if (! XAllocColor (st->dpy, st->cmap, &fgc))
goto REUSE;
st->pixels [st->npixels++] = fgc.pixel;
DONE:
;
-# ifdef HAVE_COCOA
+# ifdef HAVE_JWXYZ
{
/* give a non-opaque alpha to the color */
unsigned long pixel = gcv.foreground;
- unsigned long amask = BlackPixelOfScreen (0);
+ unsigned long amask = BlackPixel (dpy,0);
unsigned long a = (random() & amask);
pixel = (pixel & (~amask)) | a;
gcv.foreground = pixel;
}
-# endif /* !HAVE_COCOA */
+# endif /* !HAVE_JWXYZ */
}
# ifndef DO_STIPPLE
XChangeGC (st->dpy, st->gc, GCForeground, &gcv);
static const char *greynetic_defaults [] = {
".background: black",
".foreground: white",
+ "*fpsSolid: true",
"*delay: 10000",
+ "*grey: false",
+#ifdef HAVE_MOBILE
+ "*ignoreRotation: True",
+#endif
0
};
static XrmOptionDescRec greynetic_options [] = {
{ "-delay", ".delay", XrmoptionSepArg, 0 },
+ { "-grey", ".grey", XrmoptionNoArg, "True" },
{ 0, 0, 0, 0 }
};
static void
greynetic_free (Display *dpy, Window window, void *closure)
{
+ struct state *st = (struct state *) closure;
+ XFreeGC (st->dpy, st->gc);
+ free (st);
}
XSCREENSAVER_MODULE ("Greynetic", greynetic)