Re: Running the main loop in a separate thread
- From: Petko <pditchev gmail com>
- To: gtkmm-list gnome org
- Subject: Re: Running the main loop in a separate thread
- Date: Sat, 08 Sep 2012 17:41:32 +0300
Wow , that actually worked like a charm . I Looked through the classes
and how an application gets initialized , I found out that with two
windows hiding the second one works properly (it still remains a bug
that with one window GTK doesn't clear it upon hiding but rather
interrupts and waits for the process to terminate and clear things) . So
here's what I needed to do (for anyone who might stumble on this thread
in the future) :
in main() :
>create the Gtk::Application and widgets (I imported them via GtkBuilder)
>import the windows to the app via app->add_window(...);
> here I omitted dealing with the possible command line arguments , but
I'm not using them anyway
>call app->register_application
>call app->activate
>init GLUT stuff
>register the idle func to g_do_one_loop()
void g_do_one_loop(){
static Glib::RefPtr<Glib::MainContext> GMC=Glib::MainContext::get_default();
GMC->iteration(0);
return;
}
And as my widgets (windows) are global I can hide/show them from where
ever I want and everything works great .
Petko
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]