[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

2521.0. "Exiting from XtMainLoop" by MASTIC::FARRELL (Money, there is no substitute!) Tue Mar 27 1990 15:28

Hello,

Is there any way to truly "exit" from XtMainLoop ?

I have a program, which calls a function.  This function initilaizes the
X stuff and calls XtMainLoop.  Now I want the loop to end, and the function
to return; to the caller.

If I try to use a callback, all returns back to XtMainLoop.  Is there a way
around this?  I need a method to exit XtMainLoop.  I could do it manually
using get & dispatch event, but I am using timeouts and work procedures
which are controlled by the XtMainLoop.

Any/all help would be appreciated,

	$$$$ ted $$$$
T.RTitleUserPersonal
Name
DateLines
2521.1XtMainLoop is not magicGILROY::kleeKen LeeTue Mar 27 1990 17:0817
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.2No luck without xtmainloop...METIS::FARRELLWed May 16 1990 16:4514
    
    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.3GILROY::kleeKen LeeWed May 16 1990 20:419
    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.4XtAppProcessEventCLTVAX::dickSchoeller - Failed XperimentThu May 17 1990 13:3711
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