Re: expose event & pixmap question

> From: Christian Seberino <seberino spawar navy mil>
> Thanks for the reply.  It seems that NOTHING should be
> done in configure event handler.  I'm wondering why
> even bind it to ANY function!?!?!?

If you care specifically about the user resizing or moving your
window, it's useful. It's not really necessary for drawing, though,
since any newly exposed part of the window generates expose events.

> This is why I'm confused by suggestion to add
> gdk_draw_pixmap to configure event handler.  Do you
> mean (or is it OK) to do drawing in expose event
> and add gdk_draw_pixmap *there*???

The _only_ place you should _ever_ draw to a window is
in an expose event. No exceptions.

> This would mean I could call this expose event handler
> *even when there is no expose event* to do some drawing
> right???

Don't ever do this.

This is sort of in the same category of "I can write code
to intentionally create a seg fault." True, but not spectacularly

If you want to generate an expose event, call
gtk_widget_queue_draw() or gtk_widget_queue_draw_area()
(as I believe someone already mentioned). This invalidates
the window (or part of the window), causing the X server
(or gdk itself, for other back ends) to emit an expose

> Is it true that gdk_draw_pixmap is one of the functions
> that gets called "behind the scenes" when there is an
> expose event and that that is why event_handler doesn't
> always need to call gdk_draw_pixmap?

It's true that gdk does do some double buffering behind the
scenes, but at some point you have to take the image
(possibly stored in a GdkPixmap, possible made up of
other drawing primitives) and draw it to the window.
That's what the expose event is for.

Ron Steinke

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