diff options
author | Francois Pons <fpons@mandriva.com> | 2001-03-28 14:19:05 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2001-03-28 14:19:05 +0000 |
commit | 6b8801f914e374526c14a0c580439a876d95f879 (patch) | |
tree | 4e6f1afb887ef956071a119cd08ef54f1cde8e6e /perl-install/mouse.pm | |
parent | a106f867e163279d4b5564be72bea3427c37345c (diff) | |
download | drakx-6b8801f914e374526c14a0c580439a876d95f879.tar drakx-6b8801f914e374526c14a0c580439a876d95f879.tar.gz drakx-6b8801f914e374526c14a0c580439a876d95f879.tar.bz2 drakx-6b8801f914e374526c14a0c580439a876d95f879.tar.xz drakx-6b8801f914e374526c14a0c580439a876d95f879.zip |
fixed for standalone XFdrake and mousedrake (multi-mouse and
correct probe (USB)).
Diffstat (limited to 'perl-install/mouse.pm')
-rw-r--r-- | perl-install/mouse.pm | 60 |
1 files changed, 37 insertions, 23 deletions
diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm index 0a09d0ae9..3c79e9a51 100644 --- a/perl-install/mouse.pm +++ b/perl-install/mouse.pm @@ -287,27 +287,41 @@ sub write_conf { my $f = "/etc/X11/XF86Config"; my $g = "/etc/X11/XF86Config-4"; - my @zaxis = ( - $mouse->{nbuttons} > 3 ? [ "ZAxisMapping", "4 5" ] : (), - $mouse->{nbuttons} > 5 ? [ "ZAxisMapping", "6 7" ] : (), - $mouse->{nbuttons} < 3 ? ([ "Emulate3Buttons" ], [ "Emulate3Timeout", "50" ]) : () - ); - - my $zaxis = join('', map { qq(\n $_->[0]) . ($_->[1] && qq( $_->[1])) } @zaxis); - substInFile { - if (/^Section\s+"Pointer"/ .. /^EndSection/) { - $_ = '' if /(ZAxisMapping|Emulate3)/; #- remove existing line - s|^(\s*Protocol\s+).*|$1"$mouse->{XMOUSETYPE}"|; - s|^(\s*Device\s+).*|$1"/dev/mouse"$zaxis|; - } - } $f if -e $f && !$::testing; - - $zaxis = join('', map { qq(\n Option "$_->[0]") . ($_->[1] && qq( "$_->[1]")) } @zaxis); - substInFile { - if (/Identifier\s+"Mouse1"/ .. /^EndSection/) { - $_ = '' if /(ZAxisMapping|Emulate3)/; #- remove existing line - s|^(\s*Option\s+"Protocol"\s+).*|$1"$mouse->{XMOUSETYPE}"|; - s|^(\s*Option\s+"Device"\s+).*|$1"/dev/mouse"$zaxis|; - } - } $g if -e $g && !$::testing; + my $update_mouse = sub { + my ($mouse, $id) = @_; + + my @zaxis = ( + $mouse->{nbuttons} > 3 ? [ "ZAxisMapping", "4 5" ] : (), + $mouse->{nbuttons} > 5 ? [ "ZAxisMapping", "6 7" ] : (), + $mouse->{nbuttons} < 3 ? ([ "Emulate3Buttons" ], [ "Emulate3Timeout", "50" ]) : () + ); + + my $zaxis = join('', map { qq(\n $_->[0]) . ($_->[1] && qq( $_->[1])) } @zaxis); + substInFile { + if ($id > 1) { + if (/^DeviceName\s+"Mouse$id"/ .. /^EndSection/) { + $_ = '' if /(ZAxisMapping|Emulate3)/; #- remove existing line + s|^(\s*Protocol\s+).*|$1"$mouse->{XMOUSETYPE}"|; + s|^(\s*Device\s+).*|$1"/dev/mouse"$zaxis|; + } + } else { + if (/^Section\s+"Pointer"/ .. /^EndSection/) { + $_ = '' if /(ZAxisMapping|Emulate3)/; #- remove existing line + s|^(\s*Protocol\s+).*|$1"$mouse->{XMOUSETYPE}"|; + s|^(\s*Device\s+).*|$1"/dev/mouse"$zaxis|; + } + } + } $f if -e $f && !$::testing; + + $zaxis = join('', map { qq(\n Option "$_->[0]") . ($_->[1] && qq( "$_->[1]")) } @zaxis); + substInFile { + if (/Identifier\s+"Mouse$id"/ .. /^EndSection/) { + $_ = '' if /(ZAxisMapping|Emulate3)/; #- remove existing line + s|^(\s*Option\s+"Protocol"\s+).*|$1"$mouse->{XMOUSETYPE}"|; + s|^(\s*Option\s+"Device"\s+).*|$1"/dev/mouse"$zaxis|; + } + } $g if -e $g && !$::testing; + }; + $update_mouse->($mouse, 1); + $mouse->{auxmouse} and $update_mouse->($mouse->{auxmouse}, 2); } |