Re: XForms: OpenIventor and Xforms Event Problem

rander+@postbox.ius.cs.cmu.edu
Fri, 6 Jun 97 11:51:24 EDT

To subscribers of the xforms list from rander+@postbox.ius.cs.cmu.edu :

> we want to use xforms in comnbination with Open Inventor.
> Our problem: the application hangs as OpenInventor is waiting for pending
> events. It continues to run if we are moving the mouse in and out of the
> Inventor window.

I have xforms and inventor running successfully together, with
a main loop consisting of fl_check_forms() and a procedure that
I call InventorCheckEvent(), which is defined as

void InventorCheckEvent (void)
{
XFlush (myDISPLAY);
if ( XtAppPending(myCONTEXT) ) {
XtAppProcessEvent (myCONTEXT, XtIMAll);
}
}

This procedure should not be called until Inventor has been
initialized, of course. This initialization needs to set the
(global) variables myDISPLAY and myCONTEXT, which are the X
display and the XtAppContext of the Inventor window, respectively.

XtAppContext myCONTEXT;
Display *myDISPLAY;

int InitInventor (char *myname)
{
// Initialize Xt and get a window widget
Widget myWidget = SoXt::init(myname);
if (myWidget == NULL)
return (1);

// Set up viewing widget
myVIEWER = new SoXtRenderArea(myWidget);

// get X(t) parameters for events checking
myCONTEXT = SoXt::getAppContext();
myDISPLAY = myVIEWER->getDisplay();
}

my main loop then looks like this (my only Xforms widget without
a callback is the Quit button -- you will have to adapt this if
you don't handle everything in callbacks).

int stop = 0;
while (!stop) {
InventorCheckEvent ();
if (fl_check_forms() == Quit)
stop = 1;

}

-Pete
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/