|
This is Mac OS X 10.11.6 (El Capitan) with XQuartz 2.7.9. I
installed OpenMotif 2.3.4 using HomeBrew (so it's in /usr/local). I
have a very large program that uses Motif, which fails now, but
worked when built on Mavericks with an older XQuartz; I traced its
problem to Motif, and Motif's problem seems to be related to libXt. I found a simple Motif example here (attached, after fixing two trivial warnings in this old code) https://www.cs.cf.ac.uk/Dave/ It builds in the usual way: gcc -I/usr/local/include -I/opt/X11/include push.c /usr/local/lib/libXm.dylib \ /opt/X11/lib/libXt.dylib But it does not run, with an error similar to my large program: a.out Error: attempt to add non-widget child "dsm" to parent "a.out" which supports only widgets BTW I have also seen these error messages from my large program when trying different combinations: Error: Couldn't find per display information Warning: XmManager ClassInitialize: XmeTraitSet failed Error: attempt to add non-widget child "DropSiteManager" to parent "main" which \ supports only widgets _XmGetDefaultDisplay cannot be used prior to VendorS.Initialize, returns NULL(I believe this last is from incorrectly linking libXt before libXm.) In desperation I went back to the old versions of libXm and libXt (that work in my large program, built on Mavericks and runs now on El Capitan; libXm.2.dylib came from its bundle): gcc -I/usr/local/include -I/opt/X11/include push.c /usr/local/lib/libXm.2.dylib \ /opt/X11/lib/libXt.6.dylib a.out Warning: Cannot find callback list in XtAddCallback A window pops up with the push button, but pushing the button does not print the message (as the warning suggests). That's why I suspect the problem is in XQuartz and not OpenMotif. (It's possible my large program does not use this feature of libXt.) Help, please! (I also have an inquiry in homebrew-discuss with subject "openmotif fails to run".) |
#include <Xm/Xm.h> #include <Xm/PushB.h> /* Prototype Callback function */
void pushed_fn(Widget , void * , void *);
int main(int argc, char **argv)
{ Widget top_wid, button;
XtAppContext app;
top_wid = XtVaAppInitialize(&app, "Push", NULL, 0,
&argc, argv, NULL, NULL);
button = XmCreatePushButton(top_wid, "Push_me", NULL, 0);
/* tell Xt to manage button */
XtManageChild(button);
/* attach fn to widget */
XtAddCallback(button, XmNactivateCallback, pushed_fn, NULL);
XtRealizeWidget(top_wid); /* display widget hierarchy */
XtAppMainLoop(app); /* enter processing loop */
}
void pushed_fn(Widget w, void * client_data, void *cbs)
{
printf("Don't Push Me!!\n");
}
_______________________________________________ Do not post admin requests to the list. They will be ignored. X11-users mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/x11-users/archive%40mail-archive.com This email sent to [email protected]
