summaryrefslogtreecommitdiffstats
path: root/perl-install/Xconfig
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/Xconfig')
-rw-r--r--perl-install/Xconfig/FILES6
-rw-r--r--perl-install/Xconfig/card.pm584
-rw-r--r--perl-install/Xconfig/default.pm44
-rw-r--r--perl-install/Xconfig/main.pm235
-rw-r--r--perl-install/Xconfig/monitor.pm220
-rw-r--r--perl-install/Xconfig/parse.pm204
-rw-r--r--perl-install/Xconfig/proprietary.pm35
-rw-r--r--perl-install/Xconfig/resolution_and_depth.pm314
-rw-r--r--perl-install/Xconfig/screen.pm29
-rw-r--r--perl-install/Xconfig/test.pm144
-rw-r--r--perl-install/Xconfig/various.pm152
-rw-r--r--perl-install/Xconfig/xfree.pm555
12 files changed, 0 insertions, 2522 deletions
diff --git a/perl-install/Xconfig/FILES b/perl-install/Xconfig/FILES
deleted file mode 100644
index f6352dedf..000000000
--- a/perl-install/Xconfig/FILES
+++ /dev/null
@@ -1,6 +0,0 @@
-
-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
deleted file mode 100644
index 304cdc4f7..000000000
--- a/perl-install/Xconfig/card.pm
+++ /dev/null
@@ -1,584 +0,0 @@
-package Xconfig::card; # $Id$
-
-use diagnostics;
-use strict;
-
-use detect_devices;
-use modules;
-use common;
-use log;
-
-
-my %VideoRams = (
- 256 => N_("256 kB"),
- 512 => N_("512 kB"),
- 1024 => N_("1 MB"),
- 2048 => N_("2 MB"),
- 4096 => N_("4 MB"),
- 8192 => N_("8 MB"),
- 16384 => N_("16 MB"),
- 32768 => N_("32 MB"),
- 65536 => N_("64 MB or more"),
-);
-
-my $lib = arch() =~ /x86_64/ ? "lib64" : "lib";
-
-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));
-
-sub from_raw_X {
- my ($raw_X) = @_;
-
- my $device = $raw_X->get_device or die "no card configured";
-
- my $card = {
- use_DRI_GLX => eval { any { /dri/ } $raw_X->get_modules },
- %$device,
- };
- add_to_card__using_Cards($card, $card->{BoardName});
- $card;
-}
-
-sub to_raw_X {
- my ($card, $raw_X) = @_;
-
- #- Specific ATI fglrx driver default options
- if ($card->{Driver} eq 'fglrx') {
- # $default_ATI_fglrx_config need to be move in proprietary ?
- $card->{raw_LINES} ||= default_ATI_fglrx_config();
- }
-
- $raw_X->set_devices($card, @{$card->{cards} || []});
-
- $raw_X->get_ServerLayout->{Xinerama} = { commented => !$card->{Xinerama}, Option => 1 }
- if defined $card->{Xinerama};
-
- $raw_X->set_load_module('glx', !$card->{DRI_GLX_SPECIAL} && $card->{Driver2} ne 'fglrx'); #- 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->set_load_module("/usr/X11R6/$lib/modules/extensions/libglx.so", $card->{DRI_GLX_SPECIAL});
- if ($card->{Driver2} ne 'nvidia') {
- $raw_X->set_load_module("/usr/X11R6/$lib/modules/extensions/libglx.a", 1);
- }
-
- $raw_X->remove_Section('DRI');
-
- $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 }
-
-sub probe() {
-#-for Pixel tests
-#- my @c = { driver => 'Card:Matrox Millennium G400 DualHead', description => 'Matrox|Millennium G400 Dual HeadCard' };
- my @c = detect_devices::matching_driver__regexp('(Card|Server|Driver):');
-
- my @cards = map {
- my @l = $_->{description} =~ /(.*?)\|(.*)/;
- my $card = {
- description => $_->{description},
- VendorName => $l[0], BoardName => $l[1],
- BusID => "PCI:$_->{pci_bus}:$_->{pci_device}:$_->{pci_function}",
- };
- if ($_->{driver} =~ /Card:(.*)/) { $card->{BoardName} = $1; add_to_card__using_Cards($card, $1) }
- elsif ($_->{driver} =~ /Driver:(.*)/) { $card->{Driver} = $1 }
- else { internal_error() }
-
- $_->{VideoRam} = 4096 if $_->{Driver} eq 'i810';
- $_->{Options}{UseFBDev} = undef if arch() =~ /ppc/ && $_->{Driver} eq 'r128';
-
- $card;
- } @c;
-
- if (@cards >= 2 && $cards[0]{card_name} eq $cards[1]{card_name} && $cards[0]{card_name} eq 'Intel 830') {
- shift @cards;
- }
- #- take a default on sparc if nothing has been found.
- if (arch() =~ /^sparc/ && !@cards) {
- log::l("Using probe with /proc/fb as nothing has been found!");
- my $s = cat_("/proc/fb");
- @cards = { server => $s =~ /Mach64/ ? "Mach64" : $s =~ /Permedia2/ ? "3DLabs" : "Sun24" };
- }
-
- #- disabling MULTI_HEAD when not available
- foreach (@cards) {
- $_->{MULTI_HEAD} && $_->{card_name} =~ /G[24]00/ or next;
- if ($ENV{MATROX_HAL}) {
- $_->{need_MATROX_HAL} = 1;
- } else {
- delete $_->{MULTI_HEAD};
- }
- }
-
- #- in case of only one cards, remove all BusID reference, this will avoid
- #- need of change of it if the card is moved.
- #- on many PPC machines, card is on-board, BusID is important, leave?
- if (@cards == 1 && !$cards[0]{MULTI_HEAD} && arch() !~ /ppc/) {
- delete $cards[0]{BusID};
- }
-
- @cards;
-}
-
-sub card_config__not_listed {
- my ($in, $card, $options) = @_;
-
- my $vendors_regexp = join '|', map { quotemeta } (
- '3Dlabs',
- 'AOpen', 'ASUS', 'ATI', 'Ark Logic', 'Avance Logic',
- 'Cardex', 'Chaintech', 'Chips & Technologies', 'Cirrus Logic', 'Compaq', 'Creative Labs',
- 'Dell', 'Diamond', 'Digital',
- 'ET', 'Elsa',
- 'Genoa', 'Guillemot', 'Hercules', 'Intel', 'Leadtek',
- 'Matrox', 'Miro', 'NVIDIA', 'NeoMagic', 'Number Nine',
- 'Oak', 'Orchid',
- 'RIVA', 'Rendition Verite',
- 'S3', 'Silicon Motion', 'STB', 'SiS', 'Sun',
- 'Toshiba', 'Trident',
- 'VideoLogic',
- );
- my $cards = readCardsDB("$ENV{SHARE_PATH}/ldetect-lst/Cards+");
-
- my @xf4 = grep { $options->{allowFB} || $_ ne 'fbdev' } @xfree4_Drivers;
- my @list = (
- (map { 'Vendor|' . $_ } keys %$cards),
- (map { 'Xorg|' . $_ } @xf4),
- );
-
- my $r = exists $cards->{$card->{BoardName}} ? "Vendor|$card->{BoardName}" : 'Xorg|vesa';
- $in->ask_from_({ title => N("X server"),
- messages => N("Choose an X server"),
- interactive_help_id => 'configureX_card_list',
- },
- [ { val => \$r, separator => '|', list => \@list, sort => 1,
- format => sub { $_[0] =~ /^Vendor\|($vendors_regexp)\s*-?(.*)/ ? "Vendor|$1|$2" :
- $_[0] =~ /^Vendor\|(.*)/ ? "Vendor|Other|$1" : $_[0] } } ]) or return;
-
- log::l("Xconfig::card: $r manually chosen");
-
- $r eq "Vendor|$card->{BoardName}" and return 1; #- it is unchanged, don't modify $card
-
- my ($kind, $s) = $r =~ /(.*?)\|(.*)/;
-
- %$card = ();
- if ($kind eq 'Vendor') {
- add_to_card__using_Cards($card, $s);
- } else {
- $card->{Driver} = $s;
- }
- $card->{manually_chosen} = 1;
- 1;
-}
-
-sub multi_head_choose {
- my ($in, $auto, @cards) = @_;
-
- my @choices = multi_head_choices('', @cards);
-
- my $tc = $choices[0];
- if ($auto) {
- @choices == 1 or return;
- } else {
- $tc = $in->ask_from_listf(N("Multi-head configuration"),
- N("Your system supports multiple head configuration.
-What do you want to do?"), sub { $_[0]{text} }, \@choices) or return;
- }
- $tc->{code} or die internal_error();
- return $tc->{code}();
-}
-
-sub configure_auto_install {
- my ($raw_X, $do_pkgs, $old_X, $options) = @_;
-
- {
- my $card = $old_X->{card} || {};
- 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->{Driver}; #- bad card_name as we can't find the 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}{card_name}. Defaulting...');
- { Driver => ($options->{allowFB} ? 'fbdev' : 'vesa') };
- };
-
- my ($glx_choice) = xfree_and_glx_choices($card);
- log::l("Using $glx_choice->{text}");
- $glx_choice->{code}();
- set_glx_restrictions($card);
-
- 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}");
- }
- to_raw_X($card, $raw_X);
- $card;
-}
-
-sub configure {
- my ($in, $raw_X, $do_pkgs, $auto, $options) = @_;
-
- my @cards = probe();
- @cards or @cards = {};
-
- if (!$cards[0]{Driver}) {
- if ($options->{allowFB}) {
- $cards[0]{Driver} = 'fbdev';
- } elsif ($auto) {
- log::l("Xconfig::card: auto failed (unknown card and no allowFB)");
- return 0;
- }
- }
- if (!$auto) {
- card_config__not_listed:
- card_config__not_listed($in, $cards[0], $options) or return;
- }
-
- my $card = multi_head_choose($in, $auto, @cards) or return;
-
- xfree_and_glx_choose($in, $card, $auto) or return;
-
- eval { install_server($card, $options, $do_pkgs) };
- if ($@) {
- $in->ask_warn('', N("Can't install Xorg package: %s", $@));
- goto card_config__not_listed;
- }
-
- if ($card->{needVideoRam} && !$card->{VideoRam}) {
- if ($auto) {
- log::l("Xconfig::card: auto failed (needVideoRam)");
- return;
- }
- $card->{VideoRam} = (find { $_ <= $options->{VideoRam_probed} } reverse ikeys %VideoRams) || 4096;
- $in->ask_from('', N("Select the memory size of your graphics card"),
- [ { val => \$card->{VideoRam},
- type => 'list',
- list => [ ikeys %VideoRams ],
- format => sub { translate($VideoRams{$_[0]}) },
- not_edit => !$::expert } ]) or return;
- }
-
- to_raw_X($card, $raw_X);
- $card;
-}
-
-sub install_server {
- my ($card, $options, $do_pkgs) = @_;
-
- my $prog = "$::prefix/usr/X11R6/bin/Xorg";
-
- my @packages;
- push @packages, 'xorg-x11-server' if ! -x $prog;
-
- #- additional packages to install according available card.
- #- add XFree86-libs-DRI here if using DRI (future split of XFree86 TODO)
- if ($card->{use_DRI_GLX}) {
- push @packages, 'Glide_V5' if $card->{card_name} eq 'Voodoo5 (generic)';
- push @packages, 'Glide_V3-DRI' if member($card->{card_name}, 'Voodoo3 (generic)', 'Voodoo Banshee (generic)');
- push @packages, 'xorg-x11-glide-module' if $card->{card_name} =~ /Voodoo/;
- }
-
- if ($options->{freedriver}) {
- delete $card->{Driver2};
- }
-
- my %proprietary_Driver2 = (
- nvidia => [ 'nvidia-kernel', 'nvidia' ], #- using NVIDIA driver (TNT, TN2 and GeForce cards only).
- fglrx => [ 'ati-kernel', 'ati' ], #- using ATI fglrx driver (Radeon, Fire GL cards only).
- );
- if (my $rpms_needed = $proprietary_Driver2{$card->{Driver2}}) {
- if (my $proprietary_packages = $do_pkgs->check_kernel_module_packages($rpms_needed->[0], $rpms_needed->[1])) {
- push @packages, @$proprietary_packages;
- }
- }
-
- $do_pkgs->install(@packages) if @packages;
- -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.
- if ($card->{Driver2} eq 'nvidia' &&
- -e "$::prefix/usr/X11R6/$lib/modules/drivers/nvidia_drv.o" &&
- -l "$::prefix/usr/X11R6/$lib/modules/extensions/libglx.so") {
- log::l("Using specific NVIDIA driver and GLX extensions");
- $card->{Driver} = 'nvidia';
- $card->{DRI_GLX_SPECIAL} = 1;
- $card->{Options}{IgnoreEDID} = 1;
- }
- my %driver_to_libgl_config = (
- nvidia => "$::prefix/etc/ld.so.conf.d/.conf.nvidia",
- fglrx => "$::prefix/etc/ld.so.conf.d/.conf.ati",
- );
- if (my $file = $driver_to_libgl_config{$card->{Driver2}}) {
- if (-e $file) {
- symlinkf(basename($file), "$::prefix/etc/ld.so.conf.d/GL.conf");
- }
- } else {
- eval { rm_rf("/etc/ld.so.conf.d/GL.conf") };
- }
- system("/sbin/ldconfig") if $::isStandalone;
- if ($card->{Driver2} eq 'fglrx' &&
- -e "$::prefix/usr/X11R6/$lib/modules/dri/fglrx_dri.so" &&
- -e "$::prefix/usr/X11R6/$lib/modules/drivers/fglrx_drv.o") {
- log::l("Using specific ATI fglrx and DRI drivers");
- $card->{Driver} = 'fglrx';
- }
-
- if ($card->{need_MATROX_HAL}) {
- require Xconfig::proprietary;
- Xconfig::proprietary::install_matrox_hal($::prefix);
- }
-}
-
-sub xfree_and_glx_choose {
- my ($in, $card, $auto) = @_;
-
- my @choices = xfree_and_glx_choices($card);
-
- my $tc =
- $auto ? $choices[0] :
- $in->ask_from_listf_raw({ title => N("Xorg configuration"),
- messages => formatAlaTeX(join("\n\n\n", (grep { $_ } map { $_->{more_messages} } @choices),
- N("Which configuration of Xorg do you want to have?"))),
- interactive_help_id => 'configureX_xfree_and_glx',
- },
- sub { $_[0]{text} }, \@choices) or return;
- log::l("Using $tc->{text}");
- $tc->{code}();
- set_glx_restrictions($card);
- 1;
-}
-
-sub multi_head_choices {
- my ($want_Xinerama, @cards) = @_;
- my @choices;
-
- my $has_multi_head = @cards > 1 || @cards && $cards[0]{MULTI_HEAD} > 1;
- my $disable_multi_head = any {
- $_->{Driver} or log::l("found card $_->{description} not supported by XF4, disabling multi-head support");
- !$_->{Driver};
- } @cards;
-
- if ($has_multi_head && !$disable_multi_head) {
- my $configure_multi_head = sub {
-
- #- special case for multi head card using only one BusID.
- @cards = map {
- map_index { { Screen => $::i, %$_ } } ($_) x ($_->{MULTI_HEAD} || 1);
- } @cards;
-
- my $card = shift @cards; #- assume good default.
- $card->{cards} = \@cards;
- $card->{Xinerama} = $_[0];
- $card;
- };
- my $independent = { text => N("Configure all heads independently"), code => sub { $configure_multi_head->('') } };
- my $xinerama = { text => N("Use Xinerama extension"), code => sub { $configure_multi_head->(1) } };
- push @choices, $want_Xinerama ? ($xinerama, $independent) : ($independent, $xinerama);
- }
-
- foreach my $c (@cards) {
- push @choices, { text => N("Configure only card \"%s\"%s", $c->{description}, $c->{BusID} && " ($c->{BusID})"),
- code => sub { $c } };
- }
- @choices;
-}
-
-#- Xorg version available, it would be better to parse available package and get version from it.
-sub xorg_version() { '6.7.0' }
-
-sub xfree_and_glx_choices {
- my ($card) = @_;
-
- my @choices = if_($card->{Driver}, { text => N("Xorg %s", xorg_version()), code => sub {} });
-
- #- no GLX with Xinerama
- return @choices if $card->{Xinerama};
-
- #- 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("Xorg %s with 3D hardware acceleration", xorg_version()),
- code => sub { $card->{use_DRI_GLX} = 1 },
- more_messages => N("Your card can have 3D hardware acceleration support with Xorg %s.", xorg_version()),
- };
- }
-
- #- an expert user may want to try to use an EXPERIMENTAL 3D acceleration.
- if ($card->{DRI_GLX_EXPERIMENTAL} && $::expert) {
- push @choices, { text => N("Xorg %s with EXPERIMENTAL 3D hardware acceleration", xorg_version()),
- code => sub { $card->{use_DRI_GLX} = 1 },
- more_messages => N("Your card can have 3D hardware acceleration support with Xorg %s,
-NOTE THIS IS EXPERIMENTAL SUPPORT AND MAY FREEZE YOUR COMPUTER.", xorg_version()),
- };
- }
- @choices;
-}
-
-sub set_glx_restrictions {
- my ($card) = @_;
-
- #- 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}) {
- $card->{needVideoRam} = 1 if $card->{description} =~ /Matrox.* G[245][05]0/;
- ($card->{needVideoRam}, $card->{VideoRam}) = (1, 16384)
- if member($card->{card_name}, 'Intel 810', 'Intel 815');
-
- #- 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}{UseCCEFor2D} = bool2text(modules::probe_category('multimedia/tv'));
- }
- }
-
- #- check for Matrox G200 PCI cards, disable AGP in such cases, causes black screen else.
- if (member($card->{card_name}, 'Matrox Millennium 200', 'Matrox Millennium 200', 'Matrox Mystique') && $card->{description} !~ /AGP/) {
- log::l("disabling AGP mode for Matrox card, as it seems to be a PCI card");
- log::l("this is only used for XFree 3.3.6, see /etc/X11/glx.conf");
- substInFile { s/^\s*#*\s*mga_dma\s*=\s*\d+\s*$/mga_dma = 0\n/ } "$::prefix/etc/X11/glx.conf";
- }
-}
-
-sub add_to_card__using_Cards {
- my ($card, $name) = @_;
- my $cards = readCardsDB("$ENV{SHARE_PATH}/ldetect-lst/Cards+");
- add2hash($card, $cards->{$name});
- $card->{BoardName} = $card->{card_name};
-
- $card;
-}
-
-#- needed for bad cards not restoring cleanly framebuffer, according to which version of Xorg are used.
-sub check_bad_card {
- my ($card) = @_;
- 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.
-
- log::l("the graphics card does not like X in framebuffer") if $bad_card;
-
- !$bad_card;
-}
-
-sub readCardsDB {
- my ($file) = @_;
- my ($card, %cards);
-
- my $F = openFileMaybeCompressed($file);
-
- my $lineno = 0;
- my ($cmd, $val);
- my $fs = {
- NAME => sub {
- $cards{$card->{card_name}} = $card if $card;
- $card = { card_name => $val };
- },
- SEE => sub {
- my $c = $cards{$val} or die "Error in database, invalid reference $val at line $lineno";
- add2hash($card, $c);
- },
- LINE => sub { $val =~ s/^\s*//; $card->{raw_LINES} .= "$val\n" },
- CHIPSET => sub { $card->{Chipset} = $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} },
- DRI_GLX_EXPERIMENTAL => sub { $card->{DRI_GLX_EXPERIMENTAL} = 1 if $card->{Driver} },
- MULTI_HEAD => sub { $card->{MULTI_HEAD} = $val if $card->{Driver} },
- BAD_FB_RESTORE => sub { $card->{BAD_FB_RESTORE} = 1 },
- FB_TVOUT => sub { $card->{FB_TVOUT} = 1 },
- UNSUPPORTED => sub { delete $card->{Driver} },
-
- COMMENT => sub {},
- };
-
- local $_;
- while (<$F>) { $lineno++;
- s/\s+$//;
- /^#/ and next;
- /^$/ and next;
- /^END/ and do { $cards{$card->{card_name}} = $card if $card; last };
-
- ($cmd, $val) = /(\S+)\s*(.*)/ or next;
-
- my $f = $fs->{$cmd};
-
- $f ? $f->() : log::l("unknown line $lineno ($_)");
- }
- \%cards;
-}
-
-our $default_ATI_fglrx_config = <<'END';
-# === disable PnP Monitor ===
-#Option "NoDDC"
-# === disable/enable XAA/DRI ===
-Option "no_accel" "no"
-Option "no_dri" "no"
-# === FireGL DDX driver module specific settings ===
-# === Screen Management ===
-Option "DesktopSetup" "0x00000000"
-Option "MonitorLayout" "AUTO, AUTO"
-Option "IgnoreEDID" "off"
-Option "HSync2" "unspecified"
-Option "VRefresh2" "unspecified"
-Option "ScreenOverlap" "0"
-# === TV-out Management ===
-Option "NoTV" "yes"
-Option "TVStandard" "NTSC-M"
-Option "TVHSizeAdj" "0"
-Option "TVVSizeAdj" "0"
-Option "TVHPosAdj" "0"
-Option "TVVPosAdj" "0"
-Option "TVHStartAdj" "0"
-Option "TVColorAdj" "0"
-Option "GammaCorrectionI" "0x00000000"
-Option "GammaCorrectionII" "0x00000000"
-# === OpenGL specific profiles/settings ===
-Option "Capabilities" "0x00000000"
-# === Video Overlay for the Xv extension ===
-Option "VideoOverlay" "on"
-# === OpenGL Overlay ===
-# Note: When OpenGL Overlay is enabled, Video Overlay
-# will be disabled automatically
-Option "OpenGLOverlay" "off"
-Option "CenterMode" "off"
-# === QBS Support ===
-Option "Stereo" "off"
-Option "StereoSyncEnable" "1"
-# === Misc Options ===
-Option "UseFastTLS" "0"
-Option "BlockSignalsOnLock" "on"
-Option "UseInternalAGPGART" "no"
-Option "ForceGenericCPU" "no"
-# === FSAA ===
-Option "FSAAScale" "1"
-Option "FSAADisableGamma" "no"
-Option "FSAACustomizeMSPos" "no"
-Option "FSAAMSPosX0" "0.000000"
-Option "FSAAMSPosY0" "0.000000"
-Option "FSAAMSPosX1" "0.000000"
-Option "FSAAMSPosY1" "0.000000"
-Option "FSAAMSPosX2" "0.000000"
-Option "FSAAMSPosY2" "0.000000"
-Option "FSAAMSPosX3" "0.000000"
-Option "FSAAMSPosY3" "0.000000"
-Option "FSAAMSPosX4" "0.000000"
-Option "FSAAMSPosY4" "0.000000"
-Option "FSAAMSPosX5" "0.000000"
-Option "FSAAMSPosY5" "0.000000"
-END
-
-1;
-
diff --git a/perl-install/Xconfig/default.pm b/perl-install/Xconfig/default.pm
deleted file mode 100644
index f41fccaf7..000000000
--- a/perl-install/Xconfig/default.pm
+++ /dev/null
@@ -1,44 +0,0 @@
-package Xconfig::default; # $Id$
-
-use diagnostics;
-use strict;
-
-use Xconfig::xfree;
-use keyboard;
-use common;
-use mouse;
-
-
-sub configure {
- my ($do_pkgs, $o_keyboard, $o_mouse) = @_;
-
- my $keyboard = $o_keyboard || keyboard::read();
- my $mouse = $o_mouse || do {
- my $mouse = mouse::read();
- add2hash($mouse, mouse::detect(modules::any_conf->read)) if !$::noauto;
- $mouse;
- };
-
- my $raw_X = Xconfig::xfree->empty_config;
-
- $raw_X->add_load_module($_) foreach qw(dbe v4l extmod type1 freetype);
-
- config_keyboard($raw_X, $keyboard);
- config_mouse($raw_X, $do_pkgs, $mouse);
-
- $raw_X;
-}
-
-sub config_mouse {
- my ($raw_X, $do_pkgs, $mouse) = @_;
- mouse::set_xfree_conf($mouse, $raw_X);
- mouse::various_xfree_conf($do_pkgs, $mouse);
-}
-
-sub config_keyboard {
- my ($raw_X, $keyboard) = @_;
- $raw_X->set_keyboard(keyboard::keyboard2full_xkb($keyboard));
-}
-
-1;
-
diff --git a/perl-install/Xconfig/main.pm b/perl-install/Xconfig/main.pm
deleted file mode 100644
index a794f3297..000000000
--- a/perl-install/Xconfig/main.pm
+++ /dev/null
@@ -1,235 +0,0 @@
-package Xconfig::main; # $Id$
-
-use diagnostics;
-use strict;
-
-use Xconfig::monitor;
-use Xconfig::card;
-use Xconfig::resolution_and_depth;
-use Xconfig::various;
-use Xconfig::screen;
-use Xconfig::test;
-use common;
-use any;
-
-
-sub configure_monitor {
- my ($in, $raw_X) = @_;
-
- my $before = $raw_X->prepare_write;
- Xconfig::monitor::configure($in, $raw_X, int($raw_X->get_devices)) or return;
- if ($raw_X->prepare_write ne $before) {
- $raw_X->write;
- 'config_changed';
- } else {
- '';
- }
-}
-
-sub configure_resolution {
- my ($in, $raw_X) = @_;
-
- my $card = Xconfig::card::from_raw_X($raw_X);
- my $monitors = [ $raw_X->get_monitors ];
- my $before = $raw_X->prepare_write;
- Xconfig::resolution_and_depth::configure($in, $raw_X, $card, $monitors) or return;
- if ($raw_X->prepare_write ne $before) {
- $raw_X->write;
- 'config_changed';
- } else {
- '';
- }
-}
-
-
-sub configure_everything_auto_install {
- my ($raw_X, $do_pkgs, $old_X, $options) = @_;
- my $X = {};
- $X->{monitors} = Xconfig::monitor::configure_auto_install($raw_X, $old_X) or return;
- $options->{VideoRam_probed} = $X->{monitors}[0]{VideoRam_probed};
- $X->{card} = Xconfig::card::configure_auto_install($raw_X, $do_pkgs, $old_X, $options) or return;
- Xconfig::screen::configure($raw_X) or return;
- $X->{resolution} = Xconfig::resolution_and_depth::configure_auto_install($raw_X, $X->{card}, $X->{monitors}, $old_X);
-
- &write($raw_X, $X);
-
- Xconfig::various::runlevel(exists $old_X->{xdm} && !$old_X->{xdm} ? 3 : 5);
- 'config_changed';
-}
-
-sub configure_everything {
- my ($in, $raw_X, $do_pkgs, $auto, $options) = @_;
- my $X = {};
- my $ok = 1;
-
- my $ddc_info = Xconfig::monitor::getinfoFromDDC();
- $options->{VideoRam_probed} = $ddc_info->{VideoRam_probed};
- $ok &&= $X->{card} = Xconfig::card::configure($in, $raw_X, $do_pkgs, $auto, $options);
- $ok &&= $X->{monitors} = Xconfig::monitor::configure($in, $raw_X, int($raw_X->get_devices), $ddc_info, $auto);
- $ok &&= Xconfig::screen::configure($raw_X);
- $ok &&= $X->{resolution} = Xconfig::resolution_and_depth::configure($in, $raw_X, $X->{card}, $X->{monitors}, $auto);
- $ok &&= Xconfig::test::test($in, $raw_X, $X->{card}, '', 'skip_badcard') if !$auto;
-
- if (!$ok) {
- return if $auto;
- ($ok) = configure_chooser_raw($in, $raw_X, $do_pkgs, $options, $X, 1);
- }
- $X->{various} ||= Xconfig::various::various($in, $X->{card}, $options, $auto);
-
- $ok = may_write($in, $raw_X, $X, $ok);
-
- $ok && 'config_changed';
-}
-
-sub configure_chooser_raw {
- my ($in, $raw_X, $do_pkgs, $options, $X, $b_modified) = @_;
-
- my %texts;
-
- my $update_texts = sub {
- $texts{card} = $X->{card} && $X->{card}{BoardName} || N("Custom");
- $texts{monitors} = $X->{monitors} && $X->{monitors}[0]{ModelName} || N("Custom");
- $texts{resolution} = Xconfig::resolution_and_depth::to_string($X->{resolution});
-
- $texts{$_} =~ s/(.{20}).*/$1.../ foreach keys %texts; #- ensure not too long
- };
- $update_texts->();
-
- my $may_set = sub {
- my ($field, $val) = @_;
- if ($val) {
- $X->{$field} = $val;
- $X->{"modified_$field"} = 1;
- $b_modified = 1;
- $update_texts->();
-
- if (member($field, 'card', 'monitors')) {
- Xconfig::screen::configure($raw_X);
- $raw_X->set_resolution($X->{resolution}) if $X->{resolution};
- }
- }
- };
-
- my $ok;
- $in->ask_from_({ interactive_help_id => 'configureX_chooser',
- if_($::isStandalone, ok => N("Quit")) },
- [
- { label => N("Graphic Card"), val => \$texts{card}, clicked => sub {
- $may_set->('card', Xconfig::card::configure($in, $raw_X, $do_pkgs, 0, $options));
- } },
- { label => N("Monitor"), val => \$texts{monitors}, clicked => sub {
- $may_set->('monitors', Xconfig::monitor::configure($in, $raw_X, int($raw_X->get_devices)));
- } },
- { label => N("Resolution"), val => \$texts{resolution}, disabled => sub { !$X->{card} || !$X->{monitors} },
- clicked => sub {
- $may_set->('resolution', Xconfig::resolution_and_depth::configure($in, $raw_X, $X->{card}, $X->{monitors}));
- } },
- if_(Xconfig::card::check_bad_card($X->{card}) || $::isStandalone,
- { val => N("Test"), disabled => sub { !$X->{card} || !$X->{monitors} },
- clicked => sub {
- $ok = Xconfig::test::test($in, $raw_X, $X->{card}, 'auto', 0);
- } },
- ),
- { val => N("Options"), clicked => sub {
- Xconfig::various::various($in, $X->{card}, $options);
- $X->{various} = 'done';
- } },
- ]);
- $ok, $b_modified;
-}
-
-sub configure_chooser {
- my ($in, $raw_X, $do_pkgs, $options) = @_;
-
- my $X = {
- card => scalar eval { Xconfig::card::from_raw_X($raw_X) },
- monitors => [ $raw_X->get_monitors ],
- resolution => scalar eval { $raw_X->get_resolution },
- };
- my $before = $raw_X->prepare_write;
- my ($ok) = configure_chooser_raw($in, $raw_X, $do_pkgs, $options, $X);
-
- if ($raw_X->prepare_write ne $before) {
- may_write($in, $raw_X, $X, $ok) or return;
- 'config_changed';
- } else {
- '';
- }
-}
-
-sub configure_everything_or_configure_chooser {
- my ($in, $options, $auto, $o_keyboard, $o_mouse) = @_;
- my $raw_X = eval { Xconfig::xfree->read };
-
- if (!$raw_X) {
- log::l("ERROR: bad X config file $@");
- $in->ask_okcancel('',
- N("Your Xorg configuration file is broken, we will ignore it.")) or return;
- $raw_X = [];
- }
-
- if (is_empty_array_ref($raw_X)) {
- $raw_X = Xconfig::default::configure($in->do_pkgs, $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;
-}
-
-
-sub may_write {
- my ($in, $raw_X, $X, $ok) = @_;
-
- $ok ||= $in->ask_yesorno('', N("Keep the changes?
-The current configuration is:
-
-%s", Xconfig::various::info($raw_X, $X->{card})), 1);
-
- &write($raw_X, $X) if $ok;
- $ok;
-}
-
-sub write {
- my ($raw_X, $X) = @_;
- export_to_install_X($X);
- $raw_X->write;
- Xconfig::various::check_XF86Config_symlink();
- symlinkf "../../usr/X11R6/bin/Xorg", "$::prefix/etc/X11/X";
-}
-
-
-sub export_to_install_X {
- my ($X) = @_;
-
- $::isInstall or return;
-
- $::o->{X}{resolution_wanted} = $X->{resolution}{X};
- $::o->{X}{default_depth} = $X->{resolution}{Depth};
- $::o->{X}{bios_vga_mode} = $X->{resolution}{bios};
- $::o->{X}{monitors} = $X->{monitors} if $X->{monitors}[0]{manually_chosen} && $X->{monitors}[0]{vendor} ne "Plug'n Play";
- $::o->{X}{card} = $X->{card} if $X->{card}{manually_chosen};
- $::o->{X}{Xinerama} = 1 if $X->{card}{Xinerama};
-}
-
-
-#- most usefull XFree86-4.0.1 server options. Default values is the first ones.
-our @options_serverflags = (
- 'DontZap' => [ "Off", "On" ],
- 'DontZoom' => [ "Off", "On" ],
- 'DisableVidModeExtension' => [ "Off", "On" ],
- 'AllowNonLocalXvidtune' => [ "Off", "On" ],
- 'DisableModInDev' => [ "Off", "On" ],
- 'AllowNonLocalModInDev' => [ "Off", "On" ],
- 'AllowMouseOpenFail' => [ "False", "True" ],
- 'VTSysReq' => [ "Off", "On" ],
- 'BlankTime' => [ "10", "5", "3", "15", "30" ],
- 'StandByTime' => [ "20", "10", "6", "30", "60" ],
- 'SuspendTime' => [ "30", "15", "9", "45", "90" ],
- 'OffTime' => [ "40", "20", "12", "60", "120" ],
- 'Pixmap' => [ "32", "24" ],
- 'PC98' => [ "auto-detected", "False", "True" ],
- 'NoPM' => [ "False", "True" ],
-);
-
-1;
diff --git a/perl-install/Xconfig/monitor.pm b/perl-install/Xconfig/monitor.pm
deleted file mode 100644
index fc07484b4..000000000
--- a/perl-install/Xconfig/monitor.pm
+++ /dev/null
@@ -1,220 +0,0 @@
-package Xconfig::monitor; #- $Id$
-
-use diagnostics;
-use strict;
-
-use detect_devices;
-use common;
-use any;
-use log;
-
-
-sub good_default_monitor() {
- arch() =~ /ppc/ ?
- (detect_devices::get_mac_model() =~ /^iBook/ ? 'Apple|iBook 800x600' : 'Apple|iMac/PowerBook 1024x768') :
- (detect_devices::isLaptop() ? 'Generic|Flat Panel 1024x768' : 'Generic|1024x768 @ 70 Hz');
-}
-
-my @VertRefresh_ranges = ("50-70", "50-90", "50-100", "40-150");
-
-my @HorizSync_ranges = (
- "31.5",
- "31.5-35.1",
- "31.5-37.9",
- "31.5-48.5",
- "31.5-57.0",
- "31.5-64.3",
- "31.5-79.0",
- "31.5-82.0",
- "31.5-88.0",
- "31.5-94.0",
-);
-
-sub configure {
- my ($in, $raw_X, $nb_monitors, $o_ddc_info, $b_auto) = @_;
-
- my $monitors = [ $raw_X->get_or_new_monitors($nb_monitors) ];
- if ($o_ddc_info) {
- put_in_hash($monitors->[0], $o_ddc_info);
- }
- my $head_nb = 1;
- foreach my $monitor (@$monitors) {
- choose($in, $monitor, @$monitors > 1 ? $head_nb++ : 0, $b_auto) or return;
- }
- $raw_X->set_monitors(@$monitors);
- $monitors;
-}
-
-sub configure_auto_install {
- my ($raw_X, $old_X) = @_;
-
- if ($old_X->{monitor}) {
- #- keep compatibility
- $old_X->{monitor}{VertRefresh} = $old_X->{monitor}{vsyncrange};
- $old_X->{monitor}{HorizSync} = $old_X->{monitor}{hsyncrange};
-
- #- new name
- $old_X->{monitors} = [ delete $old_X->{monitor} ];
- }
-
- my $monitors = [ $raw_X->get_or_new_monitors($old_X->{monitors} ? int @{$old_X->{monitors}} : 1) ];
- mapn {
- my ($monitor, $auto_install_monitor) = @_;
- put_in_hash($monitor, $auto_install_monitor);
- } $monitors, $old_X->{monitors} if $old_X->{monitors};
-
- if (!$monitors->[0]{HorizSync}) {
- put_in_hash($monitors->[0], getinfoFromDDC());
- }
-
- my $monitors_db = monitors_db();
- foreach my $monitor (@$monitors) {
- if (!configure_automatic($monitor, $monitors_db)) {
- good_default_monitor() =~ /(.*)\|(.*)/ or internal_error("bad good_default_monitor");
- put_in_hash($monitor, { VendorName => $1, ModelName => $2 });
- configure_automatic($monitor, $monitors_db) or internal_error("good_default_monitor (" . good_default_monitor() . ") is unknown in MonitorDB");
- }
- }
- $raw_X->set_monitors(@$monitors);
- $monitors;
-}
-
-sub choose {
- my ($in, $monitor, $head_nb, $b_auto) = @_;
-
- my $monitors_db = monitors_db();
-
- my $ok = configure_automatic($monitor, $monitors_db);
- if ($b_auto) {
- log::l("Xconfig::monitor: auto failed") if !$ok;
- return $ok;
- }
-
- my %h_monitors = map {; "$_->{VendorName}|$_->{ModelName}" => $_ } @$monitors_db;
-
- ask_monitor:
- my $merged_name = do {
- if ($monitor->{VendorName} eq "Plug'n Play") {
- $monitor->{VendorName};
- } else {
- my $merged_name = $monitor->{VendorName} . '|' . $monitor->{ModelName};
-
- if (!exists $h_monitors{$merged_name}) {
- $merged_name = $monitor->{HorizSync} ? 'Custom' : good_default_monitor();
- } else {
- $merged_name;
- }
- }
- };
-
- $in->ask_from_({ title => N("Monitor"),
- messages => $head_nb ? N("Choose a monitor for head #%d", $head_nb) : N("Choose a monitor"),
- interactive_help_id => 'configureX_monitor'
- },
- [ { val => \$merged_name, separator => '|',
- list => ['Custom', "Plug'n Play", sort keys %h_monitors],
- format => sub { $_[0] eq 'Custom' ? N("Custom") :
- $_[0] eq "Plug'n Play" ? N("Plug'n Play") . ($monitor->{VendorName} eq "Plug'n Play" ? " ($monitor->{ModelName})" : '') :
- $_[0] =~ /^Generic\|(.*)/ ? N("Generic") . "|$1" :
- N("Vendor") . "|$_[0]" },
- sort => 0 } ]) or return;
-
- if ($merged_name eq "Plug'n Play") {
- local $::noauto = 0; #- hey, you asked for plug'n play, so i do probe!
- delete @$monitor{'VendorName', 'ModelName', 'EISA_ID'};
- put_in_hash($monitor, getinfoFromDDC()) if $head_nb <= 1;
- if ($head_nb > 1 || configure_automatic($monitor, $monitors_db)) {
- $monitor->{VendorName} = "Plug'n Play";
- } else {
- $in->ask_warn('', N("Plug'n Play probing failed. Please select the correct monitor"));
- goto ask_monitor;
- }
- } elsif ($merged_name eq 'Custom') {
- $in->ask_from('',
-N("The two critical parameters are the vertical refresh rate, which is the rate
-at which the whole screen is refreshed, and most importantly the horizontal
-sync rate, which is the rate at which scanlines are displayed.
-
-It is VERY IMPORTANT that you do not specify a monitor type with a sync range
-that is beyond the capabilities of your monitor: you may damage your monitor.
- If in doubt, choose a conservative setting."),
- [ { val => \$monitor->{HorizSync}, list => \@HorizSync_ranges, label => N("Horizontal refresh rate"), not_edit => 0 },
- { val => \$monitor->{VertRefresh}, list => \@VertRefresh_ranges, label => N("Vertical refresh rate"), not_edit => 0 } ]) or goto &choose;
- delete @$monitor{'VendorName', 'ModelName', 'EISA_ID'};
- } else {
- put_in_hash($monitor, $h_monitors{$merged_name});
- }
- $monitor->{manually_chosen} = 1;
- 1;
-}
-
-sub configure_automatic {
- my ($monitor, $monitors_db) = @_;
-
- if ($monitor->{EISA_ID}) {
- log::l("EISA_ID: $monitor->{EISA_ID}");
- if (my $mon = find { lc($_->{EISA_ID}) eq $monitor->{EISA_ID} } @$monitors_db) {
- add2hash($monitor, $mon);
- log::l("EISA_ID corresponds to: $monitor->{ModelName}");
- } elsif (!$monitor->{HorizSync} || !$monitor->{VertRefresh}) {
- log::l("unknown EISA_ID and partial DDC probe, so unknown monitor");
- delete @$monitor{'VendorName', 'ModelName', 'EISA_ID'};
- }
- } elsif ($monitor->{VendorName}) {
- if (my $mon = find { $_->{VendorName} eq $monitor->{VendorName} && $_->{ModelName} eq $monitor->{ModelName} } @$monitors_db) {
- put_in_hash($monitor, $mon);
- }
- }
-
- return $monitor->{HorizSync} && $monitor->{VertRefresh};
-}
-
-sub getinfoFromDDC() {
- my ($VideoRam, @l) = any::ddcxinfos() or return;
-
- my @Modes;
- local $_;
- while (($_ = shift @l) ne "\n") {
- my ($depth, $x, $y) = split;
- $depth = int(log($depth) / log(2));
-
- push @Modes, [ $x, $y, $depth ];
- }
-
- my ($h, $v, $size, @_modes) = @l;
- {
- VideoRam_probed => to_int($VideoRam),
- HorizSync => first($h =~ /^(\S*)/),
- VertRefresh => first($v =~ /^(\S*)/),
- size => to_float($size),
- if_($size =~ /EISA ID=(\S*)/, EISA_ID => lc($1), VendorName => "Plug'n Play"),
- #- not-used-anymore Modes => \@Modes,
- #- not-used-anymore ModeLines => join('', @m),
- };
-}
-
-sub monitors_db() {
- readMonitorsDB("$ENV{SHARE_PATH}/ldetect-lst/MonitorsDB");
-}
-sub readMonitorsDB {
- my ($file) = @_;
-
- my @monitors_db;
- my $F = openFileMaybeCompressed($file);
- local $_;
- my $lineno = 0; while (<$F>) {
- $lineno++;
- s/\s+$//;
- /^#/ and next;
- /^$/ and next;
-
- my @fields = qw(VendorName ModelName EISA_ID HorizSync VertRefresh dpms);
- my %l; @l{@fields} = split /\s*;\s*/;
- push @monitors_db, \%l;
- }
- \@monitors_db;
-}
-
-
-1;
-
diff --git a/perl-install/Xconfig/parse.pm b/perl-install/Xconfig/parse.pm
deleted file mode 100644
index ab2838b43..000000000
--- a/perl-install/Xconfig/parse.pm
+++ /dev/null
@@ -1,204 +0,0 @@
-package Xconfig::parse; # $Id$
-
-use diagnostics;
-use strict;
-
-use common;
-
-
-sub read_XF86Config {
- my ($file) = @_;
- my $raw_X = raw_from_file($file);
- from_raw(@$raw_X);
- $raw_X;
-}
-
-sub prepare_write_XF86Config {
- my ($raw_X) = @_;
- map { raw_to_string(before_to_string({ %$_ }, 0)) } @$raw_X;
-}
-
-sub write_XF86Config {
- my ($raw_X, $file) = @_;
- my @blocks = prepare_write_XF86Config($raw_X);
- @blocks ? output($file, @blocks) : unlink $file;
-}
-
-sub read_XF86Config_from_string {
- my ($s) = @_;
- my $raw_X = raw_from_file('-', [ split "\n", $s ]);
- from_raw(@$raw_X);
- $raw_X;
-}
-
-#-###############################################################################
-#- raw reading/saving
-#-###############################################################################
-sub raw_from_file { #- internal
- my ($file, $o_lines) = @_;
- my $raw_X = [];
-
- my $lines = $o_lines || [ cat_($file) ];
- my $line;
-
- my ($comment, $obj, @objs);
-
- my $attach_comment = sub {
- $obj || @objs or warn "$file:$line: can't attach comment\n";
- if ($comment) {
- $comment =~ s/\n+$/\n/;
- ($obj || $objs[0])->{$_[0] . '_comment'} = $comment;
- $comment = '';
- }
- };
-
- foreach (@$lines) {
- $line++;
- s/^\s*//; s/\s*$//;
-
- if (/^$/) {
- $comment .= "\n" if $comment;
- next;
- } elsif (@objs ? m/^#\W/ || /^#$/ : /^#/) {
- s/^#\s+/# /;
- $comment .= "$_\n";
- next;
- }
-
- if (/^Section\s+"(.*)"/i) {
- die "$file:$line: missing EndSection\n" if @objs;
- my $e = { name => $1, l => [], kind => 'Section' };
- push @$raw_X, $e;
- unshift @objs, $e; $obj = '';
- $attach_comment->('pre');
- } elsif (/^Subsection\s+"(.*)"/i) {
- die "$file:$line: missing EndSubsection\n" if @objs && $objs[0]{kind} eq 'Subsection';
- die "$file:$line: not in Section\n" if !@objs || $objs[0]{kind} ne 'Section';
- my $e = { name => $1, l => [], kind => 'Subsection' };
- push @{$objs[0]{l}}, $e;
- unshift @objs, $e; $obj = '';
- $attach_comment->('pre');
- } elsif (/^EndSection/i) {
- die "$file:$line: not in Section\n" if !@objs || $objs[0]{kind} ne 'Section';
- $attach_comment->('post');
- shift @objs; $obj = '';
- } elsif (/^EndSubsection/i) {
- die "$file:$line: not in Subsection\n" if !@objs || $objs[0]{kind} ne 'Subsection';
- $attach_comment->('post');
- shift @objs; $obj = '';
- } else {
- die "$file:$line: not in Section\n" if !@objs;
-
- my $commented = s/^#//;
-
- my $comment_on_line;
- s/(\s*#.*)/$comment_on_line = $1; ''/e;
-
- if (/^$/) {
- die "$file:$line: weird";
- }
-
- (my $name, my $Option, $_) =
- /^Option\s*"(.*?)"(.*)/ ? ($1, 1, $2) : /^(\S+)(.*)/ ? ($1, 0, $2) : internal_error($_);
- my ($val) = /(\S.*)/;
-
- my %e = (Option => $Option, commented => $commented, comment_on_line => $comment_on_line, pre_comment => $comment);
- $comment = '';
- $obj = { name => $name, val => $val };
- $e{$_} and $obj->{$_} = $e{$_} foreach keys %e;
-
- push @{$objs[0]{l}}, $obj;
- }
- }
- $raw_X;
-}
-
-sub raw_to_string {
- my ($e, $b_want_spacing) = @_;
- my $s = do {
- if ($e->{l}) {
- my $inside = join('', map_index { raw_to_string($_, $::i) } @{$e->{l}});
- $inside =~ s/^/ /mg;
- qq(\n$e->{kind} "$e->{name}"\n) . $inside . "End$e->{kind}";
- } else {
- ($e->{commented} ? '#' : '') .
- ($e->{Option} ? qq(Option "$e->{name}") : $e->{name}) .
- (defined $e->{val} ? ($e->{Option} && $e->{val} !~ /^"/ ? qq( "$e->{val}") : qq( $e->{val})) : '');
- }
- };
- ($e->{pre_comment} ? ($b_want_spacing ? "\n" : '') . $e->{pre_comment} : '') . $s . ($e->{comment_on_line} || '') . "\n" . ($e->{post_comment} || '');
-}
-
-#-###############################################################################
-#- refine the data structure for easier use
-#-###############################################################################
-my %kind_names = (
- Pointer => [ qw(Protocol Device Emulate3Buttons Emulate3Timeout EmulateWheel EmulateWheelButton) ],
- Mouse => [ qw(DeviceName Protocol Device AlwaysCore Emulate3Buttons Emulate3Timeout EmulateWheel EmulateWheelButton) ], # Subsection in XInput
- Keyboard => [ qw(Protocol Driver XkbModel XkbLayout XkbDisable) ],
- Monitor => [ qw(Identifier VendorName ModelName HorizSync VertRefresh) ],
- Device => [ qw(Identifier VendorName BoardName Chipset Driver VideoRam Screen BusID DPMS power_saver) ],
- Display => [ qw(Depth Modes Virtual) ], # Subsection in Device
- Screen => [ qw(Identifier Driver Device Monitor DefaultColorDepth) ],
- InputDevice => [ qw(Identifier Driver Protocol Device Type Mode XkbModel XkbLayout XkbDisable Emulate3Buttons Emulate3Timeout EmulateWheel EmulateWheelButton) ],
- WacomCursor => [ qw(Port) ], #-\
- WacomStylus => [ qw(Port) ], #--> Port must be first
- WacomEraser => [ qw(Port) ], #-/
- ServerLayout => [ qw(Identifier) ],
-);
-my @want_string = qw(Identifier DeviceName VendorName ModelName BoardName Driver Device Chipset Monitor Protocol XkbModel XkbLayout XkbOptions XkbCompat Load BusID);
-
-%kind_names = map_each { lc $::a => [ map { lc } @$::b ] } %kind_names;
-@want_string = map { lc } @want_string;
-
-sub from_raw {
- sub from_raw__rec {
- my ($current, $e) = @_;
- if ($e->{l}) {
- from_raw($e);
- push @{$current->{l}{$e->{name}}}, $e;
- } else {
- if (member(lc $e->{name}, @want_string)) {
- $e->{val} =~ s/^"(.*)"$/$1/ or warn "$e->{name} $e->{val} has no quote\n";
- }
-
- if (member(lc $e->{name}, @{$kind_names{lc $current->{name}} || []})) {
- if ($current->{l}{$e->{name}} && !$current->{l}{$e->{name}}{commented}) {
- warn "skipping conflicting line for $e->{name} in $current->{name}\n" if !$e->{commented};
- } else {
- $current->{l}{$e->{name}} = $e;
- }
- } else {
- push @{$current->{l}{$e->{name}}}, $e;
- }
- }
- delete $e->{name};
- }
-
- foreach my $e (@_) {
- ($e->{l}, my $l) = ({}, $e->{l});
- from_raw__rec($e, $_) foreach @$l;
-
- delete $e->{kind};
- }
-}
-
-sub before_to_string {
- my ($e, $depth) = @_;
-
- if ($e->{l}) {
- $e->{kind} = $depth ? 'Subsection' : 'Section';
-
- my %rated = map_index { $_ => $::i + 1 } @{$kind_names{lc $e->{name}} || []};
- my @sorted = sort { ($rated{lc $a} || 99) <=> ($rated{lc $b} || 99) } keys %{$e->{l}};
- $e->{l} = [ map {
- my $name = $_;
- map {
- before_to_string({ name => $name, %$_ }, $depth+1);
- } deref_array($e->{l}{$name});
- } @sorted ];
- } elsif (member(lc $e->{name}, @want_string)) {
- $e->{val} = qq("$e->{val}");
- }
- $e;
-}
diff --git a/perl-install/Xconfig/proprietary.pm b/perl-install/Xconfig/proprietary.pm
deleted file mode 100644
index ed196deb7..000000000
--- a/perl-install/Xconfig/proprietary.pm
+++ /dev/null
@@ -1,35 +0,0 @@
-package Xconfig::proprietary; # $Id$
-
-use diagnostics;
-use strict;
-
-use common;
-
-
-sub install_matrox_hal {
- my ($prefix) = @_;
- my $tmpdir = "$prefix/root/tmp";
-
- my $tar = "mgadrivers-2.0.tgz";
- my $dir_in_tar = "mgadrivers";
- my $dest_dir = "$prefix/usr/X11R6/lib/modules/drivers";
-
- #- already installed
- return if -e "$dest_dir/mga_hal_drv.o" || $::testing;
-
- system("wget -O $tmpdir/$tar ftp://ftp.matrox.com/pub/mga/archive/linux/2002/$tar") if !-e "$tmpdir/$tar";
- system("tar xzC $tmpdir -f $tmpdir/$tar");
-
- my $src_dir = "$tmpdir/$dir_in_tar/xfree86/4.2.1/drivers";
- foreach (all($src_dir)) {
- my $src = "$src_dir/$_";
- my $dest = "$dest_dir/$_";
- rename $dest, "$dest.non_hal";
- cp_af($src, $dest_dir);
- }
- rm_rf("$tmpdir/$tar");
- rm_rf("$tmpdir/$dir_in_tar");
-}
-
-1;
-
diff --git a/perl-install/Xconfig/resolution_and_depth.pm b/perl-install/Xconfig/resolution_and_depth.pm
deleted file mode 100644
index df72bc31d..000000000
--- a/perl-install/Xconfig/resolution_and_depth.pm
+++ /dev/null
@@ -1,314 +0,0 @@
-package Xconfig::resolution_and_depth; # $Id$
-
-use diagnostics;
-use strict;
-
-use Xconfig::card;
-use Xconfig::monitor;
-use common;
-
-
-our %depth2text = (
- 8 => N_("256 colors (8 bits)"),
- 15 => N_("32 thousand colors (15 bits)"),
- 16 => N_("65 thousand colors (16 bits)"),
- 24 => N_("16 million colors (24 bits)"),
-);
-our @depths_available = ikeys(%depth2text);
-
-my %min_hsync4x_res = (
- 640 => 31.5,
- 800 => 35.1,
- 1024 => 35.5,
- 1152 => 44.0,
- 1280 => 51.0,
- 1400 => 65.5,
- 1600 => 75.0,
- 1920 => 90.0,
- 2048 => 136.5,
-);
-
-my @bios_vga_modes = (
- { bios => 769, X => 640, Y => 480, Depth => 8 },
- { bios => 771, X => 800, Y => 600, Depth => 8 },
- { bios => 773, X => 1024, Y => 768, Depth => 8 },
- { bios => 775, X => 1280, Y => 1024, Depth => 8 },
- { bios => 777, X => 1600, Y => 1200, Depth => 8 },
- { bios => 784, X => 640, Y => 480, Depth => 15 },
- { bios => 787, X => 800, Y => 600, Depth => 15 },
- { bios => 790, X => 1024, Y => 768, Depth => 15 },
- { bios => 793, X => 1280, Y => 1024, Depth => 15 },
- { bios => 796, X => 1600, Y => 1200, Depth => 15 },
- { bios => 785, X => 640, Y => 480, Depth => 16 },
- { bios => 788, X => 800, Y => 600, Depth => 16 },
- { bios => 791, X => 1024, Y => 768, Depth => 16 },
- { bios => 794, X => 1280, Y => 1024, Depth => 16 },
- { bios => 797, X => 1600, Y => 1200, Depth => 16 },
-);
-
-sub from_bios {
- my ($bios) = @_;
- find { $_->{bios} == $bios } @bios_vga_modes;
-}
-
-sub bios_vga_modes() { @bios_vga_modes }
-
-sub size2default_resolution {
- my ($size) = @_; #- size in inch
-
- if (arch() =~ /ppc/) {
- require detect_devices;
- return "1024x768" if detect_devices::get_mac_model() =~ /^PowerBook|^iMac/;
- }
-
- my %monitorSize2resolution = (
- 13 => "640x480",
- 14 => "800x600",
- 15 => "800x600",
- 16 => "1024x768",
- 17 => "1024x768",
- 18 => "1024x768",
- 19 => "1280x1024",
- 20 => "1280x1024",
- 21 => "1600x1200",
- 22 => "1600x1200",
- );
- $monitorSize2resolution{round($size)} || ($size < 13 ? "640x480" : "1600x1200");
-}
-
-sub to_string {
- my ($resolution) = @_;
- $resolution or return '';
-
- $resolution->{X} ? sprintf("%sx%s %dbpp", @$resolution{'X', 'Y', 'Depth'}) : 'frame-buffer';
-}
-
-sub allowed {
- my ($card) = @_;
-
- my ($prefered_depth, @resolution_and_depth);
-
- if ($card->{Driver} eq 'fbdev') {
- @resolution_and_depth = grep { $_->{Depth} == 16 } @bios_vga_modes;
- } else {
- my @depths;
- if ($card->{Driver} eq 'fglrx') {
- @depths = 24;
- } elsif ($card->{BoardName} eq 'RIVA128') {
- @depths = qw(8 15 24);
- } elsif ($card->{use_DRI_GLX}) {
- $prefered_depth = 16;
- @depths = (16, 24);
- } else {
- @depths = our @depths_available;
- }
- my @resolutions = @Xconfig::xfree::resolutions;
-
- push @resolution_and_depth,
- map {
- my $Depth = $_;
- map { m/(\d+)x(\d+)/ && { X => $1, Y => $2, Depth => $Depth } } @resolutions;
- } @depths;
- }
- $prefered_depth, @resolution_and_depth;
-}
-
-# ($card->{VideoRam} || ($card->{server} eq 'FBDev' ? 2048 : 32768))
-sub filter_using_VideoRam {
- my ($VideoRam, @resolutions) = @_;
- my $mem = 1024 * $VideoRam;
- grep { $_->{X} * $_->{Y} * $_->{Depth}/8 <= $mem } @resolutions;
-
-}
-sub filter_using_HorizSync {
- my ($HorizSync, @resolutions) = @_;
- my $hsync = max(split(/[,-]/, $HorizSync));
- grep { ($min_hsync4x_res{$_->{X}} || 0) <= $hsync } @resolutions;
-}
-
-sub choose {
- my ($in, $default_resolution, @resolutions) = @_;
-
- my $resolution = $default_resolution || {};
- $in->ask_from(N("Resolutions"), "",
- [ {
- val => \$resolution, type => 'list', sort => 0,
- list => [ sort { $a->{X} <=> $b->{X} } @resolutions ],
- format => \&to_string,
- } ]) or return;
- $resolution;
-}
-
-
-sub choices {
- my ($_raw_X, $resolution_wanted, $card, $monitors) = @_;
- $resolution_wanted ||= {};
-
- my ($prefered_depth, @resolutions) = allowed($card);
-
- @resolutions = filter_using_HorizSync($monitors->[0]{HorizSync}, @resolutions) if $monitors->[0]{HorizSync};
- @resolutions = filter_using_VideoRam($card->{VideoRam}, @resolutions) if $card->{VideoRam};
-
- my $x_res = do {
- my $res = $resolution_wanted->{X} || ($monitors->[0]{ModelName} =~ /^Flat Panel (\d+x\d+)$/ ? $1 : size2default_resolution($monitors->[0]{size} || 14));
- my $x_res = first(split 'x', $res);
- #- take the first available resolution <= the wanted resolution
- max map { if_($_->{X} <= $x_res, $_->{X}) } @resolutions;
- };
-
- my @matching = grep { $_->{X} eq $x_res } @resolutions;
- my @Depths = map { $_->{Depth} } @matching;
-
- my $Depth = $resolution_wanted->{Depth};
- $Depth = $prefered_depth if !$Depth || !member($Depth, @Depths);
- $Depth = max(@Depths) if !$Depth || !member($Depth, @Depths);
-
- #- finding it in @resolutions (well @matching)
- #- (that way, we check it exists, and we get field "bios" for fbdev)
- my @default_resolutions = sort { $b->{Y} <=> $a->{Y} } grep { $_->{Depth} eq $Depth } @matching;
- my $default_resolution = (find { $resolution_wanted->{Y} eq $_->{Y} } @default_resolutions) || $default_resolutions[0];
-
- $default_resolution, @resolutions;
-}
-
-sub configure {
- my ($in, $raw_X, $card, $monitors, $b_auto) = @_;
-
- my ($default_resolution, @resolutions) = choices($raw_X, $raw_X->get_resolution, $card, $monitors);
-
- if ($b_auto) {
- #- use $default_resolution
- 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);
- }
- } elsif ($in->isa('interactive::gtk')) {
- $default_resolution = choose_gtk($in, $card, $default_resolution, @resolutions) or return;
- } else {
- $default_resolution = choose($in, $default_resolution, @resolutions) or return;
- }
- $raw_X->set_resolution($default_resolution);
-
- $default_resolution;
-}
-
-sub configure_auto_install {
- my ($raw_X, $card, $monitors, $old_X) = @_;
-
- my $resolution_wanted = { X => $old_X->{resolution_wanted}, Depth => $old_X->{default_depth} };
-
- my ($default_resolution) = choices($raw_X, $resolution_wanted, $card, $monitors);
- $default_resolution or die "you selected an unusable depth";
-
- $raw_X->set_resolution($default_resolution);
-
- $default_resolution;
-}
-
-sub choose_gtk {
- my ($in, $card, $default_resolution, @resolutions) = @_;
-
- my ($chosen_x_res, $chosen_y_res, $chosen_Depth) = @$default_resolution{'X', 'Y', 'Depth'};
- $chosen_x_res ||= 640;
-
- my %x_res2depth; push @{$x_res2depth{$_->{X}}}, $_->{Depth} foreach @resolutions;
- my %depth2x_res; push @{$depth2x_res{$_->{Depth}}}, $_->{X} foreach @resolutions;
-
- require ugtk2;
- ugtk2->import(qw(:create :helpers :wrappers));
- my $W = ugtk2->new(N("Resolution"));
-
- my %monitor_images_x_res = do {
- my @l = qw(640 800 1024 1152 1280 1400 1600 1920 2048);
- my %h = map { $_ => ugtk2::_find_imgfile("monitor-$_.png") } @l;
-
- #- for the other, use the biggest smaller
- foreach my $x_res (uniq map { $_->{X} } @resolutions) {
- my $x_res_ = max(grep { $_ <= $x_res } @l);
- $h{$x_res} ||= $h{$x_res_};
- }
- %h;
- };
-
- my ($depth_combo, $x_res_combo) = (Gtk2::ComboBox->new_text, Gtk2::ComboBox->new_text);
-
- my $pix_colors = Gtk2::Image->new;
- my $set_chosen_Depth_image = sub {
- $pix_colors->set_from_file(ugtk2::_find_imgfile(
- $chosen_Depth >= 24 ? "colors.png" :
- $chosen_Depth >= 15 ? "colors16.png" : "colors8.png"));
- };
-
- my $set_chosen_Depth = sub {
- $chosen_Depth = $_[0];
- $depth_combo->entry->set_text(translate($depth2text{$chosen_Depth}));
- $set_chosen_Depth_image->();
- };
-
- my $pixmap_mo = Gtk2::Image->new;
- my $set_chosen_resolution = sub {
- $chosen_x_res = $_[0];
- if ($_[1]) {
- $chosen_y_res = $_[1];
- } else {
- #- take one
- my $one = find { $_->{X} eq $chosen_x_res } @resolutions;
- $chosen_y_res = $one->{Y};
- }
- my $image = $monitor_images_x_res{$chosen_x_res} or internal_error("no image for resolution $chosen_x_res");
- $pixmap_mo->set_from_file($image);
- $x_res_combo->entry->set_text($chosen_x_res . "x" . $chosen_y_res);
- };
- $x_res_combo->set_popdown_strings(uniq map { "$_->{X}x$_->{Y}" } sort { $a->{X} <=> $b->{X} } @resolutions);
- $set_chosen_resolution->($chosen_x_res, $chosen_y_res);
-
- my $help_sub = $in->interactive_help_sub_display_id('configureX_resolution');
- gtkadd($W->{window},
- gtkpack_($W->create_box_with_title(N("Choose the resolution and the color depth"),
- if_($card->{BoardName}, "(" . N("Graphics card: %s", $card->{BoardName}) . ")"),
- ),
- 1, gtkpack2(Gtk2::VBox->new(0,0),
- gtkpack2__(Gtk2::VBox->new(0, 15),
- $pixmap_mo,
- gtkpack2(Gtk2::HBox->new(0,0),
- create_packtable({ col_spacings => 5, row_spacings => 5 },
- [ $x_res_combo, Gtk2::Label->new("") ],
- [ $depth_combo, gtkadd(gtkset_shadow_type(Gtk2::Frame->new, 'etched_out'), $pix_colors) ],
- ),
- ),
- ),
- ),
- 0, gtkadd($W->create_okcancel(N("Ok"), N("Cancel"), '', if_($help_sub, [ N("Help"), $help_sub, 1 ]))),
- ));
- $depth_combo->set_popdown_strings(map { translate($depth2text{$_}) } ikeys %depth2x_res);
- $depth_combo->entry->set_size_request(220, -1);
- $depth_combo->entry->signal_connect(changed => sub {
- my %txt2depth = reverse %depth2text;
- my $s = $depth_combo->entry->get_text;
- $chosen_Depth = $txt2depth{untranslate($s, keys %txt2depth)};
- $set_chosen_Depth_image->();
-
- if (!member($chosen_x_res, @{$depth2x_res{$chosen_Depth}})) {
- $set_chosen_resolution->(max(@{$depth2x_res{$chosen_Depth}}));
- }
- });
- $x_res_combo->entry->signal_connect(changed => sub {
- $set_chosen_resolution->($1, $2) if $x_res_combo->entry->get_text =~ /(\d+)x(\d+)/;
-
- if (!member($chosen_Depth, @{$x_res2depth{$chosen_x_res}})) {
- $set_chosen_Depth->(max(@{$x_res2depth{$chosen_x_res}}));
- }
- });
- $set_chosen_resolution->($chosen_x_res, $chosen_y_res);
- $set_chosen_Depth->($chosen_Depth);
- $W->{ok}->grab_focus;
-
- $W->main or return;
-
- find { $_->{X} == $chosen_x_res &&
- $_->{Y} == $chosen_y_res &&
- $_->{Depth} == $chosen_Depth } @resolutions;
-}
-
-1;
diff --git a/perl-install/Xconfig/screen.pm b/perl-install/Xconfig/screen.pm
deleted file mode 100644
index 89e416a4d..000000000
--- a/perl-install/Xconfig/screen.pm
+++ /dev/null
@@ -1,29 +0,0 @@
-package Xconfig::screen; # $Id$
-
-use diagnostics;
-use strict;
-
-use common;
-
-
-sub configure {
- my ($raw_X) = @_;
-
- my @devices = $raw_X->get_devices;
- my @monitors = $raw_X->get_monitors;
-
- if (@monitors < @devices) {
- $raw_X->set_monitors(@monitors, ({}) x (@devices - @monitors));
- @monitors = $raw_X->get_monitors;
- }
-
- my @sections = mapn {
- my ($device, $monitor) = @_;
- { Device => $device->{Identifier}, Monitor => $monitor->{Identifier} }
- } \@devices, \@monitors;
-
- $raw_X->set_screens(@sections);
- 1;
-}
-
-1;
diff --git a/perl-install/Xconfig/test.pm b/perl-install/Xconfig/test.pm
deleted file mode 100644
index ae4f1a9ec..000000000
--- a/perl-install/Xconfig/test.pm
+++ /dev/null
@@ -1,144 +0,0 @@
-package Xconfig::test; # $Id$
-
-use diagnostics;
-use strict;
-
-use Xconfig::card;
-use run_program;
-use common;
-use log;
-
-
-my $tmpconfig = "/tmp/Xconfig";
-
-
-sub xtest {
- my ($display) = @_;
- eval {
- require xf86misc::main;
- xf86misc::main::Xtest($display);
- };
-}
-
-sub test {
- my ($in, $raw_X, $card, $auto, $skip_badcard) = @_;
-
- my $bad_card = !Xconfig::card::check_bad_card($card);
- return 1 if $skip_badcard && $bad_card;
-
- if ($bad_card || !$auto) {
- $in->ask_yesorno(N("Test of the configuration"),
- N("Do you want to test the configuration?") . ($bad_card ? "\n" . N("Warning: testing this graphic card may freeze your computer") : ''),
- !$bad_card) or return 1;
- }
-
- unlink "$::prefix/tmp/.X9-lock";
-
- #- create a link from the non-prefixed /tmp/.X11-unix/X9 to the prefixed one
- #- that way, you can talk to :9 without doing a chroot
- #- but take care of non X11 install :-)
- if (-d "/tmp/.X11-unix") {
- symlinkf "$::prefix/tmp/.X11-unix/X9", "/tmp/.X11-unix/X9" if $::prefix;
- } else {
- symlinkf "$::prefix/tmp/.X11-unix", "/tmp/.X11-unix" if $::prefix;
- }
-
- #- ensure xfs is running
- fuzzy_pidofs(qr/\bxfs\b/) or do { run_program::rooted($::prefix, "/etc/rc.d/init.d/xfs", $_) foreach 'stop', 'start' };
- fuzzy_pidofs(qr/\bxfs\b/) or die "xfs is not running";
-
- my $f = $::testing ? $tmpconfig : "/etc/X11/XF86Config.test";
- $raw_X->write("$::prefix/$f");
-
- my $f_err = common::secured_file($::prefix . ($ENV{TMPDIR} || "$ENV{HOME}/tmp") . '/.drakx.Xoutput');
-
- my $pid;
- unless ($pid = fork()) {
- system("xauth add :9 . `mcookie`");
- open STDERR, ">$f_err";
- chroot $::prefix if $::prefix;
- exec 'Xorg', '-xf86config', $f, ":9" or c::_exit(0);
- }
-
- do { sleep 1 } until xtest(":9") || waitpid($pid, c::WNOHANG());
-
- my $_b = before_leaving { unlink $f_err };
-
- my $warn_error = sub {
- my ($error_msg) = @_;
- $in->ask_warn('', [ N("An error occurred:\n%s\nTry to change some parameters", $error_msg) ]);
- };
-
- if (!xtest(":9")) {
- open(my $F, $f_err);
-
- local $_;
- i: while (<$F>) {
- if (/^\(EE\)/ && !/Disabling/ || /^Fatal\b/) {
- my @msg = !/error/ && $_;
- local $_;
- while (<$F>) {
- /reporting a problem/ and last;
- $warn_error->(join('', @msg, $_));
- return 0;
- }
- }
- }
- }
-
- open(my $F, "|perl 2>/dev/null");
- printf $F q(
- use lib qw(%s);
- BEGIN { $::no_ugtk_init = 1 }
- require lang;
- require ugtk2; #- help perl_checker
- ugtk2->import(qw(:wrappers :helpers)); #- help perl_checker
- use interactive::gtk;
- use run_program;
- use common;
-
- $::prefix = "%s";
- $::isStandalone = 1;
-
- lang::bindtextdomain();
-
- $ENV{DISPLAY} = ":9";
- Gtk2->init;
-
- gtkset_background(200 * 257, 210 * 257, 210 * 257);
- my ($h, $w) = gtkroot()->get_size;
- $ugtk2::force_center = 1;
- $ugtk2::force_focus = 1;
- my $text = Gtk2::Label->new;
- my $time = 12;
- Glib::Timeout->add(1000, sub {
- $text->set(sprintf(translate("%s"), $time));
- $time-- or Gtk2->main_quit;
- 1;
- });
-
- eval { #- eval it so that missing pixmap will not break the test completely
- my $root = gtkroot();
- my $gc = Gtk2::Gdk::GC->new($root);
- my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file("$::prefix/usr/share/mdk/xfdrake/xfdrake-test-card.png");
- my ($w, $h) = ($pixbuf->get_width, $pixbuf->get_height);
- my $pixmap = Gtk2::Gdk::Pixmap->new($root, $w, $h, $root->get_depth);
- $pixbuf->render_to_drawable($pixmap, $gc, 0, 0, 0, 0, $w, $h, 'none', 0, 0);
- $root->set_back_pixmap($pixmap, 0);
- $root->clear;
- };
-
- my $in = interactive::gtk->new;
- $in->exit($in->ask_yesorno('', [ translate("%s"), $text ], 0) ? 0 : 222);
- ), join(' ', @INC), $::prefix, N_("Leaving in %d seconds"), N_("Is this the correct setting?");
- my $rc = close $F;
- my $err = $?;
-
- $rc || $err == 222 << 8 or $warn_error->('');
-
- unlink "$::prefix/$f", "$::prefix/$f-4";
- unlink "/tmp/.X11-unix/X9" if $::prefix;
- kill 2, $pid;
-
- $rc;
-}
diff --git a/perl-install/Xconfig/various.pm b/perl-install/Xconfig/various.pm
deleted file mode 100644
index c1997fb5a..000000000
--- a/perl-install/Xconfig/various.pm
+++ /dev/null
@@ -1,152 +0,0 @@
-package Xconfig::various; # $Id$
-
-use diagnostics;
-use strict;
-
-use Xconfig::card;
-use Xconfig::default;
-use Xconfig::resolution_and_depth;
-use common;
-
-
-sub to_string {
- my ($raw_X) = @_;
-
- $raw_X->is_fbdev ? 'frame-buffer' : Xconfig::resolution_and_depth::to_string($raw_X->get_resolution);
-}
-
-sub info {
- my ($raw_X, $card) = @_;
- my $info;
- my $xf_ver = Xconfig::card::xorg_version();
- my $title = $card->{use_DRI_GLX} ? N("Xorg %s with 3D hardware acceleration", $xf_ver) :
- N("Xorg %s", $xf_ver);
- my $keyboard = eval { $raw_X->get_keyboard } || {};
- my @monitors = eval { $raw_X->get_monitors };
- my $device = eval { $raw_X->get_device } || {};
- my $mouse = eval { first($raw_X->get_mice) } || {};
-
- $info .= N("Keyboard layout: %s\n", $keyboard->{XkbLayout});
- $info .= N("Mouse type: %s\n", $mouse->{Protocol});
- $info .= N("Mouse device: %s\n", $mouse->{Device}) if $::expert;
- foreach my $monitor (@monitors) {
- $info .= N("Monitor: %s\n", $monitor->{ModelName});
- $info .= N("Monitor HorizSync: %s\n", $monitor->{HorizSync}) if $::expert;
- $info .= N("Monitor VertRefresh: %s\n", $monitor->{VertRefresh}) if $::expert;
- }
- $info .= N("Graphics card: %s\n", $device->{VendorName} . ' ' . $device->{BoardName});
- $info .= N("Graphics memory: %s kB\n", $device->{VideoRam}) if $device->{VideoRam};
- if (my $resolution = eval { $raw_X->get_resolution }) {
- $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("Xorg driver: %s\n", $device->{Driver}) if $device->{Driver};
- "$title\n\n$info";
-}
-
-sub various {
- my ($in, $card, $options, $b_auto) = @_;
-
- tvout($in, $card, $options) if !$b_auto;
- choose_xdm($in, $b_auto);
- 1;
-}
-
-sub runlevel {
- my ($o_runlevel) = @_;
- my $f = "$::prefix/etc/inittab";
- -r $f or log::l("missing inittab!!!"), return;
- if ($o_runlevel) {
- substInFile { s/^id:\d:initdefault:\s*$/id:$o_runlevel:initdefault:\n/ } $f if !$::testing;
- } else {
- cat_($f) =~ /^id:(\d):initdefault:\s*$/m && $1;
- }
-}
-
-sub choose_xdm {
- my ($in, $b_auto) = @_;
- my $xdm = $::isStandalone ? runlevel() == 5 : 1;
-
- if (!$b_auto) {
- $xdm = $in->ask_yesorno_({
- title => N("Graphical interface at startup"),
- messages =>
-N("I can setup your computer to automatically start the graphical interface (Xorg) upon booting.
-Would you like Xorg to start when you reboot?"),
- interactive_help_id => 'configureXxdm',
- }, $xdm);
- }
- runlevel($xdm ? 5 : 3);
-}
-
-sub tvout {
- my ($in, $card, $options) = @_;
-
- $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.
-
-For this you have to plug your graphic card to your TV before booting your computer.
-Then choose the \"TVout\" entry in the bootloader
-
-Do you have this feature?")) or return;
-
- #- rough default value (rationale: http://download.nvidia.com/XFree86_40/1.0-2960/README.txt)
- require timezone;
- my $norm = timezone::read()->{timezone} =~ /America/ ? 'NTSC' : 'PAL';
-
- $norm = $in->ask_from_list('', N("What norm is your TV using?"), [ 'NTSC', 'PAL' ], $norm) or return;
-
- configure_FB_TVOUT($in->do_pkgs, { norm => $norm });
-}
-
-sub configure_FB_TVOUT {
- my ($do_pkgs, $use_FB_TVOUT) = @_;
-
- my $raw_X = Xconfig::default::configure($do_pkgs);
- return if is_empty_array_ref($raw_X);
-
- $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' },
- ];
- $raw_X->set_devices({ Driver => 'fbdev' });
-
- my ($device) = $raw_X->get_devices;
- my ($monitor) = $raw_X->get_monitors;
- $raw_X->set_screens({ Device => $device->{Identifier}, Monitor => $monitor->{Identifier} });
-
- my $Screen = $raw_X->get_default_screen;
- $Screen->{Display} = [ map { { l => { Depth => { val => $_ } } } } 8, 16 ];
-
- $raw_X->write("$::prefix/etc/X11/XF86Config.tvout");
-
- check_XF86Config_symlink();
-
- {
- require bootloader;
- require fsedit;
- require detect_devices;
- my $all_hds = $::isInstall ? $::o->{all_hds} : fsedit::get_hds();
- my $bootloader = $::isInstall ? $::o->{bootloader} : bootloader::read($all_hds);
-
- if (my $tvout = bootloader::duplicate_kernel_entry($bootloader, 'TVout')) {
- $tvout->{append} .= " XFree=tvout";
- bootloader::install($bootloader, $all_hds);
- }
- }
-}
-
-sub check_XF86Config_symlink() {
- my $f = "$::prefix/etc/X11/XF86Config";
- if (!-l $f && -e "$f.tvout") {
- rename $f, "$f.standard";
- symlink "XF86Config.standard", $f;
- }
-}
-
-1;
diff --git a/perl-install/Xconfig/xfree.pm b/perl-install/Xconfig/xfree.pm
deleted file mode 100644
index ba2c2cedf..000000000
--- a/perl-install/Xconfig/xfree.pm
+++ /dev/null
@@ -1,555 +0,0 @@
-package Xconfig::xfree; # $Id$
-
-use diagnostics;
-use strict;
-
-use common;
-use Xconfig::parse;
-
-#- mostly internal only
-sub new {
- my ($class, $val) = @_;
- bless $val, $class;
-}
-
-################################################################################
-# I/O ##########################################################################
-################################################################################
-sub read {
- my ($class) = @_;
- my @files = map { "$::prefix/etc/X11/$_" } 'xorg.conf', 'XF86Config-4', 'XF86Config';
- my $file = (find { -f $_ && ! -l $_ } @files) || (find { -f $_ } @files);
- my $raw_X = $class->new(Xconfig::parse::read_XF86Config($file));
-
- if (my ($Keyboard) = $raw_X->get_InputDevices('Keyboard')) {
- $Keyboard->{Driver}{val} = 'keyboard';
- }
- $raw_X;
-}
-sub write {
- my ($raw_X, $o_file) = @_;
- my $file = $o_file || "$::prefix/etc/X11/XF86Config";
- if (!$o_file) {
- my $xorg = "$::prefix/etc/X11/xorg.conf";
- foreach ($file, "$file-4", $xorg) {
- if (-l $_) {
- unlink $_;
- } else {
- rename $_, "$_.old"; #- there won't be any XF86Config-4 anymore, we want this!
- }
- }
- symlinkf 'XF86Config', $xorg;
- }
- Xconfig::parse::write_XF86Config($raw_X, $file);
-}
-sub prepare_write {
- my ($raw_X) = @_;
- join('', Xconfig::parse::prepare_write_XF86Config($raw_X));
-}
-sub empty_config {
- my ($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 = first($raw_X->get_InputDevices('keyboard')) or die "no keyboard section";
- raw_export_section($raw_kbd, \@keyboard_fields);
-}
-sub set_keyboard {
- my ($raw_X, $kbd) = @_;
- my $raw_kbd = first($raw_X->get_InputDevices('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;
-}
-
-
-################################################################################
-# synaptics ####################################################################
-################################################################################
-sub set_synaptics {
- my ($raw_X, @synaptics) = @_;
- $raw_X->remove_InputDevices('synaptics');
-
- my $layout = get_ServerLayout($raw_X)->{InputDevice} ||= [];
- @$layout = grep { $_->{val} !~ /^"SynapticsMouse/ } @$layout;
-
- @synaptics or return;
- add_load_module($raw_X, "synaptics");
-
- each_index {
- my $synaptics_mouse = $_;
- my $identifier = "SynapticsMouse" . ($::i + 1);
- my $pointer_type = $synaptics_mouse->{Primary} ? "CorePointer" : "AlwaysCore";
- my $h = { Identifier => { val => $identifier },
- Driver => { val => "synaptics" },
- Device => { val => $synaptics_mouse->{Device}, Option => 1 },
- Protocol => { val => $synaptics_mouse->{Protocol}, Option => 1 },
- LeftEdge => { val => 1700, Option => 1 },
- RightEdge => { val => 5300, Option => 1 },
- TopEdge => { val => 1700, Option => 1 },
- BottomEdge => { val => 4200, Option => 1 },
- FingerLow => { val => 25, Option => 1 },
- FingerHigh => { val => 30, Option => 1 },
- MaxTapTime => { val => 180, Option => 1 },
- MaxTapMove => { val => 220, Option => 1 },
- VertScrollDelta => { val => 100, Option => 1 },
- MinSpeed => { val => '0.06', Option => 1 },
- MaxSpeed => { val => '0.12', Option => 1 },
- AccelFactor => { val => '0.0010', Option => 1 },
- SHMConfig => { val => "on", Option => 1 },
- };
- $raw_X->add_Section('InputDevice', $h);
- push @$layout, { val => qq("$identifier" "$pointer_type") };
- } @synaptics;
-}
-
-
-################################################################################
-# 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_or_new_monitors {
- my ($raw_X, $nb_new) = @_;
- my @monitors = $raw_X->get_monitors;
-
- #- ensure we have exactly $nb_new monitors;
- if ($nb_new > @monitors) {
- @monitors, ({}) x ($nb_new - @monitors);
- } else {
- splice(@monitors, 0, $nb_new);
- }
-}
-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';
-}
-
-
-
-
-################################################################################
-# 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', {});
-
- 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);
-}
-
-
-#-##############################################################################
-#- helpers
-#-##############################################################################
-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 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]);
- }
-}
-
-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',
- '1024x480', '1024x768',
- '1152x768', '1152x864',
- '1280x800', # 16/10,
- '1280x960', '1280x1024',
- '1400x1050',
- '1600x1200',
- '1680x1050', # 16/10
- '1920x1200', # 16/10
- '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
-
- # Dell D800 and few Inspiron (16/10) 1280x800
- ModeLine "1280x800" 147.89 1280 1376 1512 1744 800 801 804 848
- # Dell D800 and few Inspiron (16/10) 1680x1050
- ModeLine "1680x1050" 214.51 1680 1800 1984 2288 1050 1051 1054 1103
- # Dell D800 and few Inspiron (16/10) 1920x1200
- ModeLine "1920x1200" 230 1920 1936 2096 2528 1200 1201 1204 1250 +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;