Michal Porzuczek wrote:
> Correct me if I'm wrong but the gtk_main() acts like an infinite while
> loop that waits for callbacks to the widgets that have been created
> before gtk_main() was called.

It is true to some extent.  It is an infinite, but terminatable loop that
waits for events (most notably, from X Window System or whatever backend
is used.)  However, it is _not_ limited to that kind of events.

> My question is, except for the g_timer function which seems to just be
> for measuring proccesses inside actual callbacks, is it possible to
> have timers running simultaneously with gtk_main() without calling a
> separate program?  That is, would it be possible to create a seperate
> while(1) that say checks for the value of some variable while
> gtk_main() is already running?

Yes, if you run it in a separate thread.  However, there is a better
(for most purposes) option.

Define your own GSource.  It can check anything you wish and run any
callbacks when events it catches arrive.  Your source will be used from
within GTK+ (actually, GLib's) main loop, but if you need it to be really
responsive, you can elevate your event source priority.  But even the
default priority must be OK for most purposes.

Paul

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to