Re: draw signals



  Alan> Carlos, Thanks for your response.  I would love to forget about
  Alan> "draw" :-) However, I don't see how I can.  Everytime I uncover a
  Alan> portion of a window with a pixmap in it, I get an "expose_event"
  Alan> (which I use to refresh the screen) and a "draw" signal which
  Alan> repaints my pixmap and then refreshes the screen a second time.  The
  Alan> repainting of my pixmap seems unnecessary IMHO and is forcing me to
  Alan> allocate memory and attach data to every pixmap I use.  I would like
  Alan> to eliminate this redundancy so that I don't need to use up the
  Alan> extra memory and waste time doing the same thing twice.  Any ideas
  Alan> on how to solve this problem would be greatly appreciated!

I think Carlos was saying that your expose event handler should draw the
pixmap and then update the screen from the pixmap.  Then you can ignore the
draw events.

Yes,

I strongly suggest you to see the code of scribble, the
drawing area example that comes with gtk. They update a
drawing area using a pixmap, and they don't use any
"draw" signal at all, only "expose_event" and "configure_event".

In Eric Harlow's book you have examples of using a pixmap
to draw a watch in a drawing area, using single and double
buffer techniques, and no "draw" signal is ever used.

And definitely my drawing (OpenGL) areas are updated just 
once when needed, not twice as in your case.

Carlos




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