Re: [gtkmm] Gtk::Main::runOneRound() or Gtk::Main::run() hook
- From: joey yandle <jwy divisionbyzero com>
- To: jgeorgal uoc gr
- Cc: gtkmm-list gnome org
- Subject: Re: [gtkmm] Gtk::Main::runOneRound() or Gtk::Main::run() hook
- Date: Fri, 11 Jul 2003 13:45:48 -0700 (PDT)
> Hello,
>
Hello.
> Is there a way to run a gtkmm-2 application through an external main
> loop? Specifically, I want to have my own main loop and then call
> explicitly a Gtk::Main::runOneRound() function for each iteration;
> for example:
>
Gtk::Main::iteration() will run the main loop once. It's a static function,
and takes an optional arg on whether or not to block until there are
events pending (default is true).
You can also use a loop like
while(Gtk::Main::events_pending()) {
Gtk::Main::iteration();
}
to handle all current events without unnecessarily blocking.
>
> or as an alternative is there a way to register a callback function,
> so that it can be run from the Gtk main loop in each iteration ?, so
> I can do:
> Gtk::Main::runHook(&remoteDevice::MainLoopOneRound);
> Gtk::Main::run();
>
You can use the Glib::signal_idle(). It runs whenever gtk+ isn't busy
doing anything. I don't think it runs every loop, but I haven't actually
checked the glib source to confirm this.
You would invoke it as such:
Glib::signal_idle().connect(SigC::slot(&RemoteDevice::MainLoopOneRound));
or if you need to pass a RemoteDevice object:
Glib::signal_idle().connect(SigC::slot(rmtDev, &RemoteDevice::MainLoopOneRound));
cheers,
--
joey yandle
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]