diff options
Diffstat (limited to 'lib/Xconfig')
-rw-r--r-- | lib/Xconfig/resolution_and_depth.pm | 14 | ||||
-rw-r--r-- | lib/Xconfig/xfree.pm | 11 |
2 files changed, 15 insertions, 10 deletions
diff --git a/lib/Xconfig/resolution_and_depth.pm b/lib/Xconfig/resolution_and_depth.pm index 09bc74b..6e4e0f0 100644 --- a/lib/Xconfig/resolution_and_depth.pm +++ b/lib/Xconfig/resolution_and_depth.pm @@ -71,8 +71,9 @@ sub to_string { my ($resolution) = @_; $resolution or return ''; - $resolution->{automatic} ? N("Automatic") : - $resolution->{X} ? sprintf("%sx%s %dbpp", @$resolution{'X', 'Y', 'Depth'}) : 'frame-buffer'; + $resolution->{automatic} + ? N("Automatic") . ($resolution->{Depth} ? sprintf(" (%dbpp)", $resolution->{Depth}) : '') + : $resolution->{X} ? sprintf("%sx%s %dbpp", @$resolution{'X', 'Y', 'Depth'}) : 'frame-buffer'; } sub allowed { @@ -127,11 +128,13 @@ sub filter_using_HorizSync_VertRefresh { sub choose { my ($in, $default_resolution, @resolutions) = @_; + my @Depths = uniq(reverse map { $_->{Depth} } @resolutions); my $resolution = $default_resolution || {}; $in->ask_from(N("Resolutions"), "", [ { val => \$resolution, type => 'list', sort => 0, - list => [ (sort { $a->{X} <=> $b->{X} } @resolutions), { automatic => 1 } ], + list => [ (sort { $a->{X} <=> $b->{X} } @resolutions), + (map { { automatic => 1, Depth => $_ } } @Depths) ], format => \&to_string, } ]) or return; $resolution; @@ -153,7 +156,7 @@ sub choices { $_->{ratio} ||= Xconfig::xfree::resolution2ratio($_) foreach @resolutions; if ($resolution_wanted->{automatic} || !$resolution_wanted->{X} && !$monitors->[0]{HorizSync}) { - return { automatic => 1 }, @resolutions; + return { automatic => 1, Depth => $resolution_wanted->{Depth} }, @resolutions; } if ($resolution_wanted->{X} && !$resolution_wanted->{Y}) { @@ -420,8 +423,6 @@ sub choose_gtk { format => sub { $_[0]{text} ? translate($_[0]{text}) : &$res2text }, list_ref => \$proposed_resolutions, changed => sub { - $pix_colors->set_sensitive(!$chosen_res->{automatic}); - $depth_combo->set_sensitive(!$chosen_res->{automatic}); if ($chosen_res->{text} eq 'Other') { undef $chosen_ratio; $set_proposed_resolutions->($previous_res); @@ -464,6 +465,7 @@ sub choose_gtk { $W->main or return; if ($chosen_res->{automatic}) { + $chosen_res->{Depth} = $chosen_Depth; $chosen_res; } else { find { $_->{X} == $chosen_res->{X} && diff --git a/lib/Xconfig/xfree.pm b/lib/Xconfig/xfree.pm index cc4d6c8..f79a788 100644 --- a/lib/Xconfig/xfree.pm +++ b/lib/Xconfig/xfree.pm @@ -180,13 +180,13 @@ sub get_resolutions { my $Screen = $o_Screen || $raw_X->get_default_screen or return {}; my $depth = val($Screen->{DefaultColorDepth} || $Screen->{DefaultDepth}); - my $Display = find { !$depth || val($_->{l}{Depth}) eq $depth } @{$Screen->{Display} || []} or return { automatic => 1 }; + my $Display = find { !$depth || val($_->{l}{Depth}) eq $depth } @{$Screen->{Display} || []} or return { automatic => 1, Depth => $depth }; my $s = val($Display->{l}{Virtual} || $Display->{l}{Modes}); my @l; while ($s =~ /(\d+)(x|\s+)(\d+)/g) { push @l, { X => $1, Y => $3, Depth => val($Display->{l}{Depth}) }; } - @l ? @l : { automatic => 1 }; + @l ? @l : { automatic => 1, Depth => $depth }; } sub set_resolutions { my ($raw_X, $resolutions, $o_Screen) = @_; @@ -206,14 +206,17 @@ sub set_resolutions { my @l = $Mode_name eq 'Modes' ? @$resolutions : first(@$resolutions); my @Modes = map { sprintf($Mode_name eq 'Modes' ? '"%dx%d"' : '%d %d', @$_{'X', 'Y'}) } @l; - $Screen->{DefaultColorDepth} = { val => $Depth }; $Screen->{Display} = [ map { { l => { Depth => { val => $_ }, $Mode_name => { val => join(' ', @Modes) } } }; } 8, 15, 16, 24 ]; } else { - delete $Screen->{DefaultColorDepth}; delete $Screen->{Display}; } + if ($Depth) { + $Screen->{DefaultColorDepth} = { val => $Depth }; + } else { + delete $Screen->{DefaultColorDepth}; + } } add_gtf_ModeLines($raw_X, $resolutions) if $resolutions->[0]{X}; |