X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fmunch.c;h=836731a76e241eb0c5f200d24c1235a59982c54d;hb=c85f503f5793839a6be4c818332aca4a96927bb2;hp=902a3e224baddedb990106a438d1d4069420d0bc;hpb=4ade52359b6eba3621566dac79793a33aa4c915f;p=xscreensaver diff --git a/hacks/munch.c b/hacks/munch.c index 902a3e22..836731a7 100644 --- a/hacks/munch.c +++ b/hacks/munch.c @@ -1,6 +1,6 @@ /* Munching Squares and Mismunch * - * Portions copyright 1992-2008 Jamie Zawinski + * Portions copyright 1992-2014 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this * software and its documentation for any purpose is hereby @@ -127,7 +127,8 @@ static void calc_logwidths (struct state *st) window, it's too big. Mismunched squares that big make things look too noisy. */ - if (st->window_height < st->window_width) { + if (st->window_height < st->window_width && + st->window_width < st->window_height * 5) { st->logmaxwidth = (int)dumb_log_2(st->window_height * 0.8); } else { st->logmaxwidth = (int)dumb_log_2(st->window_width * 0.8); @@ -167,7 +168,7 @@ static muncher *make_muncher (struct state *st) m->atX = (random() % (xgwa.width <= m->width ? 1 : xgwa.width - m->width)); m->atY = (random() % (xgwa.height <= m->width ? 1 - : xgwa.width - m->width)); + : xgwa.height - m->width)); /* wrap-around by these values; no need to % as we end up doing that later anyway */ @@ -417,6 +418,20 @@ munch_reshape (Display *dpy, Window window, void *closure, static Bool munch_event (Display *dpy, Window window, void *closure, XEvent *event) { + struct state *st = (struct state *) closure; + if (screenhack_event_helper (dpy, window, event)) + { + int i; + st->window_height--; + munch_reshape(dpy, window, closure, st->window_width, st->window_height); + st->mismunch = random() & 1; + for (i = 0; i < st->simul; i++) { + free (st->munchers[i]); + st->munchers[i] = make_muncher(st); + } + XClearWindow(dpy, window); + return True; + } return False; } @@ -429,6 +444,7 @@ munch_free (Display *dpy, Window window, void *closure) static const char *munch_defaults [] = { + ".lowrez: true", ".background: black", ".foreground: white", "*fpsSolid: true", @@ -437,9 +453,10 @@ static const char *munch_defaults [] = { "*simul: 5", "*clear: 65", "*xor: True", -#ifdef USE_IPHONE +#ifdef HAVE_MOBILE "*ignoreRotation: True", #endif + 0 };