Re: [gtk-list] GtkContainer misbehaviour



On Mon, 23 Nov 1998, Robert Roebling wrote:

> Hi,
> 
> I need to create a window that contains a GtkFixed.
> Some of the children have to be resized when the
> window changes size, such as a menubar that has to
> have the same size as the window etc. This is not 
> possible when using GTK 1.1.3 (as opposed to 1.0.6) 
> as the window blocks all queue_resize calls when within 
> a size_allocate callback. What I do is something like 
> that (much simplified):
> 
> GtkWidget *fixed;
> GtkWidget *window;
> GtkWidget *button;
> 
> size_alloc_callback(.....)
> {
>    gtk_fixed_move( fixed, button, 30, 30 );  // no effect
>    gtk_widget_set_usize( button, 100, 40 ); // no effect
> }
> 
> main()
> {
>   window = gtk_window_new();
>   connect( window, size_alloc_callback, "size_allocate" );
>   fixed = gtk_fixed_new();
>   gtk_container_add( window, fixed );
>   button = gtk_button_new();
>   gtk_fixed_insert( fixed, button, ... );
>   ...
> }
> 
> The same code works when I use an idle handler to set
> the size outside the callback, but that is no nice
> solution, because I don't want the window to show
> up trashed and then get corrected, but instead show
> up right from the beginning. I have stepped through
> GTK 1.1.3 for hours but the resizing code is equally
> distributed over at least 4 files and I haven't been
> able to understand the meaning of each flag, but it
> seems that the private flag resize_needed is set
> when the allocate_size callback is called and this
> blocks all (or maybe all but the first) calls that 
> require a gtk_widget_queue_resize.

please try to use connect_after() for your signal handler,
the queued resize should then actually take effect.
i'll try to hack something up for the next release so that
code portions like the above should work as well.

> 
>   Robert
> 

---
ciaoTJ



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