Re: gtk threads



I left one other part out you need to also modify the source_cb function:

static gboolean
source_cb(gpointer data)
{
   g_printf("i:%d\n",*((gint*)data));
   gdk_threads_enter();
   gtk_main_iteration_do( FALSE );
   gdk_threads_leave();
   return TRUE;
}

hope this helps :-)

Todd Fisher wrote:

you need to initialize the gdk threads:

int main( int argc, char *argv[] )
{
   g_thread_init(NULL);
   gdk_threads_init();
   gtk_init(&argc,&argv);
...

   gdk_threads_enter();
   gtk_main();
   gdk_threads_leave();
}

Russell Shaw wrote:

Hi,
This test prog counts to 20 on the terminal window and should show
a GtkLabel "test" displayed in a GtkWindow.

With the thread code commented out as below, "test" is shown correct.
When the thread is allowed to run, the label is not shown. Why so?

Snip



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






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