The Realize event



Due to the lack of documentation about the GtkWidget widget, I am askink 
myself a few question about the realize event.

The first time i was to use the gdk-pixbuf library i tried to write a dummy 
picture displayer, that load and displayed the image whose name was given as 
argument. I succeed, but the naive way failed.

It seemed to me that the initalisation of special graphical contexts --- that 
was the trick --- and other glib informations like display's depth etc ... 
were not ready to use between the call to gtk_init and the call to gtk_main. 
In fact i verified the default GtkGC was NULL at this time. 

So my dummy program could not render the contents of the specified file onto 
a GtkPixmap --- because this operation needs a valid GC --- before being in 
gtk_main. 

I fand that the default GC was up when the Realize event is sent to a widget, 
so i choose to handle this event by initialising the pixmap.

I am wondering if the Realize event is send one and only one time to each 
widget the first time it should be displayed, and if hooking this event for 
initialisation purposes is good-style programmation (i.e. if this usage of 
the Realize event is not too far away from what its original purpose --- that 
i do not know).





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