X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fstrange.c;h=b1739acd534a7977e46bdd7c05de57c5325261d1;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=dce0182eeb88c297d3a5339cc354cc906abb23b0;hpb=5f1f12f2a37da634000f96d18d59cc73a8814ef7;p=xscreensaver diff --git a/hacks/strange.c b/hacks/strange.c index dce0182e..b1739acd 100644 --- a/hacks/strange.c +++ b/hacks/strange.c @@ -38,12 +38,11 @@ static const char sccsid[] = "@(#)strange.c 5.00 2000/11/01 xlockmore"; # define MODE_strange # define DEFAULTS "*delay: 10000 \n" \ "*ncolors: 100 \n" \ - "*fpsSolid: True \n" + "*fpsSolid: True \n" \ + "*ignoreRotation: True \n" \ # define SMOOTH_COLORS # define refresh_strange 0 -# define reshape_strange 0 -# define strange_handle_event 0 # include "xlockmore.h" /* from the xscreensaver distribution */ #else /* !STANDALONE */ # include "xlock.h" /* from the xlockmore distribution */ @@ -83,7 +82,7 @@ ModStruct strange_description = "Shows strange attractors", 0, NULL}; #endif -#ifdef HAVE_COCOA +#ifdef HAVE_JWXYZ # define NO_DBUF #endif @@ -142,7 +141,7 @@ typedef struct _ATTRACTOR { static ATTRACTOR *Root = (ATTRACTOR *) NULL; #ifdef useAccumulator -XColor* cols; +static XColor* cols; #endif #ifdef POINTS_HISTORY @@ -487,6 +486,7 @@ draw_strange(ModeInfo * mi) A->Count = 0; } A->Col++; + mi->recursion_depth = A->Count; } @@ -577,18 +577,18 @@ init_strange(ModeInfo * mi) gcv.foreground = 0; gcv.background = 0; -#ifndef HAVE_COCOA +#ifndef HAVE_JWXYZ gcv.graphics_exposures = False; -#endif /* HAVE_COCOA */ +#endif /* HAVE_JWXYZ */ gcv.function = GXcopy; if (Attractor->dbuf_gc != None) XFreeGC(display, Attractor->dbuf_gc); if ((Attractor->dbuf_gc = XCreateGC(display, Attractor->dbuf, -#ifndef HAVE_COCOA +#ifndef HAVE_JWXYZ GCGraphicsExposures | -#endif /* HAVE_COCOA */ +#endif /* HAVE_JWXYZ */ GCFunction | GCForeground | GCBackground, &gcv)) == None) { XFreePixmap(display, Attractor->dbuf); @@ -607,7 +607,7 @@ init_strange(ModeInfo * mi) #define A Attractor if (useAccumulator) { XWindowAttributes xgwa; - int i,j,got_color; + int i,j; XGetWindowAttributes (display, window, &xgwa); /* cmap = xgwa.colormap; */ /* cmap = XCreateColormap(display, window, MI_VISUAL(mi), AllocAll); */ @@ -638,7 +638,7 @@ init_strange(ModeInfo * mi) cols[i].green = 65536*(li-FULLBLUE)/(256-FULLBLUE); cols[i].blue = 65535; } - got_color = XAllocColor (display, xgwa.colormap, &cols[i]); + XAllocColor (display, xgwa.colormap, &cols[i]); /* if (!XAllocColor(MI_DISPLAY(mi), cmap, &cols[i])) { if (!XAllocColor(display, cmap, &cols[i])) { @@ -662,6 +662,13 @@ init_strange(ModeInfo * mi) XSetGraphicsExposures(display, MI_GC(mi), False); } +ENTRYPOINT void +reshape_strange(ModeInfo * mi, int width, int height) +{ + XClearWindow (MI_DISPLAY (mi), MI_WINDOW(mi)); + init_strange (mi); +} + /***************************************************************/ ENTRYPOINT void @@ -689,6 +696,18 @@ release_strange(ModeInfo * mi) } } +ENTRYPOINT Bool +strange_handle_event (ModeInfo *mi, XEvent *event) +{ + if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event)) + { + reshape_strange (mi, MI_WIDTH(mi), MI_HEIGHT(mi)); + return True; + } + return False; +} + + XSCREENSAVER_MODULE ("Strange", strange) #endif /* MODE_strange */