[comp.windows.x.motif] Disabling Window Menu Functions?

hildjj@MODAL375.ME.VT.EDU (Joe Hildebrand) (03/25/91)

> I want to disable or sensitize menu options in the Motif Window Menu for a
> client.  Specifically, I want to disable the Close option and force the user
> to exit the client via its own Exit Option.  Could someone tell me how to do
> this. 

I just licked this problem last week.  I had a kludge where I set a resource
in the .Xdefaults to prevent the user from using the close option:

Mwm*myprog*clientFunctions: -close

But using a hint from the FAQ, I came up with the answer that 
nazgul@alfalfa.com provided.  Unfortunately, that didn't quite work for me. 
Try this:

Widget toplevel;
Arg wargs[5];
int n;
Atom wm_delete_window;

toplevel = XtInitialize (argv[0], "myprog", NULL, 0, &argc, argv);
   
XtRealizeWidget(toplevel);

n=0;
XtSetArg(wargs[n], XmNdeleteResponse, XmDO_NOTHING); n++;
XtSetValues(toplevel, wargs, n);

wm_delete_window = XmInternAtom(XtDisplay(toplevel),
				"WM_DELETE_WINDOW", True);
XmAddWMProtocolCallback(toplevel, wm_delete_window, show_dialog, 
			quit_dialog);


The key is to tell your toplevel widget not to die when Mwm tells it to.

Note: I am not using 1.1.  Your actual mileage may vary.
   
   
Joe Hildebrand  [hildjj@modal375.me.vt.edu (128.173.5.186)]
Virginia Tech Department of Mechanical Engineering
and
Babcock & Wilcox Nuclear Services, Lynchburg, VA