[cairo] Can't draw more

Gary Jaffe gfj555 at gmail.com
Sun Nov 25 12:10:56 PST 2007

Kalle Vahlman wrote:
> ...but it sounds like it is. What happens here is that you create a
> context in the configure event for the *real* window, and then
> anything you draw on it is wiped out by GTK+ in preparation for the
> expose handler. In general, you should never store the context for a
> GTK+ window outside the expose handler (since it likely will not be
> for the surface you actually want to draw on) but instead always
> create it inside it.

I'm beginning to understand that (finally).  So I have to do everything
in my expose_event method.

Since I want to allow the user to draw on the background that I already
displayed, I guess I'll have to keep track of every little bit of the
user's drawing as he is drawing it and call my expose_event with each
bit that comes back to me with the motion_notify_event hint I get back.
  Then the expose_event will draw the background and each of the bits
that have been collected up to that point.

Is that a good strategy, or am I barking up the wrong tree with cairo?


More information about the cairo mailing list