--- deliantra/Deliantra-Client/DC/UI.pm 2007/09/01 07:22:21 1.438 +++ deliantra/Deliantra-Client/DC/UI.pm 2007/09/16 13:04:36 1.439 @@ -362,6 +362,19 @@ $self->realloc; } +# travsle the widget chain up to find the maximum "physical" size constraints +sub get_max_wh { + my ($self) = @_; + + return ($self->{alloc_w}, $self->{alloc_h}) + if $self->{alloc_w} && !$self->{root}{realloc}{$self+0}; + + return $self->{parent}->get_max_wh + if $self->{parent}; + + ($::WIDTH, $::HEIGHT) +} + sub size_request { require Carp; Carp::confess "size_request is abstract"; @@ -819,7 +832,6 @@ } ############################################################################# - # back-buffered drawing area package CFPlus::UI::Window; @@ -1944,8 +1956,10 @@ my ($self) = @_; $self->{size_req} ||= do { + my ($max_w, $max_h) = $self->get_max_wh; + $self->{layout}->set_font ($self->{font}) if $self->{font}; - $self->{layout}->set_width ($self->{max_w} || -1); + $self->{layout}->set_width ($self->{max_w} || $max_w || -1); $self->{layout}->set_ellipsise ($self->{ellipsise}); $self->{layout}->set_single_paragraph_mode ($self->{ellipsise}); $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE);