dana@dino.bellcore.com (Dana A. Chee) (03/14/88)
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 <stdio.h> #include <X11/Xlib.h> #include <X11/cursorfont.h> 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