X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=hacks%2Ftessellimage.c;h=d018f0cde4927ec531a693d815c401e0dc98049e;hb=d5186197bc394e10a4402f7f6d23fbb14103bc50;hp=c506400cd5cd63a45936367d8fb46155a3af96ca;hpb=8afc01a67be4fbf3f1cc0fce9adf01b5289a21c6;p=xscreensaver diff --git a/hacks/tessellimage.c b/hacks/tessellimage.c index c506400c..d018f0cd 100644 --- a/hacks/tessellimage.c +++ b/hacks/tessellimage.c @@ -543,6 +543,9 @@ tessellate (struct state *st) st->pgc = XCreateGC(st->dpy, st->image, GCFunction, &gcv); } + if (! st->nthreshes) return; + + /* If duration2 has expired, switch to the next threshold. */ if (! st->button_down_p) @@ -573,11 +576,12 @@ tessellate (struct state *st) if (ticked_p && st->cache[st->thresh]) { - XCopyArea (st->dpy, - st->cache[st->thresh], - st->output, st->pgc, - 0, 0, st->delta->width, st->delta->height, - 0, 0); + if (st->output) + XCopyArea (st->dpy, + st->cache[st->thresh], + st->output, st->pgc, + 0, 0, st->delta->width, st->delta->height, + 0, 0); } else if (ticked_p) { @@ -753,12 +757,13 @@ tessellate (struct state *st) fprintf (stderr, "%s: out of memory\n", progname); abort(); } - XCopyArea (st->dpy, - st->output, - st->cache[st->thresh], - st->pgc, - 0, 0, st->delta->width, st->delta->height, - 0, 0); + if (st->output) + XCopyArea (st->dpy, + st->output, + st->cache[st->thresh], + st->pgc, + 0, 0, st->delta->width, st->delta->height, + 0, 0); } } @@ -854,6 +859,14 @@ tessellimage_draw (Display *dpy, Window window, void *closure) 0, 0, st->delta->width, st->delta->height, (st->xgwa.width - st->delta->width) / 2, (st->xgwa.height - st->delta->height) / 2); + else if (!st->nthreshes) + XCopyArea (st->dpy, + st->image, + st->window, st->wgc, + 0, 0, st->xgwa.width, st->xgwa.height, + 0, + 0); + DONE: return st->delay; @@ -881,30 +894,10 @@ tessellimage_event (Display *dpy, Window window, void *closure, XEvent *event) st->button_down_p = False; return True; } - else if (event->xany.type == KeyPress) + else if (screenhack_event_helper (dpy, window, event)) { - KeySym keysym = 0; - char c = 0; - if (event->xany.type == KeyPress || event->xany.type == KeyRelease) - XLookupString (&event->xkey, &c, 1, &keysym, 0); - - switch (keysym) { - case XK_Left: - case XK_Right: - case XK_Down: - case XK_Up: - st->start_time = 0; /* load next image */ - return True; - } - - switch (c) { - case '\r': - case '\n': - case '+': - case '=': - st->start_time = 0; - return True; - } + st->start_time = 0; /* load next image */ + return True; } return False; @@ -916,8 +909,8 @@ tessellimage_free (Display *dpy, Window window, void *closure) { struct state *st = (struct state *) closure; flush_cache (st); - XFreeGC (dpy, st->wgc); - XFreeGC (dpy, st->pgc); + if (st->wgc) XFreeGC (dpy, st->wgc); + if (st->pgc) XFreeGC (dpy, st->pgc); if (st->image) XFreePixmap (dpy, st->image); if (st->output) XFreePixmap (dpy, st->output); if (st->delta) XDestroyImage (st->delta); @@ -941,6 +934,7 @@ static const char *tessellimage_defaults [] = { "*cache: True", #ifdef USE_IPHONE "*ignoreRotation: True", + "*rotateImages: True", #endif 0 };