tongz@ECN.PURDUE.EDU (Tong Zheng) (01/14/91)
Hi, The subject line may look a little confusing, I will give detail in following. I am running X11R4, and using Xlib&Xt in twm/mwm/olwm. 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. 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. The DestroyNotify in Xlib doesn't work because the X serevr will first close the connection with application, how do you expect the application can get any event after the connection is closed. I tried the destroyCallback in Xt(using Athena Widget Set), but my codes in the callback function didn't get processed at all. Well, I don't know whether my understanding above is right or not. I would like to hear opinions from you Xperts. Any comment or suggestion is appreciated. You may post on the net or reply via e-mail. If there are enough interests, I will post the summary on the net. --- * * |* Zheng, Tong | ARPA: tongz@mn.ecn.purdue.edu *| |* 483 Littleton St., | UUCP: pur-ee!tongz *| |* West Lafayette, IN. 47906 | BITNET: *| |* (317)743-2239 | tongz%ecn.purdue.edu@purccvm *| |* ----------- *| |* -- student programmer, Mechanical Eng., Purdue University-- *| *----------------------------------------------------------------*
mouse@lightning.mcrcim.mcgill.EDU (01/22/91)
> 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
pds@quintus.UUCP (Peter Schachte) (01/26/91)
In article <9101220259.AA12732@lightning.McRCIM.McGill.EDU> mouse@lightning.mcrcim.mcgill.EDU writes: >> 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. I guess it's kind of late for this, but why didn't the ICCCM establish the convention that window managers just destroy a top-level window when they want to get rid of it? Applications would have to watch for destroy events on their top-level windows. That would be quite easy to do, and would work much better for multi-window applications, where you don't want the whole application killed just because the WM wants to close one window. -- -Peter Schachte pds@quintus.com ...!{uunet,sun}!quintus!pds