summaryrefslogtreecommitdiffstats
path: root/tools/mousedrake
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-04-25 10:05:59 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-04-25 10:05:59 +0000
commit640a9bd39fb2c39a63acc99949c2a2fe22002517 (patch)
tree49633b9ce5c2d67c8ff62c9e225cb29279d8fa92 /tools/mousedrake
parent314f08b696db419329be0d90e89163792dd64508 (diff)
downloaddrakx-kbd-mouse-x11-640a9bd39fb2c39a63acc99949c2a2fe22002517.tar
drakx-kbd-mouse-x11-640a9bd39fb2c39a63acc99949c2a2fe22002517.tar.gz
drakx-kbd-mouse-x11-640a9bd39fb2c39a63acc99949c2a2fe22002517.tar.bz2
drakx-kbd-mouse-x11-640a9bd39fb2c39a63acc99949c2a2fe22002517.tar.xz
drakx-kbd-mouse-x11-640a9bd39fb2c39a63acc99949c2a2fe22002517.zip
re-sync after the big svn loss
Diffstat (limited to 'tools/mousedrake')
-rwxr-xr-xtools/mousedrake74
1 files changed, 74 insertions, 0 deletions
diff --git a/tools/mousedrake b/tools/mousedrake
new file mode 100755
index 0000000..2f6d0dd
--- /dev/null
+++ b/tools/mousedrake
@@ -0,0 +1,74 @@
+#!/usr/bin/perl
+
+use lib qw(/usr/lib/libDrakX);
+
+use standalone; #- warning, standalone must be loaded very first, for 'explanations'
+
+use common;
+use interactive;
+use modules;
+use mouse;
+use c;
+
+
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/mousedrake-mdk.png";
+my $in = 'interactive'->vnew('su');
+
+my $modules_conf = modules::any_conf->read;
+
+begin:
+my $mouse = mouse::read();
+my %old = %$mouse;
+
+if (!$::noauto) {
+ my $probed_mouse = mouse::detect($modules_conf);
+ $mouse = $probed_mouse if !$mouse->{XMOUSETYPE} || !$probed_mouse->{unsafe};
+}
+
+if (!$mouse || !$::auto) {
+ $mouse ||= mouse::fullname2mouse("serial|Generic 2 Button Mouse");
+ my $test_hbox;
+ my $name = $in->ask_from_treelistf('mousedrake', N("Please choose your mouse type."), '|',
+ sub { join '|', map { translate($_) } split '\|', $_[0] },
+ [ mouse::fullnames() ],
+ $mouse->{type} . '|' . $mouse->{name});
+ $name or $in->exit(0);
+ my $mouse_chosen = mouse::fullname2mouse($name);
+ $mouse = $mouse_chosen if !($mouse->{type} eq $mouse_chosen->{type} && $mouse->{name} eq $mouse_chosen->{name});
+
+ if ($mouse->{device} eq "usbmouse") {
+ modules::load_category($modules_conf, 'bus/usb') or die 'no usb bus found\n';
+ modules::load(qw(hid mousedev usbmouse));
+ }
+
+ $mouse->{XEMU3} = 'yes' if $mouse->{nbuttons} < 3 && (!$::noauto || $in->ask_yesorno('', N("Emulate third button?"), 1));
+
+ $mouse->{device} = $in->ask_from_listf(N("Mouse Port"),
+ N("Please choose which serial port your mouse is connected to."),
+ \&mouse::serial_port2text,
+ [ mouse::serial_ports ],
+ $mouse->{device},
+ ) || goto begin if $mouse->{type} eq 'serial';
+ $test_hbox and $test_hbox->destroy;
+}
+
+mouse::write_conf($in->do_pkgs, $modules_conf, $mouse, 1);
+
+if ($in->isa('interactive::gtk') && mouse::change_mouse_live($mouse, \%old)) {
+
+ require ugtk2;
+ ugtk2->import(qw(:wrappers :create));
+ my $w = ugtk2->new(N("Mouse test"));
+ gtkadd($w->{window},
+ gtkpack(Gtk2::VBox->new(0, 5),
+ Gtk2::Label->new(N("Please test your mouse:")),
+ my $test_hbox = Gtk2::HBox->new(0, 5),
+ $w->create_okcancel));
+ mouse::test_mouse_standalone($mouse, $test_hbox);
+ $w->main or goto begin;
+}
+
+system('service', 'gpm', 'restart') if -e '/var/lock/subsys/gpm';
+
+$in->exit(0);
+goto begin;