From a1c30874dd79d9b39590180e3eb63b64a9e424ac Mon Sep 17 00:00:00 2001 From: damien Date: Tue, 11 Sep 2001 13:16:18 +0000 Subject: fear the shaped windows... --- perl-install/interactive_gtk.pm | 4 ++-- perl-install/my_gtk.pm | 44 ++++++++++++++++++++++++++++++++++------- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm index c3a9c1cc9..e4d42daa7 100644 --- a/perl-install/interactive_gtk.pm +++ b/perl-install/interactive_gtk.pm @@ -528,8 +528,8 @@ sub ask_fromW { $pack->pack_start($advanced_pack, 1, 1, 0); gtkadd($mainw->{window}, $pack); if (!$::isEmbedded && !$::isWizard || $my_gtk::pop_it) { - $mainw->{rwindow}->set_default_size($mainw->{box_width}, $mainw->{box_height}) if $has_scroll; - $mainw->{rwindow}->set_default_size($mainw->{box_width}, 0) if $has_horiz_scroll; + $mainw->{rwindow}->set_default_size($mainw->{box_width}+6+$my_gtk::shape_width, $mainw->{box_height}+6+3+$my_gtk::shape_width) if $has_scroll; + $mainw->{rwindow}->set_default_size($mainw->{box_width}+6+$my_gtk::shape_width, 0) if $has_horiz_scroll; } $set_advanced->(0); (@widgets ? $widgets[0]{focus_w} : $common->{focus_cancel} ? $mainw->{cancel} : $mainw->{ok})->grab_focus(); 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); -- cgit v1.2.1