diff options
author | damien <damien@mandriva.com> | 2001-09-11 13:16:18 +0000 |
---|---|---|
committer | damien <damien@mandriva.com> | 2001-09-11 13:16:18 +0000 |
commit | a1c30874dd79d9b39590180e3eb63b64a9e424ac (patch) | |
tree | e319cf21184ae239e335708aa5c8de3d0725f1a3 /perl-install/my_gtk.pm | |
parent | ca93c3dd1750ae75a79671a62cd6fbf74985707f (diff) | |
download | drakx-a1c30874dd79d9b39590180e3eb63b64a9e424ac.tar drakx-a1c30874dd79d9b39590180e3eb63b64a9e424ac.tar.gz drakx-a1c30874dd79d9b39590180e3eb63b64a9e424ac.tar.bz2 drakx-a1c30874dd79d9b39590180e3eb63b64a9e424ac.tar.xz drakx-a1c30874dd79d9b39590180e3eb63b64a9e424ac.zip |
fear the shaped windows...
Diffstat (limited to 'perl-install/my_gtk.pm')
-rw-r--r-- | perl-install/my_gtk.pm | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index 47060bbda..c25bebdc1 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -532,13 +532,31 @@ sub create_vbox { sub _create_window($$) { my ($o, $title) = @_; my $w = new Gtk::Window; - gtkadd($w, - gtkadd( my $f_ = gtkset_shadow_type(new Gtk::Frame(undef), 'out'), - my $f = gtkset_border_width(gtkset_shadow_type(new Gtk::Frame(undef), 'none'), 3) - ), - ); + my $gc = Gtk::Gdk::GC->new(gtkroot()); + $my_gtk::shape_width = 7; +#- $gc->set_foreground(gtkcolor(8448, 17664, 40191)); #- in hex : 33, 69, 157 + $gc->set_foreground(gtkcolor(5120, 10752, 22784)); #- in hex : 20, 42, 89 + gtkadd($w, my $table = new Gtk::Table(2, 2, 0)); + $table->attach( gtkadd(my $f_ = gtkset_shadow_type(new Gtk::Frame(undef), 'out'), + my $f = gtkset_border_width(gtkset_shadow_type(new Gtk::Frame(undef), 'none'), 3) + ), + 0, 1, 0, 1, 1|4, 1|4, 0, 0); + $table->attach( gtksignal_connect(gtkset_usize(new Gtk::DrawingArea, 7, 1), expose_event => sub { + $_[0]->window->draw_rectangle($_[0]->style->bg_gc('normal'), 1, 0, 0, 7, 7); + $_[0]->window->draw_rectangle($gc, 1, 0, 7, 7, $_[0]->allocation->[3]); + }), + 1, 2, 0, 1, 'fill', 'fill', 0, 0); + $table->attach( gtksignal_connect(gtkset_usize(new Gtk::DrawingArea, 1, 7), expose_event => sub { + $_[0]->window->draw_rectangle($_[0]->style->bg_gc('normal'), 1, 0, 0, 7, 7); + $_[0]->window->draw_rectangle($gc, 1, 7, 0, $_[0]->allocation->[2], 7); + }), + 0, 1, 1, 2, 'fill', 'fill', 0, 0); + $table->attach( gtksignal_connect(gtkset_usize(new Gtk::DrawingArea, 7, 7), expose_event => sub { + $_[0]->window->draw_rectangle($gc, 1, 0, 0, 7, 7); + }), + 1, 2, 1, 2, 'fill', 'fill', 0, 0); + $table->show_all; $w->set_name("Title"); - $w->set_title($title); $w->signal_connect(expose_event => sub { eval { $interactive::objects[-1]{rwindow} == $w and $w->window->XSetInputFocus } }) if $my_gtk::force_focus || $o->{force_focus}; @@ -583,11 +601,23 @@ sub _create_window($$) { my ($wi, $he) = @{$_[1]}[2,3]; my ($X, $Y, $Wi, $He) = @{$my_gtk::force_center || $o->{force_center}}; $w->set_uposition(max(0, $X + ($Wi - $wi) / 2), max(0, $Y + ($He - $he) / 2)); + + my $sqw = $my_gtk::shape_width; #square width + my $wia = int(($wi+7)/8); + my $s = "\xFF" x ($wia*$he); + my $wib = $wia*8; + my $dif = $wib-$wi; + foreach my $y (0..$sqw-1) { vec($s, $wib-1-$dif-$_+$wib*$y, 1) = 0x0 foreach (0..$sqw-1) } + foreach my $y (0..$sqw-1) { vec($s, (($he-1)*$wib)-$wib*$y+$_, 1) = 0x0 foreach (0..$sqw-1) } + $w->realize; + my $b = Gtk::Gdk::Bitmap->create_from_data($w->window, $s, $wib, $he); + $w->window->shape_combine_mask($b, 0, 0); + }) if ($my_gtk::force_center || $o->{force_center}) && !($my_gtk::force_position || $o->{force_position}) ; $o->{window} = $f; $o->{rwindow} = $w; - $f_->draw(undef); + $table->draw(undef); } my ($next_child, $left, $right, $up, $down); |