[comp.windows.x] WM_PROTOCOLS question

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