Re: Minimum height for minimum width



Hi,

On Tue, Oct 12, 2010 at 11:20 AM, Tristan Van Berkom
<tristanvb openismus com> wrote:
> I'm not sure what exactly you are talking about here, the only guess
> a label currently makes is for a reasonable "width-chars", i.e. limiting
> a wrapping label to a reasonably large minimum width. This is to avoid
> unreasonably large heights in proportion to the width.

search for guess_wrap_width in gtklabel.c, that's what I mean, i think
it's the same thing you're talking about.
That sets min size I guess, but I'm also saying we should have natural
size be max useful size, not another guess (related to earlier
discussion).
Basically I don't think min or natural should be a "guess what looks
good," they should be true min and max useful size.

>  b.) letting the user shrink the window's width too small and grow the
>      window's height too much (if we were to constrain window size
>      dynamically)

"too small" and "too much" here just means "somewhat unaesthetic
aspect ratio" rather than "broken." If the user wants to resize to
that, fine. Maybe their screen is a weird size. We shouldn't default
to it though, which is why GtkWindow needs more smarts.

If min size is two words per line instead of one word, ok, but
philosophically the min size should be the minimum size that's
remotely useful - NOT "size that looks pretty good" or "guess at a
nice aspect ratio"

Essentially, I don't think individual widgets should have much smarts
about this stuff. They should just report min remotely useful size,
max remotely useful size. Toolkit or app need to take steps to then
make the overall layout look good.

> Please explain where we are second-guessing stuff and how exactly
> the toolkit is broken, then we can move on to fix it.

I'm saying if the label needs any intelligence then we have a problem
because any other widget using h-for-w would also need intelligence,
and those heuristics may not even be compatible with each other or
make sense in the overall layout. Widgets should just be dumb about
this. Report their min and max useful size.

> So far the two things I would change (or add as enhancements) are:
>  a.) Add a feature to let the GtkWindow choose a default size
>      according to the natural size clamped into the screen size
>  b.) Try making the window's height constraint contextual to
>      the window's allocated width.

Yep I agree

> I wouldn't say the toolkit is broken just because we haven't yet
> added those features.

If making Label "dumb" (just reports min and max useful size) has bad
results, then that's a bug in the toolkit, or at least the app, or
some widget with more contextual knowledge like GtkDialog.
There isn't enough information on the Label level.

Havoc


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