From a56b6bf9d29aab40564f3a1c0ac0d9fe7d910e2e Mon Sep 17 00:00:00 2001
From: Pascal Rigaux <pixel@mandriva.com>
Date: Thu, 5 Sep 2002 21:21:25 +0000
Subject: add an option for prefering Xinerama in auto_installs

---
 perl-install/Xconfig/card.pm | 11 ++++++-----
 perl-install/Xconfig/main.pm |  1 +
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/perl-install/Xconfig/card.pm b/perl-install/Xconfig/card.pm
index 2c1a472f6..ded139220 100644
--- a/perl-install/Xconfig/card.pm
+++ b/perl-install/Xconfig/card.pm
@@ -225,7 +225,7 @@ sub card_config__not_listed {
 sub multi_head_choose {
     my ($in, @cards) = @_;
 
-    my @choices = multi_head_choices(@cards);
+    my @choices = multi_head_choices('', @cards);
 
     my $tc = $in->ask_from_listf(_("Multi-head configuration"),
 				 _("Your system support multiple head configuration.
@@ -249,7 +249,7 @@ sub configure_auto_install {
     }
 
     my @cards = probe();
-    my ($choice) = multi_head_choices(@cards) or log::l('no graphic card probed, try providing one using $o->{card}{Driver} or $o->{card}{server} or $o->{card}{card_name}'), return;
+    my ($choice) = multi_head_choices($old_X->{Xinerama}, @cards) or log::l('no graphic card probed, try providing one using $o->{card}{Driver} or $o->{card}{server} or $o->{card}{card_name}'), return;
     my $card = $choice->{code}();
 
     my ($glx_choice) = xfree_and_glx_choices($card);
@@ -355,7 +355,7 @@ sub xfree_and_glx_choose {
 }
 
 sub multi_head_choices {
-    my (@cards) = @_;
+    my ($want_Xinerama, @cards) = @_;
     my @choices;
 
     my $has_multi_head = @cards > 1 || $cards[0]{MULTI_HEAD} > 1;
@@ -378,8 +378,9 @@ sub multi_head_choices {
 	    $card->{Xinerama} = $_[0];
 	    $card;
 	};
-	push @choices, { text => _("Configure all heads independently"), code => sub { $configure_multi_head->('') } };
-	push @choices, { text => _("Use Xinerama extension"), code => sub { $configure_multi_head->(1) } };
+	my $independent = { text => _("Configure all heads independently"), code => sub { $configure_multi_head->('') } };
+	my $xinerama    = { text => _("Use Xinerama extension"),            code => sub { $configure_multi_head->(1) } };
+	push @choices, $want_Xinerama ? ($xinerama, $independent) : ($independent, $xinerama);
     }
 
     foreach my $c (@cards) {
diff --git a/perl-install/Xconfig/main.pm b/perl-install/Xconfig/main.pm
index 661f1d5f5..f4729b6c8 100644
--- a/perl-install/Xconfig/main.pm
+++ b/perl-install/Xconfig/main.pm
@@ -169,6 +169,7 @@ sub export_to_install_X {
     $::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}{card} = $X->{monitor} if $X->{card}{manually_chosen};
+    $::o->{X}{Xinerama} = 1 if $X->{card}{Xinerama};
 }
 
 
-- 
cgit v1.2.1