Ok I figured this much out: you have to add: XA_PROTOCOLS=XInternAtom(PStatus.xdisplay,"WM_PROTOCOLS",0); XA_WM_DELETE_WINDOW=XInternAtom(PStatus.xdisplay,"WM_DELETE_WINDOW",0); XSetWMProtocols(PStatus.xdisplay,twin->xwindow,&XA_WM_DELETE_WINDOW,1); to all the windows that you want to catch the clicking on the "x" destroy event. In the event handler: case ClientMessage: fprintf(stderr,"Client Message\n"); if(xevent.xclient.message_type == XA_PROTOCOLS && xevent.xclient.data.l[0] == XA_WM_DELETE_WINDOW){ XDestroyWindow(PStatus.xdisplay,twin->xwindow); } break; ================ But I am still getting the: X connection to :0.0 broken (explicit kill or server shutdown). message for the first window. Why us the first window different? Thanks, Ted _______________________________________________ XFree86 mailing list XFree86@xxxxxxxxxxx http://XFree86.Org/mailman/listinfo/xfree86