Draw on a pixmap?



Hi,
I have a problem with drawing on a pixmap.

I set up my interface in my main() block. This is also the place where I
create two pixmaps, one original (pixmap) and one scratch pixmap
(pixbuffer).  After that I blit out the pixmap with gtk_pixmap_set().
Then I have a timeout which gets called every second.

The first thing I do in the timeout function is to copy the original
pixmap to the scratch pixmap with gdk_draw_pixmap().
I am drawing some lines in the timeout function on top of the scratch
pixmap (pixbuffer).  After that I'm blitting out the scratch pixmap to
the screen with gtk_pixmap_set(). This only works the *first* time and
only if I call the function explicitly from my main() loop. It does not
work if it's only called from the timeout.

Question: Do I need to connect any signals or call some sort of refresh
function to update my pixmap on screen? What could be wrong? A simple
matter of RTFM?

(I might add that I have other pixmaps in my application which also gets
updated in the timeout function. And they are working properly. The
difference is that I don't draw anything ontop of them, they just get
gtk_pixmap_set() in the timeout function. And I'm doing other stuff in
the timeout function which gets done every second. So the timeout
happens and work.)

Thanks!

Jörgen Pehrson    jp@spektr.eu.org


(The code in question can be found at:
http://spektr.eu.org/~jp/battstat_applet-2.0.0.tar.gz)





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