Re[1]: Newbie Q: external event loop



>>> gnome-list-request@gnome.org  Thu Apr 30 10:55:19 1998 seems to think that:
>Hi,
>
>Is it possible to use an external event loop instead of the gtk_main?
>I can not find any "gtk_do_one_event"-like function in gtk doc.
  [ ... ]

I also asked this question.  The mantra is not to do that, but I was
vaguely successful in making an external event loop work under gtk
after sufficient hacking.

The gtk_main function eventually boils down to code like this which is
probably not what you want:

  while(!gtk_main_iteration()) ;

I call my event loop based on X events pending, and then do this which
may be more what you want.

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

If you are doing fancy things to determine when you run your loop, be
warned that the menues all use timers to delay popup times.  This is
what makes the menus feel nice.  If this is the case, I'm not yet sure
how to find out what the current timout value is, but if you run the
function:

  gtk_main_iteration_do(FALSE);

it will run any out-of-date timers for you, so you may need to make
sure you run this after a sufficient short delay after handling
events.

Doing this lets me keep my event loop which I use when I run my app in
curses mode.

-Eric

-- 
|\/\/\___/\/\/|  Eric Ludlam                 zappo@gnu.org; zappo@ultranet.com
\____ o o ____/  Homepage:                      http://www.ultranet.com/~zappo
     )   (       Trebuchets:    http://www.ultranet.com/~zappo/trebuchet.shtml
    ( * * )      FSF:				            http://www.fsf.org
     \___/           "Have a fling with a Hudson Trebuchet Crew member"



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