gtk and multithreading



I've got a problem.

The main program I have calls gtk_main() 
and everything works great until I get into threads.

What I'm trying to do is call a thread to connect to a remote
server. And when it recieves a response, it needs to pop up a 
window showing the response.

Well anyhow it works for the most part...I'm using libglade
so I'm doing a gtk_widget_show(widget);  where the widget has
already been referenced and hidden, etc.  But the use of
libglade should be most irrelevant.

the only problem is that the widget won't display until I move
the mouse...

if I use gtk_widget_show_now(widget) instead it gives me an error
about the main loop running in another thread, but again it displays
properly as soon as I move the mouse.

The only solution I can think of is to emit an event of some sort, and
have the main loop capture the event and show the window for me instead
of having my thread do it, but this is my first attempt at creating any
GUI ... ever ... anywhere. So, the whole event structure is new to me 
(but I seem to have everything else besides threads down!)

Also, I looked at the example in the FAQ, and it IS showing a redraw
of a text field.  So it seems as though a thread can update the GUI, 
so this really confuses me...maybe I'm not using the gdk_enter_thread()
stuff properly....

Any help would be much appreciated...thank you.

-----------------------------
Brad House
Sr. Developer
Main Street Softworks, Inc.

brad mainstreetsoftworks com
(352) 378-8228
-----------------------------




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