[comp.windows.x.motif] can't do work proc's with multi-app-contexts

digger@cae780.csi.com (Doug Selph) (03/22/91)

	Hi World!

	I am developing a motif-application using 1.1.  I am trying 
to handle properly the event queue with multiple application contexts.
My main loop looks something like this:

*****************
main_loop(calc_context, page_context, sysmsg_context)
XtAppContext calc_context, page_context, sysmsg_context;
{
  XtInputMask mask;
  Display *scalcDisplay(), *spageDisplay(), *sysmsgDisplay();

  while(1)
  {
    if ((mask = XtAppPending(calc_context)) != 0)
    {
      XtAppProcessEvent(calc_context, mask);
      XFlush(scalcDisplay());
    }
    if ((mask = XtAppPending(page_context)) != 0)
    {
      XtAppProcessEvent(page_context, mask);
      XFlush(spageDisplay());
    }
    if ((mask = XtAppPending(sysmsg_context)) != 0)
    {
      XtAppProcessEvent(sysmsg_context, mask);
      XFlush(sysmsgDisplay());
    }
  }
}
********************

	My problem has to do with WorkProc's.  I have a work
procedure that I want to do when nothing else is pending in
the 'page_context'.  But work procedures are only called when
nothing is pending and if I call AppProcessEvent() at that time
then the rest of my contexts are left out.
	So what I am looking for I guess, is a way to say,

	if (XtPending() == 0) /* nothing pending anywhere */
	  XtDoWorkProcs();	/* do work procs until event happens */

	I would do this at the end my loop.

	Any ideas on how I can get what I want?

	Please reply to digger@csi.com or ...uunet!cae780!digger
	Thanks ahead of time for any replies.

						---digger