From 3cf33eab50fd8e7eb927c617986f62938e0485a1 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Fri, 1 Oct 1999 15:57:39 +0000 Subject: *** empty log message *** --- perl-install/Xconfig.pm | 55 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 19 deletions(-) (limited to 'perl-install/Xconfig.pm') diff --git a/perl-install/Xconfig.pm b/perl-install/Xconfig.pm index 9d01673b9..6158873df 100644 --- a/perl-install/Xconfig.pm +++ b/perl-install/Xconfig.pm @@ -1,7 +1,11 @@ package Xconfig; +use diagnostics; +use strict; + use common qw(:common :file :system); use mouse; +use Xconfigurator; # otherwise uses the rule substr($keymap, 0, 2) my %keymap_translate = ( @@ -31,44 +35,56 @@ sub getinfo { sub getinfoFromXF86Config { my $o = shift || {}; - my (%c, $depth); + my $prefix = shift || ""; + my (%c, $depth, $driver); - $o->{card}{server} ||= $1 if readlink("/etc/X11/X") =~ /XF86_ (\w+)$/x; #- /x for perl2fcalls + $o->{card}{server} ||= $1 if readlink("$prefix/etc/X11/X") =~ /XF86_ (\w+)$/x; #- /x for perl2fcalls local *F; - open F, "/etc/X11/XF86Config" or return {}; + open F, "$prefix/etc/X11/XF86Config" or return {}; foreach () { if (/^Section "Keyboard"/ .. /^EndSection/) { + $o->{keyboard}{altmeta} ||= ($1 eq "ModeShift" ? 1 : 0) if /^\s*RightAlt\s+"(.*?)"/; $o->{keyboard}{xkb_keymap} ||= $1 if /^\s*XkbLayout\s+"(.*?)"/; } elsif (/^Section "Pointer"/ .. /^EndSection/) { $o->{mouse}{XMOUSETYPE} ||= $1 if /^\s*Protocol\s+"(.*?)"/; $o->{mouse}{device} ||= $1 if m|^\s*Device\s+"/dev/(.*?)"|; + $o->{mouse}{XEMU3} ||= 1 if m/^\s*Emulate3Buttons\s+/; + $o->{mouse}{cleardtrrts} ||= 1 if m/^\s*ClearDTR\s+/; + $o->{mouse}{cleardtrrts} ||= 1 if m/^\s*ClearRTS\s+/; } elsif (my $i = /^Section "Device"/ .. /^EndSection/) { - if ($i = 1 && $c{type} && $c{type} ne "Generic VGA") { - add2hash($o->{card} ||= {}, \%c); - %c = (); - } + %c = () if $i == 1; + $c{type} ||= $1 if /^\s*Identifier\s+"(.*?)"/; - $c{memory} ||= $1 if /^\s*VideoRam\s+(\d+)/; + $c{memory} ||= $1 if /VideoRam\s+(\d+)/; + $c{flags}{needVideoRam} ||= 1 if /^\s*VideoRam\s+/; $c{vendor} ||= $1 if /^\s*VendorName\s+"(.*?)"/; $c{board} ||= $1 if /^\s*BoardName\s+"(.*?)"/; + #- clockchip, ramdac, dacspeed read with following line. push @{$c{lines}}, $_ unless /(Section|Identifier|VideoRam|VendorName|BoardName)/; + + add2hash($o->{card} ||= {}, \%c) if ($i =~ /E0/ && $c{type} && $c{type} ne "Generic VGA"); } elsif (/^Section "Monitor"/ .. /^EndSection/) { $o->{monitor}{type} ||= $1 if /^\s*Identifier\s+"(.*?)"/; $o->{monitor}{hsyncrange} ||= $1 if /^\s*HorizSync\s+(.*)/; $o->{monitor}{vsyncrange} ||= $1 if /^\s*VertRefresh\s+(.*)/; $o->{monitor}{vendor} ||= $1 if /^\s*VendorName\s+"(.*?)"/; $o->{monitor}{model} ||= $1 if /^\s*ModelName\s+"(.*?)"/; - } elsif (/^Section "Screen"/ .. /^EndSection/) { - $o->{card}{default_depth} ||= $1 if /^\s*DefaultColorDepth\s+(\d+)/; - if (my $i = /^\s*Subsection\s+"Display"/ .. /^\s*EndSubsection/) { - $depth = undef if $i == 1; - $depth = $1 if /^\s*Depth\s+(\d*)/; - if (/^\s*Modes\s+(.*)/) { - my $a = 0; - push @{$o->{card}{depth}{$depth || 8}}, - grep { $_->[0] >= 640 } map { [ /"(\d+)x(\d+)"/ ] } split ' ', $1; + } elsif (my $s = /^Section "Screen"/ .. /^EndSection/) { + $driver = undef if $s == 1; + $driver = $1 if /^\s*Driver\s+"(.*?)"/; + print "($driver eq $Xconfigurator::serversdriver{$o->{card}{server}})"; + if ($driver eq $Xconfigurator::serversdriver{$o->{card}{server}}) { #- take into account the right screen section for the server. + $o->{card}{default_depth} ||= $1 if /^\s*DefaultColorDepth\s+(\d+)/; + if (my $i = /^\s*Subsection\s+"Display"/ .. /^\s*EndSubsection/) { + $depth = undef if $i == 1; + $depth = $1 if /^\s*Depth\s+(\d*)/; + if (/^\s*Modes\s+(.*)/) { + my $a = 0; + push @{$o->{card}{depth}{$depth || 8}}, + grep { $_->[0] >= 640 } map { [ /"(\d+)x(\d+)"/ ] } split ' ', $1; + } } } } @@ -78,10 +94,11 @@ sub getinfoFromXF86Config { sub getinfoFromSysconfig { my $o = shift || {}; + my $prefix = shift || ""; - add2hash($o->{mouse} ||= {}, { getVarsFromSh("/etc/sysconfig/mouse") }); + add2hash($o->{mouse} ||= {}, { getVarsFromSh("$prefix/etc/sysconfig/mouse") }); - if (my %keyboard = getVarsFromSh "/etc/sysconfig/keyboard") { + if (my %keyboard = getVarsFromSh "$prefix/etc/sysconfig/keyboard") { $keyboard{KEYTABLE} or last; $o->{keyboard}{xkb_keymap} ||= keymap_translate($keyboard{KEYTABLE}); } -- cgit v1.2.1