amir@taux01.nsc.com (Amir J. Katz (Xpert)) (05/06/91)
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
terence@hkov04.dec.com (Terence Lee @HKO) (05/10/91)
In article <AMIR.91May6162639@taux01.nsc.com>, 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. ================================================================================