gtk_widget_show/hide in threads



Hello,

(I'm new to this list). I am beginning to use GTK 1.2 on a Sun Ultra 10 machine, 
with SunOS 5.6. Although I'm on Sun, I use POSIX threads.
I made some experiments using plain C, then I have started to use Glade for 
creating the GUI.
The graphic part is actually partly controlled by a big commercial application. 
I want my window in GTK to pop-up when I click on a menu entry in the host 
application.

I have a thread (which is not the main one because it's reserved by the host 
app) from which gtk_main() is launched.
Before calling gtk_thread, I create another thread which is used for IO (sending 
and receiving messages from the host app and others).

I use the functions gtk_widget_show and gtk_widget_hide from this second thread, 
and this thread gets requests from a pipe.
The first time, my window in GTK pops-up all right. When it is asked to close, 
it does it but not until I move to mouse pointer into the window.
Then on subsequent requests to show/hide the window, nothing happens.
gtk_widget_show/hide don't block, but nothing happens.

When I want to terminate, I send a terminate request to this thread, which calls 
gtk_main_quit(). This function works fine, only showing/hiding doesn't work.

I tried this g_iteration (or something like that) but it couldn't work since a 
main loop was already running in another thread.

I read the FAQ and found an article about threads. I tried to put 
gdk_threads_enter/leave around my gtk_widget_show/hide calls but it didn't help.
(I didn't forget the g_threads_init( NULL ) before the gtk stuff )
In the February archive of the list there is someone suggesting to put 
gdk_threads_enter/leave around any GTK call.
Does this apply to gtk calls in callback functions ?


Is there anything to know about gtk_widget_show/hide ? I don't understand why 
they return while performing no action :-/


Thank you for your help !

Vincent





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