… | |
… | |
148 | sub configure { |
148 | sub configure { |
149 | my ($self, $x, $y, $w, $h) = @_; |
149 | my ($self, $x, $y, $w, $h) = @_; |
150 | |
150 | |
151 | $self->{x} = $x; |
151 | $self->{x} = $x; |
152 | $self->{y} = $y; |
152 | $self->{y} = $y; |
|
|
153 | |
|
|
154 | if ($self->{aspect}) { |
|
|
155 | $w = List::Util::min $w, int $h * $self->{aspect}; |
|
|
156 | $h = List::Util::min $h, int $w / $self->{aspect}; |
|
|
157 | } |
153 | |
158 | |
154 | return unless $self->{w} != $w || $self->{h} != $h; |
159 | return unless $self->{w} != $w || $self->{h} != $h; |
155 | |
160 | |
156 | $self->{w} = $w; |
161 | $self->{w} = $w; |
157 | $self->{h} = $h; |
162 | $self->{h} = $h; |
… | |
… | |
1449 | |
1454 | |
1450 | # eg. VGauge->new (gauge => 'food'), default gauge: food |
1455 | # eg. VGauge->new (gauge => 'food'), default gauge: food |
1451 | sub new { |
1456 | sub new { |
1452 | my $class = shift; |
1457 | my $class = shift; |
1453 | |
1458 | |
1454 | my $self = $class->SUPER::new (gauge => 'food', @_); |
1459 | my $self = $class->SUPER::new ( |
|
|
1460 | gauge => 'food', |
|
|
1461 | @_ |
|
|
1462 | ); |
|
|
1463 | |
|
|
1464 | $self->{aspect} = $tex{$self->{gauge}}[0]{w} / $tex{$self->{gauge}}[0]{h}; |
1455 | |
1465 | |
1456 | $self |
1466 | $self |
1457 | } |
1467 | } |
1458 | |
1468 | |
1459 | sub size_request { |
1469 | sub size_request { |