Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!sdd.hp.com!think.com!snorkelwacker.mit.edu!bloom-beacon!dont-send-mail-to-path-lines From: mouse@lightning.mcrcim.mcgill.EDU Newsgroups: comp.windows.x Subject: Re: Can an application know a DESTROY/KILL is applied on itself? Message-ID: <9101220259.AA12732@lightning.McRCIM.McGill.EDU> Date: 22 Jan 91 02:59:20 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 38 > By far I understand, to destroy a window in a WM, such as using > "destroy/kill" in twm, "close" in mwm, is to tell X server to close > the connection with the application which creates the window. This is how it has traditionally been done. The ICCCM defines the DELETE_WINDOW protocol, with others under discussion, to address this perceived need. I won't describe this here; it would make this posting excessively large and I probably wouldn't get it right, unless I quoted directly from the ICCC document itself. And you can read it for yourself.... > My question is, is there any way an application can be notified or > get to know a DESTROY/KILL instruction is applied to the application. > The purpose to do that is for safty. For example, a drawing program > certainly wants to save the contents before terminated by an > acciendly DESTROY/KILL from the WM. Not to address the problem, but "certainly" is too strong a word. In my case, for example, doing a kill in my window manager is sufficiently difficult that it does not happen by accident; if I kill the window I do *not* want it to auto-save what is probably a botched drawing. (Auto-checkpoint would be a reasonable compromise.) > The DestroyNotify in Xlib doesn't work because Because DestroyNotify is for something else: notifying applications of window destruction. And as you noticed, while the window is destroyed by the forced connection close, the client can't get the event. It would work to open a second connection and have that connection do nothing but select for DestroyNotify on the windows created on the first connection. (This qualifies as a gross kludge. Besides, it really doesn't tell you anything more than the first connection being broken does.) der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu