xflip-1.01.orig/ 40755 764 764 0 6114355666 11622 5ustar joeyjoeyxflip-1.01.orig/Imakefile100644 764 764 534 5651512711 13501 0ustar joeyjoey#ifdef HPArchitecture CCOPTIONS = -Ae #endif OBJS1 = meltdown.o OBJS2 = flip.o LOCAL_LIBRARIES = $(XLIB) PROGRAMS = meltdown flip AllTarget($(PROGRAMS)) NormalProgramTarget(meltdown, $(OBJS1), , , $(LOCAL_LIBRARIES)) NormalProgramTarget(flip, $(OBJS2), , , $(LOCAL_LIBRARIES)) InstallProgram(meltdown,$(BINDIR)) InstallProgram(flip,$(BINDIR)) xflip-1.01.orig/Makefile.sunpro100644 764 764 345 4606072437 14662 0ustar joeyjoeyCFLAGS = -O #CFLAGS = -g -DDEBUG #LDFLAGS = -Bstatic LIBS = -lX11 .KEEP_STATE: meltdown: meltdown.o cc -o $@ meltdown.o $(LDFLAGS) $(LIBS) flip: flip.o cc -o $@ flip.o $(LDFLAGS) $(LIBS) clean: rm -f core *.o flip meltdown xflip-1.01.orig/flip.c100644 764 764 21745 5651505674 13047 0ustar joeyjoey/* * flip -- mess up the screen */ /* * Copyright 1990 David Lemke and Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Network Computing Devices not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Network Computing * Devices makes no representations about the suitability of this software * for any purpose. It is provided "as is" without express or implied * warranty. * * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE * OR PERFORMANCE OF THIS SOFTWARE. * * Author: * Dave Lemke * lemke@ncd.com * * Network Computing Devices, Inc * 350 North Bernardo Ave * Mountain View, CA 94043 * * @(#)flip.c 1.3 90/03/22 * */ #include #include #ifdef DEBUG #define assert(ex) {if (!(ex)){(void)fprintf(stderr,"Assertion \"ex\" failed: file \"%s\", line %d\n", __FILE__, __LINE__);abort();}} #else #define assert(ex) #endif #ifdef __hpux #define random() rand() #define srandom(a) srand(a) #endif #define rnd(x) (random() % (x)) /* parameters for random flips */ #define CHUNK_WIDTH 100 #define CHUNK_HEIGHT 100 #define MIN_CHUNK_WIDTH 5 #define MIN_CHUNK_HEIGHT 5 /* number of times to do random flipping */ #define NUM_TIMES 300 #define MIN_TIMES 20 #define GLOAT_TIME 3 /* time in seconds to show the results if * in fast mode */ Display *dpy; Window win; Pixmap pmap; GC copygc; int screen; Bool do_oblic = False; /* flip horiz and vert */ Bool do_vert = False; /* flip top-to-bottom */ Bool do_fast = False; /* show results all at once */ Bool do_random = False; /* do small random pieces instead of full screen */ Bool do_planes = False; /* do a single plane at a time instead of all */ int do_half = 1; /* divisor for how much to flip. * 1 leaves things the way they started * 2 leaves them flipped */ usage() { fprintf(stderr, "Usage: flip [-planes] [-vert] [-oblic] [-fast | -random] [-times] [-display ]\n"); exit(1); } main(argc, argv) int argc; char **argv; { char *display = NULL; unsigned long vmask, gcmask; XSetWindowAttributes xswat; XGCValues gcvals; int i; int times = -1; Drawable drawable; int x, y, w, h; /* process args */ for (i = 1; i < argc; i++) { if (strncmp(argv[i], "-dis", 4) == 0) { if (argv[i+1]) display = argv[++i]; else usage(); } else if (strncmp(argv[i], "-t", 2) == 0) { if (argv[i+1]) times = atoi(argv[++i]); else usage(); } else if (strncmp(argv[i], "-p", 2) == 0) { do_planes = True; } else if (strncmp(argv[i], "-f", 2) == 0) { do_fast = True; do_half = 2; } else if (strncmp(argv[i], "-r", 2) == 0) { do_random = True; if (times < 0) times = rnd(NUM_TIMES) + MIN_TIMES; } else if (strncmp(argv[i], "-v", 2) == 0) { do_vert = True; } else if (strncmp(argv[i], "-o", 2) == 0) { do_oblic = True; } else usage(); } if ((dpy = XOpenDisplay(display)) == NULL) { fprintf(stderr, "can't open display\n"); exit(0); } screen = DefaultScreen(dpy); if (!do_random) { xswat.override_redirect = True; xswat.do_not_propagate_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask; vmask = CWOverrideRedirect | CWDontPropagate; win = XCreateWindow(dpy, RootWindow(dpy, screen), 0, 0, DisplayWidth(dpy, screen), DisplayHeight(dpy, screen), 0, CopyFromParent, CopyFromParent, CopyFromParent, vmask, &xswat); } if (do_fast) { pmap = XCreatePixmap(dpy, RootWindow(dpy, screen), DisplayWidth(dpy, screen), DisplayHeight(dpy, screen), DisplayPlanes(dpy, screen)); } gcvals.graphics_exposures = False; /* copyplane gc wants to leave the data alone */ gcvals.foreground = 1; gcvals.background = 0; gcvals.subwindow_mode = IncludeInferiors; gcmask = GCForeground | GCBackground | GCGraphicsExposures | GCSubwindowMode; copygc = XCreateGC(dpy, RootWindow(dpy, screen), gcmask, &gcvals); if (do_fast) { /* copy the screen contents */ XCopyArea(dpy, RootWindow(dpy, screen), pmap, copygc, 0, 0, DisplayWidth(dpy, screen), DisplayHeight(dpy, screen), 0, 0); } else if (!do_random) { XMapRaised(dpy, win); } /* make sure everything's done */ XSync(dpy, 0); /* choose what to mess up */ if (do_fast) drawable = pmap; else if (do_random) drawable = RootWindow(dpy, screen); else drawable = win; srandom(getpid()); if (do_random) { for (i = 0; i < times; i++) { if (do_planes) XSetPlaneMask(dpy, copygc, (1 << rnd(DisplayPlanes(dpy, screen)))); x = rnd(DisplayWidth(dpy, screen)); y = rnd(DisplayHeight(dpy, screen)); w = rnd(CHUNK_WIDTH) + MIN_CHUNK_WIDTH; h = rnd(CHUNK_HEIGHT) + MIN_CHUNK_HEIGHT; /* shift over if going off screen */ if ((x + w) >= DisplayWidth(dpy, screen)) { x -= (w + 1); /* dont get the last line */ } if ((y + h) >= DisplayHeight(dpy, screen)) { y -= (h + 1); } if (rnd(2)) flip_vert(drawable, x, y, w, h); else flip_horz(drawable, x, y, w, h); XSync(dpy, 0); } exit (0); } else { if (do_planes) XSetPlaneMask(dpy, copygc, (1 << rnd(DisplayPlanes(dpy, screen)))); if (do_vert) flip_vert(drawable, 0, 0, DisplayWidth(dpy, screen) - 1, DisplayHeight(dpy, screen) - 1); else if (do_oblic) flip_oblic(drawable, 0, 0, DisplayWidth(dpy, screen) - 1, DisplayHeight(dpy, screen) - 1); else flip_horz(drawable, 0, 0, DisplayWidth(dpy, screen) - 1, DisplayHeight(dpy, screen) - 1); } /* show the dirty work */ if (do_fast) { XMapWindow(dpy, win); XSync(dpy, 0); /* be sure its mapped before filling it */ XCopyArea(dpy, pmap, win, copygc, 0, 0, DisplayWidth(dpy, screen), DisplayHeight(dpy, screen), 0, 0); } XSync(dpy, 0); /* gloat a bit */ if (do_fast) sleep(GLOAT_TIME); exit(0); } flip_horz(d, x, y, w, h) Drawable d; int x, y, w, h; { Pixmap temp; int i; int width = 1; assert(h > 0); temp = XCreatePixmap(dpy, RootWindow(dpy, screen), width, h, DisplayPlanes(dpy, screen)); for (i = x; i <= (x + w)/do_half; i+= width) { XCopyArea(dpy, d, temp, copygc, i, y, width, h, 0, 0); XCopyArea(dpy, d, d, copygc, (w + x) - (i - x), y, width, h, i, y); XCopyArea(dpy, temp, d, copygc, 0, 0, width, h, (w + x) - (i - x), y); } XFreePixmap(dpy, temp); } flip_vert(d, x, y, w, h) Drawable d; int x, y, w, h; { Pixmap temp; int i; int height = 1; assert(w > 0); temp = XCreatePixmap(dpy, RootWindow(dpy, screen), w, height, DisplayPlanes(dpy, screen)); for (i = y; i <= (y + h)/do_half; i+= height) { XCopyArea(dpy, d, temp, copygc, x, i, w, height, 0, 0); XCopyArea(dpy, d, d, copygc, x, (y + h) - (i - y), w, height, x, i); XCopyArea(dpy, temp, d, copygc, 0, 0, w, height, x, (y + h) - (i - y)); } XFreePixmap(dpy, temp); } flip_oblic(d, x, y, w, h) Drawable d; int x, y, w, h; { Pixmap tempv; Pixmap temph; int i; int height = 1; int width = 1; assert(w > 0); assert(h > 0); tempv = XCreatePixmap(dpy, RootWindow(dpy, screen), w, height, DisplayPlanes(dpy, screen)); temph = XCreatePixmap(dpy, RootWindow(dpy, screen), width, h, DisplayPlanes(dpy, screen)); for (i = y; i <= (y + h)/do_half; i+= height) { XCopyArea(dpy, d, tempv, copygc, x, i, w, height, 0, 0); XCopyArea(dpy, d, d, copygc, x, (y + h) - (i - y), w, height, x, i); XCopyArea(dpy, tempv, d, copygc, 0, 0, w, height, x, (y + h) - (i - y)); XCopyArea(dpy, d, temph, copygc, i, y, width, h, 0, 0); XCopyArea(dpy, d, d, copygc, (w + x) - (i - x), y, width, h, i, y); XCopyArea(dpy, temph, d, copygc, 0, 0, width, h, (w + x) - (i - x), y); } XFreePixmap(dpy, tempv); XFreePixmap(dpy, temph); } xflip-1.01.orig/meltdown.c100644 764 764 13607 5651504355 13737 0ustar joeyjoey/* * meltdown -- mess up the screen */ /* * Copyright 1990 David Lemke and Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Network Computing Devices not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Network Computing * Devices makes no representations about the suitability of this software * for any purpose. It is provided "as is" without express or implied * warranty. * * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE * OR PERFORMANCE OF THIS SOFTWARE. * * Author: * Dave Lemke * lemke@ncd.com * * Network Computing Devices, Inc * 350 North Bernardo Ave * Mountain View, CA 94043 * * @(#)meltdown.c 1.2 90/02/22 * */ #include #include #define MIN_SIZE 10 #define MAX_SIZE 100 #define MIN_DIST 10 #define MIN_WIDTH 30 #define WIDTH_ADD 20 #define FINISHED 50 #ifdef __hpux #define random() rand() #define srandom(a) srand(a) #endif #define rnd(x) (random() % (x)) #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b)) Display *dpy; Window win; GC copygc, fillgc; int screen; int depth; short **heights; usage() { fprintf(stderr, "Usage: meltdown [-planes] [-display ]\n"); exit(1); } main(argc, argv) int argc; char **argv; { char *display = NULL; unsigned long vmask; XSetWindowAttributes xswat; XGCValues gcvals; Bool use_planes = False; int i; srandom(getpid()); for (i = 1; i < argc; i++) { if (strncmp(argv[i], "-dis", 4) == 0) { if (argv[i+1]) display = argv[++i]; else usage(); } else if (strncmp(argv[i], "-p", 2) == 0) { use_planes = 1; } else usage(); } if ((dpy = XOpenDisplay(display)) == NULL) { fprintf(stderr, "can't open display\n"); exit(0); } screen = DefaultScreen(dpy); xswat.override_redirect = True; xswat.do_not_propagate_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask; vmask = CWOverrideRedirect | CWDontPropagate; win = XCreateWindow(dpy, RootWindow(dpy, screen), 0, 0, DisplayWidth(dpy, screen), DisplayHeight(dpy, screen), 0, CopyFromParent, CopyFromParent, CopyFromParent, vmask, &xswat); XMapWindow(dpy, win); gcvals.graphics_exposures = False; /* copyplane gc wants to leave the data alone */ gcvals.foreground = 1; gcvals.background = 0; copygc = XCreateGC(dpy, win, GCForeground | GCBackground | GCGraphicsExposures, &gcvals); gcvals.foreground = BlackPixel(dpy, screen); fillgc = XCreateGC(dpy, win, GCForeground, &gcvals); XSync(dpy, 0); sleep(1); if (use_planes) { do_planes(); } else { do_all(); } /* NOTREACHED */ exit(0); } do_planes() { int finished = 0; int width, xloc, yloc, dist, size, i; short **heights; heights = (short **) malloc(DisplayPlanes(dpy, screen)); for (i = 0; i < DisplayPlanes(dpy, screen); i++) heights[i] = (short *) calloc(sizeof(short), DisplayWidth(dpy, screen)); while (1) { depth = rnd(DisplayPlanes(dpy, screen)); width = rnd(MIN_WIDTH) + WIDTH_ADD; xloc = calc_xloc(width); yloc = DisplayHeight(dpy, screen); for (i = xloc; i < (xloc + width); i++) { yloc = min(yloc, heights[depth][i]); } if (yloc == DisplayHeight(dpy, screen)) continue; dist = rnd(yloc/10 + MIN_DIST); size = rnd(max(yloc + MIN_SIZE, MAX_SIZE)); XSetPlaneMask(dpy, copygc, 1 << depth); XSetPlaneMask(dpy, fillgc, 1 << depth); XCopyArea(dpy, win, win, copygc, xloc, yloc, width, size, xloc, yloc + dist); XFillRectangle(dpy, win, fillgc, xloc, yloc, width, dist); yloc += dist; for (i = xloc; i < (xloc + width); i++) { if ((heights[depth][i] < (DisplayHeight(dpy, screen) - MIN_SIZE)) && (yloc >= (DisplayHeight(dpy, screen) - MIN_SIZE))) finished++; heights[depth][i] = max(heights[depth][i], yloc); } if (finished >= (DisplayWidth(dpy, screen) - FINISHED)) { XSync(dpy, 0); exit(0); } } } do_all() { int finished = 0; int width, xloc, yloc, dist, size, i; short *heights; heights = (short *) calloc(sizeof(short), DisplayWidth(dpy, screen)); while (1) { depth = rnd(DisplayPlanes(dpy, screen)); width = rnd(MIN_WIDTH) + WIDTH_ADD; xloc = calc_xloc(width); yloc = DisplayHeight(dpy, screen); for (i = xloc; i < (xloc + width); i++) { yloc = min(yloc, heights[i]); } if (yloc == DisplayHeight(dpy, screen)) continue; dist = rnd(yloc/10 + MIN_DIST); size = rnd(max(yloc + MIN_SIZE, MAX_SIZE)); XCopyArea(dpy, win, win, copygc, xloc, yloc, width, size, xloc, yloc + dist); XFillRectangle(dpy, win, fillgc, xloc, yloc, width, dist); yloc += dist; for (i = xloc; i < (xloc + width); i++) { if ((heights[i] < (DisplayHeight(dpy, screen) - MIN_SIZE)) && (yloc >= (DisplayHeight(dpy, screen) - MIN_SIZE))) finished++; heights[i] = max(heights[i], yloc); } if (finished >= (DisplayWidth(dpy, screen) - FINISHED)) { XSync(dpy, 0); exit(0); } } } int calc_xloc(width) int width; { int xloc; /* give values near edges a better chance */ xloc = rnd(DisplayWidth(dpy, screen) + MIN_WIDTH) - MIN_WIDTH; if ((xloc + width) > DisplayWidth(dpy, screen)) xloc = DisplayWidth(dpy, screen) - width; else if (xloc < 0) xloc = 0; return xloc; } xflip-1.01.orig/flip.c.cln100644 764 764 16151 4606072440 13602 0ustar joeyjoey/* * flip -- mess up the screen */ /* * Copyright 1990 David Lemke and Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Network Computing Devices not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Network Computing * Devices makes no representations about the suitability of this software * for any purpose. It is provided "as is" without express or implied * warranty. * * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE * OR PERFORMANCE OF THIS SOFTWARE. * * Author: * Dave Lemke * lemke@ncd.com * * Network Computing Devices, Inc * 350 North Bernardo Ave * Mountain View, CA 94043 * * @(#)flip.c 1.3 90/03/22 * */ #include #include #ifdef DEBUG #define assert(ex) {if (!(ex)){(void)fprintf(stderr,"Assertion \"ex\" failed: file \"%s\", line %d\n", __FILE__, __LINE__);abort();}} #else #define assert(ex) #endif #define rnd(x) (random() % (x)) /* parameters for random flips */ #define CHUNK_WIDTH 100 #define CHUNK_HEIGHT 100 #define MIN_CHUNK_WIDTH 5 #define MIN_CHUNK_HEIGHT 5 /* number of times to do random flipping */ #define NUM_TIMES 300 #define MIN_TIMES 20 #define GLOAT_TIME 3 /* time in seconds to show the results if * in fast mode */ Display *dpy; Window win; Pixmap pmap; GC copygc; int screen; Bool do_vert = False; /* flip top-to-bottom */ Bool do_fast = False; /* show results all at once */ Bool do_random = False; /* do small random pieces instead of full screen */ Bool do_planes = False; /* do a single plane at a time instead of all */ int do_half = 1; /* divisor for how much to flip. * 1 leaves things the way they started * 2 leaves them flipped */ usage() { fprintf(stderr, "Usage: flip [-planes] [-vert] [-fast | -random] [-times] [-display ]\n"); exit(1); } main(argc, argv) int argc; char **argv; { char *display = NULL; unsigned long vmask, gcmask; XSetWindowAttributes xswat; XGCValues gcvals; int i; int times = -1; Drawable drawable; int x, y, w, h; /* process args */ for (i = 1; i < argc; i++) { if (strncmp(argv[i], "-dis", 4) == 0) { if (argv[i+1]) display = argv[++i]; else usage(); } else if (strncmp(argv[i], "-t", 2) == 0) { if (argv[i+1]) times = atoi(argv[++i]); else usage(); } else if (strncmp(argv[i], "-p", 2) == 0) { do_planes = True; } else if (strncmp(argv[i], "-f", 2) == 0) { do_fast = True; do_half = 2; } else if (strncmp(argv[i], "-r", 2) == 0) { do_random = True; if (times < 0) times = rnd(NUM_TIMES) + MIN_TIMES; } else if (strncmp(argv[i], "-v", 2) == 0) { do_vert = True; } else usage(); } if ((dpy = XOpenDisplay(display)) == NULL) { fprintf(stderr, "can't open display\n"); exit(0); } screen = DefaultScreen(dpy); if (!do_random) { xswat.override_redirect = True; xswat.do_not_propagate_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask; vmask = CWOverrideRedirect | CWDontPropagate; win = XCreateWindow(dpy, RootWindow(dpy, screen), 0, 0, DisplayWidth(dpy, screen), DisplayHeight(dpy, screen), 0, CopyFromParent, CopyFromParent, CopyFromParent, vmask, &xswat); } if (do_fast) { pmap = XCreatePixmap(dpy, RootWindow(dpy, screen), DisplayWidth(dpy, screen), DisplayHeight(dpy, screen), DisplayPlanes(dpy, screen)); } gcvals.graphics_exposures = False; /* copyplane gc wants to leave the data alone */ gcvals.foreground = 1; gcvals.background = 0; gcvals.subwindow_mode = IncludeInferiors; gcmask = GCForeground | GCBackground | GCGraphicsExposures | GCSubwindowMode; copygc = XCreateGC(dpy, RootWindow(dpy, screen), gcmask, &gcvals); if (do_fast) { /* copy the screen contents */ XCopyArea(dpy, RootWindow(dpy, screen), pmap, copygc, 0, 0, DisplayWidth(dpy, screen), DisplayHeight(dpy, screen), 0, 0); } else if (!do_random) { XMapRaised(dpy, win); } /* make sure everything's done */ XSync(dpy, 0); /* choose what to mess up */ if (do_fast) drawable = pmap; else if (do_random) drawable = RootWindow(dpy, screen); else drawable = win; srandom(getpid()); if (do_random) { for (i = 0; i < times; i++) { if (do_planes) XSetPlaneMask(dpy, copygc, (1 << rnd(DisplayPlanes(dpy, screen)))); x = rnd(DisplayWidth(dpy, screen)); y = rnd(DisplayHeight(dpy, screen)); w = rnd(CHUNK_WIDTH) + MIN_CHUNK_WIDTH; h = rnd(CHUNK_HEIGHT) + MIN_CHUNK_HEIGHT; /* shift over if going off screen */ if ((x + w) >= DisplayWidth(dpy, screen)) { x -= (w + 1); /* dont get the last line */ } if ((y + h) >= DisplayHeight(dpy, screen)) { y -= (h + 1); } if (rnd(2)) flip_vert(drawable, x, y, w, h); else flip_horz(drawable, x, y, w, h); XSync(dpy, 0); } exit (0); } else { if (do_planes) XSetPlaneMask(dpy, copygc, (1 << rnd(DisplayPlanes(dpy, screen)))); if (do_vert) flip_vert(drawable, 0, 0, DisplayWidth(dpy, screen) - 1, DisplayHeight(dpy, screen) - 1); else flip_horz(drawable, 0, 0, DisplayWidth(dpy, screen) - 1, DisplayHeight(dpy, screen) - 1); } /* show the dirty work */ if (do_fast) { XMapWindow(dpy, win); XSync(dpy, 0); /* be sure its mapped before filling it */ XCopyArea(dpy, pmap, win, copygc, 0, 0, DisplayWidth(dpy, screen), DisplayHeight(dpy, screen), 0, 0); } XSync(dpy, 0); /* gloat a bit */ if (do_fast) sleep(GLOAT_TIME); exit(0); } flip_horz(d, x, y, w, h) Drawable d; int x, y, w, h; { Pixmap temp; int i; int width = 1; assert(h > 0); temp = XCreatePixmap(dpy, RootWindow(dpy, screen), width, h, DisplayPlanes(dpy, screen)); for (i = x; i <= (x + w)/do_half; i+= width) { XCopyArea(dpy, d, temp, copygc, i, y, width, h, 0, 0); XCopyArea(dpy, d, d, copygc, (w + x) - (i - x), y, width, h, i, y); XCopyArea(dpy, temp, d, copygc, 0, 0, width, h, (w + x) - (i - x), y); } XFreePixmap(dpy, temp); } flip_vert(d, x, y, w, h) Drawable d; int x, y, w, h; { Pixmap temp; int i; int height = 1; assert(w > 0); temp = XCreatePixmap(dpy, RootWindow(dpy, screen), w, height, DisplayPlanes(dpy, screen)); for (i = y; i <= (y + h)/do_half; i+= height) { XCopyArea(dpy, d, temp, copygc, x, i, w, height, 0, 0); XCopyArea(dpy, d, d, copygc, x, (y + h) - (i - y), w, height, x, i); XCopyArea(dpy, temp, d, copygc, 0, 0, w, height, x, (y + h) - (i - y)); } XFreePixmap(dpy, temp); } xflip-1.01.orig/Imakefile.cln100644 764 764 355 4606072436 14261 0ustar joeyjoeyLOCAL_LIBRARIES = $(XLIB) OBJS1 = meltdown.o OBJS2 = flip.o PROGRAMS = meltdown flip AllTarget($(PROGRAMS)) NormalProgramTarget(meltdown, $(OBJS1), , , $(LOCAL_LIBRARIES)) NormalProgramTarget(flip, $(OBJS2), , , $(LOCAL_LIBRARIES)) xflip-1.01.orig/meltdown.c.cln100644 764 764 13475 4606072442 14511 0ustar joeyjoey/* * meltdown -- mess up the screen */ /* * Copyright 1990 David Lemke and Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Network Computing Devices not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Network Computing * Devices makes no representations about the suitability of this software * for any purpose. It is provided "as is" without express or implied * warranty. * * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE * OR PERFORMANCE OF THIS SOFTWARE. * * Author: * Dave Lemke * lemke@ncd.com * * Network Computing Devices, Inc * 350 North Bernardo Ave * Mountain View, CA 94043 * * @(#)meltdown.c 1.2 90/02/22 * */ #include #include #define MIN_SIZE 10 #define MAX_SIZE 100 #define MIN_DIST 10 #define MIN_WIDTH 30 #define WIDTH_ADD 20 #define FINISHED 50 #define rnd(x) (random() % (x)) #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b)) Display *dpy; Window win; GC copygc, fillgc; int screen; int depth; short **heights; usage() { fprintf(stderr, "Usage: meltdown [-planes] [-display ]\n"); exit(1); } main(argc, argv) int argc; char **argv; { char *display = NULL; unsigned long vmask; XSetWindowAttributes xswat; XGCValues gcvals; Bool use_planes = False; int i; srandom(getpid()); for (i = 1; i < argc; i++) { if (strncmp(argv[i], "-dis", 4) == 0) { if (argv[i+1]) display = argv[++i]; else usage(); } else if (strncmp(argv[i], "-p", 2) == 0) { use_planes = 1; } else usage(); } if ((dpy = XOpenDisplay(display)) == NULL) { fprintf(stderr, "can't open display\n"); exit(0); } screen = DefaultScreen(dpy); xswat.override_redirect = True; xswat.do_not_propagate_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask; vmask = CWOverrideRedirect | CWDontPropagate; win = XCreateWindow(dpy, RootWindow(dpy, screen), 0, 0, DisplayWidth(dpy, screen), DisplayHeight(dpy, screen), 0, CopyFromParent, CopyFromParent, CopyFromParent, vmask, &xswat); XMapWindow(dpy, win); gcvals.graphics_exposures = False; /* copyplane gc wants to leave the data alone */ gcvals.foreground = 1; gcvals.background = 0; copygc = XCreateGC(dpy, win, GCForeground | GCBackground | GCGraphicsExposures, &gcvals); gcvals.foreground = BlackPixel(dpy, screen); fillgc = XCreateGC(dpy, win, GCForeground, &gcvals); XSync(dpy, 0); sleep(1); if (use_planes) { do_planes(); } else { do_all(); } /* NOTREACHED */ exit(0); } do_planes() { int finished = 0; int width, xloc, yloc, dist, size, i; short **heights; heights = (short **) malloc(DisplayPlanes(dpy, screen)); for (i = 0; i < DisplayPlanes(dpy, screen); i++) heights[i] = (short *) calloc(sizeof(short), DisplayWidth(dpy, screen)); while (1) { depth = rnd(DisplayPlanes(dpy, screen)); width = rnd(MIN_WIDTH) + WIDTH_ADD; xloc = calc_xloc(width); yloc = DisplayHeight(dpy, screen); for (i = xloc; i < (xloc + width); i++) { yloc = min(yloc, heights[depth][i]); } if (yloc == DisplayHeight(dpy, screen)) continue; dist = rnd(yloc/10 + MIN_DIST); size = rnd(max(yloc + MIN_SIZE, MAX_SIZE)); XSetPlaneMask(dpy, copygc, 1 << depth); XSetPlaneMask(dpy, fillgc, 1 << depth); XCopyArea(dpy, win, win, copygc, xloc, yloc, width, size, xloc, yloc + dist); XFillRectangle(dpy, win, fillgc, xloc, yloc, width, dist); yloc += dist; for (i = xloc; i < (xloc + width); i++) { if ((heights[depth][i] < (DisplayHeight(dpy, screen) - MIN_SIZE)) && (yloc >= (DisplayHeight(dpy, screen) - MIN_SIZE))) finished++; heights[depth][i] = max(heights[depth][i], yloc); } if (finished >= (DisplayWidth(dpy, screen) - FINISHED)) { XSync(dpy, 0); exit(0); } } } do_all() { int finished = 0; int width, xloc, yloc, dist, size, i; short *heights; heights = (short *) calloc(sizeof(short), DisplayWidth(dpy, screen)); while (1) { depth = rnd(DisplayPlanes(dpy, screen)); width = rnd(MIN_WIDTH) + WIDTH_ADD; xloc = calc_xloc(width); yloc = DisplayHeight(dpy, screen); for (i = xloc; i < (xloc + width); i++) { yloc = min(yloc, heights[i]); } if (yloc == DisplayHeight(dpy, screen)) continue; dist = rnd(yloc/10 + MIN_DIST); size = rnd(max(yloc + MIN_SIZE, MAX_SIZE)); XCopyArea(dpy, win, win, copygc, xloc, yloc, width, size, xloc, yloc + dist); XFillRectangle(dpy, win, fillgc, xloc, yloc, width, dist); yloc += dist; for (i = xloc; i < (xloc + width); i++) { if ((heights[i] < (DisplayHeight(dpy, screen) - MIN_SIZE)) && (yloc >= (DisplayHeight(dpy, screen) - MIN_SIZE))) finished++; heights[i] = max(heights[i], yloc); } if (finished >= (DisplayWidth(dpy, screen) - FINISHED)) { XSync(dpy, 0); exit(0); } } } int calc_xloc(width) int width; { int xloc; /* give values near edges a better chance */ xloc = rnd(DisplayWidth(dpy, screen) + MIN_WIDTH) - MIN_WIDTH; if ((xloc + width) > DisplayWidth(dpy, screen)) xloc = DisplayWidth(dpy, screen) - width; else if (xloc < 0) xloc = 0; return xloc; } xflip-1.01.orig/HPUX.Install100644 764 764 634 6114354364 14010 0ustar joeyjoeyFiles changed: * Imakefile: - Added ANSI flag for HP-UX. * flip.c and meltdown.c: - Simulated random() and srandom() for HP-UX. * flip.c: - Rolled in new "-oblic" option code (see Notes). To compile and install: xmkmf make install Notes: * Applied new "-oblic" option (horizontal and vertical flip) from Hacquin Renaud . * No man page :-( Try "flip -?" or "meltdown -?". xflip-1.01.orig/HPUX.Install.cln100644 764 764 634 5651512536 14565 0ustar joeyjoeyFiles changed: * Imakefile: - Added ANSI flag for HP-UX. * flip.c and meltdown.c: - Simulated random() and srandom() for HP-UX. * flip.c: - Rolled in new "-oblic" option code (see Notes). To compile and install: xmkmf make install Notes: * Applied new "-oblic" option (horizontal and vertical flip) from Hacquin Renaud . * No man page :-( Try "flip -?" or "meltdown -?". xflip-1.01.orig/README.HPPD100644 764 764 1210 6114355666 13323 0ustar joeyjoeyPackage name: xflip Version number: 1.01 Original author: Dave Lemke Report bugs to: hpux@csc.liv.ac.uk Tested on: HP 9000/735/125 running HP-UX 9.03 C compiler used: Version A.09.77 Purpose: Two programs to mirror-image or melt your display. Flip your screen on either the vertical or horizontal axis or crumble away the graphics on your display. Both commands have a -planes option to independently act on individual bit planes. This version now comes with a new -oblic option which flips horizontally and vertically simultaneously. Date archived: Mon 26 Feb 1996 Special notes: Read HPUX.Install as usual.