From d98b056a1e6b58d598364089dd1c4660468c36a0 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 22 Feb 2001 14:16:06 +0000 Subject: (create_box_with_title): disallow focusing on text if it is non-scrolled --- perl-install/my_gtk.pm | 10 ++++++++-- 1 file 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}, -- cgit v1.2.1