summaryrefslogtreecommitdiffstats
path: root/perl-install/Xconfig
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/Xconfig')
-rw-r--r--perl-install/Xconfig/FILES14
-rw-r--r--perl-install/Xconfig/card.pm184
-rw-r--r--perl-install/Xconfig/default.pm2
-rw-r--r--perl-install/Xconfig/main.pm21
-rw-r--r--perl-install/Xconfig/resolution_and_depth.pm25
-rw-r--r--perl-install/Xconfig/screen.pm25
-rw-r--r--perl-install/Xconfig/test.pm32
-rw-r--r--perl-install/Xconfig/various.pm28
-rw-r--r--perl-install/Xconfig/xfree.pm517
-rw-r--r--perl-install/Xconfig/xfree3.pm281
-rw-r--r--perl-install/Xconfig/xfree4.pm165
-rw-r--r--perl-install/Xconfig/xfreeX.pm357
12 files changed, 512 insertions, 1139 deletions
diff --git a/perl-install/Xconfig/FILES b/perl-install/Xconfig/FILES
index deefdedec..f6352dedf 100644
--- a/perl-install/Xconfig/FILES
+++ b/perl-install/Xconfig/FILES
@@ -1,8 +1,6 @@
-
- xfree3
- / \
-parse - -- xfreeX -- xfree ---- default ------------------ main
- \ / \--- card -------------------/ test
- xfree4 \-- monitor ---------------/ various
- \- screen ---------------/ proprietary
- \ resolution_and_depth-/
+
+parse --- xfree ---- default ------------------ main
+ \--- card -------------------/ test
+ \-- monitor ---------------/ various
+ \- screen ---------------/ proprietary
+ \ resolution_and_depth-/
diff --git a/perl-install/Xconfig/card.pm b/perl-install/Xconfig/card.pm
index f7ed0fe8c..2cb8dc1f6 100644
--- a/perl-install/Xconfig/card.pm
+++ b/perl-install/Xconfig/card.pm
@@ -9,9 +9,6 @@ use common;
use log;
-my $force_xf4 = 1;
-
-
my %VideoRams = (
256 => N_("256 kB"),
512 => N_("512 kB"),
@@ -24,74 +21,22 @@ my %VideoRams = (
65536 => N_("64 MB or more"),
);
-our %serversdriver = arch() =~ /^sparc/ ? (
- 'Mach64' => "accel",
- '3DLabs' => "accel",
- 'Sun' => "fbdev",
- 'Sun24' => "fbdev",
- 'SunMono' => "fbdev",
- 'VGA16' => "vga16",
- 'FBDev' => "fbdev",
-) : (
- 'SVGA' => "svga",
- 'S3' => "accel",
- 'Mach32' => "accel",
- 'Mach8' => "accel",
- '8514' => "accel",
- 'P9000' => "accel",
- 'AGX' => "accel",
- 'W32' => "accel",
- 'Mach64' => "accel",
- 'I128' => "accel",
- 'S3V' => "accel",
- '3DLabs' => "accel",
- 'VGA16' => "vga16",
- 'FBDev' => "fbdev",
-);
-my @allbutfbservers = grep { arch() =~ /^sparc/ || $serversdriver{$_} ne "fbdev" } keys(%serversdriver);
-my @allservers = keys(%serversdriver);
-
my @xfree4_Drivers = ((arch() =~ /^sparc/ ? qw(sunbw2 suncg14 suncg3 suncg6 sunffb sunleo suntcx) :
qw(apm ark chips cirrus cyrix glide i128 i740 i810 imstt
mga neomagic newport nv rendition r128 radeon vesa
s3 s3virge savage siliconmotion sis tdfx tga trident tseng vmware)),
qw(ati glint vga fbdev));
-
-#- using XF4 if {Driver} && !{prefer_xf3} otherwise using XF3
-#- error if $force_xf4 && !{Driver} || !{Driver} && !{server}
-#- internal error if $force_xf4 && {prefer_xf3} || {prefer_xf3} && !{server}
-
-sub using_xf4 {
- my ($card) = @_;
- $card->{Driver} && !$card->{prefer_xf3};
-}
-
-sub server_binary {
- my ($card) = @_;
- "/usr/X11R6/bin/" .
- (using_xf4($card) ? 'XFree86' :
- $card->{server} =~ /Sun(.*)/ ? "Xsun$1" :
- $card->{server} eq 'Xpmac' ? 'Xpmac' :
- "XF86_$card->{server}");
-}
-
sub from_raw_X {
my ($raw_X) = @_;
my $device = $raw_X->get_device or die "no card configured";
- my ($xfree3_server) = readlink("$::prefix/etc/X11/X") =~ /XF86_(.*)/;
-
my $card = {
- use_UTAH_GLX => eval { any { /glx/ } $raw_X->{xfree3}->get_modules },
- use_DRI_GLX => eval { any { /dri/ } $raw_X->{xfree4}->get_modules },
- server => $xfree3_server,
- prefer_xf3 => $xfree3_server && !$force_xf4,
+ use_DRI_GLX => eval { any { /dri/ } $raw_X->get_modules },
%$device,
};
add_to_card__using_Cards($card, $card->{BoardName});
- $card->{prog} = server_binary($card);
$card;
}
@@ -106,23 +51,21 @@ sub to_raw_X {
$raw_X->set_devices($card, @{$card->{cards} || []});
- $raw_X->{xfree4}->get_ServerLayout->{Xinerama} = { commented => !$card->{Xinerama}, Option => 1 }
+ $raw_X->get_ServerLayout->{Xinerama} = { commented => !$card->{Xinerama}, Option => 1 }
if defined $card->{Xinerama};
- $raw_X->{xfree3}->set_load_module('glx-3.so', $card->{use_UTAH_GLX}); #- glx.so may clash with server version 4.
-
- $raw_X->{xfree4}->set_load_module('glx', !$card->{DRI_GLX_SPECIAL}); #- glx for everyone, except proprietary nvidia
- $raw_X->{xfree4}->set_load_module('dri', $card->{use_DRI_GLX} && !$card->{DRI_GLX_SPECIAL});
+ $raw_X->set_load_module('glx', !$card->{DRI_GLX_SPECIAL}); #- glx for everyone, except proprietary nvidia
+ $raw_X->set_load_module('dri', $card->{use_DRI_GLX} && !$card->{DRI_GLX_SPECIAL});
# This loads the NVIDIA GLX extension module.
# IT IS IMPORTANT TO KEEP NAME AS FULL PATH TO libglx.so ELSE
# IT WILL LOAD XFree86 glx module and the server will crash.
- $raw_X->{xfree4}->set_load_module('/usr/X11R6/lib/modules/extensions/libglx.so', $card->{DRI_GLX_SPECIAL});
+ $raw_X->set_load_module('/usr/X11R6/lib/modules/extensions/libglx.so', $card->{DRI_GLX_SPECIAL});
- $raw_X->{xfree4}->remove_Section('DRI');
- $raw_X->{xfree4}->add_Section('DRI', { Mode => { val => '0666' } }) if $card->{use_DRI_GLX};
+ $raw_X->remove_Section('DRI');
+ $raw_X->add_Section('DRI', { Mode => { val => '0666' } }) if $card->{use_DRI_GLX};
- $raw_X->{xfree4}->remove_load_module('v4l') if $card->{use_DRI_GLX} && $card->{Driver} eq 'r128';
+ $raw_X->remove_load_module('v4l') if $card->{use_DRI_GLX} && $card->{Driver} eq 'r128';
}
sub default_ATI_fglrx_config() { our $default_ATI_fglrx_config }
@@ -140,12 +83,11 @@ sub probe() {
BusID => "PCI:$_->{pci_bus}:$_->{pci_device}:$_->{pci_function}",
};
if ($_->{driver} =~ /Card:(.*)/) { $card->{BoardName} = $1; add_to_card__using_Cards($card, $1) }
- elsif ($_->{driver} =~ /Server:(.*)/) { $card->{server} = $1 }
elsif ($_->{driver} =~ /Driver:(.*)/) { $card->{Driver} = $1 }
else { internal_error() }
$_->{VideoRam} = 4096 if $_->{Driver} eq 'i810';
- $_->{Options_xfree4}{UseFBDev} = undef if arch() =~ /ppc/ && $_->{Driver} eq 'r128';
+ $_->{Options}{UseFBDev} = undef if arch() =~ /ppc/ && $_->{Driver} eq 'r128';
$card;
} @c;
@@ -199,11 +141,9 @@ sub card_config__not_listed {
);
my $cards = readCardsDB("$ENV{SHARE_PATH}/ldetect-lst/Cards+");
- my @xf3 = $options->{allowFB} ? @allservers : @allbutfbservers;
my @xf4 = grep { $options->{allowFB} || $_ ne 'fbdev' } @xfree4_Drivers;
my @list = (
(map { 'Vendor|' . $_ } keys %$cards),
- if_(!$force_xf4, map { 'XFree 3|' . $_ } @xf3),
(map { 'XFree 4|' . $_ } @xf4),
);
@@ -225,8 +165,6 @@ sub card_config__not_listed {
%$card = ();
if ($kind eq 'Vendor') {
add_to_card__using_Cards($card, $s);
- } elsif ($kind eq 'XFree 3') {
- $card->{server} = $s;
} else {
$card->{Driver} = $s;
}
@@ -257,15 +195,15 @@ sub configure_auto_install {
if ($card->{card_name}) {
#- try to get info from given card_name
add_to_card__using_Cards($card, $card->{card_name});
- undef $card->{card_name} if !$card->{server} && !$card->{Driver}; #- bad card_name as we can't find the server
+ undef $card->{card_name} if !$card->{Driver}; #- bad card_name as we can't find the driver
}
- return if $card->{server} || $card->{Driver};
+ return if $card->{Driver};
}
my @cards = probe();
my ($choice) = multi_head_choices($old_X->{Xinerama}, @cards);
my $card = $choice ? $choice->{code}() : do {
- log::l('no graphic card probed, try providing one using $o->{card}{Driver} or $o->{card}{server} or $o->{card}{card_name}. Defaulting...');
+ log::l('no graphic card probed, try providing one using $o->{card}{Driver} or $o->{card}{card_name}. Defaulting...');
{ Driver => ($options->{allowFB} ? 'fbdev' : 'vesa') };
};
@@ -274,7 +212,7 @@ sub configure_auto_install {
$glx_choice->{code}();
set_glx_restrictions($card);
- $card->{prog} = install_server($card, $options, $do_pkgs);
+ install_server($card, $options, $do_pkgs);
if ($card->{needVideoRam} && !$card->{VideoRam}) {
$card->{VideoRam} = $options->{VideoRam_probed} || 4096;
log::l("argh, I need to know VideoRam! Taking " . ($options->{probed_VideoRam} ? "the probed" : "a default") . " value: VideoRam = $card->{VideoRam}");
@@ -289,7 +227,7 @@ sub configure {
my @cards = probe();
@cards or @cards = {};
- if (!$cards[0]{server} && !$cards[0]{Driver}) {
+ if (!$cards[0]{Driver}) {
if ($options->{allowFB}) {
$cards[0]{Driver} = 'fbdev';
} elsif ($auto) {
@@ -306,12 +244,11 @@ sub configure {
xfree_and_glx_choose($in, $card, $auto) or return;
- eval {
- $card->{prog} = install_server($card, $options, $do_pkgs);
- } or do {
+ eval { install_server($card, $options, $do_pkgs) };
+ if ($@) {
$in->ask_warn('', N("Can't install XFree package: %s", $@));
goto card_config__not_listed;
- };
+ }
if ($card->{needVideoRam} && !$card->{VideoRam}) {
if ($auto) {
@@ -334,10 +271,10 @@ sub configure {
sub install_server {
my ($card, $_options, $do_pkgs) = @_;
- my $prog = server_binary($card);
+ my $prog = "$::prefix/usr/X11R6/bin/XFree86";
my @packages;
- push @packages, using_xf4($card) ? 'XFree86-server' : "XFree86-$card->{server}" if ! -x "$::prefix$prog";
+ push @packages, 'XFree86-server' if ! -x $prog;
#- additional packages to install according available card.
#- add XFree86-libs-DRI here if using DRI (future split of XFree86 TODO)
@@ -346,9 +283,6 @@ sub install_server {
push @packages, 'Glide_V3-DRI' if member($card->{card_name}, 'Voodoo3 (generic)', 'Voodoo Banshee (generic)');
push @packages, 'XFree86-glide-module' if $card->{card_name} =~ /Voodoo/;
}
- if ($card->{use_UTAH_GLX}) {
- push @packages, 'Mesa';
- }
my %proprietary_Driver2 = (
nvidia => [ 'NVIDIA_kernel', 'NVIDIA_GLX' ], #- using NVIDIA driver (TNT, TN2 and GeForce cards only).
@@ -361,7 +295,7 @@ sub install_server {
}
$do_pkgs->install(@packages) if @packages;
- -x "$::prefix$prog" or die "server $card->{server} is not available (should be in $::prefix$prog)";
+ -x $prog or die "server not available (should be in $prog)";
#- make sure everything is correct at this point, packages have really been installed
#- and driver and GLX extension is present.
@@ -371,7 +305,7 @@ sub install_server {
log::l("Using specific NVIDIA driver and GLX extensions");
$card->{Driver} = 'nvidia';
$card->{DRI_GLX_SPECIAL} = 1;
- $card->{Options_xfree4}{IgnoreEDID} = 1;
+ $card->{Options}{IgnoreEDID} = 1;
}
if ($card->{Driver2} eq 'fglrx' &&
-e "$::prefix/usr/X11R6/lib/modules/dri/fglrx_dri.so" &&
@@ -384,8 +318,6 @@ sub install_server {
require Xconfig::proprietary;
Xconfig::proprietary::install_matrox_hal($::prefix);
}
-
- $prog;
}
sub xfree_and_glx_choose {
@@ -425,7 +357,6 @@ sub multi_head_choices {
map_index { { Screen => $::i, %$_ } } ($_) x ($_->{MULTI_HEAD} || 1);
} @cards;
- delete $_->{server} foreach @cards; #- XFree 3 doesn't handle multi head (?)
my $card = shift @cards; #- assume good default.
$card->{cards} = \@cards;
$card->{Xinerama} = $_[0];
@@ -445,53 +376,19 @@ sub multi_head_choices {
#- XFree version available, it would be better to parse available package and get version from it.
sub xfree4_version() { '4.3' }
-sub xfree3_version() { '3.3.6' }
sub xfree_and_glx_choices {
my ($card) = @_;
- my $xf3 = if_($card->{server} && !$force_xf4,
- { text => N("XFree %s", xfree3_version()), code => sub { $card->{prefer_xf3} = 1 } });
- my $xf4 = if_($card->{Driver},
- { text => N("XFree %s", xfree4_version()), code => sub { $card->{prefer_xf3} = 0 } });
-
- #- no XFree3 with multi-head
- my @choices = grep { $_ } ($card->{cards} ? $xf4 : $card->{prefer_xf3} ? ($xf3, $xf4) : ($xf4, $xf3));
+ my @choices = if_($card->{Driver}, { text => N("XFree %s", xfree4_version()), code => sub {} });
#- no GLX with Xinerama
return @choices if $card->{Xinerama};
- #- try to figure if 3D acceleration is supported
- #- by XFree 3.3 but not XFree 4 then ask user to keep XFree 3.3 ?
- if ($card->{UTAH_GLX} && !$force_xf4) {
- my $e = { text => N("XFree %s with 3D hardware acceleration", xfree3_version()),
- code => sub { $card->{prefer_xf3} = 1; $card->{use_UTAH_GLX} = 1 },
- more_messages => ($card->{Driver} && !$card->{DRI_GLX} ?
-N("Your card can have 3D hardware acceleration support but only with XFree %s.
-Your card is supported by XFree %s which may have a better support in 2D.", xfree3_version(), xfree4_version()) :
-N("Your card can have 3D hardware acceleration support with XFree %s.", xfree3_version())),
- };
- $card->{prefer_xf3} ? unshift(@choices, $e) : push(@choices, $e);
- }
-
- #- an expert user may want to try to use an EXPERIMENTAL 3D acceleration, currenlty
- #- this is with Utah GLX and so, it can provide a way of testing.
- if ($card->{UTAH_GLX_EXPERIMENTAL} && $::expert && !$force_xf4) {
- push @choices, { text => N("XFree %s with EXPERIMENTAL 3D hardware acceleration", xfree3_version()),
- code => sub { $card->{prefer_xf3} = 1; $card->{use_UTAH_GLX} = 1 },
- more_messages => (using_xf4($card) && !$card->{DRI_GLX} ?
-N("Your card can have 3D hardware acceleration support but only with XFree %s,
-NOTE THIS IS EXPERIMENTAL SUPPORT AND MAY FREEZE YOUR COMPUTER.
-Your card is supported by XFree %s which may have a better support in 2D.", xfree3_version(), xfree4_version()) :
-N("Your card can have 3D hardware acceleration support with XFree %s,
-NOTE THIS IS EXPERIMENTAL SUPPORT AND MAY FREEZE YOUR COMPUTER.", xfree3_version())),
- };
- }
-
#- ask the expert or any user on second pass user to enable or not hardware acceleration support.
if ($card->{DRI_GLX}) {
unshift @choices, { text => N("XFree %s with 3D hardware acceleration", xfree4_version()),
- code => sub { $card->{prefer_xf3} = 0; $card->{use_DRI_GLX} = 1 },
+ code => sub { $card->{use_DRI_GLX} = 1 },
more_messages => N("Your card can have 3D hardware acceleration support with XFree %s.", xfree4_version()),
};
}
@@ -499,36 +396,17 @@ NOTE THIS IS EXPERIMENTAL SUPPORT AND MAY FREEZE YOUR COMPUTER.", xfree3_version
#- an expert user may want to try to use an EXPERIMENTAL 3D acceleration.
if ($card->{DRI_GLX_EXPERIMENTAL} && $::expert) {
push @choices, { text => N("XFree %s with EXPERIMENTAL 3D hardware acceleration", xfree4_version()),
- code => sub { $card->{prefer_xf3} = 0; $card->{use_DRI_GLX} = 1 },
+ code => sub { $card->{use_DRI_GLX} = 1 },
more_messages => N("Your card can have 3D hardware acceleration support with XFree %s,
NOTE THIS IS EXPERIMENTAL SUPPORT AND MAY FREEZE YOUR COMPUTER.", xfree4_version()),
};
}
-
- if (arch() =~ /ppc/ && $ENV{DISPLAY}) {
- push @choices, { text => N("Xpmac (installation display driver)"), code => sub {
- #- HACK: re-allowing XFree 3
- $force_xf4 = 0;
- $card->{server} = "Xpmac";
- $card->{prefer_xf3} = 1;
- } };
- }
@choices;
}
sub set_glx_restrictions {
my ($card) = @_;
- #- hack for ATI Mach64 cards where two options should be used if using Utah-GLX.
- if (member($card->{card_name}, 'ATI Mach64 Utah', 'ATI Rage Mobility')) {
- $card->{Options_xfree3}{no_font_cache} = undef if $card->{use_UTAH_GLX};
- $card->{Options_xfree3}{no_pixmap_cache} = undef if $card->{use_UTAH_GLX};
- }
- #- hack for SiS cards where an option should be used if using Utah-GLX.
- if (member($card->{card_name}, 'SiS 6326', 'SiS 630')) {
- $card->{Options_xfree3}{no_pixmap_cache} = undef if $card->{use_UTAH_GLX};
- }
-
#- 3D acceleration configuration for XFree 4 using DRI, this is enabled by default
#- but for some there is a need to specify VideoRam (else it won't run).
if ($card->{use_DRI_GLX}) {
@@ -539,7 +417,7 @@ sub set_glx_restrictions {
#- hack for ATI Rage 128 card using a bttv or peripheral with PCI bus mastering exchange
#- AND using DRI at the same time.
if (member($card->{card_name}, 'ATI Rage 128', 'ATI Rage 128 TVout', 'ATI Rage 128 Mobility')) {
- $card->{Options_xfree4}{UseCCEFor2D} = bool2text(modules::probe_category('multimedia/tv'));
+ $card->{Options}{UseCCEFor2D} = bool2text(modules::probe_category('multimedia/tv'));
}
}
@@ -557,21 +435,15 @@ sub add_to_card__using_Cards {
add2hash($card, $cards->{$name});
$card->{BoardName} = $card->{card_name};
- delete @$card{'server'} if $force_xf4;
-
- delete @$card{'UTAH_GLX', 'UTAH_GLX_EXPERIMENTAL'}
- if $force_xf4 || availableRamMB() > 800; #- no Utah GLX if more than 800 Mb (server, or kernel-enterprise, Utha GLX does not work with latest).
-
$card;
}
#- needed for bad cards not restoring cleanly framebuffer, according to which version of XFree are used.
sub check_bad_card {
my ($card) = @_;
- my $bad_card = using_xf4($card) ? $card->{BAD_FB_RESTORE} : $card->{BAD_FB_RESTORE_XF3};
+ my $bad_card = $card->{BAD_FB_RESTORE};
$bad_card ||= $card->{Driver} eq 'i810' || $card->{Driver} eq 'fbdev';
$bad_card ||= member($card->{Driver}, 'nvidia', 'vmware') if !$::isStandalone; #- avoid testing during install at any price.
- $bad_card ||= $card->{server} =~ /FBDev|Sun/ if !using_xf4($card);
log::l("the graphics card does not like X in framebuffer") if $bad_card;
@@ -596,17 +468,13 @@ sub readCardsDB {
},
LINE => sub { $val =~ s/^\s*//; $card->{raw_LINES} .= "$val\n" },
CHIPSET => sub { $card->{Chipset} = $val },
- SERVER => sub { $card->{server} = $val },
DRIVER => sub { $card->{Driver} = $val },
DRIVER2 => sub { $card->{Driver2} = $val },
NEEDVIDEORAM => sub { $card->{needVideoRam} = 1 },
DRI_GLX => sub { $card->{DRI_GLX} = 1 if $card->{Driver} },
- UTAH_GLX => sub { $card->{UTAH_GLX} = 1 if $card->{server} },
DRI_GLX_EXPERIMENTAL => sub { $card->{DRI_GLX_EXPERIMENTAL} = 1 if $card->{Driver} },
- UTAH_GLX_EXPERIMENTAL => sub { $card->{UTAH_GLX_EXPERIMENTAL} = 1 if $card->{server} },
MULTI_HEAD => sub { $card->{MULTI_HEAD} = $val if $card->{Driver} },
BAD_FB_RESTORE => sub { $card->{BAD_FB_RESTORE} = 1 },
- BAD_FB_RESTORE_XF3 => sub { $card->{BAD_FB_RESTORE_XF3} = 1 },
FB_TVOUT => sub { $card->{FB_TVOUT} = 1 },
UNSUPPORTED => sub { delete $card->{Driver} },
diff --git a/perl-install/Xconfig/default.pm b/perl-install/Xconfig/default.pm
index e1cd2e1b8..9d317fc3a 100644
--- a/perl-install/Xconfig/default.pm
+++ b/perl-install/Xconfig/default.pm
@@ -22,7 +22,7 @@ sub configure {
my $raw_X = Xconfig::xfree->empty_config;
- $raw_X->{xfree4}->add_load_module($_) foreach qw(dbe v4l extmod type1 freetype);
+ $raw_X->add_load_module($_) foreach qw(dbe v4l extmod type1 freetype);
config_keyboard($raw_X, $keyboard);
config_mouse($raw_X, $mouse);
diff --git a/perl-install/Xconfig/main.pm b/perl-install/Xconfig/main.pm
index 1e11b2b49..86ea9ed7c 100644
--- a/perl-install/Xconfig/main.pm
+++ b/perl-install/Xconfig/main.pm
@@ -48,7 +48,7 @@ sub configure_everything_auto_install {
$X->{monitor} = Xconfig::monitor::configure_auto_install($raw_X, $old_X) or return;
$options->{VideoRam_probed} = $X->{monitor}{VideoRam_probed};
$X->{card} = Xconfig::card::configure_auto_install($raw_X, $do_pkgs, $old_X, $options) or return;
- Xconfig::screen::configure($raw_X, $X->{card}) or return;
+ Xconfig::screen::configure($raw_X) or return;
$X->{resolution} = Xconfig::resolution_and_depth::configure_auto_install($raw_X, $X->{card}, $X->{monitor}, $old_X);
&write($raw_X, $X);
@@ -64,7 +64,7 @@ sub configure_everything {
$ok &&= $X->{monitor} = Xconfig::monitor::configure($in, $raw_X, $auto);
$options->{VideoRam_probed} = $X->{monitor}{VideoRam_probed};
$ok &&= $X->{card} = Xconfig::card::configure($in, $raw_X, $do_pkgs, $auto, $options);
- $ok &&= Xconfig::screen::configure($raw_X, $X->{card});
+ $ok &&= Xconfig::screen::configure($raw_X);
$ok &&= $X->{resolution} = Xconfig::resolution_and_depth::configure($in, $raw_X, $X->{card}, $X->{monitor}, $auto);
$ok &&= Xconfig::test::test($in, $raw_X, $X->{card}, '', 'skip_badcard') if !$auto;
@@ -102,7 +102,7 @@ sub configure_chooser_raw {
$update_texts->();
if (member($field, 'card', 'monitor')) {
- Xconfig::screen::configure($raw_X, $X->{card});
+ Xconfig::screen::configure($raw_X);
$raw_X->set_resolution($X->{resolution}) if $X->{resolution};
}
}
@@ -158,17 +158,12 @@ sub configure_chooser {
sub configure_everything_or_configure_chooser {
my ($in, $options, $auto, $o_keyboard, $o_mouse) = @_;
my $raw_X = Xconfig::xfree->read;
- my $default = Xconfig::default::configure($o_keyboard, $o_mouse);
- my $has_conf = @{$raw_X->{xfree3}} || @{$raw_X->{xfree4}};
- $raw_X->{xfree3} = $default->{xfree3} if !@{$raw_X->{xfree3}};
- $raw_X->{xfree4} = $default->{xfree4} if !@{$raw_X->{xfree4}};
- return $raw_X if $has_conf && $auto;
-
- if ($has_conf) {
- Xconfig::main::configure_chooser($in, $raw_X, $in->do_pkgs, $options) or return;
- } else {
+ if (is_empty_array_ref($raw_X)) {
+ $raw_X = Xconfig::default::configure($o_keyboard, $o_mouse);
Xconfig::main::configure_everything($in, $raw_X, $in->do_pkgs, $auto, $options) or return;
+ } else {
+ Xconfig::main::configure_chooser($in, $raw_X, $in->do_pkgs, $options) or return if !$auto;
}
$raw_X;
}
@@ -191,7 +186,7 @@ sub write {
export_to_install_X($X);
$raw_X->write;
Xconfig::various::check_XF86Config_symlink();
- symlinkf "../..$X->{card}{prog}", "$::prefix/etc/X11/X" if $X->{card}{server} !~ /Xpmac/;
+ symlinkf "../../usr/X11R6/bin/XFree86", "$::prefix/etc/X11/X";
}
diff --git a/perl-install/Xconfig/resolution_and_depth.pm b/perl-install/Xconfig/resolution_and_depth.pm
index 95c892f17..14a2ef5b2 100644
--- a/perl-install/Xconfig/resolution_and_depth.pm
+++ b/perl-install/Xconfig/resolution_and_depth.pm
@@ -13,7 +13,6 @@ our %depth2text = (
15 => N_("32 thousand colors (15 bits)"),
16 => N_("65 thousand colors (16 bits)"),
24 => N_("16 million colors (24 bits)"),
- 32 => N_("4 billion colors (32 bits)"),
);
our @depths_available = ikeys(%depth2text);
@@ -84,33 +83,21 @@ sub allowed {
my ($prefered_depth, @depths, @resolutions, @resolution_and_depth);
- my $using_xf4 = Xconfig::card::using_xf4($card);
-
- if ($using_xf4 ? $card->{Driver} eq 'fbdev' : $card->{server} eq 'FBDev') {
+ if ($card->{Driver} eq 'fbdev') {
push @resolution_and_depth, grep { $_->{Depth} == 16 } @bios_vga_modes;
- } elsif ($using_xf4 && $card->{Driver} eq 'fglrx') {
+ } elsif ($card->{Driver} eq 'fglrx') {
$prefered_depth = 24;
push @depths, 24;
- } elsif ($using_xf4) {
+ } else {
if ($card->{use_DRI_GLX}) {
$prefered_depth = 16;
push @depths, 16, 24;
}
if ($card->{BoardName} eq 'RIVA128') { @depths = qw(8 15 24) } #- X doesn't even start in 16bpp for RIVA128
- } elsif ($card->{use_UTAH_GLX}) {
- $prefered_depth = 16;
- push @depths, 16;
- } else {
- if ($card->{server} eq 'Sun24') { push @depths, 24, 8, 2 }
- elsif ($card->{server} eq 'Sun') { push @depths, 8, 2 }
- elsif ($card->{server} eq 'SunMono') { push @depths, 2 }
- elsif ($card->{server} eq 'VGA16') { push @depths, 8; push @resolutions, '640x480' }
- elsif ($card->{BoardName} =~ /SiS/) { push @depths, 24, 16, 8 }
- elsif ($card->{BoardName} eq 'S3 Trio3D') { push @depths, 24, 16, 8 }
}
if (!@resolution_and_depth || @depths || @resolutions) {
- @depths = grep { !($using_xf4 && /32/) } (our @depths_available) if !@depths;
- @resolutions = @Xconfig::xfreeX::resolutions if !@resolutions;
+ @depths = our @depths_available if !@depths;
+ @resolutions = @Xconfig::xfree::resolutions if !@resolutions;
push @resolution_and_depth,
map {
@@ -186,7 +173,7 @@ sub configure {
if ($b_auto) {
#- use $default_resolution
- if (Xconfig::card::using_xf4($card) && $card->{Driver} eq 'fglrx') {
+ if ($card->{Driver} eq 'fglrx') {
$default_resolution = first(find { $default_resolution->{Y} eq $_->{Y} && $_->{Depth} == 24 }
$default_resolution, @resolutions);
$default_resolution ||= first(find { $_->{Depth} == 24 } $default_resolution, @resolutions);
diff --git a/perl-install/Xconfig/screen.pm b/perl-install/Xconfig/screen.pm
index 761c5defd..89e416a4d 100644
--- a/perl-install/Xconfig/screen.pm
+++ b/perl-install/Xconfig/screen.pm
@@ -7,7 +7,7 @@ use common;
sub configure {
- my ($raw_X, $card) = @_;
+ my ($raw_X) = @_;
my @devices = $raw_X->get_devices;
my @monitors = $raw_X->get_monitors;
@@ -17,25 +17,12 @@ sub configure {
@monitors = $raw_X->get_monitors;
}
- if ($card->{server}) {
- $raw_X->{xfree3}->set_screens({ Device => $devices[0]{Identifier}, Monitor => $monitors[0]{Identifier},
- Driver => $Xconfig::card::serversdriver{$card->{server}} || internal_error("bad XFree3 server $card->{server}"),
- });
- } else {
- @{$raw_X->{xfree3}} = ();
- }
-
- if ($card->{Driver}) {
- my @sections = mapn {
- my ($device, $monitor) = @_;
- { Device => $device->{Identifier}, Monitor => $monitor->{Identifier} }
- } \@devices, \@monitors;
-
- $raw_X->{xfree4}->set_screens(@sections);
- } else {
- @{$raw_X->{xfree4}} = ();
- }
+ my @sections = mapn {
+ my ($device, $monitor) = @_;
+ { Device => $device->{Identifier}, Monitor => $monitor->{Identifier} }
+ } \@devices, \@monitors;
+ $raw_X->set_screens(@sections);
1;
}
diff --git a/perl-install/Xconfig/test.pm b/perl-install/Xconfig/test.pm
index 8a2ecc632..e2ac0505a 100644
--- a/perl-install/Xconfig/test.pm
+++ b/perl-install/Xconfig/test.pm
@@ -48,7 +48,7 @@ sub test {
fuzzy_pidofs(qr/\bxfs\b/) or die "xfs is not running";
my $f = $::testing ? $tmpconfig : "/etc/X11/XF86Config.test";
- $raw_X->{Xconfig::card::using_xf4($card) ? 'xfree4' : 'xfree3'}->write("$::prefix/$f");
+ $raw_X->write("$::prefix/$f");
my $f_err = common::secured_file($::prefix . ($ENV{TMPDIR} || "$ENV{HOME}/tmp") . '/.drakx.Xoutput');
@@ -57,9 +57,7 @@ sub test {
system("xauth add :9 . `mcookie`");
open STDERR, ">$f_err";
chroot $::prefix if $::prefix;
- exec $card->{prog},
- if_($card->{prog} !~ /Xsun/, "-xf86config", $f),
- ":9" or c::_exit(0);
+ exec 'XFree86', '-xf86config', $f, ":9" or c::_exit(0);
}
do { sleep 1 } until xtest(":9") || waitpid($pid, c::WNOHANG());
@@ -76,26 +74,12 @@ sub test {
local $_;
i: while (<$F>) {
- if (Xconfig::card::using_xf4($card)) {
- if (/^\(EE\)/ && !/Disabling/ || /^Fatal\b/) {
- my @msg = !/error/ && $_;
- local $_;
- while (<$F>) {
- /reporting a problem/ and last;
- $warn_error->(join(@msg, $_));
- return 0;
- }
- }
- } else {
- if (/\b(error|not supported)\b/i) {
- my @msg = !/error/ && $_;
- local $_;
- while (<$F>) {
- /not fatal/ and last i;
- /^$/ and last;
- push @msg, $_;
- }
- $warn_error->(join(@msg));
+ if (/^\(EE\)/ && !/Disabling/ || /^Fatal\b/) {
+ my @msg = !/error/ && $_;
+ local $_;
+ while (<$F>) {
+ /reporting a problem/ and last;
+ $warn_error->(join(@msg, $_));
return 0;
}
}
diff --git a/perl-install/Xconfig/various.pm b/perl-install/Xconfig/various.pm
index 1aa0dd1be..5d7832c06 100644
--- a/perl-install/Xconfig/various.pm
+++ b/perl-install/Xconfig/various.pm
@@ -18,9 +18,9 @@ sub to_string {
sub info {
my ($raw_X, $card) = @_;
my $info;
- my $xf_ver = Xconfig::card::using_xf4($card) ? Xconfig::card::xfree4_version() : Xconfig::card::xfree3_version();
- my $title = $card->{use_DRI_GLX} || $card->{use_UTAH_GLX} ?
- N("XFree %s with 3D hardware acceleration", $xf_ver) : N("XFree %s", $xf_ver);
+ my $xf_ver = Xconfig::card::xfree4_version();
+ my $title = $card->{use_DRI_GLX} ? N("XFree %s with 3D hardware acceleration", $xf_ver) :
+ N("XFree %s", $xf_ver);
my $keyboard = eval { $raw_X->get_keyboard } || {};
my $monitor = eval { $raw_X->get_monitor } || {};
my $device = eval { $raw_X->get_device } || {};
@@ -38,7 +38,6 @@ sub info {
$info .= N("Color depth: %s\n", translate($Xconfig::resolution_and_depth::depth2text{$resolution->{Depth}}));
$info .= N("Resolution: %s\n", join('x', @$resolution{'X', 'Y'}));
}
- $info .= N("XFree86 server: %s\n", $card->{server}) if $card->{server};
$info .= N("XFree86 driver: %s\n", $device->{Driver}) if $device->{Driver};
"$title\n\n$info";
}
@@ -81,7 +80,7 @@ Would you like XFree to start when you reboot?"),
sub tvout {
my ($in, $card, $options) = @_;
- $card->{FB_TVOUT} && Xconfig::card::using_xf4($card) && $options->{allowFB} or return;
+ $card->{FB_TVOUT} && $options->{allowFB} or return;
$in->ask_yesorno('', N("Your graphic card seems to have a TV-OUT connector.
It can be configured to work using frame-buffer.
@@ -104,26 +103,25 @@ sub configure_FB_TVOUT {
my ($use_FB_TVOUT) = @_;
my $raw_X = Xconfig::default::configure();
- my $xfree4 = $raw_X->{xfree4};
- return if is_empty_array_ref($xfree4);
+ return if is_empty_array_ref($raw_X);
- $xfree4->set_monitors({ HorizSync => '30-50', VertRefresh => ($use_FB_TVOUT->{norm} eq 'NTSC' ? 60 : 50) });
- first($xfree4->get_monitor_sections)->{ModeLine} = [
+ $raw_X->set_monitors({ HorizSync => '30-50', VertRefresh => ($use_FB_TVOUT->{norm} eq 'NTSC' ? 60 : 50) });
+ first($raw_X->get_Sections('Monitor'))->{ModeLine} = [
{ val => '"640x480" 29.50 640 675 678 944 480 530 535 625', pre_comment => "# PAL\n" },
{ val => '"800x600" 36.00 800 818 820 960 600 653 655 750' },
{ val => '"640x480" 28.195793 640 656 658 784 480 520 525 600', pre_comment => "# NTSC\n" },
{ val => '"800x600" 38.769241 800 812 814 880 600 646 649 735' },
];
- $xfree4->set_devices({ Driver => 'fbdev' });
+ $raw_X->set_devices({ Driver => 'fbdev' });
- my ($device) = $xfree4->get_devices;
- my ($monitor) = $xfree4->get_monitors;
- $xfree4->set_screens({ Device => $device->{Identifier}, Monitor => $monitor->{Identifier} });
+ my ($device) = $raw_X->get_devices;
+ my ($monitor) = $raw_X->get_monitors;
+ $raw_X->set_screens({ Device => $device->{Identifier}, Monitor => $monitor->{Identifier} });
- my $Screen = $xfree4->get_default_screen;
+ my $Screen = $raw_X->get_default_screen;
$Screen->{Display} = [ map { { l => { Depth => { val => $_ } } } } 8, 16 ];
- $xfree4->write("$::prefix/etc/X11/XF86Config-4.tvout");
+ $raw_X->write("$::prefix/etc/X11/XF86Config.tvout");
check_XF86Config_symlink();
diff --git a/perl-install/Xconfig/xfree.pm b/perl-install/Xconfig/xfree.pm
index df6c0d3e0..c567192c9 100644
--- a/perl-install/Xconfig/xfree.pm
+++ b/perl-install/Xconfig/xfree.pm
@@ -5,111 +5,470 @@ use strict;
use common;
use Xconfig::parse;
-use Xconfig::xfree3;
-use Xconfig::xfree4;
-use log;
+#- mostly internal only
+sub new {
+ my ($class, $val) = @_;
+ bless $val, $class;
+}
+################################################################################
+# I/O ##########################################################################
+################################################################################
sub read {
- my ($class, $o_xfree3_file, $o_xfree4_file) = @_;
- bless { xfree3 => eval { Xconfig::xfree3->read($o_xfree3_file) } || [],
- xfree4 => eval { Xconfig::xfree4->read($o_xfree4_file) } || [] }, $class;
+ my ($class) = @_;
+ my $file = "$::prefix/etc/X11/XF86Config";
+ $file = "$file-4" if -e "$file-4"; #- prefer XF86Config-4 when there is one. Writing will take care of keeping only the new name
+ $class->new(Xconfig::parse::read_XF86Config($file));
}
sub write {
- my ($both, $o_xfree3_file, $o_xfree4_file) = @_;
- $both->{xfree3} ? $both->{xfree3}->write($o_xfree3_file) : unlink($o_xfree3_file);
- $both->{xfree4} ? $both->{xfree4}->write($o_xfree4_file) : unlink($o_xfree4_file);
+ my ($raw_X) = @_;
+ my $file = "$::prefix/etc/X11/XF86Config";
+ rename $file, "$file.old";
+ rename "$file-4", "$file-4.old"; #- there won't be any XF86Config-4 anymore, we want this!
+ Xconfig::parse::write_XF86Config($raw_X, $file);
}
sub prepare_write {
- my ($both) = @_;
- ($both->{xfree4} || $both->{xfree3})->prepare_write;
+ my ($raw_X) = @_;
+ join('', Xconfig::parse::prepare_write_XF86Config($raw_X));
}
-
sub empty_config {
my ($class) = @_;
- bless { xfree3 => Xconfig::xfree3->empty_config,
- xfree4 => Xconfig::xfree4->empty_config }, $class;
+ $class->new(Xconfig::parse::read_XF86Config_from_string(our $default_header));
+}
+
+################################################################################
+# keyboard #####################################################################
+################################################################################
+my @keyboard_fields = qw(XkbLayout XkbModel XkbDisable XkbOptions XkbCompat);
+sub get_keyboard {
+ my ($raw_X) = @_;
+ my $raw_kbd = $raw_X->get_Section('Keyboard') or die "no keyboard section";
+ raw_export_section($raw_kbd, \@keyboard_fields);
+}
+sub set_keyboard {
+ my ($raw_X, $kbd) = @_;
+ my $raw_kbd = $raw_X->get_Section('Keyboard') || _new_keyboard_section($raw_X);
+ raw_import_section($raw_kbd, $kbd);
+ _set_Option('keyboard', $raw_kbd, keys %$kbd);
+}
+sub _new_keyboard_section {
+ my ($raw_X) = @_;
+ my $raw_kbd = { Identifier => { val => 'Keyboard1' }, Driver => { val => 'Keyboard' } };
+ $raw_X->add_Section('InputDevice', $raw_kbd);
+
+ my $layout = get_ServerLayout($raw_X)->{InputDevice} ||= [];
+ push @$layout, { val => '"Keyboard1" "CoreKeyboard"' };
+
+ $raw_kbd;
+}
+
+
+################################################################################
+# mouse ########################################################################
+################################################################################
+#- example: { Protocol => 'IMPS/2', Device => '/dev/psaux', Emulate3Buttons => undef, Emulate3Timeout => 50, ZAxisMapping => [ '4 5', '6 7' ] }
+my @mouse_fields = qw(Protocol Device ZAxisMapping Emulate3Buttons Emulate3Timeout); #-);
+sub get_mice {
+ my ($raw_X) = @_;
+ my @raw_mice = $raw_X->get_InputDevices('mouse');
+ map { raw_export_section($_, \@mouse_fields) } @raw_mice;
+}
+sub set_mice {
+ my ($raw_X, @mice) = @_;
+ my @raw_mice = _new_mouse_sections($raw_X, int @mice);
+ mapn {
+ my ($raw_mouse, $mouse) = @_;
+ raw_import_section($raw_mouse, $mouse);
+ _set_Option('mouse', $raw_mouse, keys %$mouse);
+ } \@raw_mice, \@mice;
+}
+sub _new_mouse_sections {
+ my ($raw_X, $nb_new) = @_;
+ $raw_X->remove_InputDevices('mouse');
+
+ my $layout = get_ServerLayout($raw_X)->{InputDevice} ||= [];
+ @$layout = grep { $_->{val} !~ /^"Mouse/ } @$layout;
+
+ $nb_new or return;
+
+ my @l = map {
+ my $h = { Identifier => { val => "Mouse$_" }, Driver => { val => 'mouse' } };
+ $raw_X->add_Section('InputDevice', $h);
+ } (1 .. $nb_new);
+
+ push @$layout, { val => qq("Mouse1" "CorePointer") };
+ push @$layout, { val => qq("Mouse$_" "SendCoreEvents") } foreach 2 .. $nb_new;
+
+ @l;
+}
+
+
+################################################################################
+# resolution ###################################################################
+################################################################################
+sub get_resolution {
+ my ($raw_X, $o_Screen) = @_;
+ my $Screen = $o_Screen || $raw_X->get_default_screen or return {};
+
+ my $depth = val($Screen->{DefaultColorDepth});
+ my $Display = find { !$depth || val($_->{l}{Depth}) eq $depth } @{$Screen->{Display} || []} or return {};
+ $Display->{l}{Virtual} && val($Display->{l}{Virtual}) =~ /(\d+)\s+(\d+)/ or
+ val($Display->{l}{Modes}) =~ /(\d+)x(\d+)/ or return {};
+ { X => $1, Y => $2, Depth => val($Display->{l}{Depth}) };
+}
+sub set_resolution {
+ my ($raw_X, $resolution, $o_Screen_) = @_;
+
+ foreach my $Screen ($o_Screen_ ? $o_Screen_ : $raw_X->get_Sections('Screen')) {
+ $Screen ||= $raw_X->get_default_screen or internal_error('no screen');
+
+ $Screen->{DefaultColorDepth} = { val => $resolution->{Depth} eq '32' ? 24 : $resolution->{Depth} };
+ $Screen->{Display} = [ map {
+ { l => { Depth => { val => $_ }, Virtual => { val => join(' ', @$resolution{'X', 'Y'}) } } };
+ } 8, 15, 16, 24 ];
+ }
+}
+
+
+################################################################################
+# device #######################################################################
+################################################################################
+my @device_fields = qw(VendorName BoardName Driver VideoRam Screen BusID); #-);
+sub get_device {
+ my ($raw_X) = @_;
+ first(get_devices($raw_X));
+}
+sub get_devices {
+ my ($raw_X) = @_;
+ my @raw_devices = $raw_X->get_Sections('Device');
+ map {
+ my $raw_device = $_;
+ my $device = raw_export_section($raw_device, [ 'Identifier', @device_fields ]);
+ $device->{Options} = raw_export_section($raw_device, [ grep { (deref_array($raw_device->{$_}))[0]->{Option} } keys %$raw_device ]);
+ $device;
+ } @raw_devices;
+}
+sub set_devices {
+ my ($raw_X, @devices) = @_;
+ my @raw_devices = _new_device_sections($raw_X, int @devices);
+ mapn {
+ my ($raw_device, $device) = @_;
+ my %Options = %{$device->{Options} || {}};
+ raw_import_section($raw_device, $device, \@device_fields);
+ raw_import_section($raw_device, \%Options);
+ $_->{Option} = 1 foreach map { deref_array($raw_device->{$_}) } keys %Options;
+ $raw_device->{''} = [ { post_comment => $device->{raw_LINES} } ] if $device->{raw_LINES};
+ } \@raw_devices, \@devices;
+}
+sub _new_device_sections {
+ my ($raw_X, $nb_new) = @_;
+ $raw_X->remove_Section('Device');
+ map { $raw_X->add_Section('Device', { Identifier => { val => "device$_" }, DPMS => { Option => 1 } }) } (1 .. $nb_new);
+}
+
+
+################################################################################
+# wacoms #######################################################################
+################################################################################
+sub set_wacoms {
+ my ($raw_X, @wacoms) = @_;
+ $raw_X->remove_InputDevices('wacom');
+
+ my $layout = get_ServerLayout($raw_X)->{InputDevice} ||= [];
+ @$layout = grep { $_->{val} !~ /^"(Stylus|Eraser|Cursor)/ } @$layout;
+
+ @wacoms or return;
+
+ my %Modes = (Stylus => 'Absolute', Eraser => 'Absolute', Cursor => 'Relative');
+
+ each_index {
+ my $wacom = $_;
+ foreach (keys %Modes) {
+ my $identifier = $_ . ($::i + 1);
+ my $h = { Identifier => { val => $identifier },
+ Driver => { val => 'wacom' },
+ Type => { val => lc $_, Option => 1 },
+ Device => { val => $wacom->{Device}, Option => 1 },
+ Mode => { val => $Modes{$_}, Option => 1 },
+ if_($wacom->{USB}, USB => { Option => 1 })
+ };
+ $raw_X->add_Section('InputDevice', $h);
+ push @$layout, { val => qq("$identifier" "AlwaysCore") };
+ }
+ } @wacoms;
+}
+
+
+################################################################################
+# monitor ######################################################################
+################################################################################
+my @monitor_fields = qw(VendorName ModelName HorizSync VertRefresh);
+sub get_monitors {
+ my ($raw_X) = @_;
+ my @raw_monitors = $raw_X->get_Sections('Monitor');
+ map { raw_export_section($_, [ 'Identifier', @monitor_fields ]) } @raw_monitors;
+}
+sub set_monitors {
+ my ($raw_X, @monitors) = @_;
+ my @raw_monitors = _new_monitor_sections($raw_X, int @monitors);
+ mapn {
+ my ($raw_monitor, $monitor) = @_;
+ raw_import_section($raw_monitor, $monitor, \@monitor_fields);
+ } \@raw_monitors, \@monitors;
+}
+sub get_monitor {
+ my ($raw_X) = @_;
+ $raw_X->get_monitors or _new_monitor_sections($raw_X, 1);
+ first($raw_X->get_monitors);
+}
+sub _new_monitor_sections {
+ my ($raw_X, $nb_new) = @_;
+ my $ModeLine = ModeLine_from_string(qq(Section "Monitor"\n) . (our $default_ModeLine) . qq(EndSection\n));
+ $raw_X->remove_Section('Monitor');
+ map { $raw_X->add_Section('Monitor', { Identifier => { val => "monitor$_" }, ModeLine => $ModeLine }) } (1 .. $nb_new);
+}
+
+
+################################################################################
+# screens ######################################################################
+################################################################################
+sub get_default_screen {
+ my ($raw_X) = @_;
+ my @l = $raw_X->get_Sections('Screen');
+ (find { $_->{Identifier} && val($_->{Identifier}) eq 'screen1' ||
+ $_->{Driver} && val($_->{Driver}) =~ /svga|accel/ } @l) || $l[0];
+}
+sub set_screens {
+ my ($raw_X, @screens) = @_;
+ my @raw_screens = _new_screen_sections($raw_X, int @screens);
+ mapn {
+ my ($raw_screen, $screen) = @_;
+ raw_import_section($raw_screen, $screen);
+ } \@raw_screens, \@screens;
+}
+sub _new_screen_sections {
+ my ($raw_X, $nb_new) = @_;
+ $raw_X->remove_Section('Screen');
+ my @l = map { $raw_X->add_Section('Screen', { Identifier => { val => "screen$_" } }) } (1 .. $nb_new);
+
+ get_ServerLayout($raw_X)->{Screen} = [
+ { val => qq("screen1") },
+ map { { val => sprintf('"screen%d" RightOf "screen%d"', $_, $_ - 1) } } (2 .. $nb_new)
+ ];
+ @l;
+}
+sub is_fbdev {
+ my ($raw_X, $o_Screen) = @_;
+
+ my $Screen = $o_Screen || $raw_X->get_default_screen or return;
+
+ my $Device = $raw_X->get_Section_by_Identifier('Device', val($Screen->{Device})) or internal_error("no device named $Screen->{Device}");
+ val($Device->{Driver}) eq 'fbdev';
}
-sub get_keyboard { get_both('get_keyboard', @_) }
-sub set_keyboard { set_both('set_keyboard', @_) }
-sub get_mice { get_both('get_mice', @_) }
-sub set_mice { set_both('set_mice', @_) }
-sub get_resolution { get_both('get_resolution', @_) }
-sub set_resolution { set_both('set_resolution', @_) }
-sub get_device { get_both('get_device', @_) }
-sub get_devices { get_both('get_devices', @_) }
-sub set_devices { set_both('set_devices', @_) }
-sub set_wacoms { set_both('set_wacoms', @_) }
+################################################################################
+# modules ######################################################################
+################################################################################
+sub get_modules {
+ my ($raw_X) = @_;
+ my $raw_Module = $raw_X->get_Section('Module') or return;
+ my $Module = raw_export_section($raw_Module, ['Load']);
+ @{$Module->{Load} || []};
+}
+sub add_load_module {
+ my ($raw_X, $module) = @_;
+ my $raw_Module = $raw_X->get_Section('Module') || $raw_X->add_Section('Module', {});
-sub get_monitor { get_both('get_monitor', @_) }
-sub get_monitors { get_both('get_monitors', @_) }
-sub set_monitors { set_both('set_monitors', @_) }
+ my %load_modules_comment = (
+ dbe => 'Double-Buffering Extension',
+ v4l => 'Video for Linux',
+ dri => 'direct rendering',
+ glx => '3D layer',
+ 'glx-3.so' => '3D layer',
+ );
+ my $comment = $load_modules_comment{$module};
+ push @{$raw_Module->{Load}}, { val => $module,
+ comment_on_line => $comment && " # $comment",
+ } if !member($module, $raw_X->get_modules);
+}
+sub remove_load_module {
+ my ($raw_X, $module) = @_;
+ my $raw_Module = $raw_X->get_Section('Module') or return;
+ if (my @l = grep { $_->{val} ne $module } @{$raw_Module->{Load}}) {
+ $raw_Module->{Load} = \@l;
+ } else {
+ $raw_X->remove_Section('Module');
+ }
+}
+sub set_load_module {
+ my ($raw_X, $module, $bool) = @_;
+ $bool ? add_load_module($raw_X, $module) : remove_load_module($raw_X, $module);
+}
-sub is_fbdev { get_both('is_fbdev', @_) }
#-##############################################################################
#- helpers
#-##############################################################################
-sub get_both {
- my ($getter, $both) = @_;
-
- if (is_empty_array_ref($both->{xfree3})) {
- $both->{xfree4}->$getter;
- } elsif (is_empty_array_ref($both->{xfree4})) {
- $both->{xfree3}->$getter;
- } else {
- my @l3 = $both->{xfree3}->$getter;
- my @l4 = $both->{xfree4}->$getter;
- merge_values(\@l3, \@l4);
+sub _set_Option {
+ my ($category, $node, @names) = @_;
+
+ if (member($category, 'keyboard', 'mouse')) {
+ #- everything we export is an Option
+ $_->{Option} = 1 foreach map { deref_array($node->{$_}) } @names;
}
}
-sub set_both {
- my ($setter, $both, @l) = @_;
-
- $both->{xfree3}->$setter(@l) if !is_empty_array_ref($both->{xfree3});
- $both->{xfree4}->$setter(@l) if !is_empty_array_ref($both->{xfree4});
-}
-
-sub merge_values {
- my ($l3, $l4) = @_;
-
- sub merge_values__hashes {
- my ($h3, $h4) = @_;
- $h3 || $h4 or return;
- $h3 or return $h4;
- $h4 or return $h3;
-
- my %h = %$h4;
- foreach (keys %$h3) {
- if (exists $h{$_}) {
- if (ref($h{$_}) eq 'HASH' && ref($h3->{$_}) eq 'HASH') {
- #- needed for "Options" of Devices
- $h{$_} = +{ %{$h3->{$_}}, %{$h{$_}} };
- } else {
- my $s4 = join(", ", deref_array($h{$_}));
- my $s3 = join(", ", deref_array($h3->{$_}));
- my $s3_ = join(", ", map { qq("$_") } deref_array($h3->{$_}));
- if ($s4 eq $s3_) {
- #- keeping the non-double-quoted value
- $h{$_} = $h3->{$_};
- } else {
- $s4 eq $s3 or log::l(qq(XFree: conflicting value for $_, "$s4" and "$s3" are different));
- }
- }
- } else {
- $h{$_} = $h3->{$_};
- }
- }
- \%h;
+
+sub get_InputDevices {
+ my ($raw_X, $Driver) = @_;
+ $raw_X->get_Sections('InputDevice', sub { val($_[0]{Driver}) eq $Driver });
+}
+sub remove_InputDevices {
+ my ($raw_X, $Driver) = @_;
+ $raw_X->remove_Section('InputDevice', sub { val($_[0]{Driver}) ne $Driver });
+}
+
+sub get_ServerLayout {
+ my ($raw_X) = @_;
+ $raw_X->get_Section('ServerLayout') ||
+ $raw_X->add_Section('ServerLayout', { Identifier => { val => 'layout1' } });
+}
+
+#-##############################################################################
+#- helpers
+#-##############################################################################
+sub raw_export_section {
+ my ($section, $fields) = @_;
+
+ my $export_name = sub {
+ my ($name) = @_;
+ my $h = $section->{$name} or return;
+
+ my @l = map { if_(!$_->{commented}, $_->{val}) } deref_array($h) or return;
+ $name => (ref($h) eq 'ARRAY' ? \@l : $l[0]);
+ };
+
+ my %h = map { $export_name->($_) } @$fields;
+ \%h;
+}
+
+sub raw_import_section {
+ my ($section, $h, $o_fields) = @_;
+ foreach ($o_fields ? grep { exists $h->{$_} } @$o_fields : keys %$h) {
+ my @l = map { ref($_) eq 'HASH' ? $_ : { val => $_ } } deref_array($h->{$_});
+ $section->{$_} = (ref($h->{$_}) eq 'ARRAY' ? \@l : $l[0]);
}
+}
- my @r = mapn_(\&merge_values__hashes, $l3, $l4);
+sub add_Section {
+ my ($raw_X, $Section, $h) = @_;
+ my @suggested_ordering = qw(Files ServerFlags Module DRI Keyboard Pointer XInput InputDevice Monitor Device Screen ServerLayout);
+ my %order = map_index { { lc($_) => $::i } } @suggested_ordering;
+ my $e = { name => $Section, l => $h };
+ my $added;
+ @$raw_X = map {
+ if ($order{lc $_->{name}} > $order{lc $Section} && !$added) {
+ $added = 1;
+ ($e, $_);
+ } else { $_ }
+ } @$raw_X;
+ push @$raw_X, $e if !$added;
+ $h;
+}
+sub remove_Section {
+ my ($raw_X, $Section, $o_when) = @_;
+ @$raw_X = grep { $_->{name} ne $Section || $o_when && $o_when->($_->{l}) } @$raw_X;
+ $raw_X;
+}
+sub get_Sections {
+ my ($raw_X, $Section, $o_when) = @_;
+ map { if_($_->{name} eq $Section && (!$o_when || $o_when->($_->{l})), $_->{l}) } @$raw_X;
+}
+sub get_Section {
+ my ($raw_X, $Section, $o_when) = @_;
+ my @l = get_Sections($raw_X, $Section, $o_when);
+ @l > 1 and log::l("Xconfig: found more than one Section $Section");
+ $l[0];
+}
+sub get_Section_by_Identifier {
+ my ($raw_X, $Section, $Identifier) = @_;
+ my @l = get_Sections($raw_X, $Section, sub { val($_[0]{Identifier}) eq $Identifier });
+ @l > 1 and die "more than one Section $Section has Identifier $Identifier";
+ $l[0];
+}
- @r == 1 ? $r[0] : @r;
+sub val {
+ my ($ref) = @_;
+ $ref && $ref->{val};
}
+
+sub ModeLine_from_string {
+ my ($s) = @_;
+ my $raw_X_for_ModeLine = Xconfig::parse::read_XF86Config_from_string($s);
+ get_Section($raw_X_for_ModeLine, 'Monitor')->{ModeLine};
+}
+
+
+
+our @resolutions = ('640x480', '800x600', '1024x768', if_(arch() =~ /ppc/, '1152x768'), '1152x864', '1280x960', '1280x1024', '1400x1050', '1600x1200', '1920x1440', '2048x1536');
+
+our $default_header = <<'END';
+# File generated by XFdrake.
+
+# **********************************************************************
+# Refer to the XF86Config man page for details about the format of
+# this file.
+# **********************************************************************
+
+Section "Files"
+ # Multiple FontPath entries are allowed (they are concatenated together)
+ # By default, Mandrake 6.0 and later now use a font server independent of
+ # the X server to render fonts.
+ FontPath "unix/:-1"
+EndSection
+
+Section "ServerFlags"
+ #DontZap # disable <Crtl><Alt><BS> (server abort)
+ #DontZoom # disable <Crtl><Alt><KP_+>/<KP_-> (resolution switching)
+ AllowMouseOpenFail # allows the server to start up even if the mouse doesn't work
+EndSection
+END
+
+our $default_ModeLine = arch() =~ /ppc/ ? <<'END_PPC' : <<'END';
+ # Apple iMac modes
+ ModeLine "1024x768" 78.525 1024 1049 1145 1312 768 769 772 800 +hsync +vsync
+ ModeLine "800x600" 62.357 800 821 901 1040 600 601 604 632 +hsync +vsync
+ ModeLine "640x480" 49.886 640 661 725 832 480 481 484 514 +hsync +vsync
+ # Apple monitors tend to do 832x624
+ ModeLine "832x624" 57 832 876 940 1152 624 625 628 667 -hsync -vsync
+ # Apple PowerBook G3
+ ModeLine "800x600" 100 800 816 824 840 600 616 624 640 -hsync -vsync
+ # Apple TI Powerbook
+ ModeLine "1152x768" 78.741 1152 1173 1269 1440 768 769 772 800 +vsync +vsync
+ # Pismo Firewire G3
+ ModeLine "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
+ # iBook2
+ ModeLine "1024x768" 65 1024 1048 1184 1344 768 771 777 806 -hsync -vsync
+ # 17" Apple Studio Display
+ ModeLine "1024x768" 112.62 1024 1076 1248 1420 768 768 780 808 +hsync +vsync
+ # HiRes Apple Studio Display
+ ModeLine "1280x1024" 135 1280 1288 1392 1664 1024 1027 1030 1064
+ # Another variation
+ ModeLine "1280x1024" 134.989 1280 1317 1429 1688 1024 1025 1028 1066 +hsync +vsync
+END_PPC
+ # Sony Vaio C1(X,XS,VE,VN)?
+ # 1024x480 @ 85.6 Hz, 48 kHz hsync
+ ModeLine "1024x480" 65.00 1024 1032 1176 1344 480 488 494 563 -hsync -vsync
+
+ # TV fullscreen mode or DVD fullscreen output.
+ # 768x576 @ 79 Hz, 50 kHz hsync
+ ModeLine "768x576" 50.00 768 832 846 1000 576 590 595 630
+ # 768x576 @ 100 Hz, 61.6 kHz hsync
+ ModeLine "768x576" 63.07 768 800 960 1024 576 578 590 616
+END
+
1;
diff --git a/perl-install/Xconfig/xfree3.pm b/perl-install/Xconfig/xfree3.pm
deleted file mode 100644
index 2c753f148..000000000
--- a/perl-install/Xconfig/xfree3.pm
+++ /dev/null
@@ -1,281 +0,0 @@
-package Xconfig::xfree3; # $Id$
-
-use diagnostics;
-use strict;
-
-use common;
-use Xconfig::parse;
-use Xconfig::xfreeX;
-
-our @ISA = 'Xconfig::xfreeX';
-
-sub name { 'xfree3' }
-sub config_file { '/etc/X11/XF86Config' }
-
-
-sub get_keyboard_section {
- my ($raw_X) = @_;
- return $raw_X->get_Section('Keyboard') or die "no keyboard section";
-}
-sub new_keyboard_section {
- my ($raw_X) = @_;
- return $raw_X->add_Section('Keyboard', { Protocol => { val => 'Standard' } });
-}
-
-sub get_mouse_sections {
- my ($raw_X) = @_;
- my $main = $raw_X->get_Section('Pointer') or die "no mouse section";
- my $XInput = $raw_X->get_Section('XInput');
- $main, if_($XInput, map { $_->{l} } @{$XInput->{Mouse} || []});
-}
-
-sub new_mouse_sections {
- my ($raw_X, $nb_new) = @_;
-
- $raw_X->remove_Section('Pointer');
- my $XInput = $raw_X->get_Section('XInput');
- delete $XInput->{Mouse} if $XInput;
- $raw_X->remove_Section('XInput') if $nb_new <= 1 && $XInput && !%$XInput;
-
- $nb_new or return;
-
- my $main = $raw_X->add_Section('Pointer', {});
-
- if ($nb_new == 1) {
- $main;
- } else {
- my @l = map { { AlwaysCore => {} } } (2 .. $nb_new);
- $XInput ||= $raw_X->add_Section('XInput', {});
- $XInput->{Mouse} = [ map { { l => $_ } } @l ];
- $main, @l;
- }
-}
-
-sub set_mice {
- my ($raw_X, @mice) = @_;
- @mice = map {
- my %h = %$_;
- put_in_hash(\%h, { Protocol => 'IMPS/2', ZAxisMapping => '4 5' }) if $h{Protocol} eq 'ExplorerPS/2';
- \%h;
- } @mice;
- $raw_X->SUPER::set_mice(@mice);
-}
-
-sub set_wacoms {
- my ($raw_X, @wacoms) = @_;
-
- my %Modes = (Stylus => 'Absolute', Eraser => 'Absolute', Cursor => 'Relative');
-
- my $XInput = $raw_X->get_Section('XInput');
- if ($XInput) {
- delete $XInput->{"Wacom$_"} foreach keys %Modes;
- $raw_X->remove_Section('XInput') if !@wacoms && $XInput && !%$XInput;
- }
- #- only wacom is handled in XFree 3
- my ($wacom) = @wacoms or return;
-
- $XInput ||= $raw_X->add_Section('XInput', {});
- foreach (keys %Modes) {
- $XInput->{"Wacom$_"} = [ { l => { Port => { val => qq("$wacom->{Device}") },
- Mode => { val => $Modes{$_} },
- if_($wacom->{USB}, USB => {}),
- AlwaysCore => {} } } ];
- }
-}
-
-sub depths { 8, 15, 16, 24, 32 }
-
-sub set_resolution {
- my ($raw_X, $resolution, $o_Screen_) = @_;
-
- foreach my $Screen ($o_Screen_ ? $o_Screen_ : $raw_X->get_screens) {
- $Screen ||= $raw_X->get_default_screen or internal_error('no screen');
-
- $Screen->{DefaultColorDepth} = { val => $resolution->{Depth} };
- $Screen->{Display} = [ map {
- my $modes = do {
- if ($raw_X->is_fbdev($Screen)) {
- '"default"';
- } else {
- my @Modes = grep {
- if_(m/(\d+)x(\d+)/,
- $1 <= $resolution->{X} && (!$resolution->{Y} || $2 <= $resolution->{Y}));
- } reverse @Xconfig::xfreeX::resolutions;
- join(" ", map { qq("$_") } @Modes);
- }
- };
- { l => { Depth => { val => $_ }, Modes => { val => $modes } } };
- } $raw_X->depths ];
- }
-}
-
-sub get_device_section_fields {
- qw(VendorName BoardName Chipset VideoRam); #-);
-}
-
-sub default_ModeLine {
- my ($raw_X) = @_;
- $raw_X->SUPER::default_ModeLine . (our $default_ModeLine);
-}
-
-sub new_device_sections {
- my ($raw_X, $nb_new) = @_;
- my @l = $raw_X->SUPER::new_device_sections($nb_new);
- $_->{power_saver} = { Option => 1 } foreach @l;
- @l;
-}
-
-sub is_fbdev {
- my ($raw_X, $o_Screen) = @_;
-
- my $Screen = $o_Screen || $raw_X->get_default_screen or return;
-
- val($Screen->{Server}) eq 'FBDev';
-}
-
-sub set_Option {
- my ($_raw_X, $_category, $_node, @_names) = @_;
-}
-
-
-sub val {
- my ($ref) = @_;
- $ref && $ref->{val};
-}
-
-our $default_ModeLine = <<'END';
- # This is a set of standard mode timings. Modes that are out of monitor spec
- # are automatically deleted by the server (provided the HorizSync and
- # VertRefresh lines are correct), so there's no immediate need to
- # delete mode timings (unless particular mode timings don't work on your
- # monitor). With these modes, the best standard mode that your monitor
- # and video card can support for a given resolution is automatically
- # used.
-
- # 640x400 @ 70 Hz, 31.5 kHz hsync
- ModeLine "640x400" 25.175 640 664 760 800 400 409 411 450
- # 640x480 @ 60 Hz, 31.5 kHz hsync
- ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525
- # 800x600 @ 56 Hz, 35.15 kHz hsync
- ModeLine "800x600" 36 800 824 896 1024 600 601 603 625
- # 1024x768 @ 87 Hz interlaced, 35.5 kHz hsync
- ModeLine "1024x768" 44.9 1024 1048 1208 1264 768 776 784 817 Interlace
-
- # 640x400 @ 85 Hz, 37.86 kHz hsync
- ModeLine "640x400" 31.5 640 672 736 832 400 401 404 445 -HSync +VSync
- # 640x480 @ 75 Hz, 37.50 kHz hsync
- ModeLine "640x480" 31.5 640 656 720 840 480 481 484 500 -HSync -VSync
- # 800x600 @ 60 Hz, 37.8 kHz hsync
- ModeLine "800x600" 40 800 840 968 1056 600 601 605 628 +hsync +vsync
-
- # 640x480 @ 85 Hz, 43.27 kHz hsync
- ModeLine "640x480" 36 640 696 752 832 480 481 484 509 -HSync -VSync
- # 1152x864 @ 89 Hz interlaced, 44 kHz hsync
- ModeLine "1152x864" 65 1152 1168 1384 1480 864 865 875 985 Interlace
-
- # 800x600 @ 72 Hz, 48.0 kHz hsync
- ModeLine "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync
- # 1024x768 @ 60 Hz, 48.4 kHz hsync
- ModeLine "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
-
- # 640x480 @ 100 Hz, 53.01 kHz hsync
- ModeLine "640x480" 45.8 640 672 768 864 480 488 494 530 -HSync -VSync
- # 1152x864 @ 60 Hz, 53.5 kHz hsync
- ModeLine "1152x864" 89.9 1152 1216 1472 1680 864 868 876 892 -HSync -VSync
- # 800x600 @ 85 Hz, 55.84 kHz hsync
- ModeLine "800x600" 60.75 800 864 928 1088 600 616 621 657 -HSync -VSync
-
- # 1024x768 @ 70 Hz, 56.5 kHz hsync
- ModeLine "1024x768" 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
- # 1280x1024 @ 87 Hz interlaced, 51 kHz hsync
- ModeLine "1280x1024" 80 1280 1296 1512 1568 1024 1025 1037 1165 Interlace
-
- # 800x600 @ 100 Hz, 64.02 kHz hsync
- ModeLine "800x600" 69.65 800 864 928 1088 600 604 610 640 -HSync -VSync
- # 1024x768 @ 76 Hz, 62.5 kHz hsync
- ModeLine "1024x768" 85 1024 1032 1152 1360 768 784 787 823
- # 1152x864 @ 70 Hz, 62.4 kHz hsync
- ModeLine "1152x864" 92 1152 1208 1368 1474 864 865 875 895
- # 1280x1024 @ 61 Hz, 64.2 kHz hsync
- ModeLine "1280x1024" 110 1280 1328 1512 1712 1024 1025 1028 1054
- # 1400x1050 @ 60 Hz, 65.5 kHz
- ModeLine "1400x1050" 122.0 1400 1488 1640 1880 1050 1052 1064 1082 +HSync +VSync
-
- # 1024x768 @ 85 Hz, 70.24 kHz hsync
- ModeLine "1024x768" 98.9 1024 1056 1216 1408 768 782 788 822 -HSync -VSync
- # 1152x864 @ 78 Hz, 70.8 kHz hsync
- ModeLine "1152x864" 110 1152 1240 1324 1552 864 864 876 908
-
- # 1280x1024 @ 70 Hz, 74.59 kHz hsync
- ModeLine "1280x1024" 126.5 1280 1312 1472 1696 1024 1032 1040 1068 -HSync -VSync
- # 1600x1200 @ 60Hz, 75.00 kHz hsync
- ModeLine "1600x1200" 162 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync
- # 1152x864 @ 84 Hz, 76.0 kHz hsync
- ModeLine "1152x864" 135 1152 1464 1592 1776 864 864 876 908
-
- # 1280x1024 @ 75 Hz, 79.98 kHz hsync
- ModeLine "1280x1024" 135 1280 1296 1440 1688 1024 1025 1028 1066 +HSync +VSync
-
- # 1024x768 @ 100Hz, 80.21 kHz hsync
- ModeLine "1024x768" 115.5 1024 1056 1248 1440 768 771 781 802 -HSync -VSync
- # 1400x1050 @ 75 Hz, 82.2 kHz hsync
- ModeLine "1400x1050" 155.8 1400 1464 1784 1912 1050 1052 1064 1090 +HSync +VSync
-
- # 1600x1200 @ 70 Hz, 87.50 kHz hsync
- ModeLine "1600x1200" 189 1600 1664 1856 2160 1200 1201 1204 1250 -HSync -VSync
- # 1152x864 @ 100 Hz, 89.62 kHz hsync
- ModeLine "1152x864" 137.65 1152 1184 1312 1536 864 866 885 902 -HSync -VSync
- # 1280x1024 @ 85 Hz, 91.15 kHz hsync
- ModeLine "1280x1024" 157.5 1280 1344 1504 1728 1024 1025 1028 1072 +HSync +VSync
- # 1600x1200 @ 75 Hz, 93.75 kHz hsync
- ModeLine "1600x1200" 202.5 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync
- # 1600x1200 @ 85 Hz, 105.77 kHz hsync
- ModeLine "1600x1200" 220 1600 1616 1808 2080 1200 1204 1207 1244 +HSync +VSync
- # 1600x1200 @ 85 Hz, 106.3 kHz hsync
- ModeLine "1600x1200" 229.5 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync
- # 1280x1024 @ 100 Hz, 107.16 kHz hsync
- ModeLine "1280x1024" 181.75 1280 1312 1440 1696 1024 1031 1046 1072 -HSync -VSync
-
- # 1800x1440 @ 64Hz, 96.15 kHz hsync
- ModeLine "1800X1440" 230 1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync
- # 1800x1440 @ 70Hz, 104.52 kHz hsync
- ModeLine "1800X1440" 250 1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync
-
- # 1920x1440 @ 60 Hz, 90.0 kHz hsync
- ModeLine "1920x1440" 234.0 1920 2048 2256 2600 1440 1441 1444 1500 -HSync +VSync
- # 1920x1440 @ 75 Hz, 112.5kHz hsync
- ModeLine "1920x1440" 297.0 1920 2064 2288 2640 1440 1441 1444 1500 -HSync +VSync
-
- # 512x384 @ 78 Hz, 31.50 kHz hsync
- ModeLine "512x384" 20.160 512 528 592 640 384 385 388 404 -HSync -VSync
- # 512x384 @ 85 Hz, 34.38 kHz hsync
- ModeLine "512x384" 22 512 528 592 640 384 385 388 404 -HSync -VSync
-
-
- # Low-res Doublescan modes
- # If your chipset does not support doublescan, you get a 'squashed'
- # resolution like 320x400.
-
- # 320x200 @ 70 Hz, 31.5 kHz hsync, 8:5 aspect ratio
- ModeLine "320x200" 12.588 320 336 384 400 200 204 205 225 Doublescan
- # 320x240 @ 60 Hz, 31.5 kHz hsync, 4:3 aspect ratio
- ModeLine "320x240" 12.588 320 336 384 400 240 245 246 262 Doublescan
- # 320x240 @ 72 Hz, 36.5 kHz hsync
- ModeLine "320x240" 15.750 320 336 384 400 240 244 246 262 Doublescan
- # 400x300 @ 56 Hz, 35.2 kHz hsync, 4:3 aspect ratio
- ModeLine "400x300" 18 400 416 448 512 300 301 302 312 Doublescan
- # 400x300 @ 60 Hz, 37.8 kHz hsync
- ModeLine "400x300" 20 400 416 480 528 300 301 303 314 Doublescan
- # 400x300 @ 72 Hz, 48.0 kHz hsync
- ModeLine "400x300" 25 400 424 488 520 300 319 322 333 Doublescan
- # 480x300 @ 56 Hz, 35.2 kHz hsync, 8:5 aspect ratio
- ModeLine "480x300" 21.656 480 496 536 616 300 301 302 312 Doublescan
- # 480x300 @ 60 Hz, 37.8 kHz hsync
- ModeLine "480x300" 23.890 480 496 576 632 300 301 303 314 Doublescan
- # 480x300 @ 63 Hz, 39.6 kHz hsync
- ModeLine "480x300" 25 480 496 576 632 300 301 303 314 Doublescan
- # 480x300 @ 72 Hz, 48.0 kHz hsync
- ModeLine "480x300" 29.952 480 504 584 624 300 319 322 333 Doublescan
-END
-
-1;
diff --git a/perl-install/Xconfig/xfree4.pm b/perl-install/Xconfig/xfree4.pm
deleted file mode 100644
index 5c2d23286..000000000
--- a/perl-install/Xconfig/xfree4.pm
+++ /dev/null
@@ -1,165 +0,0 @@
-package Xconfig::xfree4; # $Id$
-
-use diagnostics;
-use strict;
-
-use common;
-use Xconfig::parse;
-use Xconfig::xfree;
-
-our @ISA = 'Xconfig::xfreeX';
-
-sub name { 'xfree4' }
-sub config_file { '/etc/X11/XF86Config-4' }
-
-
-sub get_keyboard_section {
- my ($raw_X) = @_;
- my ($raw_kbd) = get_InputDevices($raw_X, 'Keyboard') or die "no keyboard section";
- $raw_kbd;
-}
-
-sub new_keyboard_section {
- my ($raw_X) = @_;
- my $raw_kbd = { Identifier => { val => 'Keyboard1' }, Driver => { val => 'Keyboard' } };
- $raw_X->add_Section('InputDevice', $raw_kbd);
-
- my $layout = get_ServerLayout($raw_X)->{InputDevice} ||= [];
- push @$layout, { val => '"Keyboard1" "CoreKeyboard"' };
-
- $raw_kbd;
-}
-
-sub get_mouse_sections {
- my ($raw_X) = @_;
- get_InputDevices($raw_X, 'mouse');
-}
-sub new_mouse_sections {
- my ($raw_X, $nb_new) = @_;
- $raw_X->remove_InputDevices('mouse');
-
- my $layout = get_ServerLayout($raw_X)->{InputDevice} ||= [];
- @$layout = grep { $_->{val} !~ /^"Mouse/ } @$layout;
-
- $nb_new or return;
-
- my @l = map {
- my $h = { Identifier => { val => "Mouse$_" }, Driver => { val => 'mouse' } };
- $raw_X->add_Section('InputDevice', $h);
- } (1 .. $nb_new);
-
- push @$layout, { val => qq("Mouse1" "CorePointer") };
- push @$layout, { val => qq("Mouse$_" "SendCoreEvents") } foreach 2 .. $nb_new;
-
- @l;
-}
-
-sub set_wacoms {
- my ($raw_X, @wacoms) = @_;
- $raw_X->remove_InputDevices('wacom');
-
- my $layout = get_ServerLayout($raw_X)->{InputDevice} ||= [];
- @$layout = grep { $_->{val} !~ /^"(Stylus|Eraser|Cursor)/ } @$layout;
-
- @wacoms or return;
-
- my %Modes = (Stylus => 'Absolute', Eraser => 'Absolute', Cursor => 'Relative');
-
- each_index {
- my $wacom = $_;
- foreach (keys %Modes) {
- my $identifier = $_ . ($::i + 1);
- my $h = { Identifier => { val => $identifier },
- Driver => { val => 'wacom' },
- Type => { val => lc $_, Option => 1 },
- Device => { val => $wacom->{Device}, Option => 1 },
- Mode => { val => $Modes{$_}, Option => 1 },
- if_($wacom->{USB}, USB => { Option => 1 })
- };
- $raw_X->add_Section('InputDevice', $h);
- push @$layout, { val => qq("$identifier" "AlwaysCore") };
- }
- } @wacoms;
-}
-
-sub depths { 8, 15, 16, 24 }
-sub set_resolution {
- my ($raw_X, $resolution, $o_Screen_) = @_;
-
- foreach my $Screen ($o_Screen_ ? $o_Screen_ : $raw_X->get_screens) {
- $Screen ||= $raw_X->get_default_screen or internal_error('no screen');
-
- $Screen->{DefaultColorDepth} = { val => $resolution->{Depth} eq '32' ? 24 : $resolution->{Depth} };
- $Screen->{Display} = [ map {
- { l => { Depth => { val => $_ }, Virtual => { val => join(' ', @$resolution{'X', 'Y'}) } } };
- } $raw_X->depths ];
- }
-}
-
-sub get_device_section_fields {
- qw(VendorName BoardName Driver VideoRam Screen BusID); #-);
-}
-
-sub new_device_sections {
- my ($raw_X, $nb_new) = @_;
- my @l = $raw_X->SUPER::new_device_sections($nb_new);
- $_->{DPMS} = { Option => 1 } foreach @l;
- @l;
-}
-
-sub new_screen_sections {
- my ($raw_X, $nb_new) = @_;
- my @l = $raw_X->SUPER::new_screen_sections($nb_new);
- each_index { $_->{Identifier} = { val => "screen" . ($::i+1) } } @l;
-
- get_ServerLayout($raw_X)->{Screen} = [
- { val => qq("screen1") }, #-)
- map { { val => sprintf('"screen%d" RightOf "screen%d"', $_, $_ - 1) } } (2 .. $nb_new)
- ];
-
- @l;
-}
-
-sub is_fbdev {
- my ($raw_X, $Screen) = @_;
-
- my $Screen_ = $Screen || $raw_X->get_default_screen or return;
-
- my $Device = $raw_X->get_Section_by_Identifier('Device', val($Screen_->{Device})) or internal_error("no device named $Screen_->{Device}");
- val($Device->{Driver}) eq 'fbdev';
-}
-
-sub set_Option {
- my ($_raw_X, $category, $node, @names) = @_;
-
- if (member($category, 'keyboard', 'mouse')) {
- #- everything we export is an Option
- $_->{Option} = 1 foreach map { deref_array($node->{$_}) } @names;
- }
-}
-
-
-#-##############################################################################
-#- helpers
-#-##############################################################################
-sub get_InputDevices {
- my ($raw_X, $Driver) = @_;
- $raw_X->get_Sections('InputDevice', sub { val($_[0]{Driver}) eq $Driver });
-}
-sub remove_InputDevices {
- my ($raw_X, $Driver) = @_;
- $raw_X->remove_Section('InputDevice', sub { val($_[0]{Driver}) ne $Driver });
-}
-
-sub get_ServerLayout {
- my ($raw_X) = @_;
- $raw_X->get_Section('ServerLayout') ||
- $raw_X->add_Section('ServerLayout', { Identifier => { val => 'layout1' } });
-}
-
-sub val {
- my ($ref) = @_;
- $ref && $ref->{val};
-}
-
-1;
diff --git a/perl-install/Xconfig/xfreeX.pm b/perl-install/Xconfig/xfreeX.pm
deleted file mode 100644
index 7d830ddee..000000000
--- a/perl-install/Xconfig/xfreeX.pm
+++ /dev/null
@@ -1,357 +0,0 @@
-package Xconfig::xfreeX; # $Id$
-
-use diagnostics;
-use strict;
-
-use Xconfig::parse;
-use common;
-use log;
-
-
-sub empty_config {
- my ($class) = @_;
- my $raw_X = Xconfig::parse::read_XF86Config_from_string(our $default_header);
- bless $raw_X, $class;
-}
-
-sub read {
- my ($class, $o_file) = @_;
- my $file = $o_file || ($::prefix || '') . (bless {}, $class)->config_file;
- my $raw_X = Xconfig::parse::read_XF86Config($file);
- bless $raw_X, $class;
-}
-sub write {
- my ($raw_X, $o_file) = @_;
- my $file = $o_file || ($::prefix || '') . $raw_X->config_file;
- rename $file, "$file.old";
- Xconfig::parse::write_XF86Config($raw_X, $file);
-}
-sub prepare_write {
- my ($raw_X) = @_;
- join('', Xconfig::parse::prepare_write_XF86Config($raw_X));
-}
-
-
-my @monitor_fields = qw(VendorName ModelName HorizSync VertRefresh);
-sub get_monitors {
- my ($raw_X) = @_;
- my @raw_monitors = $raw_X->get_monitor_sections;
- map { raw_export_section($_, [ 'Identifier', @monitor_fields ]) } @raw_monitors;
-}
-sub set_monitors {
- my ($raw_X, @monitors) = @_;
- my @raw_monitors = $raw_X->new_monitor_sections(int @monitors);
- mapn {
- my ($raw_monitor, $monitor) = @_;
- raw_import_section($raw_monitor, $monitor, \@monitor_fields);
- } \@raw_monitors, \@monitors;
-}
-sub get_monitor {
- my ($raw_X) = @_;
- my @l = $raw_X->get_monitors;
- if (!@l) {
- $raw_X->new_monitor_sections(1);
- @l = $raw_X->get_monitors;
- }
- $l[0]
-}
-
-my @keyboard_fields = qw(XkbLayout XkbModel XkbDisable XkbOptions XkbCompat);
-sub get_keyboard {
- my ($raw_X) = @_;
- my $raw_kbd = $raw_X->get_keyboard_section;
- raw_export_section($raw_kbd, \@keyboard_fields);
-}
-sub set_keyboard {
- my ($raw_X, $kbd) = @_;
- my $raw_kbd = eval { $raw_X->get_keyboard_section } || $raw_X->new_keyboard_section;
- raw_import_section($raw_kbd, $kbd);
- $raw_X->set_Option('keyboard', $raw_kbd, keys %$kbd);
-}
-
-#- example: { Protocol => 'IMPS/2', Device => '/dev/psaux', Emulate3Buttons => undef, Emulate3Timeout => 50, ZAxisMapping => [ '4 5', '6 7' ] }
-my @mouse_fields = qw(Protocol Device ZAxisMapping Emulate3Buttons Emulate3Timeout); #-);
-sub get_mice {
- my ($raw_X) = @_;
- my @raw_mice = $raw_X->get_mouse_sections;
- map { raw_export_section($_, \@mouse_fields) } @raw_mice;
-}
-sub set_mice {
- my ($raw_X, @mice) = @_;
- my @raw_mice = $raw_X->new_mouse_sections(int @mice);
- mapn {
- my ($raw_mouse, $mouse) = @_;
- raw_import_section($raw_mouse, $mouse);
- $raw_X->set_Option('mouse', $raw_mouse, keys %$mouse);
- } \@raw_mice, \@mice;
-}
-
-sub get_devices {
- my ($raw_X) = @_;
- my @raw_devices = $raw_X->get_device_sections;
- map {
- my $raw_device = $_;
- my $device = raw_export_section($raw_device, [ 'Identifier', $raw_X->get_device_section_fields ]);
- $device->{Options} = raw_export_section($raw_device, [ grep { (deref_array($raw_device->{$_}))[0]->{Option} } keys %$raw_device ]);
- $device;
- } @raw_devices;
-}
-sub set_devices {
- my ($raw_X, @devices) = @_;
- my @raw_devices = $raw_X->new_device_sections(int @devices);
- mapn {
- my ($raw_device, $device) = @_;
- my %Options = %{$device->{Options} || {}};
- add2hash(\%Options, $device->{'Options_' . $raw_X->name});
- raw_import_section($raw_device, $device, [ $raw_X->get_device_section_fields ]);
- raw_import_section($raw_device, \%Options);
- $_->{Option} = 1 foreach map { deref_array($raw_device->{$_}) } keys %Options;
- $raw_device->{''} = [ { post_comment => $device->{raw_LINES} } ] if $device->{raw_LINES};
- } \@raw_devices, \@devices;
-}
-
-sub get_device {
- my ($raw_X) = @_;
- first(get_devices($raw_X));
-}
-
-sub get_screens {
- my ($raw_X) = @_;
- $raw_X->get_Sections('Screen');
-}
-sub get_default_screen {
- my ($raw_X) = @_;
- my @l = get_screens($raw_X);
- (find { $_->{Identifier} && val($_->{Identifier}) eq 'screen1' ||
- $_->{Driver} && val($_->{Driver}) =~ /svga|accel/ } @l) || $l[0];
-}
-sub set_screens {
- my ($raw_X, @screens) = @_;
- my @raw_screens = $raw_X->new_screen_sections(int @screens);
- mapn {
- my ($raw_screen, $screen) = @_;
- raw_import_section($raw_screen, $screen);
- } \@raw_screens, \@screens;
-}
-
-sub get_modules {
- my ($raw_X) = @_;
- my $raw_Module = $raw_X->get_Section('Module') or return;
- my $Module = raw_export_section($raw_Module, ['Load']);
- @{$Module->{Load} || []};
-}
-sub add_load_module {
- my ($raw_X, $module) = @_;
- my $raw_Module = $raw_X->get_Section('Module') || $raw_X->new_module_section;
-
- my %load_modules_comment = (
- dbe => 'Double-Buffering Extension',
- v4l => 'Video for Linux',
- dri => 'direct rendering',
- glx => '3D layer',
- 'glx-3.so' => '3D layer',
- );
- my $comment = $load_modules_comment{$module};
- push @{$raw_Module->{Load}}, { val => $module,
- comment_on_line => $comment && " # $comment",
- } if !member($module, $raw_X->get_modules);
-}
-sub remove_load_module {
- my ($raw_X, $module) = @_;
- my $raw_Module = $raw_X->get_Section('Module') or return;
- if (my @l = grep { $_->{val} ne $module } @{$raw_Module->{Load}}) {
- $raw_Module->{Load} = \@l;
- } else {
- $raw_X->remove_Section('Module');
- }
-}
-sub set_load_module {
- my ($raw_X, $module, $bool) = @_;
- $bool ? add_load_module($raw_X, $module) : remove_load_module($raw_X, $module);
-}
-
-sub get_resolution {
- my ($raw_X, $o_Screen) = @_;
- my $Screen = $o_Screen || $raw_X->get_default_screen or return {};
-
- my $depth = val($Screen->{DefaultColorDepth});
- my $Display = find { !$depth || val($_->{l}{Depth}) eq $depth } @{$Screen->{Display} || []} or return {};
- $Display->{l}{Virtual} && val($Display->{l}{Virtual}) =~ /(\d+)\s+(\d+)/ or
- val($Display->{l}{Modes}) =~ /(\d+)x(\d+)/ or return {};
- { X => $1, Y => $2, Depth => val($Display->{l}{Depth}) };
-}
-
-#-##############################################################################
-#- common to xfree3 and xfree4
-#-##############################################################################
-sub default_ModeLine { our $default_ModeLine }
-
-
-sub get_device_sections {
- my ($raw_X) = @_;
- $raw_X->get_Sections('Device');
-}
-sub new_device_sections {
- my ($raw_X, $nb_new) = @_;
- $raw_X->remove_Section('Device');
- map { $raw_X->add_Section('Device', { Identifier => { val => "device$_" } }) } (1 .. $nb_new);
-}
-
-sub get_monitor_sections {
- my ($raw_X) = @_;
- $raw_X->get_Sections('Monitor');
-}
-sub new_monitor_sections {
- my ($raw_X, $nb_new) = @_;
- my $ModeLine = ModeLine_from_string(qq(Section "Monitor"\n) . $raw_X->default_ModeLine . qq(EndSection\n));
- $raw_X->remove_Section('Monitor');
- map { $raw_X->add_Section('Monitor', { Identifier => { val => "monitor$_" }, ModeLine => $ModeLine }) } (1 .. $nb_new);
-}
-
-sub new_screen_sections {
- my ($raw_X, $nb_new) = @_;
- $raw_X->remove_Section('Screen');
- map { $raw_X->add_Section('Screen', {}) } (1 .. $nb_new);
-}
-
-sub new_module_section {
- my ($raw_X) = @_;
- return $raw_X->add_Section('Module', {});
-}
-
-
-#-##############################################################################
-#- helpers
-#-##############################################################################
-sub raw_export_section {
- my ($section, $fields) = @_;
-
- my $export_name = sub {
- my ($name) = @_;
- my $h = $section->{$name} or return;
-
- my @l = map { if_(!$_->{commented}, $_->{val}) } deref_array($h) or return;
- $name => (ref($h) eq 'ARRAY' ? \@l : $l[0]);
- };
-
- my %h = map { $export_name->($_) } @$fields;
- \%h;
-}
-
-sub raw_import_section {
- my ($section, $h, $o_fields) = @_;
- foreach ($o_fields ? grep { exists $h->{$_} } @$o_fields : keys %$h) {
- my @l = map { ref($_) eq 'HASH' ? $_ : { val => $_ } } deref_array($h->{$_});
- $section->{$_} = (ref($h->{$_}) eq 'ARRAY' ? \@l : $l[0]);
- }
-}
-
-sub add_Section {
- my ($raw_X, $Section, $h) = @_;
- my @suggested_ordering = qw(Files ServerFlags Module DRI Keyboard Pointer XInput InputDevice Monitor Device Screen ServerLayout);
- my %order = map_index { { lc($_) => $::i } } @suggested_ordering;
- my $e = { name => $Section, l => $h };
- my $added;
- @$raw_X = map {
- if ($order{lc $_->{name}} > $order{lc $Section} && !$added) {
- $added = 1;
- ($e, $_);
- } else { $_ }
- } @$raw_X;
- push @$raw_X, $e if !$added;
- $h;
-}
-sub remove_Section {
- my ($raw_X, $Section, $o_when) = @_;
- @$raw_X = grep { $_->{name} ne $Section || $o_when && $o_when->($_->{l}) } @$raw_X;
- $raw_X;
-}
-sub get_Sections {
- my ($raw_X, $Section, $o_when) = @_;
- map { if_($_->{name} eq $Section && (!$o_when || $o_when->($_->{l})), $_->{l}) } @$raw_X;
-}
-sub get_Section {
- my ($raw_X, $Section, $o_when) = @_;
- my @l = get_Sections($raw_X, $Section, $o_when);
- @l > 1 and log::l("Xconfig: found more than one Section $Section");
- $l[0];
-}
-sub get_Section_by_Identifier {
- my ($raw_X, $Section, $Identifier) = @_;
- my @l = get_Sections($raw_X, $Section, sub { val($_[0]{Identifier}) eq $Identifier });
- @l > 1 and die "more than one Section $Section has Identifier $Identifier";
- $l[0];
-}
-
-sub val {
- my ($ref) = @_;
- $ref && $ref->{val};
-}
-
-sub ModeLine_from_string {
- my ($s) = @_;
- my $raw_X_for_ModeLine = Xconfig::parse::read_XF86Config_from_string($s);
- get_Section($raw_X_for_ModeLine, 'Monitor')->{ModeLine};
-}
-
-
-
-our @resolutions = ('640x480', '800x600', '1024x768', if_(arch() =~ /ppc/, '1152x768'), '1152x864', '1280x960', '1280x1024', '1400x1050', '1600x1200', '1920x1440', '2048x1536');
-
-our $default_header = <<'END';
-# File generated by XFdrake.
-
-# **********************************************************************
-# Refer to the XF86Config man page for details about the format of
-# this file.
-# **********************************************************************
-
-Section "Files"
- # Multiple FontPath entries are allowed (they are concatenated together)
- # By default, Mandrake 6.0 and later now use a font server independent of
- # the X server to render fonts.
- FontPath "unix/:-1"
-EndSection
-
-Section "ServerFlags"
- #DontZap # disable <Crtl><Alt><BS> (server abort)
- #DontZoom # disable <Crtl><Alt><KP_+>/<KP_-> (resolution switching)
- AllowMouseOpenFail # allows the server to start up even if the mouse doesn't work
-EndSection
-END
-
-our $default_ModeLine = arch() =~ /ppc/ ? <<'END_PPC' : <<'END';
- # Apple iMac modes
- ModeLine "1024x768" 78.525 1024 1049 1145 1312 768 769 772 800 +hsync +vsync
- ModeLine "800x600" 62.357 800 821 901 1040 600 601 604 632 +hsync +vsync
- ModeLine "640x480" 49.886 640 661 725 832 480 481 484 514 +hsync +vsync
- # Apple monitors tend to do 832x624
- ModeLine "832x624" 57 832 876 940 1152 624 625 628 667 -hsync -vsync
- # Apple PowerBook G3
- ModeLine "800x600" 100 800 816 824 840 600 616 624 640 -hsync -vsync
- # Apple TI Powerbook
- ModeLine "1152x768" 78.741 1152 1173 1269 1440 768 769 772 800 +vsync +vsync
- # Pismo Firewire G3
- ModeLine "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
- # iBook2
- ModeLine "1024x768" 65 1024 1048 1184 1344 768 771 777 806 -hsync -vsync
- # 17" Apple Studio Display
- ModeLine "1024x768" 112.62 1024 1076 1248 1420 768 768 780 808 +hsync +vsync
- # HiRes Apple Studio Display
- ModeLine "1280x1024" 135 1280 1288 1392 1664 1024 1027 1030 1064
- # Another variation
- ModeLine "1280x1024" 134.989 1280 1317 1429 1688 1024 1025 1028 1066 +hsync +vsync
-END_PPC
- # Sony Vaio C1(X,XS,VE,VN)?
- # 1024x480 @ 85.6 Hz, 48 kHz hsync
- ModeLine "1024x480" 65.00 1024 1032 1176 1344 480 488 494 563 -hsync -vsync
-
- # TV fullscreen mode or DVD fullscreen output.
- # 768x576 @ 79 Hz, 50 kHz hsync
- ModeLine "768x576" 50.00 768 832 846 1000 576 590 595 630
- # 768x576 @ 100 Hz, 61.6 kHz hsync
- ModeLine "768x576" 63.07 768 800 960 1024 576 578 590 616
-END
-
-1;
-