Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!decwrl!pa.dec.com!jrdzzz.jrd.dec.com!tkou02.enet.dec.com!usenet From: terence@hkov04.dec.com (Terence Lee @HKO) Newsgroups: comp.windows.x.motif Subject: Re: WM_PROTOCOLS question Message-ID: <1991May10.011730.6913@tkou02.enet.dec.com> Date: 10 May 91 01:17:30 GMT References: Sender: usenet@tkou02.enet.dec.com (USENET News System) Reply-To: terence@hkov04.dec.com (Terence Lee @HKO) Distribution: comp Organization: Digital Equipment Corporation, Hong Kong Lines: 69 In article , amir@taux01.nsc.com (Amir J. Katz (Xpert)) writes: #From: amir@taux01.nsc.com (Amir J. Katz (Xpert)) #Subject: WM_PROTOCOLS question #Date: 6 May 91 13:26:38 GMT #Organization: Silvaco Israel Ltd. # #Following my previous inquiry how to kill X softly, it was pointed out that #the ugly messages from dying clients happen because these clients do not handle #the Motif's f.close event at all. # #I am trying to make a small Xm/Xt test program handle this protocol. # #As I understand from the manuals, I need to add a window manager protocol, #but I can't get it to work. Here is the relevent code segments: # # Atom protocols[10]; # Widget toplevel; # int n; # ... # toplevel = XtInitialize (argv[0], "test", NULL, 0, &argc, argv); # ... # n=0; # protocols[n] = XInternAtom (XtDisplay(toplevel), "WM_DELETE_WINDOW", False); n++; # protocols[n] = XInternAtom (XtDisplay(toplevel), "WM_SAVE_YOURSELF", False); n++; # XmAddWMProtocols (toplevel, protocols, n); # #I have looked into one of OSF/Motif 1.0.A test cases (atoms_gb.c) which does work, #but it's too complex. Isolating the relevent parts did not help. # #The same theme works if I use X primitives: # # main_wid = XCreateWindow (display,... # status = XSetWMProtocols (display, main_wid, protocols, n); # #My questions are: #1. Do I need to add the protocols to a VendorShell or any shell widget will do? #2. How can I make it work in Xt/Xm applications? # #-- Thanks in advance - please email to address below. #-- # Amir J. Katz, System Manager # #Internet: amir%pilat.UUCP@taux01.nsc.com #UUCP: {decwrl,uunet,...}!nsc!taux01!amir #Phone: +972 52-570713 #Fax: +972 52-570719 #Snail-mail: Amir J. Katz, Silvaco Israel Ltd. # 19 Maskit St., Herzelia, Israel 46733 # Setting XmNdeleteResponse = XmDO_NOTHING on the shell will make the widget ignore the WM_DELETE_WINDOW protocol. If you want to do something when receiving the WM_DELETE_WINDOW protocol, you will need to add the following XmAddWMProtocolCallback( the_shell, XmInternAtom(XtDisplay(the_shell),"WM_DELETE_WINDOW",FALSE), (XtCallbackProc)dont_kill_me, (XtPointer)0); -- ================================================================================ Terence Lee | terence%hkov04.dec@decwrl.dec.com | root%hkvs04.dec@decwrl.dec.com =====================+========================================================== From Middlesex, UWO | Just forget what I've said. I don't know it neither. ================================================================================