Minimum height for minimum width

When we are doing height-for-width layout, sometimes we get a situation
where we have a height-for-width object in a context that doesn't
support height-for-with-layout.


 A) The height-for-width contents of a GtkWindow. X doesn't support
    height-for-width layout, the window hints are just the minimum
    size and the default size. [*]

 B) A height-for-width widget inside a container that is

The current behavior of GTK+-2.9x is that the miminum size in such a
context is the minimum-height-for-the-minimum width.

This sounds obviously right, but I think it's not. For example, if a
wrapping GtkLabel did the obvious thing and reported its minimum width
as the minimum width as the width of the longest word, the result of
putting this inside a GtkWindow would be:

 |is  | (using the current default-size-of-GtkWindow is minimum size)


 |This is some text|
 |                 | (using default-size-of-GtkWindow is natural size)
 |                 |
 |                 |

Because that works out so badly, GtkLabel currently doesn't report it's
real minimum width, but, as in GTK+-2.0, reports a guess of "a good
width to wrap to" as the mininum width, so what you get is that the
window starts off as:

 |This is   | 
 |some text |

and can't be resized to a smaller width/height. That doesn't work badly
for this case, but means that a wrapped GtkLabel always has that
artificial minimum width, even in cases where it has a real
height-for-width parent. (Unless overridden by the programmer.)

In my opinion minimum-height-for-minimum width is just conceptually
wrong - the minimum width should be the real minimum width, and at the
real minimum width a height-for-width widget will be unnaturally tall.
This is no a good miminimum height.

What, to my mind, works better in every way is
minimum-height-for-natural-width. The objection I was hearing to this
is then the window ends up with:

 |This is some text|

And can't be made any narrower than this, but unlike minimum width, the
natural width has no inherent meaning for a widget that can adapt to any
width, like a wrapping label. We can get identical results to the
current results by making a wrapped GtkLabel report "a good width to
wrap to" as the *natural* width. And we do this without breaking the
minimum width of GtkLabel.

- Owen

[*] It actually works pretty well in X to report a dynamic minimum
    height depending on the current width. We start off with the
    minimum width of the window as the real minimum width, but the
    minimum height of the window as the height for the default/natural
    width. If the user starts shrinking the window horizontally, we set
    progressively bigger minimum height hints. This does work out
    slightly oddly with wireframe resizing, however.

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