T.R | Title | User | Personal Name | Date | Lines |
---|
2521.1 | XtMainLoop is not magic | GILROY::klee | Ken Lee | Tue Mar 27 1990 17:08 | 17 |
| In general, you're best off using XtAppMainLoop() or XtMainLoop() and
doing all your work in callbacks. If, for some reason, you can't do
this, you can modify XtAppMainLoop() to do whatever you want. Here is
the complete source code:
void XtAppMainLoop(app)
XtAppContext app;
{
XEvent event;
for (;;) {
XtAppNextEvent(app, &event);
XtDispatchEvent(&event);
}
}
Your timeouts and work procs are all handled by XtAppNextEvent() and
XtDispatchEvent().
|
2521.2 | No luck without xtmainloop... | METIS::FARRELL | | Wed May 16 1990 16:45 | 14 |
|
RE: .1 - Are you sure about the nextevent/dispatchevent handling my
workprocedures and timeouts?
I received source for another mainloop (motif i think) and it handles
all the timouts and stuff.
I have 2 programs. Both add the exact timeout. The one who uses
XtMainLoop works fine. The one who uses XNextEvent & XDispatchEvent
does not!!!
any ideas anyone?
$$$$ ted $$$$
|
2521.3 | | GILROY::klee | Ken Lee | Wed May 16 1990 20:41 | 9 |
| I have 2 programs. Both add the exact timeout. The one who uses
XtMainLoop works fine. The one who uses XNextEvent & XDispatchEvent
does not!!!
The code in .1 is the same in every version of Xt that I have access to
(including Motif, DWT, and MIT X11R4). Make sure you use XtNextEvent,
not XNextEvent, though. XtNextEvent includes the work proc, timer, etc. stuff.
Ken
|
2521.4 | XtAppProcessEvent | CLTVAX::dick | Schoeller - Failed Xperiment | Thu May 17 1990 13:37 | 11 |
| There is a problem with .1 (different from what .2 asks about).
If you want it to return as a result of a timer or an alternative input,
it won't. Timers, work procs and alternative input is handled in XtAppNextEvent
(or XtNextEvent) and you will never come out of there until a real X event
comes along.
If you need to do that, change the XtAppNextEvent/XtDispatchEvent pair to
a call to XtAppProcessEvent (app_context, XtIMAll) (or XtProcessEvent(XtIMAll)).
Dick
|