Re: [gtk-list] Re: Q: automatic function on program startup



On Mon, 22 Dec 1997 csmall@scooter.o.i.net wrote:

> OK, so something like this pseudo code?
> 
> show_window_1();
> while(!finished) {
>   finished = do_my_special_calcs();
>   update_window_1();
> }
> show_window_2();
> 
> Now, you are going to have some problems here, if your calculations are
> *that* intense that it will be a while for them to complete, poor old
> gtk_main() won't get a lookin, which is a Bad Thing.  It means important
> stuff like window redrawing will not happen.  I am unsure if there is a 
> like a release() command where you give up some cycles every now and then
> for gtk_main to do its thing.
> 
> I can see some troubles with these calculations.

As I mentioned earlier, I've had some success with:

  do {
	gtk_main_iteration();
  } while (gdk_events_pending());

as a "yield" function. This programming model might not be the best suited
for X (or other environments), but it is the simplest possible
co-processing model, and very convenient for displaying a progress
indicator.

What's less helpful is that I've had some severe problems (apparent
deadlocks) in trying to use this in combination with modal windows that
may -- or may not -- be visible at the moment.

(The exact sequence I am looking for is that a progress window is created,
made app-modal, but kept hidden, is updated periodically, as above, and
once it is clear the task will take more then a fraction of a second, the
window is shown. Modality is not released until the task is complete and
the window destroyed.) 

-- 
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]