diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-12-17 12:13:49 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-12-17 12:13:49 +0000 |
commit | d9a91c227c295a8caacb4340fb94a5af5ed0fa3d (patch) | |
tree | 2d0dcf0b646abe4e1c1e3eaaee0683744bd6dc17 /perl-install/mygtk2.pm | |
parent | e87951e4e1efca128c0ff719ae23b37d4217c270 (diff) | |
download | drakx-d9a91c227c295a8caacb4340fb94a5af5ed0fa3d.tar drakx-d9a91c227c295a8caacb4340fb94a5af5ed0fa3d.tar.gz drakx-d9a91c227c295a8caacb4340fb94a5af5ed0fa3d.tar.bz2 drakx-d9a91c227c295a8caacb4340fb94a5af5ed0fa3d.tar.xz drakx-d9a91c227c295a8caacb4340fb94a5af5ed0fa3d.zip |
add some more functions in mygtk2
Diffstat (limited to 'perl-install/mygtk2.pm')
-rw-r--r-- | perl-install/mygtk2.pm | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm index ee90cf5c1..68f95e714 100644 --- a/perl-install/mygtk2.pm +++ b/perl-install/mygtk2.pm @@ -652,5 +652,33 @@ sub flush() { Gtk2->main_iteration while Gtk2->events_pending; } +sub may_destroy { + my ($w) = @_; + $w->destroy if $w; +} + +sub root_window() { + my $root if 0; + $root ||= Gtk2::Gdk->get_default_root_window; +} + +sub rgb2color { + my ($r, $g, $b) = @_; + my $color = Gtk2::Gdk::Color->new($r, $g, $b); + root_window()->get_colormap->rgb_find_color($color); + $color; +} + +sub set_root_window_background { + my ($r, $g, $b) = @_; + my $root = root_window(); + my $gc = Gtk2::Gdk::GC->new($root); + my $color = rgb2color($r, $g, $b); + $gc->set_rgb_fg_color($color); + $root->set_background($color); + my ($w, $h) = $root->get_size; + $root->draw_rectangle($gc, 1, 0, 0, $w, $h); +} + 1; |