dpy = XtDisplay(topLevel); save = XmInternAtom(dpy, "WM_SAVE_YOURSELF", False); XmAddWMProtocols(topLevel, &save, 1); XmAddWMProtocolCallback(topLevel, &save, saveProc, topLevel);