X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Frorschach.c;h=d9b0010ae85317239327d0bbbe7fd8c8ce009369;hb=8eb2873d7054e705c4e83f22d18c40946a9e2529;hp=5c556159594be5c1379babc4990636aa16321f38;hpb=0a1527cc01e9894017614b7c36b838b2b6914ba9;p=xscreensaver diff --git a/hacks/rorschach.c b/hacks/rorschach.c index 5c556159..d9b0010a 100644 --- a/hacks/rorschach.c +++ b/hacks/rorschach.c @@ -1,4 +1,5 @@ -/* xscreensaver, Copyright (c) 1992 Jamie Zawinski +/* xscreensaver, Copyright (c) 1992, 1996, 1998, 2001 + * Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -7,19 +8,22 @@ * documentation. No representations are made about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. + * + * 19971004: Johannes Keukelaar : Use helix screen + * eraser. */ #include "screenhack.h" +#include "erase.h" static GC draw_gc, erase_gc; static unsigned int default_fg_pixel; static int iterations, offset; static Bool xsym, ysym; +static int sleep_time; static void -init_rorschach (dpy, window) - Display *dpy; - Window window; +init_rorschach (Display *dpy, Window window) { XGCValues gcv; Colormap cmap; @@ -40,9 +44,7 @@ init_rorschach (dpy, window) } static void -hurm (dpy, window) - Display *dpy; - Window window; +hurm (Display *dpy, Window window) { Colormap cmap; XWindowAttributes xgwa; @@ -91,20 +93,17 @@ hurm (dpy, window) j++; } XDrawPoints (dpy, window, draw_gc, points, j, CoordModeOrigin); - XSync (dpy, True); - } - sleep (5); - for (i = 0; i < (ylim >> 1); i++) - { - int y = (random () % ylim); - XDrawLine (dpy, window, erase_gc, 0, y, xlim, y); - XFlush (dpy); - if ((i % 50) == 0) - usleep (10000); + XSync (dpy, False); + screenhack_handle_events (dpy); } + sleep ( sleep_time ); + + erase_full_window(dpy, window); + XClearWindow (dpy, window); if (got_color) XFreeColors (dpy, cmap, &color.pixel, 1, 0); - XSync (dpy, True); + XSync (dpy, False); + screenhack_handle_events (dpy); sleep (1); } @@ -112,12 +111,13 @@ hurm (dpy, window) char *progclass = "Rorschach"; char *defaults [] = { - "*background: black", - "*foreground: white", + ".background: black", + ".foreground: white", "*xsymmetry: true", "*ysymmetry: false", "*iterations: 4000", "*offset: 4", + "*delay: 5", 0 }; @@ -125,15 +125,18 @@ XrmOptionDescRec options [] = { { "-iterations", ".iterations", XrmoptionSepArg, 0 }, { "-offset", ".offset", XrmoptionSepArg, 0 }, { "-xsymmetry", ".xsymmetry", XrmoptionNoArg, "true" }, - { "-ysymmetry", ".ysymmetry", XrmoptionNoArg, "true" } + { "-ysymmetry", ".ysymmetry", XrmoptionNoArg, "true" }, + { "-no-xsymmetry", ".xsymmetry", XrmoptionNoArg, "false" }, + { "-no-ysymmetry", ".ysymmetry", XrmoptionNoArg, "false" }, + { "-erase-speed", ".eraseSpeed", XrmoptionSepArg, 0 }, + { "-delay", ".delay", 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) { + sleep_time = get_integer_resource("delay", "Integer"); init_rorschach (dpy, window); while (1) hurm (dpy, window);