summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-05-07 10:15:17 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-05-07 10:15:17 +0000
commita72f7bb1d7790993ef294f770e80517a8761abfc (patch)
treedc38c66018ac81ad85bbf3c7e563889db45e66d7
parent67fa57fea049bcb27429f921a84cbffdd83faee1 (diff)
downloaddrakx-backup-do-not-use-a72f7bb1d7790993ef294f770e80517a8761abfc.tar
drakx-backup-do-not-use-a72f7bb1d7790993ef294f770e80517a8761abfc.tar.gz
drakx-backup-do-not-use-a72f7bb1d7790993ef294f770e80517a8761abfc.tar.bz2
drakx-backup-do-not-use-a72f7bb1d7790993ef294f770e80517a8761abfc.tar.xz
drakx-backup-do-not-use-a72f7bb1d7790993ef294f770e80517a8761abfc.zip
you can now configure monitors on heads > 1
-rw-r--r--perl-install/Xconfig/main.pm40
-rw-r--r--perl-install/Xconfig/monitor.pm68
-rw-r--r--perl-install/Xconfig/resolution_and_depth.pm14
-rw-r--r--perl-install/Xconfig/various.pm10
-rw-r--r--perl-install/Xconfig/xfree.pm14
5 files changed, 82 insertions, 64 deletions
diff --git a/perl-install/Xconfig/main.pm b/perl-install/Xconfig/main.pm
index 39de21fb6..21751676a 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) or return;
+ 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';
@@ -30,9 +30,9 @@ sub configure_resolution {
my ($in, $raw_X) = @_;
my $card = Xconfig::card::from_raw_X($raw_X);
- my $monitor = Xconfig::monitor::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, $monitor) or return;
+ Xconfig::resolution_and_depth::configure($in, $raw_X, $card, $monitors) 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->{monitor} = Xconfig::monitor::configure_auto_install($raw_X, $old_X) or return;
- $options->{VideoRam_probed} = $X->{monitor}{VideoRam_probed};
+ $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->{monitor}, $old_X);
+ $X->{resolution} = Xconfig::resolution_and_depth::configure_auto_install($raw_X, $X->{card}, $X->{monitors}, $old_X);
&write($raw_X, $X);
@@ -61,11 +61,13 @@ sub configure_everything {
my ($in, $raw_X, $do_pkgs, $auto, $options) = @_;
my $X = {};
my $ok = 1;
- $ok &&= $X->{monitor} = Xconfig::monitor::configure($in, $raw_X, $auto);
- $options->{VideoRam_probed} = $X->{monitor}{VideoRam_probed};
+
+ 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->{monitor}, $auto);
+ $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) {
@@ -86,7 +88,7 @@ sub configure_chooser_raw {
my $update_texts = sub {
$texts{card} = $X->{card} && $X->{card}{BoardName} || N("Custom");
- $texts{monitor} = $X->{monitor} && $X->{monitor}{ModelName} || 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
@@ -101,7 +103,7 @@ sub configure_chooser_raw {
$b_modified = 1;
$update_texts->();
- if (member($field, 'card', 'monitor')) {
+ if (member($field, 'card', 'monitors')) {
Xconfig::screen::configure($raw_X);
$raw_X->set_resolution($X->{resolution}) if $X->{resolution};
}
@@ -115,15 +117,17 @@ 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{monitor}, clicked => sub {
- $may_set->('monitor', Xconfig::monitor::configure($in, $raw_X));
+ { label => N("Monitor"), val => \$texts{monitors}, clicked => sub {
+ use Data::Dumper;
+ print Dumper($raw_X->get_devices);
+ $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->{monitor} },
+ { 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->{monitor}));
+ $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->{monitor} },
+ { val => N("Test"), disabled => sub { !$X->{card} || !$X->{monitors} },
clicked => sub {
$ok = Xconfig::test::test($in, $raw_X, $X->{card}, 'auto', 0);
} },
@@ -141,7 +145,7 @@ sub configure_chooser {
my $X = {
card => scalar eval { Xconfig::card::from_raw_X($raw_X) },
- monitor => $raw_X->get_monitors && Xconfig::monitor::from_raw_X($raw_X),
+ monitors => [ $raw_X->get_monitors ],
resolution => scalar eval { $raw_X->get_resolution },
};
my $before = $raw_X->prepare_write;
@@ -198,7 +202,7 @@ 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}{monitor} = $X->{monitor} if $X->{monitor}{manually_chosen} && $X->{monitor}{vendor} ne "Plug'n Play";
+ $::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};
}
diff --git a/perl-install/Xconfig/monitor.pm b/perl-install/Xconfig/monitor.pm
index 69079d3b7..008e0aef8 100644
--- a/perl-install/Xconfig/monitor.pm
+++ b/perl-install/Xconfig/monitor.pm
@@ -30,47 +30,53 @@ my @HorizSync_ranges = (
"31.5-94.0",
);
-
-sub from_raw_X {
- my ($raw_X) = @_;
-
- my $monitor = $raw_X->get_monitor;
- if (!$monitor->{HorizSync}) {
- put_in_hash($monitor, getinfoFromDDC());
- }
- $monitor;
-}
-
sub configure {
- my ($in, $raw_X, $b_auto) = @_;
+ my ($in, $raw_X, $nb_monitors, $o_ddc_info, $b_auto) = @_;
- my $monitor = from_raw_X($raw_X);
- choose($in, $monitor, $b_auto) or return;
- $raw_X->set_monitors($monitor);
- $monitor;
+ 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) = @_;
- my $old_monitor = $old_X->{monitor} || {};
- my %rename = (vsyncrange => 'VertRefresh', hsyncrange => 'HorizSync');
- foreach (keys %rename) {
- my $v = $old_monitor->{$_} or next;
- $old_monitor->{$rename{$_}} = $v;
+ 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 $monitor = from_raw_X($raw_X);
- put_in_hash($monitor, $old_monitor);
+ my $monitors = [ $raw_X->get_or_new_monitors($old_X->{monitors} ? @{$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 = monitors();
- configure_automatic($monitor, $monitors) or put_in_hash($monitor, { HorizSync => '31.5-35.1', VertRefresh => '50-61' });
- $raw_X->set_monitors($monitor);
- $monitor;
+ my $monitors_db = monitors_db();
+ foreach my $monitor (@$monitors) {
+ configure_automatic($monitor, $monitors_db) or put_in_hash($monitor, { HorizSync => '31.5-35.1', VertRefresh => '50-61' });
+ }
+ $raw_X->set_monitors(@$monitors);
+ $monitors;
}
sub choose {
- my ($in, $monitor, $b_auto) = @_;
+ my ($in, $monitor, $head_nb, $b_auto) = @_;
my $monitors_db = monitors_db();
@@ -98,7 +104,7 @@ sub choose {
};
$in->ask_from_({ title => N("Monitor"),
- messages => N("Choose a 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 => '|',
@@ -112,8 +118,8 @@ sub choose {
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 (configure_automatic($monitor, $monitors_db)) {
+ 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"));
diff --git a/perl-install/Xconfig/resolution_and_depth.pm b/perl-install/Xconfig/resolution_and_depth.pm
index 14a2ef5b2..436228d04 100644
--- a/perl-install/Xconfig/resolution_and_depth.pm
+++ b/perl-install/Xconfig/resolution_and_depth.pm
@@ -136,16 +136,16 @@ sub choose {
sub choices {
- my ($_raw_X, $resolution_wanted, $card, $monitor) = @_;
+ my ($_raw_X, $resolution_wanted, $card, $monitors) = @_;
$resolution_wanted ||= {};
my ($prefered_depth, @resolutions) = allowed($card);
- @resolutions = filter_using_HorizSync($monitor->{HorizSync}, @resolutions) if $monitor->{HorizSync};
+ @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} || ($monitor->{ModelName} =~ /^Flat Panel (\d+x\d+)$/ ? $1 : size2default_resolution($monitor->{size} || 14));
+ 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;
@@ -167,9 +167,9 @@ sub choices {
}
sub configure {
- my ($in, $raw_X, $card, $monitor, $b_auto) = @_;
+ my ($in, $raw_X, $card, $monitors, $b_auto) = @_;
- my ($default_resolution, @resolutions) = choices($raw_X, $raw_X->get_resolution, $card, $monitor);
+ my ($default_resolution, @resolutions) = choices($raw_X, $raw_X->get_resolution, $card, $monitors);
if ($b_auto) {
#- use $default_resolution
@@ -189,11 +189,11 @@ sub configure {
}
sub configure_auto_install {
- my ($raw_X, $card, $monitor, $old_X) = @_;
+ 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, $monitor);
+ 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);
diff --git a/perl-install/Xconfig/various.pm b/perl-install/Xconfig/various.pm
index 5d7832c06..d3d49ee08 100644
--- a/perl-install/Xconfig/various.pm
+++ b/perl-install/Xconfig/various.pm
@@ -22,16 +22,18 @@ sub info {
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 @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;
- $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;
+ 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 }) {
diff --git a/perl-install/Xconfig/xfree.pm b/perl-install/Xconfig/xfree.pm
index c567192c9..33600f9c0 100644
--- a/perl-install/Xconfig/xfree.pm
+++ b/perl-install/Xconfig/xfree.pm
@@ -217,10 +217,16 @@ sub set_monitors {
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 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) = @_;