summaryrefslogtreecommitdiffstats
path: root/perl-install/mygtk2.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-12-17 12:13:49 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-12-17 12:13:49 +0000
commitd9a91c227c295a8caacb4340fb94a5af5ed0fa3d (patch)
tree2d0dcf0b646abe4e1c1e3eaaee0683744bd6dc17 /perl-install/mygtk2.pm
parente87951e4e1efca128c0ff719ae23b37d4217c270 (diff)
downloaddrakx-backup-do-not-use-d9a91c227c295a8caacb4340fb94a5af5ed0fa3d.tar
drakx-backup-do-not-use-d9a91c227c295a8caacb4340fb94a5af5ed0fa3d.tar.gz
drakx-backup-do-not-use-d9a91c227c295a8caacb4340fb94a5af5ed0fa3d.tar.bz2
drakx-backup-do-not-use-d9a91c227c295a8caacb4340fb94a5af5ed0fa3d.tar.xz
drakx-backup-do-not-use-d9a91c227c295a8caacb4340fb94a5af5ed0fa3d.zip
add some more functions in mygtk2
Diffstat (limited to 'perl-install/mygtk2.pm')
-rw-r--r--perl-install/mygtk2.pm28
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;