summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@mandriva.com>2000-11-24 14:53:35 +0000
committerdamien <damien@mandriva.com>2000-11-24 14:53:35 +0000
commit05a818f3dd3295a90d9457576c60ae3cce1f0545 (patch)
tree1d49f7a22130848e832dc6d1104aca155fa8c40a
parentee88006a37dcc52504252ca91ef1789a509e1e20 (diff)
downloaddrakx-05a818f3dd3295a90d9457576c60ae3cce1f0545.tar
drakx-05a818f3dd3295a90d9457576c60ae3cce1f0545.tar.gz
drakx-05a818f3dd3295a90d9457576c60ae3cce1f0545.tar.bz2
drakx-05a818f3dd3295a90d9457576c60ae3cce1f0545.tar.xz
drakx-05a818f3dd3295a90d9457576c60ae3cce1f0545.zip
doc + split
-rw-r--r--perl-install/mouse.pm45
1 files changed, 45 insertions, 0 deletions
diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm
index 246bcef03..e6c6f3cc8 100644
--- a/perl-install/mouse.pm
+++ b/perl-install/mouse.pm
@@ -238,3 +238,48 @@ sub detect() {
#- Oops? using return let return a hash ref, if not using it, it return a list directly :-)
return fullname2mouse("serial|Generic 2 Button Mouse", unsafe => 1);
}
+
+#- write_conf : write the mouse infos into the Xconfig files.
+#- input :
+#- $mouse : the hashtable containing the informations
+#- $mouse input
+#- $mouse->{nbuttons} : number of buttons : integer
+#- $mouse->{device} : device of the mouse : string : ex 'psaux'
+#- $mouse->{XMOUSETYPE} : type of the mouse for gpm : string : ex 'PS/2'
+#- $mouse->{type} : type (generic ?) of the mouse : string : ex 'PS/2'
+#- $mouse->{name} : name of the mouse : string : ex 'Standard'
+#- $mouse->{MOUSETYPE} : type of the mouse : string : ex "ps/2"
+#- $mouse->{XEMU3} : emulate 3rd button : string : 'yes' or 'no'
+sub write_conf {
+ my ($mouse) = @_;
+
+ mouse::write('', $mouse);
+ modules::write_conf('') if $mouse->{device} eq "usbmouse" && !$::testing;
+
+ 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;
+}