Re: set_resize



Hi,

On Thu, Jan 15, 2009 at 10:04 AM, Pietro Battiston <toobaz email it> wrote:
> I already considered my doubt as answered (see below), but I disagree
> with what you say: if you call size_request "minimum size", why don't
> you fulfill it, and how do you call "set_size_request"?!
>
> Maybe you meant set_size_request?

I don't know what you mean; set_size_request just sets the size
request. The size request is defined as the minimum size, that is how
GTK works. If you don't set it with set_size_request, then the size
request (aka minimum size) of a window will be the sum of the minimum
sizes (size requests) of all the contained widgets in the window.
set_size_request is just a way to override the "normal" minimum size.

I promise I am right, I added gtk_widget_set_size_request in the first place:

2001-08-07  Havoc Pennington  <hp pobox com>

 	* gtk/gtkwidget.c (gtk_widget_set_size_request): new function
 	(gtk_widget_get_size_request): new function

And the API docs are:

 * gtk_widget_set_size_request:
 * @widget: a #GtkWidget
 * @width: width @widget should request, or -1 to unset
 * @height: height @widget should request, or -1 to unset
 *
 * Sets the minimum size of a widget [...]

When the docs say "Also remember that the size request is not
necessarily the size a widget will actually be allocated," they are
primarily referring to the fact that the widget can be *larger* than
its size request, because there is extra space in the window for
whatever reason.

It is possible for widgets to get a size smaller than their minimum
size, but only due to a bug in something, really. It can be due to a
bug in the window manager rather than the app, so gtk widgets usually
try not to crash if they get a size below the minimum.

> What I wanted is: windows which don't overflow the screen when their
> size_request (but not their set_size_request) is too big; however, I
> understood this is impossible without coordinate improvements to the
> window manager(s) _and_ gtk.

Some window managers may automatically force windows to fit on the
screen, but it's not technically allowed for them to force windows
below their minimum size. Some may do it anyway, perhaps, but it's
pretty much a bug.

If you want to resize a window without changing its minimum size, then
the right calls are things like gtk_window_set_default_size() and
gtk_window_resize().

Havoc


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