projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From http://www.jwz.org/xscreensaver/xscreensaver-5.38.tar.gz
[xscreensaver]
/
hacks
/
greynetic.c
diff --git
a/hacks/greynetic.c
b/hacks/greynetic.c
index 47f91a9f85b73c97217c571575b9039f90daf5f4..586fdffb04a132753eef19814559d84c2987a034 100644
(file)
--- a/
hacks/greynetic.c
+++ b/
hacks/greynetic.c
@@
-1,5
+1,4
@@
-/* 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
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@
-12,7
+11,7
@@
#include "screenhack.h"
#include "screenhack.h"
-#ifndef HAVE_
COCOA
+#ifndef HAVE_
JWXYZ
# define DO_STIPPLE
#endif
# define DO_STIPPLE
#endif
@@
-100,6
+99,7
@@
struct state {
unsigned long fg, bg, pixels [512];
int npixels;
int xlim, ylim;
unsigned long fg, bg, pixels [512];
int npixels;
int xlim, ylim;
+ Bool grey_p;
Colormap cmap;
};
Colormap cmap;
};
@@
-121,6
+121,7
@@
greynetic_init (Display *dpy, Window window)
st->ylim = xgwa.height;
st->cmap = xgwa.colormap;
st->npixels = 0;
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");
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");
@@
-129,9
+130,9
@@
greynetic_init (Display *dpy, Window window)
# ifndef DO_STIPPLE
st->gc = XCreateGC (st->dpy, st->window, GCForeground, &gcv);
# 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);
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);
# else /* DO_STIPPLE */
gcv.fill_style= FillOpaqueStippled;
st->gc = XCreateGC (st->dpy, st->window, GCForeground|GCBackground|GCFillStyle, &gcv);
@@
-199,6
+200,12
@@
greynetic_draw (Display *dpy, Window window, void *closure)
bgc.blue = random ();
# endif /* DO_STIPPLE */
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;
if (! XAllocColor (st->dpy, st->cmap, &fgc))
goto REUSE;
st->pixels [st->npixels++] = fgc.pixel;
@@
-223,16
+230,16
@@
greynetic_draw (Display *dpy, Window window, void *closure)
DONE:
;
DONE:
;
-# ifdef HAVE_
COCOA
+# ifdef HAVE_
JWXYZ
{
/* give a non-opaque alpha to the color */
unsigned long pixel = gcv.foreground;
{
/* give a non-opaque alpha to the color */
unsigned long pixel = gcv.foreground;
- unsigned long amask = BlackPixel
OfScreen (
0);
+ unsigned long amask = BlackPixel
(dpy,
0);
unsigned long a = (random() & amask);
pixel = (pixel & (~amask)) | a;
gcv.foreground = pixel;
}
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);
}
# ifndef DO_STIPPLE
XChangeGC (st->dpy, st->gc, GCForeground, &gcv);
@@
-247,12
+254,18
@@
greynetic_draw (Display *dpy, Window window, void *closure)
static const char *greynetic_defaults [] = {
".background: black",
".foreground: white",
static const char *greynetic_defaults [] = {
".background: black",
".foreground: white",
+ "*fpsSolid: true",
"*delay: 10000",
"*delay: 10000",
+ "*grey: false",
+#ifdef HAVE_MOBILE
+ "*ignoreRotation: True",
+#endif
0
};
static XrmOptionDescRec greynetic_options [] = {
{ "-delay", ".delay", XrmoptionSepArg, 0 },
0
};
static XrmOptionDescRec greynetic_options [] = {
{ "-delay", ".delay", XrmoptionSepArg, 0 },
+ { "-grey", ".grey", XrmoptionNoArg, "True" },
{ 0, 0, 0, 0 }
};
{ 0, 0, 0, 0 }
};
@@
-274,6
+287,9
@@
greynetic_event (Display *dpy, Window window, void *closure, XEvent *event)
static void
greynetic_free (Display *dpy, Window window, void *closure)
{
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)
}
XSCREENSAVER_MODULE ("Greynetic", greynetic)