diff options
Diffstat (limited to 'perl-install/Xconfig/main.pm')
-rw-r--r-- | perl-install/Xconfig/main.pm | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/perl-install/Xconfig/main.pm b/perl-install/Xconfig/main.pm index cab241fae..1e11b2b49 100644 --- a/perl-install/Xconfig/main.pm +++ b/perl-install/Xconfig/main.pm @@ -17,7 +17,7 @@ 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; + Xconfig::monitor::configure($in, $raw_X) or return; if ($raw_X->prepare_write ne $before) { $raw_X->write; 'config_changed'; @@ -30,9 +30,9 @@ sub configure_resolution { my ($in, $raw_X) = @_; my $card = Xconfig::card::from_raw_X($raw_X); - my $monitors = [ $raw_X->get_monitors ]; + my $monitor = Xconfig::monitor::from_raw_X($raw_X); my $before = $raw_X->prepare_write; - Xconfig::resolution_and_depth::configure($in, $raw_X, $card, $monitors) or return; + Xconfig::resolution_and_depth::configure($in, $raw_X, $card, $monitor) or return; if ($raw_X->prepare_write ne $before) { $raw_X->write; 'config_changed'; @@ -45,11 +45,11 @@ sub configure_resolution { 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->{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) or return; - $X->{resolution} = Xconfig::resolution_and_depth::configure_auto_install($raw_X, $X->{card}, $X->{monitors}, $old_X); + Xconfig::screen::configure($raw_X, $X->{card}) or return; + $X->{resolution} = Xconfig::resolution_and_depth::configure_auto_install($raw_X, $X->{card}, $X->{monitor}, $old_X); &write($raw_X, $X); @@ -61,13 +61,11 @@ 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->{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 &&= $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::screen::configure($raw_X, $X->{card}); + $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; if (!$ok) { @@ -88,7 +86,7 @@ sub configure_chooser_raw { my $update_texts = sub { $texts{card} = $X->{card} && $X->{card}{BoardName} || N("Custom"); - $texts{monitors} = $X->{monitors} && $X->{monitors}[0]{ModelName} || N("Custom"); + $texts{monitor} = $X->{monitor} && $X->{monitor}{ModelName} || N("Custom"); $texts{resolution} = Xconfig::resolution_and_depth::to_string($X->{resolution}); $texts{$_} =~ s/(.{20}).*/$1.../ foreach keys %texts; #- ensure not too long @@ -103,8 +101,8 @@ sub configure_chooser_raw { $b_modified = 1; $update_texts->(); - if (member($field, 'card', 'monitors')) { - Xconfig::screen::configure($raw_X); + if (member($field, 'card', 'monitor')) { + Xconfig::screen::configure($raw_X, $X->{card}); $raw_X->set_resolution($X->{resolution}) if $X->{resolution}; } } @@ -117,15 +115,15 @@ sub configure_chooser_raw { { 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("Monitor"), val => \$texts{monitor}, clicked => sub { + $may_set->('monitor', Xconfig::monitor::configure($in, $raw_X)); } }, - { label => N("Resolution"), val => \$texts{resolution}, disabled => sub { !$X->{card} || !$X->{monitors} }, + { label => N("Resolution"), val => \$texts{resolution}, disabled => sub { !$X->{card} || !$X->{monitor} }, clicked => sub { - $may_set->('resolution', Xconfig::resolution_and_depth::configure($in, $raw_X, $X->{card}, $X->{monitors})); + $may_set->('resolution', Xconfig::resolution_and_depth::configure($in, $raw_X, $X->{card}, $X->{monitor})); } }, if_(Xconfig::card::check_bad_card($X->{card}) || $::isStandalone, - { val => N("Test"), disabled => sub { !$X->{card} || !$X->{monitors} }, + { val => N("Test"), disabled => sub { !$X->{card} || !$X->{monitor} }, clicked => sub { $ok = Xconfig::test::test($in, $raw_X, $X->{card}, 'auto', 0); } }, @@ -143,7 +141,7 @@ sub configure_chooser { my $X = { card => scalar eval { Xconfig::card::from_raw_X($raw_X) }, - monitors => [ $raw_X->get_monitors ], + monitor => $raw_X->get_monitors && Xconfig::monitor::from_raw_X($raw_X), resolution => scalar eval { $raw_X->get_resolution }, }; my $before = $raw_X->prepare_write; @@ -160,12 +158,17 @@ 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}}; - 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; + return $raw_X if $has_conf && $auto; + + if ($has_conf) { + Xconfig::main::configure_chooser($in, $raw_X, $in->do_pkgs, $options) or return; } else { - Xconfig::main::configure_chooser($in, $raw_X, $in->do_pkgs, $options) or return if !$auto; + Xconfig::main::configure_everything($in, $raw_X, $in->do_pkgs, $auto, $options) or return; } $raw_X; } @@ -188,7 +191,7 @@ sub write { export_to_install_X($X); $raw_X->write; Xconfig::various::check_XF86Config_symlink(); - symlinkf "../../usr/X11R6/bin/XFree86", "$::prefix/etc/X11/X"; + symlinkf "../..$X->{card}{prog}", "$::prefix/etc/X11/X" if $X->{card}{server} !~ /Xpmac/; } @@ -200,8 +203,8 @@ sub export_to_install_X { $::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}{monitor} = $X->{monitor} if $X->{monitor}{manually_chosen} && $X->{monitor}{vendor} ne "Plug'n Play"; + $::o->{X}{card} = $X->{monitor} if $X->{card}{manually_chosen}; $::o->{X}{Xinerama} = 1 if $X->{card}{Xinerama}; } |