Dear All,
I have a Poly/ML Motif-based tool that is intended to be run from inside an
interactive Poly/ML session. If you just take the defaults, when you use the
window manager to close the shell window for the tool, the default value of
XmDELETE for the deleteResponse resource on the shell widget means that the
process gets killed, and the process in question is the Poly/ML session and
that's not what I want. What I want to do is to tidy up without killing the
interactive session so that the tool can be restarted in the same session if
the user wants to. I have a quit callback which does this tidy up when you
press a quit pushbutton in the tool.
The C code to do this looks like this:
XtVaSetValues(shell,
XmNdeleteResponse, XmDO_NOTHING,
NULL);
WM_DELETE_WINDOW = XmInternAtom(XtDisplay(shell),
"WM_DELETE_WINDOW",
False);
XmAddWMProtocolCallback(shell,
WM_DELETE_WINDOW,
quit,
shell);
Unfortunately, XmAddWMProtocolCallback and XmInternAtom aren't supported in
the Poly/ML Motif structure. The Xlib interfaces you need to set up the WM
protocols and handle client message events from the window manager are also
not all provided.
I'm currently using the following work-around. I set the deleteResponse
resource on the shell widget to XmUNMAP then arrange for the function that
starts the tool to attempt to map it again. If this fails, then the tool was
killed by the quit pushbutton and I rebuild the widget hierarchy. Luckily,
this gives the functionality I want, but it does mean that the window manager
close differs from the quit pushbutton in not freeing the client and server
memory and other resources occupied by the tool.
Also, my quit callback is only able to destroy the widget hierarchy, since
the interface hides application contexts behind the scenes. Does
XtDestroyWidget cause the application context to be destroyed if you destroy
the shell widget? I couldn't see any calls to XtDestroyApplicationContext in
the driver code - so presumably I have a small memory leak with things as
they are.
Is there a better way with the existing Motif and X support? If not, is there
a simple recipe for adding in extra Motif and X library functions?
Regards,
Rob.