Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!pws.bull.com From: mwolf@pws.bull.com (Mary-Anne Wolf) Newsgroups: comp.windows.x Subject: Processing events "normally" outside XtMainLoop() Summary: How do I keep running when I lose the focus? Keywords: XEvent, XtProcessEvent, event Message-ID: <15762@know.pws.bull.com> Date: 11 Sep 90 18:43:46 GMT Sender: news@pws.bull.com Followup-To: comp.windows.x Organization: Bull Worldwide Information Systems Inc. Lines: 38 Nntp-Posting-Host: oak.pws.bull.com I am trying to do something and have not quite figured out how. I had not expected it to be so hard. I'd appreciate help. I have a program written in C and UIL on Motif 1.0 on X11R3 on SCO running with mwm. I have a function which takes a long time to run, and originally, my program's window was unresponsive while the function was running. This was unacceptable because I need the user to be able to push a button to make this long function abort. I prefer to avoid the overhead of forking processes, because it's too slow, and to avoid writing my own event handler, because handling the UIL callbacks is probably difficult. The best solution seemed to be to insert event-handling code in my function every so often that just calls the "normal" event handler. I tried lots of things, and the closest to something that works is: event_return->type = -1; while(XtPeekEvent(event_return) != 0) && (event_return->type != FocusOut)) { XtProcessEvent(XtIMALL); } if (event_return->type == FocusOut) { XtProcessEvent(XtAllEvents); } but this causes my function to suspend when it loses the focus (when I move the mouse out of the window) and to continue running when it regains the focus, and I want it to keep running whether it has the focus or not, but I also want to be able to do things in other windows while it is running. Anyone know the right way to do this? Thanks, Mary-Anne Wolf Bull mwolf@pws.bull.com or mwolf@granite.cr.bull.com "There is ALWAYS one more bug."