Re: Expose event?




 I do my init stuff on the "draw" event, and my update stuff on the
"expose_event".. in this case, I create a SDL surface (SDL is a library
for real time graphics designed for videogames)

 What are the differences of these events? I was believing it is better
off If I use expose to manage the update stuff and draw to init the
stuff. I attach a surface using the drawarea window, and it works
well...

 I'll do some futher research to know exactly which events are
happening...

 Well, on this morning, I got the answer, so, I'll reply to myself
(maybe it is useful to others)

 If you draw some stuff over a drawarea (like my SDL surface, or maybe
an opengl context) It looks like expose-event of the draw area is not a
total warranty that the whole widget is exposed. After I create the
widget, I attach it to a gnomeapp. so, It is exposed the draw area...
BUT (and this is the issue) the cover surface (sdl or opengl) are not
updated (even if you force it with the eventspending loop). Ofcourse,
The contents are updated when the container is updated. But the point is
that you cant load an image over the draw area if the drawarea is not
attached yet

 So, doing below code AFTER THE WIDGET CONNECTION repairs the bug

        /* wait till drawarea is exposed */
        while (!screen->surface)
        {
          while ( gtk_events_pending() ) gtk_main_iteration();
        }

 What is the problem here? If any error happens... I've got an
infinite loop (i.e. I never open the SDL surface).. I can use some
flags,
etc... but I'd like to see another point of view or any suggestion

 Maybe, this is a problem only specific to my concrete app...

pd. Also, I moved all init stuff to the expose-event, but I'd like to
know the meaning of "draw" anyway..

Thanks!

-- 
signed
          derethor of centolos






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