[mitre.windows.x.xpert] Event Loops

cookson@helios.mitre.org (Cookson) (05/30/90)

First off let me say thank you to all the people who replied to my first 
message.  Now for a slight clarification of my problem.
I'm avoiding an event loop by doing the following.


#include	"toolkit.h"
Display *mydisplay;
int	childpid;
int	fd;
end();

Event_Loop()
{

	while(XEventsQueued(mydisplay, QueuedAfterReading)) {
		XEvent	myevent;

		XtNextEvent(&myevent);
		XtDispatchEvent(myevent);
	}
}

Initialize_Toolkit(int argc, char *argv[])
{

  Widget control_shell, control_board, tracker_select, tracker_form;
  Widget start_button, quit_button;
  Arg wargs[2];
  
  /* Initialize the toolkit, and create the shell for the control window. */
  control_shell = XtInitialize(argv[0], "Xradar", NULL, 0, &argc, argv);
  mydisplay = XtDisplay(control_shell);
  fd = ConnectionNumber(mydisplay);
  fcntl(fd, F_SETOWN, getpid());
  fcntl(fd, F_SETFL, FASYNC);
  signal(SIGIO, Event_Loop);
  /*	Create all my widgets, etc... */
}

The problem is that when Event_Loop gets called, XEventsQueued() claims
that there are no events in the queue.  (Yes XtPending() says the same thing).
Now, it's obvious that I'm either blind or stupid (or both), and that I'm
missing something painfully obvious.  But the question is what????

Thanks in Advance,
Dean


% Dean Cookson				  $ Anyone can be taught to sculpt    %
% dcookson@mitre.org			    $ Michaelangleo would have had to %
% {devax,et al..}!linus!mbunix!helios!cookson $ have been taught how not to.  %
% Disclaimer: My opinions are my own, and       $ The same is true of great   %
%       are of questionable sanity                $ programmers               %