Use the Motif XmAddWMProtocol() function to set the WM_SAVE_YOURSELF atom on the WM_PROTOCOLS property for the top-level window of your application, as shown in the following example.
Atom XaWmSaveYourself; Display *dsp; dsp = XtDisplay(toplevel); XaWmSaveYourself = XmInternAtom(dsp, "WM_SAVE_YOURSELF", False); XmAddWMProtocols(toplevel, &XaWmSaveYourself, 1);
Do not set the WM_SAVE_YOURSELF atom for more than one window.