Re: Threads in GTK goofing up expose event



Neil Hodge <neh attbi com> writes:

All:

I am trying to implement threads in my app.  Basically, it seems to be
working fine, except it is not processing the expose event properly
(i.e., when I put another window in front of my app and then move it out
of the way, my app will only redraw some of the widgets some of the
time, while other widgets remain greyed out).  However, it is processing
mouse clicks just fine (even though a widget is greyed out, I can click
on it, and it works fine).  Basically, I am set up just like the thread
example in the GTK FAQ (which I ran, and it worked fine):

http://www.gtk.org/faq/#AEN462

with one (apparent) exception; I am using normal pthreads mutexes and
semaphores inside my worker thread (as opposed to using only
G_LOCK()/G_UNLOCK() and gdk_threads_enter()/gdk_threads_leave() as per
the example).  Does anyone have any idea what my problem is, and
specifically, if it is related to the use of stock pthreads calls?

There is something that should be in the faq, that (as I recall) isn't...
I'm not sure if this is your problem or not.

If you do GTK+ stuff in a separate thread from where your main loop
is running, you should generally end the sequence of calls with a 
call to gdk_flush() before you call gdk_threads_leave() ... otherwise you 
may have queued X requests that aren't sent out.

Regards,
                                        Owen



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