Re: drawing a line



Hi,

Shiraz Baig <shiraz_baig yahoo com> writes:

>    I do understand the advantage of "expose" but I
> wanted to understand the fundamentals first.

actually I don't think the concept of expose events as exposed by X11
(and thus GDK) has any advantages, but that's a different question...

> BTW, I have now drawn the line with "expose" event.
> But I am slightly confused, becuase it calls the
> expose function three times. This is how I tested it.
> I just put a statement in the "expose" function call
> as;
>   int static turn=0
>   g_print turn++;
> 
> And I found that when I first draw the line this
> command prints 0,1 and 2. That means that it has been
> exposed three times. I thought that it is only being
> exposed when it is created. Any comments on that?

the expose event is called whenever the window (or parts of it) need
to be repainted. This is the case if the gtk_widget_queue_draw() or a
similar function is called and whenever the X server decides that it
needs to happen (for example because the window was obscured by
another window and becomes unobscured). You should note that the
expose_event carries an expose rectangle (event->area) so you probably
see three expose events on different areas of your windows. You will
only want to redraw the entire window on every expose event if you are
lazy.


Salut, Sven



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