Re: [gtk-list] how do i force a window to be fully realized ?




On Tue, 16 Nov 1999, Paul Barton-Davis wrote:
> 
> worse still, it seems pretty easy to send the program into an endless
> loop with the top loop - the window returned by get_window () is
> sometimes NULL repeatedly, and no attempt to give GTK a chance to
> catch up succeeds.
> 

You call gtk_widget_realize() right? If not, the widget won't be realized
until its toplevel is realized. If you do call it, the widget must be 
a child of a toplevel or it won't work since a force-realize entails
realizing a widget's parent.

Either way though, I wouldn't approach the problem the way you are; it's
the equivalent of:
 while (1) {
   if (window)
     break;
 }

Granted, you jump through a few more hoops. 

A much nicer way is to connect a signal handler to the "realize" signal
(or if you need the window to be ready for drawing, the first "expose"
signal), and then wait in a recursive gtk_main() until your signal handler
is called. See gnome_dialog_run() for an example of how this works.

This is assuming you need the function to block waiting for the widget to
be realized, if you can afford to return then just connect to "realize".

Havoc




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