| There are two pieces of the application, a DECwindows application
and a background process. The background process gathers information
and communicates to the DECwindows appl through a socket. The
way I planned on having this work would be when the background
process wrote data to the socket, the DECwindow appl would be
able to process it by registering a callback routine (using
XtAppAddInput) to be called on input to the socket.
code :
appl_context = XtCreateApplicationContext();
XtAppAddInput(appl_context,
sd, /* socket descriptor */
XtInputReadMask,
data_handler, /* callback procedure */
0);
:
XtMainloop();
The background process is writing to the socket, but the
callback procedure is not being entered. I am able to
get this working by using a signal handler for SIGIO, but
I'd like to know what I'm doing wrong using XtAppAddInput.
Thanks, Dave Zeltserman
|
| One thing that I can see is that you are calling XtAppAddInput to
register your're alternate input source and are then calling
XtMainLoop to do your event processing.
Either use XtAddInput or, if you must use application contexts for
some other reason in your program - like multiple instance trees,
then call XtAppMainLoop instead of XtMainLoop.
Whatever you do, be consistent with your use of routines that take
an application context and those that use the default application
context (like XtInitialize, XtAddInput, and XtMainLoop).
If you used XtInitialize to init the toolkit and create your top
level shell then you already have and application context and
don't need to create a second with XtCreateApplicationContext.
Use something like:
appl_context = XtWidgetToApplicationContext(top_level);
to obtain the id of the default context.
Ron
|