Re: How to resize a widget?



learfox furry ao net writes:

Calling gtk_widget_queue_resize() on the toplevel window may do what
you want.

Thanks a bunch!! That did the trick! :)


(What you are running into, I think, is that GTK+ has a concept of
'hysteresis' - generally, a widget will be reallocated a new size only
if it needs MORE size than it currently has, not less; so if the
size of widget is changing, it may not be the same size as if
the layout was done from scratch. I have some hope of getting rid
of this in the future, but haven't really gone through and figured
out what that would take.)

Hmm, it's gonna be difficult since GTK+ is pretty much very `desktop space
efficient'. Meaning it wants to use as little space as possible (much
different than say Motif).

I would suggest a new function to set the exact size and force it to take
on that size.  There might be apps that currently rely on certain
behavours of gtk_widget_set_usize().

What I would want to do is make

 gtk_widget_queue_resize (widget);

Behavior the same as:

 gtk_widget_queue_resize (gtk_widget_get_toplevel (widget));

This shouldn't harm any existing apps, because after all,
a resize might be queued on the toplevel anyways for some
other reason. 

And it would remove one mysterious, and sometimes annoying element
from GTK+'s size-allocation policies.

[ 
  Literally making gtk_widget_queue_resize() always queue a
  a resize on the toplevel is possible, but would result
  in excessive redrawing and probably can be done more efficiently.
]

Regards,
                                        Owen




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