Re: Extended Layout incubator branch.



On Sun, Apr 25, 2010 at 9:03 PM, Matthias Clasen
<matthias clasen gmail com> wrote:
> On Sun, Apr 25, 2010 at 5:43 PM, Tristan Van Berkom <tvb gnome org> wrote:
>> On Sun, Apr 25, 2010 at 5:08 PM, Matthias Clasen
>
>>
>> The intention was to ensure the minimum size in the backwards
>> request mode. A horizontal label likes to be asked its width but
>> returns an invented value for the height; so when asked for its
>> desired height it returns the desired heights for the minimum width.
>>
>> It seems the required_rect in this case is rendered with the minimum
>> width making the required_rect.height be the correct value anyway.
>>
>> In this case we should at least do:
>>   natural = MAX (minimum, natural);
>>
>> To make sure the label is responding to the api correctly.
>
> I have committed something that fixes testellipsize and seems to still
> do the right thing for backwards request mode. Not sure if it makes
> sense, though...

Ok I'll take a look, the important part is that it returns the
minimum height for the minimum width when called for
the inverted case.

It will also only make sense for wrapping labels at right angles.

>
> One more behaviour difference I see in testgtk is that the wrapped
> labels in the labels example seem to get a bit too much space
> allocated and don't fill out their frames entirely. Any ideas about
> that ?
>

I fired up testgtk and see what you're saying.

This will be because GtkFrame still does a classic size request,
in this case its getting the minimum height for the minimum width
of the text and using that as a size request.

Since the underlined label below constrains the window size to something bigger,
the lines dont wrap up so small and leave an upper/lower border.

The real fix for that would be to implement extended layout on GtkFrame
as if it were an hbox with 2 children. It needs to:
  - collectively report h4w/w4h of its children
  - report the collective desired width/height + frame padding
  - do a GtkHBox like allocation to get the right height4width of
    the label and content widget respectively.

GtkExpander will need similar treatment.

Note that even after all this, the test still wont behave exactly
the same (it will still be narrower because of the minimum for
minimum request).

To get the exact same effect of the previous test, one would
have to set an explicit width-chars to something wide enough
to require less lines

Perhaps the reduced default wrap width I set in
get_label_wrap_width() was also too small for a default
width (i.e. the strlen ("this is a long enough string"))

Cheers,
     -Tristan


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