summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-09-25 15:11:27 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-09-25 15:11:27 +0000
commitda0efd11f88ac0611644ede0120d2572f9040246 (patch)
tree7553ce59e604d792b7c477a774e69456e9a9d5d9
parent97ed258da08e51ab9d12f923952f875db5456680 (diff)
downloaddrakx-kbd-mouse-x11-da0efd11f88ac0611644ede0120d2572f9040246.tar
drakx-kbd-mouse-x11-da0efd11f88ac0611644ede0120d2572f9040246.tar.gz
drakx-kbd-mouse-x11-da0efd11f88ac0611644ede0120d2572f9040246.tar.bz2
drakx-kbd-mouse-x11-da0efd11f88ac0611644ede0120d2572f9040246.tar.xz
drakx-kbd-mouse-x11-da0efd11f88ac0611644ede0120d2572f9040246.zip
- XFdrake:
o set "PreferredMode" in Monitor section if the user changes the resolution (we still do not use PreferredMode for the default resolution)
-rw-r--r--NEWS4
-rw-r--r--lib/Xconfig/main.pm2
-rw-r--r--lib/Xconfig/parse.pm4
-rw-r--r--lib/Xconfig/resolution_and_depth.pm25
-rw-r--r--lib/Xconfig/xfree.pm3
5 files changed, 31 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 6d7c7c5..feba513 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+- XFdrake:
+ o set "PreferredMode" in Monitor section if the user changes the resolution
+ (we still do not use PreferredMode for the default resolution)
+
Version 0.61 - 11 September 2008
- keyboarddrake:
diff --git a/lib/Xconfig/main.pm b/lib/Xconfig/main.pm
index 5cf6649..5b58ffc 100644
--- a/lib/Xconfig/main.pm
+++ b/lib/Xconfig/main.pm
@@ -112,7 +112,7 @@ sub configure_chooser_raw {
$prompt_for_resolution->();
} else {
Xconfig::screen::configure($raw_X);
- $may_set->('resolutions', Xconfig::resolution_and_depth::set_resolution($raw_X, $default_resolution, @other_resolutions));
+ $may_set->('resolutions', Xconfig::resolution_and_depth::set_resolution($raw_X, $X->{monitors}, $default_resolution, @other_resolutions));
}
}
}
diff --git a/lib/Xconfig/parse.pm b/lib/Xconfig/parse.pm
index 283065f..1454b56 100644
--- a/lib/Xconfig/parse.pm
+++ b/lib/Xconfig/parse.pm
@@ -142,7 +142,7 @@ 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) ],
+ Monitor => [ qw(Identifier VendorName ModelName HorizSync VertRefresh PreferredMode) ],
Device => [ qw(Identifier VendorName BoardName Chipset Driver VideoRam Screen BusID DPMS power_saver AccelMethod MonitorLayout TwinViewOrientation BIOSHotkeys RenderAccel SWCursor XaaNoOffscreenPixmaps) ],
Display => [ qw(Depth Modes Virtual) ], # Subsection in Device
Screen => [ qw(Identifier Driver Device Monitor DefaultDepth DefaultColorDepth) ],
@@ -153,7 +153,7 @@ my %kind_names = (
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 ModulePath BusID);
+my @want_string = qw(Identifier DeviceName VendorName ModelName BoardName Driver Device Chipset Monitor Protocol XkbModel XkbLayout XkbOptions XkbCompat Load ModulePath BusID PreferredMode);
%kind_names = map_each { lc $::a => [ map { lc } @$::b ] } %kind_names;
@want_string = map { lc } @want_string;
diff --git a/lib/Xconfig/resolution_and_depth.pm b/lib/Xconfig/resolution_and_depth.pm
index 479ceda..dc3f446 100644
--- a/lib/Xconfig/resolution_and_depth.pm
+++ b/lib/Xconfig/resolution_and_depth.pm
@@ -214,7 +214,7 @@ sub configure {
} else {
$resolution = choose($in, $default_resolution, @resolutions) or return;
}
- set_resolution($raw_X, $resolution, @resolutions);
+ set_resolution_($raw_X, $monitors, $default_resolution, $resolution, @resolutions);
}
sub configure_auto_install {
@@ -232,12 +232,17 @@ sub configure_auto_install {
($default_resolution, @resolutions) = choices($raw_X, $resolution_wanted, $card, $monitors);
$default_resolution or die "you selected an unusable depth";
}
- set_resolution($raw_X, $default_resolution, @resolutions);
+ set_resolution($raw_X, $monitors, $default_resolution, @resolutions);
}
sub set_resolution {
- my ($raw_X, $resolution, @other) = @_;
+ my ($raw_X, $monitors, $resolution, @other) = @_;
+ set_resolution_($raw_X, $monitors, $resolution, $resolution, @other);
+}
+sub set_resolution_ {
+ my ($raw_X, $monitors, $default_resolution, $resolution, @other) = @_;
+ my $PreferredMode;
if (!$resolution->{automatic}) {
my $ratio = Xconfig::xfree::resolution2ratio($resolution, 'non-strict');
@other = uniq_ { XxY($_) } @other;
@@ -245,7 +250,21 @@ sub set_resolution {
@other = filter_on_ratio($ratio, @other);
set_915resolution($resolution) if is_915resolution_configured();
+
+ if (XxY($default_resolution) ne XxY($resolution)) {
+ log::l("setting PreferredMode since wanted resolution (" . XxY($resolution) . ") differs from the default one (" . XxY($default_resolution) . ")");
+ $PreferredMode = XxY($resolution);
+ }
}
+ if ($monitors->[0]{PreferredMode} ne $PreferredMode) {
+ if ($PreferredMode) {
+ $monitors->[0]{PreferredMode} = $PreferredMode;
+ } else {
+ delete $monitors->[0]{PreferredMode};
+ }
+ $raw_X->set_monitors(@$monitors);
+ }
+
set_default_background($resolution);
my $resolutions = [ $resolution, @other ];
$raw_X->set_resolutions($resolutions);
diff --git a/lib/Xconfig/xfree.pm b/lib/Xconfig/xfree.pm
index f1f52c9..6b52ff5 100644
--- a/lib/Xconfig/xfree.pm
+++ b/lib/Xconfig/xfree.pm
@@ -345,7 +345,7 @@ sub set_synaptics {
################################################################################
# monitor ######################################################################
################################################################################
-my @monitor_fields = qw(VendorName ModelName HorizSync VertRefresh);
+my @monitor_fields = qw(VendorName ModelName HorizSync VertRefresh PreferredMode);
sub get_monitors {
my ($raw_X) = @_;
my @raw_monitors = $raw_X->get_Sections('Monitor');
@@ -361,6 +361,7 @@ sub set_monitors {
mapn {
my ($raw_monitor, $monitor) = @_;
raw_import_section($raw_monitor, $monitor, \@monitor_fields);
+ $raw_monitor->{PreferredMode}{Option} = 1 if $raw_monitor->{PreferredMode};
$raw_monitor->{ModeLine} = $monitor->{ModeLine} if $monitor->{ModeLine};
} \@raw_monitors, \@monitors;
}