Re: How to redraw the application window of a multithreaded GTK app?



Joerg Vogler wrote:

Hello,

I'm developing a multithreaded application based on GTK+ 1.2. The main
thread creates the application window and calls gtk_main() then. The
application window comprises a menu, a drawing area and a status bar.

The drawing area is intended to display a GdkImage created and manipulated
by another thread. This thread calls gtk_widget_queue_draw() periodically
(10 to 15 times per second) to let the expose_event handler of the drawing
area draw the GdkImage.

1. Under the X you can use XShm shared pixmap. You can read/write its memory
like an image's memory but its faster to draw it.
2. gdk_widget_queue_draw() is not the best way to update the screen in your case. You have to directly call gdk_draw_* in drawing thread (dont forget to call gdk_flush()
to sync X server).
3. Set the shared pixmap as the background of the drawing area window to avoid
handling "expose" event manually. There was a big thread "drawing graphics"
(09.19.2001) about.

Olexiy





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