home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.x
- From: daniel@uunet.UU.NET@vicorp (Daniel Dee)
- Subject: v19i041: blast - X Shape Extension program to blast holes in your windows, Part01/01
- Message-ID: <1993Mar12.141752.20034@sparky.imd.sterling.com>
- X-Md4-Signature: 6440903ae2c19f2ff0a6ceffd3509dc3
- Date: Fri, 12 Mar 1993 14:17:52 GMT
- Approved: chris@sparky.imd.sterling.com
-
- Submitted-by: daniel@uunet.UU.NET@vicorp (Daniel Dee)
- Posting-number: Volume 19, Issue 41
- Archive-name: blast/part01
- Environment: X11, Shape
-
- [There are no man pages for this program. It really didn't need any, so I
- posted it anyway. -- cmo]
-
- blast v1.0
- Copyright (c) 1992 Daniel Dee
- This program is free software; you may
- redistribute it and/or modify it under the terms of
- the GNU General Public License as published by the
- Free Software Foundation; either version, or
- any later version.
-
-
- email: ddee@vicorp.com
- V.I. Corporation
- 47 Pleasant Street
- Northampton, MA 01060
-
-
- What is Blast?
-
- Blast is simple program that lets you blast holes any window in X
- using mouse button 1. Mouse button 2 repairs blasted windows and
- mouse button 3 exits the program. Holes become permanent unless
- you repair them before you quit. You may move permanently "damaged"
- windows and enjoy the view behind the holes.
-
- -------------------------Cut Here------------------------------------
- echo x - Imakefile
- sed 's/^X//' >Imakefile <<'*-*-END-of-Imakefile-*-*'
- XCCOPTIONS = -g -Dsun4
- XSYS_LIBRARIES = -lm
- XLOCAL_LIBRARIES = $(XLIB)
- XDEPLIB =
- XSRCS = blast.c
- XOBJS = blast.o
- X
- XComplexProgramTarget(blast)
- X
- Xblast: shooting.au
- X
- Xshooting.au: shooting.au.uu
- X uudecode shooting.au.uu
- X
- *-*-END-of-Imakefile-*-*
- echo x - Makefile
- sed 's/^X//' >Makefile <<'*-*-END-of-Makefile-*-*'
- X# Makefile generated by imake - do not edit!
- X# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $
- X#
- X# The cpp used on this machine replaces all newlines and multiple tabs and
- X# spaces in a macro expansion with a single space. Imake tries to compensate
- X# for this, but is not always successful.
- X#
- X
- X# -------------------------------------------------------------------------
- X# Makefile generated from "Imake.tmpl" and <Imakefile>
- X# $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $
- X#
- X# Platform-specific parameters may be set in the appropriate <vendor>.cf
- X# configuration files. Site-specific parameters should be set in the file
- X# site.def. Full rebuilds are recommended if any parameters are changed.
- X#
- X# If your C preprocessor does not define any unique symbols, you will need
- X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
- X# "make World" the first time).
- X#
- X
- X# -------------------------------------------------------------------------
- X# site-specific configuration parameters that need to come before
- X# the platform-specific parameters - edit site.def to change
- X
- X# site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
- X
- X# -------------------------------------------------------------------------
- X# platform-specific configuration parameters - edit sun.cf to change
- X
- X# platform: $XConsortium: sun.cf,v 1.72.1.1 92/03/18 13:13:37 rws Exp $
- X
- X# operating system: SunOS 4.1.1
- X
- X# $XConsortium: sunLib.rules,v 1.7 91/12/20 11:19:47 rws Exp $
- X
- X.c.o:
- X $(CC) -c $(CFLAGS) $*.c
- X
- X# -------------------------------------------------------------------------
- X# site-specific configuration parameters that go after
- X# the platform-specific parameters - edit site.def to change
- X
- X# site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
- X
- X SHELL = /bin/sh
- X
- X TOP = .
- X CURRENT_DIR = .
- X
- X AR = ar clq
- X BOOTSTRAPCFLAGS =
- X CC = gcc -fpcc-struct-return
- X AS = as
- X
- X COMPRESS = compress
- X CPP = /lib/cpp $(STD_CPP_DEFINES)
- X PREPROCESSCMD = gcc -fpcc-struct-return -E $(STD_CPP_DEFINES)
- X INSTALL = install
- X LD = ld
- X LINT = lint
- X LINTLIBFLAG = -C
- X LINTOPTS = -axz
- X LN = ln -s
- X MAKE = make
- X MV = mv
- X CP = cp
- X
- X RANLIB = ranlib
- X RANLIBINSTFLAGS =
- X
- X RM = rm -f
- X TROFF = psroff
- X MSMACROS = -ms
- X TBL = tbl
- X EQN = eqn
- X STD_INCLUDES =
- X STD_CPP_DEFINES =
- X STD_DEFINES =
- X EXTRA_LOAD_FLAGS =
- X EXTRA_LIBRARIES =
- X TAGS = ctags
- X
- X SHAREDCODEDEF = -DSHAREDCODE
- X SHLIBDEF = -DSUNSHLIB
- X
- X PROTO_DEFINES =
- X
- X INSTPGMFLAGS =
- X
- X INSTBINFLAGS = -m 0755
- X INSTUIDFLAGS = -m 4755
- X INSTLIBFLAGS = -m 0644
- X INSTINCFLAGS = -m 0444
- X INSTMANFLAGS = -m 0444
- X INSTDATFLAGS = -m 0444
- X INSTKMEMFLAGS = -g kmem -m 2755
- X
- X PROJECTROOT = /usr/local/X11R5
- X
- X TOP_INCLUDES = -I$(INCROOT)
- X
- X CDEBUGFLAGS = -O2
- X CCOPTIONS =
- X
- X ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
- X ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
- X CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
- X LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
- X
- X LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
- X
- X LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR)
- X
- X LDCOMBINEFLAGS = -X -r
- X DEPENDFLAGS =
- X
- X MACROFILE = sun.cf
- X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
- X
- X IMAKE_DEFINES =
- X
- X IRULESRC = $(CONFIGDIR)
- X IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
- X
- X ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
- X $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
- X $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
- X
- X# -------------------------------------------------------------------------
- X# X Window System Build Parameters
- X# $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
- X
- X# -------------------------------------------------------------------------
- X# X Window System make variables; this need to be coordinated with rules
- X
- X PATHSEP = /
- X USRLIBDIR = /usr/local/X11R5/lib
- X BINDIR = /usr/local/X11R5/bin
- X INCROOT = /usr/local/X11R5/include
- X BUILDINCROOT = $(TOP)
- X BUILDINCDIR = $(BUILDINCROOT)/X11
- X BUILDINCTOP = ..
- X INCDIR = $(INCROOT)/X11
- X ADMDIR = /usr/adm
- X LIBDIR = $(USRLIBDIR)/X11
- X CONFIGDIR = $(LIBDIR)/config
- X LINTLIBDIR = $(USRLIBDIR)/lint
- X
- X FONTDIR = $(LIBDIR)/fonts
- X XINITDIR = $(LIBDIR)/xinit
- X XDMDIR = $(LIBDIR)/xdm
- X TWMDIR = $(LIBDIR)/twm
- X MANPATH = /usr/local/X11R5/man
- X MANSOURCEPATH = $(MANPATH)/man
- X MANSUFFIX = n
- X LIBMANSUFFIX = 3
- X MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
- X LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
- X NLSDIR = $(LIBDIR)/nls
- X PEXAPIDIR = $(LIBDIR)/PEX
- X XAPPLOADDIR = $(LIBDIR)/app-defaults
- X FONTCFLAGS = -t
- X
- X INSTAPPFLAGS = $(INSTDATFLAGS)
- X
- X IMAKE = imake
- X DEPEND = makedepend
- X RGB = rgb
- X
- X FONTC = bdftopcf
- X
- X MKFONTDIR = mkfontdir
- X MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
- X
- X CONFIGSRC = $(TOP)/config
- X DOCUTILSRC = $(TOP)/doc/util
- X CLIENTSRC = $(TOP)/clients
- X DEMOSRC = $(TOP)/demos
- X LIBSRC = $(TOP)/lib
- X FONTSRC = $(TOP)/fonts
- X INCLUDESRC = $(TOP)/X11
- X SERVERSRC = $(TOP)/server
- X UTILSRC = $(TOP)/util
- X SCRIPTSRC = $(UTILSRC)/scripts
- X EXAMPLESRC = $(TOP)/examples
- X CONTRIBSRC = $(TOP)/../contrib
- X DOCSRC = $(TOP)/doc
- X RGBSRC = $(TOP)/rgb
- X DEPENDSRC = $(UTILSRC)/makedepend
- X IMAKESRC = $(CONFIGSRC)
- X XAUTHSRC = $(LIBSRC)/Xau
- X XLIBSRC = $(LIBSRC)/X
- X XMUSRC = $(LIBSRC)/Xmu
- X TOOLKITSRC = $(LIBSRC)/Xt
- X AWIDGETSRC = $(LIBSRC)/Xaw
- X OLDXLIBSRC = $(LIBSRC)/oldX
- X XDMCPLIBSRC = $(LIBSRC)/Xdmcp
- X BDFTOSNFSRC = $(FONTSRC)/bdftosnf
- X BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
- X BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
- X MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
- X FSLIBSRC = $(FONTSRC)/lib/fs
- X FONTSERVERSRC = $(FONTSRC)/server
- X EXTENSIONSRC = $(TOP)/extensions
- X XILIBSRC = $(EXTENSIONSRC)/lib/xinput
- X PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
- X
- X# $XConsortium: sunLib.tmpl,v 1.14.1.1 92/03/17 14:58:46 rws Exp $
- X
- XSHLIBLDFLAGS = -assert pure-text
- XPICFLAGS = -fpic
- X
- X DEPEXTENSIONLIB =
- X EXTENSIONLIB = -lXext
- X
- X DEPXLIB = $(DEPEXTENSIONLIB)
- X XLIB = $(EXTENSIONLIB) -lX11
- X
- X DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV)
- X XMULIBONLY = -lXmu
- X XMULIB = -lXmu
- X
- X DEPOLDXLIB =
- X OLDXLIB = -loldX
- X
- X DEPXTOOLLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV)
- X XTOOLLIB = -lXt
- X
- X DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV)
- X XAWLIB = -lXaw
- X
- X DEPXILIB =
- X XILIB = -lXi
- X
- X SOXLIBREV = 4.10
- X SOXTREV = 4.10
- X SOXAWREV = 5.0
- X SOOLDXREV = 4.10
- X SOXMUREV = 4.10
- X SOXEXTREV = 4.10
- X SOXINPUTREV = 4.10
- X
- X DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
- X XAUTHLIB = -lXau
- X DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
- X XDMCPLIB = -lXdmcp
- X
- X DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
- X PHIGSLIB = -lphigs
- X
- X DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
- X XBSDLIB = -lXbsd
- X
- X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
- X LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
- X LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
- X LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
- X LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
- X LINTXI = $(LINTLIBDIR)/llib-lXi.ln
- X LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
- X
- X DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
- X
- X DEPLIBS1 = $(DEPLIBS)
- X DEPLIBS2 = $(DEPLIBS)
- X DEPLIBS3 = $(DEPLIBS)
- X
- X# -------------------------------------------------------------------------
- X# Imake rules for building libraries, programs, scripts, and data files
- X# rules: $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
- X
- X# -------------------------------------------------------------------------
- X# start of Imakefile
- X
- XCCOPTIONS = -g
- XSYS_LIBRARIES = -lm
- XLOCAL_LIBRARIES = $(XLIB)
- XDEPLIB =
- XSRCS = blast.c
- XOBJS = blast.o
- X
- X PROGRAM = blast
- X
- Xall:: blast
- X
- Xblast: $(OBJS) $(DEPLIBS)
- X $(RM) $@
- X $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
- X
- Xsaber_blast:: $(SRCS)
- X # load $(ALLDEFINES) $(SRCS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
- X
- Xosaber_blast:: $(OBJS)
- X # load $(ALLDEFINES) $(OBJS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
- X
- Xinstall:: blast
- X @if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \
- X else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi
- X $(INSTALL) -c $(INSTPGMFLAGS) blast $(DESTDIR)$(BINDIR)
- X
- Xinstall.man:: blast.man
- X @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
- X else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
- X $(INSTALL) -c $(INSTMANFLAGS) blast.man $(DESTDIR)$(MANDIR)/blast.$(MANSUFFIX)
- X
- Xdepend::
- X $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
- X
- Xlint:
- X $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
- Xlint1:
- X $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
- X
- Xclean::
- X $(RM) $(PROGRAM)
- X
- Xblast: shooting.au
- X
- Xshooting.au: shooting.au.uu
- X uudecode shooting.au.uu
- X
- X# -------------------------------------------------------------------------
- X# common rules for all Makefiles - do not edit
- X
- Xemptyrule::
- X
- Xclean::
- X $(RM_CMD) "#"*
- X
- XMakefile::
- X -@if [ -f Makefile ]; then set -x; \
- X $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
- X else exit 0; fi
- X $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
- X
- Xtags::
- X $(TAGS) -w *.[ch]
- X $(TAGS) -xw *.[ch] > TAGS
- X
- Xsaber:
- X # load $(ALLDEFINES) $(SRCS)
- X
- Xosaber:
- X # load $(ALLDEFINES) $(OBJS)
- X
- X# -------------------------------------------------------------------------
- X# empty rules for directories that do not have SUBDIRS - do not edit
- X
- Xinstall::
- X @echo "install in $(CURRENT_DIR) done"
- X
- Xinstall.man::
- X @echo "install.man in $(CURRENT_DIR) done"
- X
- XMakefiles::
- X
- Xincludes::
- X
- X# -------------------------------------------------------------------------
- X# dependencies generated by makedepend
- X
- *-*-END-of-Makefile-*-*
- echo x - README
- sed 's/^X//' >README <<'*-*-END-of-README-*-*'
- Xblast v1.0
- XCopyright (c) 1992 Daniel Dee
- XThis program is free software; you may
- Xredistribute it and/or modify it under the terms of
- Xthe GNU General Public License as published by the
- XFree Software Foundation; either version, or
- Xany later version.
- X
- X
- Xemail: ddee@vicorp.com
- XV.I. Corporation
- X47 Pleasant Street
- XNorthampton, MA 01060
- X
- X
- XWhat is Blast?
- X
- XBlast is simple program that lets you blast holes any window in X
- Xusing mouse button 1. Mouse button 2 repairs blasted windows and
- Xmouse button 3 exits the program. Holes become permanent unless
- Xyou repair them before you quit. You may move permanently "damaged"
- Xwindows and enjoy the view behind the holes.
- X
- X
- XBuilding Blast
- X
- XEdit the Imakefile. Set CCOPTIONS to use the appropriate
- Xplatform/architecture. Then type xmkmf to generate a new
- XMakefile. Type: make blast to build the blast program.
- X
- XThis program was tested on Sparc IPC, Silicon Graphics IRIS,
- X386s running SCO Unix, and DECstations running Ultrix.
- X
- X
- XTechnical Details
- X
- XBlast uses the X Window Shape Extension library. If you are
- Xbuilding this on a Sun 4, you may also enable the shooting sound
- Xeffect.
- X
- XYou may have the program repair all holes by default when you
- Xquit by setting REPAIR_EVERYTHING_IN_SIGHT.
- X
- XThe program is not overly sophisticated. It was written as an
- Xexercise in using X Shape Extension. Hopefully, it will
- Xeducational for others as well.
- X
- X
- XAny suggestion for future enhancements is welcome. I'd like most
- Xto incorporate sound effects for machines other the Sun. If
- Xsomebody can give me a hint on where to start, I'd be most grateful.
- X
- XEnjoy.
- X
- *-*-END-of-README-*-*
- echo x - blast.c
- sed 's/^X//' >blast.c <<'*-*-END-of-blast.c-*-*'
- X#ifndef lint
- Xstatic char SccsId[] = "@(#)blast.c V1.1 9/9/92";
- X#endif
- X
- X/* blast.c
- X Written by Daniel Dee 7/23/92
- X
- X Copyright (c) 1992 Daniel Dee
- X This program is free software; you may
- X redistribute it and/or modify it under the terms of
- X the GNU General Public License as published by the
- X Free Software Foundation; either version, or
- X any later version.
- X
- X email: ddee@vicorp.com
- X V.I. Corporation
- X 47 Pleasant Street
- X Northampton, MA 01060
- X*/
- X
- X#include <stdio.h>
- X
- X#ifndef VMS
- X/* Header files for Unix version */
- X#include <X11/X.h>
- X#include <X11/Xlib.h>
- X#include <X11/Xutil.h>
- X#include <X11/Intrinsic.h>
- X#include <X11/Xatom.h>
- X#include <X11/cursorfont.h>
- X#include <X11/keysym.h>
- X#include <X11/extensions/shape.h>
- X
- X#include <errno.h>
- X#include <ctype.h>
- X#include <stdlib.h>
- X#include <fcntl.h>
- X#else
- X/* Header files for VMS version */
- X#include <decw$include/Xlib.h>
- X#include <decw$include/Xutil.h>
- X#include <decw$include/Intrinsic.h>
- X#include <decw$include/Xatom.h>
- X#include <decw$include/keysym.h>
- X#endif /* VMS */
- X
- X#define INITIAL_MAXWIN 100
- X#define AUDIO_DEVICE "/dev/audio"
- X#define FILENAME "shooting.au"
- X
- Xstatic void BlastWindow();
- Xstatic void SaveWindow();
- Xstatic Window GetWindowToBlast();
- Xstatic void RepairWindows();
- Xstatic void MakeNoise();
- Xstatic FILE* OpenSoundFile();
- Xstatic void CloseSoundFile();
- X
- Xtypedef struct
- X{
- X Window window;
- X Bool bshaped;
- X XRectangle *bound;
- X int bcount;
- X int border;
- X Bool cshaped;
- X XRectangle *clip;
- X int ccount;
- X int corder;
- X}
- XWinList;
- X
- Xmain( argc, argv )
- Xint argc;
- Xchar *argv[];
- X{
- X Display *display;
- X Window window, root;
- X long screen;
- X GC gc;
- X XEvent event;
- X XGCValues gcvalues;
- X Pixmap shape_mask;
- X WinList *winlist;
- X int numwin = 0;
- X int maxwin = INITIAL_MAXWIN;
- X FILE *fp, *afp;
- X
- X /* Open display connection and create a window */
- X if( (display = XOpenDisplay( "" )) == (Display*)NULL )
- X {
- X fprintf( stderr, "Invalid display\n" );
- X exit(0);
- X }
- X
- X winlist = (WinList*)malloc( maxwin * sizeof(WinList) );
- X screen = DefaultScreen(display);
- X root = RootWindow( display, screen );
- X
- X gcvalues.foreground = 1;
- X gcvalues.background = 0;
- X shape_mask = XCreatePixmap( display, root,
- X DisplayWidth(display,screen),
- X DisplayHeight(display,screen), 1);
- X gc = XCreateGC(display, shape_mask, GCForeground | GCBackground, &gcvalues);
- X
- X afp = OpenSoundFile();
- X
- X /* Main event loop */
- X for(;;)
- X {
- X window = GetWindowToBlast(display, screen, &event, winlist,
- X &numwin, &maxwin);
- X switch( event.xbutton.button )
- X {
- X case Button1:
- X BlastWindow( display, window, gc, screen, shape_mask, afp );
- X break;
- X case Button2:
- X RepairWindows( display, root, winlist, numwin );
- X break;
- X case Button3:
- X CloseSoundFile( afp );
- X exit(0);
- X }
- X }
- X}
- X
- X
- Xstatic void BlastWindow( display, window, gc, screen, shape_mask, afp )
- XDisplay *display;
- XWindow window;
- XGC gc;
- Xlong screen;
- XPixmap shape_mask;
- XFILE *afp;
- X{
- X int x, y, root_x, root_y;
- X unsigned int bwidth, dummy;
- X unsigned int key_buttons;
- X Window root, child;
- X
- X XGetGeometry( display, window, &root, &x, &y,
- X &dummy, &dummy, &bwidth, &dummy );
- X
- X#if 0
- X window = XmuClientWindow (display, window);
- X#endif
- X
- X XSetForeground( display, gc, 1 );
- X XFillRectangle( display, shape_mask, gc, 0, 0,
- X DisplayWidth(display,screen),
- X DisplayHeight(display,screen) );
- X
- X XQueryPointer(display, window, &root, &child, &root_x,
- X &root_y, &x, &y, &key_buttons );
- X
- X XSetForeground( display, gc, 0 );
- X XFillArc( display, shape_mask, gc, x-25, y-25, 50, 50, 0, 360 * 64);
- X XShapeCombineMask(display,window,ShapeBounding, -bwidth, -bwidth,
- X shape_mask,
- X ShapeIntersect );
- X MakeNoise(afp, FILENAME);
- X}
- X
- X
- Xstatic Window GetWindowToBlast(display, screen, event, winlist, numwin, maxwin)
- XDisplay *display;
- Xlong screen;
- XXEvent *event;
- XWinList *winlist;
- Xint *numwin, *maxwin;
- X{
- X int status;
- X Cursor cursor;
- X Window target_win = None, root = RootWindow(display,screen);
- X int buttons = 0;
- X
- X /* Make the target cursor */
- X cursor = XCreateFontCursor(display, XC_crosshair);
- X
- X /* Grab the pointer using target cursor, letting it room all over */
- X status = XGrabPointer(display, root, False,
- X ButtonPressMask|ButtonReleaseMask, GrabModeSync,
- X GrabModeAsync, root, cursor, CurrentTime);
- X#if 0
- X if (status != GrabSuccess) Fatal_Error("Can't grab the mouse.");
- X#endif
- X
- X /* Let the user select a window... */
- X while ((target_win == None) || (buttons != 0)) {
- X /* allow one more event */
- X XAllowEvents(display, SyncPointer, CurrentTime);
- X XWindowEvent(display, root, ButtonPressMask|ButtonReleaseMask, event);
- X switch (event->type)
- X {
- X case ButtonPress:
- X if (target_win == None)
- X {
- X target_win = event->xbutton.subwindow; /* window selected */
- X if (target_win == None) target_win = root;
- X }
- X buttons++;
- X break;
- X case ButtonRelease:
- X if (buttons > 0) /* there may have been some down before we started */
- X buttons--;
- X break;
- X }
- X }
- X
- X XUngrabPointer(display, CurrentTime); /* Done with pointer */
- X SaveWindow( display, target_win, winlist, numwin, maxwin );
- X return(target_win);
- X}
- X
- Xstatic void RepairWindows( display, window, winlist, numwin )
- XDisplay *display;
- XWindow window;
- XWinList *winlist;
- Xint numwin;
- X{
- X Window root, parent, *children;
- X int i, num_children;
- X#ifdef REPAIR_EVERYTHING_IN_SIGHT
- X XQueryTree( display, window, &root, &parent, &children, &num_children );
- X for( i=0; i < num_children; i++ )
- X XShapeCombineMask(display, children[i], ShapeBounding, 0, 0,
- X None, ShapeSet );
- X XFree( *children );
- X#endif
- X for( i=0; i < numwin; i++ )
- X {
- X if( winlist[i].bshaped )
- X XShapeCombineRectangles( display, winlist[i].window, ShapeBounding,
- X 0, 0, winlist[i].bound, winlist[i].bcount,
- X ShapeSet, winlist[i].border );
- X else
- X XShapeCombineMask(display, winlist[i].window, ShapeBounding, 0, 0,
- X None, ShapeSet );
- X
- X if( winlist[i].cshaped )
- X XShapeCombineRectangles( display, winlist[i].window, ShapeClip,
- X 0, 0, winlist[i].clip, winlist[i].ccount,
- X ShapeSet, winlist[i].corder );
- X else
- X XShapeCombineMask(display, winlist[i].window, ShapeClip, 0, 0,
- X None, ShapeSet );
- X }
- X}
- X
- Xstatic void SaveWindow( display, window, winlist, numwin, maxwin )
- XDisplay *display;
- XWindow window;
- XWinList *winlist;
- Xint *numwin, *maxwin;
- X{
- X int i, count, order, dummy;
- X Bool bshaped, cshaped;
- X unsigned int udummy;
- X
- X for( i=0; i < *numwin; i++ )
- X if( window == winlist[i].window )
- X return;
- X winlist[*numwin].window = window;
- X
- X XShapeQueryExtents(display, window, &bshaped,
- X &dummy, &dummy, &udummy, &udummy,
- X &cshaped, &dummy, &dummy, &udummy, &udummy);
- X
- X if( winlist[*numwin].bshaped = bshaped )
- X {
- X winlist[*numwin].bound = XShapeGetRectangles( display, window,
- X ShapeBounding, &count, &order );
- X winlist[*numwin].bcount = count;
- X winlist[*numwin].border = order;
- X }
- X
- X if( winlist[*numwin].cshaped = cshaped )
- X {
- X winlist[*numwin].clip = XShapeGetRectangles( display, window, ShapeClip,
- X &count, &order );
- X winlist[*numwin].ccount = count;
- X winlist[*numwin].corder = order;
- X }
- X
- X (*numwin)++;
- X
- X if( *numwin >= *maxwin )
- X {
- X winlist = (WinList*)realloc( winlist, 2 * (*maxwin) * sizeof(WinList) );
- X *maxwin *= 2;
- X }
- X
- X}
- X
- Xstatic void MakeNoise( afp, filename )
- XFILE *afp;
- XString filename;
- X{
- X unsigned char buf[1024*64];
- X int cnt;
- X FILE *fp;
- X#ifdef sun4
- X fp = (FILE*)open( filename, O_RDONLY, 0 );
- X while( (cnt = read(fp, (char*)buf, sizeof(buf))) > 0 )
- X write( afp, (char*)buf, cnt );
- X close(fp);
- X#endif
- X}
- X
- Xstatic FILE* OpenSoundFile()
- X{
- X#ifdef sun4
- X return (FILE*)open( AUDIO_DEVICE, O_WRONLY | O_NDELAY );
- X#endif
- X}
- X
- Xstatic void CloseSoundFile( afp )
- XFILE *afp;
- X{
- X#ifdef sun4
- X close( afp );
- X#endif
- X}
- *-*-END-of-blast.c-*-*
- echo x - shooting.au.uu
- sed 's/^X//' >shooting.au.uu <<'*-*-END-of-shooting.au.uu-*-*'
- Xbegin 644 shooting.au
- XM+G-N9 !@ !#L @ 'T ! !#]_=&%P9#8G)!#@Q*"$@(#1
- XM!S8@+R8_4%,@QS]_P+]0@)]_ (#_?W!_?^#W?P"#*X" [Z" @%_@?W]P?W\@
- XM'S((^/" @(" @)&7_W]_?W]_?W]_$*" @(" @(" EQ]_?W]_?W]_?T3 @("
- XM@(" @(#7$V%_?W]_?W]_>#X @(" @(" @("1H.=_?W]_?W]_?V!2(*"G@("
- XM@(" @[?[/WI_?W]_?WAR4"#0@(" @(" @/\I/VM_?W]_<']_4/CPH*&@@("
- XM@(&_ QM_?W]_?W]_<!"PH(" @("#D/<@%V]_?W]_?W$P\+" @(" D*__\.L_
- XM(-8?:V!C8 /5C04$"\_("<B_?O!NZ"GT="G^T= 7V!??W]_=!#0@(" @(#/
- XM ,<_8#]_0"-_(*<'D(<&P-=_$-]_(+]_$( ?0(#_?X#_?Z#_?T"G7WR@OV<@
- XM@/= @)=70*#_?U#W?W_ WTL @(#$@(#??R"A/W]P+W]_X("_*(" GW]_@("W
- XM?W^ @-=??W]@!0"[Q+\_?N" AU=_ &]@,@8@H//_X("GL,]31"4\;W\@_S<@
- XM@(!O8(" T(!_((!_?U<T(U5@/^" URB$GS]_,-+O?W]_?P" _W" _X" +L"I
- XM@#]_@#]_,/W0WS\ @("3R8"7/U 0/R" /W]P@&] @#][4("O?X!O?V<T?Z"
- XM;W_ @(#+/W]_?X"'?T!O?^#72P" @*^@@(#G?W] ?W]_?V" @7\ @(#/D("
- XMKW\1?WA_?W\ ]W^HSX" I("#@(" )W]\/W]_?V"G?T" _WB @'_ @)]TP']\
- XMTW] .W_PH("'0(" _^"O!( _?\ _?W_@/W]X@#]_@)<@@)\P@(=@H(#W?T"
- XM_W!??R" /V" @/\*P("O?X" =W\ /W_ _W]_(( B@+]_\(" _W9_>(=_?]#_
- XM?W_ @)+_X(" ?T#D_T" _W\7?Z#_8( O<*#?P-]_=S" WVB0GS#G ( _?V"
- XM@W]_Z#]_ (!_,-?@@/^POW\PNVB KW]_H)]_0( O8+L@@(!_?Z" 7W\P@#]_
- XMH(!_0+<0@(%_8-]_()=_((!_?^#7?R" @-,_$._PDW]_(("!?W\ @']P@( _
- XM(#]0JW=_T#]_L(!;X(!O4("O?V"0_W]_X#< MW] @( _1.R /W\ @#]_,U"P
- XM_SC([W\@@+]PH-]_((,_?V# LR< @-^XWU8@@(!/>73@WW]@@($W0"WPIRM0
- XM(#=_((#WX- G?P" @"]_(",]/S#HT(-??P" @U\@PK3_-W]@H"] YW]_X/]_
- XMP(%B@(#0@!]^X(?G]U]_((!??X"/4(#W4']_H(=_ (=_8(!_?X"O?\#_@(!_
- XM0( _>(!_?\" ?T" AQ"_4("!?P" ?T#??W^ [W\ @#] KW^@/WB WW^@CW]X
- XM@.]_((!_4*]_P(!_@(!O0(!_?\"??WB @'? CS" @'?@OW]@MW]_,( W?P"
- XM_W^ AW" CW\@OW]_L"=_8(" >P" @'_ @%<0_W\@@']^@(=_ ("O?R" /W\
- XME0_H?W" WW_@@']_0( ??^" 'S"7=T# _W^ OW] @!]_?P" _V" @&=@_W\
-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."K5WR@@/]_(( ??V @(-G
- XM?," KW]XD1-@*@0_?U"@@/]J1O34YS]XT("_:T"DUV]0H(!??T" CW]_0("
- XM]W]@@( _?R" _W]@@)]_<("7?W^ @#]_?P" SW]P@("7?V" ]V0@H(<_?R2
- XM]W] \,O$%W_@@)]_8(" 7W\ @']_8(" ;W] @(\_?WZ @*]_?H"_?W#@@/]_
- XM8("??W" @/]_%"C OU]_((" _W\ @#] M<3'5W_@@/=_$,OGX-]_?Z" MW]_
- XM@( _?R" OW]_X(#??WCHH+<7?W^@@)=_?X"_?W@PP*-?>(" /W \T( ?8" \
- XM\)#_?V" BQ=_0("'5SC0@(%_?]" ;W\%-3; IW]_@(!_?\" UW]_@(!_?^"
- XM@&]_0("//R!_((" 7W\P@"]_?*" SW]_@( ??R" CW] /WC@@(!_?X" _W]_
- XMH( _?U" @/]_?^" _R W?/" @#]_8(" ?W\ @(!_?V" @']_\(" /W_@XJ43
- XMT']_H( -+W\@@/]_0-" @#]_X("!?S _(/^@OW]_@(!??T" @7=_((" ;W_
- XM@(#_?V#0@/=D$%T@D*+O?WZ @#]_8(" _W]_H(#_?S3RH/]_($]0H."1;W^
- XM@.]_?Z" OW]_$(" ?W_@@)=_,!]_ (" _W]P@(!_?S" @+]_?P" @7]_\("
- XM_W\@MW9$0(#_?P" Q^-_?Z" /W\ EH"'5W] @(!??X-_ /\$MV]_ ("!?W^@
- XM@( _?T" @!]_(,N @']\@#\P? "W?P"5H-=W?H" ?T#HX*"W?W]0L( _?X"?
- XM)-,_T-]_0(" MW]P@("W?W\@@( _?R"!I(!_?\"_/O]6X+]WP*?@@"]_T( @
- XM(W\@IK<5 W=_P(!??^#_,,=@X-=_0*<(@+]_(("!/W]@D("W?W_0((#_?V"C
- XM][<_(( _0("LD/]_0("_4"=_(-'N$#]_0("!?W"0[P"G?P"??T#7?X"/?T"
- XMNQ=_?]" @#]_ ("T@#]_ (#"%W\ @'\PMQ" /W_@@/]_M#] @*LG/W\@@*]_
- XM4) O,(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- XD?T#(D]<O\-%??Z"??W"G/W]P@($_$-; YV]\Y,?0TS\P@!]@
- X
- Xend
- *-*-END-of-shooting.au.uu-*-*
- exit
- exit 0 # Just in case...
- --
- // chris@IMD.Sterling.COM | Send comp.sources.x submissions to:
- \X/ Amiga - The only way to fly! |
- "It's intuitively obvious to the most | sources-x@imd.sterling.com
- casual observer..." |
-