X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fabstractile.c;h=b4394f14ec257f1c965a72466ad4bec1eccb4128;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=aaac029e8b098c82b7cd0c042148f4200284788e;hpb=4ade52359b6eba3621566dac79793a33aa4c915f;p=xscreensaver diff --git a/hacks/abstractile.c b/hacks/abstractile.c index aaac029e..b4394f14 100644 --- a/hacks/abstractile.c +++ b/hacks/abstractile.c @@ -18,8 +18,6 @@ #include /*#include */ -#define DEBUGFILE "/tmp/abstractile.dbg" - #define MODE_CREATE 0 /* init, create, then finish sleep */ #define MODE_ERASE 1 /* erase, then reset colors */ #define MODE_DRAW 2 @@ -92,7 +90,8 @@ struct state { /* draw, erase, fill, init, line, object, z indexes */ unsigned int di, ei, fi, ii, bi, li, eli, oi, zi; /* size variables */ - unsigned int gridx, gridy, gridn; /* grid size */ + int gridx, gridy; /* grid size */ + unsigned int gridn; int lwid, bwid, swid;/* line width, background width, shadow width */ int narray, max_wxh; int elwid, elpu, egridx, egridy; /* for now */ @@ -207,6 +206,7 @@ _init_zlist(struct state *st) st->gridx=st->xgwa.width/st->lwid; st->gridy=st->xgwa.height/st->lwid; + if ((st->gridx <= 0) || (st->gridy <= 0)) abort(); st->gridn=st->gridx*st->gridy; /* clear grid */ for (z=0; zgridn; z++) { @@ -916,6 +916,7 @@ _getcolor(struct state *st, int x, int y) { int n, cv[LAYERS]; + cv[0] = 0; for (n=0; nlayers; n++) { cv[n]=_pattern(st,x,y,n); /* first wave/shape */ @@ -1079,8 +1080,13 @@ _newline(struct state *st) True : False; st->dline[st->li].obj = (lt==LINE_NEW) ? st->oi : st->dline[bl].obj; - st->dline[st->li].color = (lt==LINE_NEW) ? - (_getcolor(st,x,y))%st->ncolors : st->dline[bl].color; + if (lt==LINE_NEW) { + int color = (_getcolor(st,x,y))%st->ncolors; + if (color < 0) color += st->ncolors; + st->dline[st->li].color = color; + } else { + st->dline[st->li].color = st->dline[bl].color; + } st->dline[st->li].deo=(_getdeo(st,x,y,st->dmap,1) + (random()%st->dvar) + (random()%st->dvar))*st->ddir; st->dline[st->li].ndol=0; @@ -1559,6 +1565,13 @@ abstractile_reshape (Display *dpy, Window window, void *closure, static Bool abstractile_event (Display *dpy, Window window, void *closure, XEvent *event) { + struct state *st = (struct state *) closure; + if (screenhack_event_helper (dpy, window, event)) + { + st->mode=MODE_CREATE; + return True; + } + return False; } @@ -1576,6 +1589,9 @@ static const char *abstractile_defaults [] = { "*sleep: 3", "*speed: 3", "*tile: random", +#ifdef HAVE_MOBILE + "*ignoreRotation: True", +#endif 0 };