Threads troubles. and events



I'm working on gtk using gthreads., but I have a little trouble.

In a random time, a thread  needs update a widget(it draws a rectagle in a 
pixmap "gdk_draw_rectangle" and puts the rectangle in the widget draw queue 
"gtk_widget_queue_draw_area"), it seems work ok, but isn't it . After a lot 
of calls to this function.  the widget seems stop your work. and some other 
child widgets disapear  from the widget (are not drawn). 
The widget  is indeed running, it does all event callbacks ok. but the draw 
event queue seems broken. All redraw functions not works.

I think is a something about draw events queue, but I unknown how the main 
event loop works and how can I fix it. 

I can solve this by setting a shared variable and a timeout 
(g_timeout_add/gtk_timeout_add) in the gtk_main thread, every X time , read 
this variable , if changes, update . But it will introduce a lot of unneeded 
overhead. to the gtk_main loop.  I prefer do update acction from the other 
thread.

Can I do it?
Can I put form another thread an update area using 
"gtk_widget_queue_draw_area", ?


-- 
=================
Toni Moreno Giménez
=================
Pje de las rosas  nº 22
Vilassar de Mar 
(Barcelona) España
CP: 08340




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