Hi guys,
I'm a 2013 GSOC applicant and am currently working on porting the GTK+3 AWT support for the classpath.
I have worked tirelessly for the past couple of days and finished all of the porting process except for the changes required for gdk_threads.
As of GTK+3 3.6.4 gdk_threads_enter() and gdk_threads_leave() have been completely deprecated. The documentation asks for the complete removal of these calls and for them to be replaced by g_idle_add() calls in the main thread of the gtk-peer.
Unfortunately I dont have much experience in handling threads, especially for gtk. I dont quiete understand how to use g_idle_add in place of the simple thread calls in each function which require blocking in the gtk-peer. I have searched for a while now
on google but have also not found any concrete examples on how to do this.
i'm wondering if someone can provide me with some info on this, for example here is a code snippet from gnu_java_awt_peer_gtk_GtkMenuPeer.c;
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addTearOff
(JNIEnv *env, jobject obj)
{
void *ptr1;
GtkWidget *menu, *item;
gdk_threads_enter ();
ptr1 = gtkpeer_get_widget (env, obj);
menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (ptr1));
item = gtk_tearoff_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
gdk_threads_leave ();
}
how would i go about changing these gdk_thread calls to a single g_idle_add call?
Any help or tips would be greatly appreciated!
Farshad
|