Re: Event loop



Ubirata Azevedo Ignacio <ubirata zeus unisinos br> writes:

  How can I control th event loop?
  I wanna something like
 
     while(1)
     {
      do_something() ;
      process_gtk_event_loop() ;
      do_another_thing() ;
     }


The easiest way to do this type of thing in GTK is usually to put
do_something() in an idle handler.  A loop as above "fights the
system" and doesn't work that great.

Another option is a custom main loop source, using g_source_add() and
a custom GSourceFuncs. Using the GLib API docs and the sources
included with GLib (IO, idle, etc.) you can probably figure out how to
do that.

Pretty much any _something() can simply be integrated into the GLib
main loop instead of doing your own busy loop.

Havoc




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