X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fsquiral.c;h=a38e0603dd28fa85bc366b47916c0edfdb8652b6;hb=39809ded547bdbb08207d3e514950425215b4410;hp=2a0b0fd29bb61016afe8abe1ed8dddb8925c8f38;hpb=6f5482d73adb0165c0130bb47d852644ab0c4869;p=xscreensaver diff --git a/hacks/squiral.c b/hacks/squiral.c index 2a0b0fd2..a38e0603 100644 --- a/hacks/squiral.c +++ b/hacks/squiral.c @@ -14,7 +14,7 @@ #include "erase.h" #include "yarandom.h" -#define R(x) (abs(random())%x) +#define R(x) (random()%x) #define PROB(x) (frand(1.0) < (x)) #define NCOLORSMAX 255 @@ -156,7 +156,7 @@ squiral_init (Display *dpy, Window window) st->erase_gc = XCreateGC (st->dpy, st->window, GCForeground, &gcv); cmap = xgwa.colormap; if( st->ncolors ) { - free_colors(st->dpy, cmap, st->colors, st->ncolors); + free_colors(xgwa.screen, cmap, st->colors, st->ncolors); st->ncolors = 0; } if( mono_p ) { @@ -166,7 +166,8 @@ squiral_init (Display *dpy, Window window) st->ncolors = get_integer_resource(st->dpy, "ncolors", "Integer"); if (st->ncolors < 0 || st->ncolors > NCOLORSMAX) st->ncolors = NCOLORSMAX; - make_uniform_colormap(st->dpy, xgwa.visual, cmap, st->colors, &st->ncolors, True, + make_uniform_colormap(xgwa.screen, xgwa.visual, cmap, + st->colors, &st->ncolors, True, &writeable, False); if (st->ncolors <= 0) { st->ncolors = 1; @@ -238,6 +239,13 @@ squiral_reshape (Display *dpy, Window window, void *closure, static Bool squiral_event (Display *dpy, Window window, void *closure, XEvent *event) { + struct state *st = (struct state *) closure; + if (screenhack_event_helper (dpy, window, event)) + { + squiral_init_1 (st); + XClearWindow (dpy, window); + return True; + } return False; } @@ -250,6 +258,7 @@ squiral_free (Display *dpy, Window window, void *closure) static const char *squiral_defaults[] = { + ".lowrez: true", ".background: black", ".foreground: white", "*fpsSolid: true", @@ -260,6 +269,9 @@ static const char *squiral_defaults[] = { "*disorder: 0.005", "*cycle: False", "*handedness: 0.5", +#ifdef HAVE_MOBILE + "*ignoreRotation: True", +#endif 0 };