giguere@csg.UWaterloo.CA (Eric Giguere) (07/09/90)
Pardon me if this is a stupid question: How can I tell under Motif/X when a user has selected the "Close" item on the system menu attached to the top-level shell? As far as I can tell a ClientMessage gets generated and then the application exits. All fine and dandy, but I need to intercept that message so that I can perform my own exit calls before letting Motif continue -- or after, actually. Do I need to add some kind of event handler for XtDispatchEvent to call? Specific info would be appreciated. While I'm at it: we're running Motif on top of XR4. The docs say Motif was designed to work with R3. Am I going to run into any major difficulties? -- Eric Giguere giguere@csg.UWaterloo.CA
tsang@isi.com (Kam C. Tsang) (07/10/90)
> How can I tell under Motif/X when a user has selected the "Close" item > on the system menu attached to the top-level shell? The VendorShell resource XmNdeleteResponse can be used to trap the "Close" item. The simpleset case is to set it to XmDO_NOTHING. Otherwise you can set it to XmDESTROY (or XmUNMAP), and then do your cleanup in your XmNdestroyCallback (or XmNunmapCallback). -------------------------------------------------------------- Kam Tsang User Interface Group Tel: (408) 980-1500 x275 Integrated Systems, Inc. Internet: tsang@isi.com 2500 Mission College Blvd. Voice mail: (408) 980-1590 x275 Santa Clara, CA 94054
basil@THYME.JPL.NASA.GOV (Basil Hashem) (07/10/90)
In addition to what was posted, how about something a bit simpler that doesn't
use events:
void FinalCleanupCB(w, client_data, call_data)
Widget w;
caddr_t client_data, call_data;
{
printf("Do your thang here\n");
}
main()
{
Atom wm_delete_window;
...
XtRealizeWidget(toplevel);
...
wm_delete_window =
XmInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", False);
XmAddWMProtocolCallback(toplevel, wm_delete_window, FinalCleanupCB, NULL);
XtMainLoop();
Enjoy,
Basil Hashem
basil@thyme.jpl.nasa.gov
Jet Propulsion Laboratory La Canada Flintridge, CA
gabe@hpcvlx.cv.hp.com (Gabe Begeddov) (07/10/90)
/ hpcvlx:comp.windows.x.motif / giguere@csg.UWaterloo.CA (Eric Giguere) / 8:47 am Jul 9, 1990 / Pardon me if this is a stupid question: How can I tell under Motif/X when a user has selected the "Close" item on the system menu attached to the top-level shell? As far as I can tell a ClientMessage gets generated and then the application exits. All fine and dandy, but I need to intercept that message so that I can perform my own exit calls before letting Motif continue -- or after, actually. Do I need to add some kind of event handler for XtDispatchEvent to call? VendorShell exports a resource (XmNdeleteResponse) that controls the built-in response to the message. In addition, a set of interfaces is exported that allows you to add a "callback" that is invoked for a specific inter-client protocol. In this case the "WM_DELETE_WINDOW" protocol. Check the syntax in the programmer's guide (I think ch 8) which should be something like: XmAddWMProtocolCallback(shell, delete_window_atom, callback, c_data) While I'm at it: we're running Motif on top of XR4. The docs say Motif was designed to work with R3. Am I going to run into any major difficulties? As long as you use the client side libraries for Motif (Xm, Xt). You may get some warnings from an R4 Xlib. You may also need to run your r4 server in backwards compatability mode to get around some paned window funnies. -- Eric Giguere giguere@csg.UWaterloo.CA ---------- Gabe Beged-Dov ++++++++++++++++ HP Motif Team Corvallis,Oregon