Path: utzoo!mnetor!uunet!husc6!mailrus!umix!umich!mibte!gamma!ulysses!thumper!faline!dana From: dana@dino.bellcore.com (Dana A. Chee) Newsgroups: comp.windows.x Subject: xdestroy for X11 Message-ID: Date: 14 Mar 88 14:18:55 GMT Sender: news@faline.bellcore.com Distribution: comp Organization: Bellcore, Morristown, NJ USA Lines: 74 Below is the program xdestroy rewritten for Version 11 of X. Hopefully this will get the ball rolling for posting updated/new programs. Any improvements are welcome. Compile: cc xdestroy -o xdestroy -lX11 ----------------- cut here ----------------------- /* * xdestroy.c * * Dana Chee * Bellcore * Morristown, NJ 07960 * (201) 829-4488 * dana@thumper.bellcore.com */ #ifndef lint static char sccs_id[] = "%W% %D%"; #endif lint #include #include #include static void punt(string) char *string; { fprintf(stderr, "xdestroy: %s\n", string); exit(1); } /* end punt() */ main() { Status status; XEvent event; Display *dpy; int screen; Cursor cursor; if( (dpy = XOpenDisplay(NULL)) == NULL) { punt("couldn't open display."); } screen = DefaultScreen(dpy); if( (cursor = XCreateFontCursor(dpy, XC_draped_box)) == NULL) { punt("can't create cursor"); } status = XGrabPointer(dpy, RootWindow(dpy, screen), False, ButtonPressMask|ButtonReleaseMask, GrabModeSync, GrabModeAsync, None, cursor, CurrentTime); if( status != GrabSuccess ) { punt("can't grab the mouse."); } XAllowEvents(dpy, SyncPointer, CurrentTime); XWindowEvent(dpy, RootWindow(dpy, screen), ButtonPressMask|ButtonReleaseMask, &event); XUngrabPointer(dpy, CurrentTime); XUnmapWindow(dpy, event.xbutton.subwindow); XDestroyWindow(dpy, event.xbutton.subwindow); XFlush(dpy); } ------------------ cut here -------------------- -- Dana Chee MRE 2Q-250 (201) 829-4488 dana@faline