summaryrefslogtreecommitdiffstats
path: root/perl-install/my_gtk.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/my_gtk.pm')
-rw-r--r--perl-install/my_gtk.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm
index 749ae9aa4..a387c83a8 100644
--- a/perl-install/my_gtk.pm
+++ b/perl-install/my_gtk.pm
@@ -307,9 +307,15 @@ sub create_box_with_title($@) {
$o->{box} = new Gtk::VBox(0,0);
if (@_ <= 2 && $nb_lines > 4) {
my $font = $o->{box}->style->font;
+ my $wanted = $nb_lines * ($font->ascent + $font->descent) + 7;
+ my $height = min(250, $wanted);
+ my $has_scroll = $height < $wanted;
+
+ my $wtext = new Gtk::Text;
+ $wtext->can_focus($has_scroll);
chomp(my $text = join("\n", @_));
- my $scroll = createScrolledWindow(gtktext_insert(new Gtk::Text, $text));
- $scroll->set_usize(400, min(250, $nb_lines * ($font->ascent + $font->descent) + 7));
+ my $scroll = createScrolledWindow(gtktext_insert($wtext, $text));
+ $scroll->set_usize(400, $height);
gtkpack__($o->{box}, $scroll);
} else {
gtkpack__($o->{box},