diff options
-rw-r--r-- | perl-install/install_gtk.pm | 24 | ||||
-rw-r--r-- | perl-install/mygtk2.pm | 9 |
2 files changed, 17 insertions, 16 deletions
diff --git a/perl-install/install_gtk.pm b/perl-install/install_gtk.pm index 59eff6373..28256021d 100644 --- a/perl-install/install_gtk.pm +++ b/perl-install/install_gtk.pm @@ -13,8 +13,6 @@ use devices; #-INTERN CONSTANT #-##################################################################################### -my @background; - #- if we're running for the doc team, we want screenshots with #- a good B&W contrast: we'll override values of our theme my $theme_overriding_for_doc = q(style "galaxy-default" @@ -57,17 +55,10 @@ widget "*logo*" style "background-logo" sub load_rc { my ($o, $name) = @_; - if (my $f = -r $name ? $name - : find { -r $_ } map { "$_/themes-$name.rc" } ("share", $ENV{SHARE_PATH}, dirname(__FILE__))) { - my @contents = cat_($f); - $o->{doc} and push @contents, $theme_overriding_for_doc; - - Gtk2::Rc->parse_string(join("\n", @contents)); - foreach (@contents) { - if (/style\s+"background"/ .. /^\s*$/) { - @background = map { $_ * 255 * 255 } split ',', $1 if /NORMAL.*\{(.*)\}/; - } - } + my $f = $name; + -r $name or $f = find { -r $_ } map { "$_/themes-$name.rc" } ("share", $ENV{SHARE_PATH}, dirname(__FILE__)); + if ($f) { + Gtk2::Rc->parse_string($o->{doc} ? $theme_overriding_for_doc : scalar cat_($f)); } if ($::move) { @@ -118,7 +109,12 @@ sub install_theme { load_rc($o, $o->{theme} ||= default_theme($o)); load_font($o); - mygtk2::set_root_window_background(@background) if !$::move; + + if (!$::move) { + my $win = gtknew('Window', widget_name => 'background'); + $win->realize; + mygtk2::set_root_window_background_with_gc($win->style->bg_gc('normal')); + } } #------------------------------------------------------------------------------ diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm index 68f95e714..5f9e3d2eb 100644 --- a/perl-install/mygtk2.pm +++ b/perl-install/mygtk2.pm @@ -675,10 +675,15 @@ sub set_root_window_background { my $gc = Gtk2::Gdk::GC->new($root); my $color = rgb2color($r, $g, $b); $gc->set_rgb_fg_color($color); - $root->set_background($color); + set_root_window_background_with_gc($gc); +} + +sub set_root_window_background_with_gc { + my ($gc) = @_; + my $root = root_window(); my ($w, $h) = $root->get_size; + $root->set_background($gc->get_values->{foreground}); $root->draw_rectangle($gc, 1, 0, 0, $w, $h); } 1; - |