[comp.windows.open-look] Explicit event dispatching in XView

kurti@cbnewsm.att.com (kurt.a.kanaskie) (02/22/91)

I am porting an existing UI toolkit to XView.  I need to maintain the existing
command based functionality of asking for input and waiting for the reply.
The reply can be typed in or entered through any available UI object 
(buttons, menus, etc.) A UI object has a command string associated with it.

In addition I need to provide the normal event based callback architecture.

My solution involves creating my own main loop which gets an event dispatches it
and then checks for a global flag setting.  Not a new concept.

I can do this with Xol (Xt+) by calling XtNextEvent and XtDispatchEvent.

I've attempted to use notify_start and notify_stop, but I seem
to get into an infinite loop when for example I press the mouse button
in a TEXTSW. It appears to be some sort of race condition.
I've also attempted to use select, but it returns when any information
is on the input file descriptor. There could be more than one events
worth in which case I don't know how many times to call notify_dispatch.
I guess I could figure it out using the sizeof XEvent, but that seems
like to much effort.
I've also attempted to use XPeekEvent, XPending and notify_dispatch
but I encounter the same sort of race condition.

Is their a function in XView which I can call which does the equivalent
of XtNextEvent, that is return the next event on the queue if there is
one or block until one arrives?
Or a function which dispaches a given event?


Thanks

Kurt Kanaskie				AT&T Bell Labs
kak@alux5.att.com			Computer Aided Design Lab
					Allentown PA