From 26b59c16c5bed325be76f77f438f47518a2d1b7a Mon Sep 17 00:00:00 2001 From: damien Date: Mon, 10 Sep 2001 18:04:10 +0000 Subject: don't fork the code --- perl-install/standalone/mousedrake | 76 +------------------------------------- 1 file changed, 1 insertion(+), 75 deletions(-) (limited to 'perl-install/standalone/mousedrake') diff --git a/perl-install/standalone/mousedrake b/perl-install/standalone/mousedrake index 9af8479c7..177f7489a 100755 --- a/perl-install/standalone/mousedrake +++ b/perl-install/standalone/mousedrake @@ -41,7 +41,7 @@ if (!$mouse || !$::auto) { require my_gtk; my $time_tag = Gtk->timeout_add(100, sub { defined $::Plug && defined $::Plug->child or return 1; - test_mouse($mouse,$::Plug->child); + mouse::test_mouse_standalone($mouse,$::Plug->child); 0; }); } @@ -74,77 +74,3 @@ mouse::write_conf($mouse); $::isEmbedded ? kill(USR1, $::CCPID) : $in->exit(0); goto begin; - -sub test_mouse { - my ($mouse, $hbox) = @_; - - my ($width, $height, $offset) = (210, round_up(min(350, $::windowheight - 150), 6), 25); - - my $darea = new Gtk::DrawingArea; - $darea->set_events([ 'button_press_mask', 'button_release_mask' ]); #$darea must be unrealized. - my_gtk::gtkpack($hbox, my_gtk::gtkset_border_width(my_gtk::gtkpack(new Gtk::VBox(0,10), my_gtk::gtksize(my_gtk::gtkset_usize($darea, $width+1, $height+1), $width, $height)),10)); - - - my ($m3_image, $m3_mask) = my_gtk::gtkcreate_xpm($darea, 'mouse_3b.xpm'); - my ($m3_imagep, $m3_maskp) = my_gtk::gtkcreate_xpm($darea, 'mouse_3b+.xpm'); - my ($m3_left, $m3_left_mask) = my_gtk::gtkcreate_xpm($darea, 'mouse_left.xpm'); - my ($m3_right, $m3_right_mask) = my_gtk::gtkcreate_xpm($darea, 'mouse_right.xpm'); - my ($m3_middle, $m3_middle_mask) = my_gtk::gtkcreate_xpm($darea, 'mouse_middle.xpm'); - my $image = $m3_image; - $mouse->{nbuttons} > 3 and $image = $m3_imagep; - my $drawarea; $drawarea = sub { $darea->window->draw_pixmap ($darea->style->bg_gc('normal'), - $image, 0, 0, - ($darea->allocation->[2]-$width)/2, ($darea->allocation->[3]-$height)/2, - 210, 350) - }; - - my $paintButton = sub { - my ($nb, $pressed) = @_; - my $x = 60 + $nb*33; - $drawarea->(); - if ($nb == 0) { - $darea->window->draw_pixmap ($darea->style->bg_gc('normal'), - $m3_left, 0, 0, - ($darea->allocation->[2]-$width)/2+31, ($darea->allocation->[3]-$height)/2 + 52, - 59, 91); - } elsif ($nb == 2) { - $darea->window->draw_pixmap ($darea->style->bg_gc('normal'), - $m3_right, 0, 0, - ($darea->allocation->[2]-$width)/2+117, ($darea->allocation->[3]-$height)/2 + 52, - 61, 91); - } elsif ($nb == 1) { - if($mouse->{nbuttons} > 3) { - $darea->window->draw_pixmap ($darea->style->bg_gc('normal'), - $m3_middle, 0, 0, - ($darea->allocation->[2]-$width)/2+98, ($darea->allocation->[3]-$height)/2 + 67, - 13, 62); - } else { - $darea->window->draw_arc ( $darea->style->black_gc, - 1, ($darea->allocation->[2]-$width)/2 + $x, ($darea->allocation->[3]-$height)/2 + 90, 20, 25, - 0, 360*64); - } - } elsif ($nb == 4) { - $darea->window->draw_pixmap ($darea->style->bg_gc('normal'), - $m3_middle, 0, 0, - ($darea->allocation->[2]-$width)/2+98, ($darea->allocation->[3]-$height)/2 + 67, - 13, 62) - } elsif ($nb == 5) { - $darea->window->draw_pixmap ($darea->style->bg_gc('normal'), - $m3_middle, 0, 0, - ($darea->allocation->[2]-$width)/2+98, ($darea->allocation->[3]-$height)/2 + 67, - 13, 62) - } - }; - $darea->signal_connect(button_press_event => sub { - my $b = $_[1]{button}; - $time = $default_time; - $b >= 4 ? - $paintWheel->($b == 4 ? -1 : 1) : - $paintButton->($b - 1); - $expose2 = 0; - }); - $darea->signal_connect(button_release_event => sub { - $drawarea->() - }); - $darea->signal_connect(expose_event => sub { $drawarea->() }); -} -- cgit v1.2.1