aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavid_david <david.david@mageialinux-online.org>2013-12-08 16:46:22 +0100
committerdavid_david <david.david@mageialinux-online.org>2013-12-08 16:46:22 +0100
commit3ae40d6f27437d4d2819e38508d2a9d2884449f4 (patch)
tree25e93deab7dad70517b63d7bb0ee026e0c868326
parentda59fabe88fde35290a814cd66b89f7b6bbe0ed9 (diff)
downloadisodumper-3ae40d6f27437d4d2819e38508d2a9d2884449f4.tar
isodumper-3ae40d6f27437d4d2819e38508d2a9d2884449f4.tar.gz
isodumper-3ae40d6f27437d4d2819e38508d2a9d2884449f4.tar.bz2
isodumper-3ae40d6f27437d4d2819e38508d2a9d2884449f4.tar.xz
isodumper-3ae40d6f27437d4d2819e38508d2a9d2884449f4.zip
Update Changelog for future 0.13 release
added and update German translations.
-rw-r--r--CHANGELOG2
1 files changed, 1 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 3633583..c035657 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,7 +3,7 @@ The modifications are:
IsoDumper 0.13
------------
- - added and update Polish translations.
+ - added and update Polish and German translations.
- updated Dutch and Italian translations.
- added a Makefile file for build package.
- added a pixmaps icons.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453
package Xconfig::resolution_and_depth; # $Id: resolution_and_depth.pm 250289 2008-12-08 09:59:02Z pixel $

use lib qw(/usr/lib/libDrakX); # for perl_checker
use diagnostics;
use strict;
# perl_checker: require MDK::Common
# perl_checker: require ugtk3
use common;


our %depth2text = (
      8 => N_("256 colors (8 bits)"),
     15 => N_("32 thousand colors (15 bits)"),
     16 => N_("65 thousand colors (16 bits)"),
     24 => N_("16 million colors (24 bits)"),
);
our @depths_available = ikeys(%depth2text);

my @bios_vga_modes = (
    { bios => 769, X =>  640, Y =>  480, Depth =>  8 },
    { bios => 771, X =>  800, Y =>  600, Depth =>  8 },
    { bios => 773, X => 1024, Y =>  768, Depth =>  8 },
    { bios => 775, X => 1280, Y => 1024, Depth =>  8 },
    { bios => 777, X => 1600, Y => 1200, Depth =>  8 }, 
    { bios => 784, X =>  640, Y =>  480, Depth => 15 },
    { bios => 787, X =>  800, Y =>  600, Depth => 15 },
    { bios => 790, X => 1024, Y =>  768, Depth => 15 },
    { bios => 793, X => 1280, Y => 1024, Depth => 15 },
    { bios => 796, X => 1600, Y => 1200, Depth => 15 }, 
    { bios => 785, X =>  640, Y =>  480, Depth => 16 },
    { bios => 788, X =>  800, Y =>  600, Depth => 16 },
    { bios => 791, X => 1024, Y =>  768, Depth => 16 },
    { bios => 794, X => 1280, Y => 1024, Depth => 16 },
    { bios => 797, X => 1600, Y => 1200, Depth => 16 }, 
);

sub from_bios {
    my ($bios) = @_;
    my $bios_int = $bios =~ /^0x(.*)/ ? hex($1) : $bios;
    find { $_->{bios} == $bios_int } @bios_vga_modes;
}

sub bios_vga_modes() { @bios_vga_modes }

sub XxY { &Xconfig::xfree::XxY }

sub to_string {
    my ($resolution) = @_;
    $resolution or return '';

    $resolution->{automatic}
      ? N("Automatic") . ($resolution->{Depth} ? sprintf(" (%dbpp)", $resolution->{Depth}) : '')
      : $resolution->{X} ? sprintf("%sx%s %dbpp", @$resolution{'X', 'Y', 'Depth'}) : 'frame-buffer';
}

sub allowed {
    my ($card) = @_;

    my ($prefered_depth, @resolution_and_depth);
    
    if ($card->{Driver} eq 'fbdev' && $card->{BoardName} !~ /Poulsbo/) {
	@resolution_and_depth = grep { $_->{Depth} == 16 } @bios_vga_modes;
    } else {
	my @depths;
	if (member($card->{Driver}, qw(fglrx qxl savage))) {
	    @depths = 24;
	} elsif ($card->{Driver} eq 'geode') {
	    @depths = qw(16);
	} elsif ($card->{BoardName} eq 'NVIDIA RIVA 128') { 
	    @depths = qw(8 15 24);
	} elsif ($card->{use_DRI_GLX}) {
	    $prefered_depth = 24;
	    @depths = (16, 24);
	} else {
	    @depths = our @depths_available;
	}
	my @resolutions = @Xconfig::xfree::resolutions;

	push @resolution_and_depth,
	  map {
	      my $Depth = $_;
	      map { m/(\d+)x(\d+)/ && { X => $1, Y => $2, Depth => $Depth } } @resolutions;
	  } @depths;
    }
    $prefered_depth, @resolution_and_depth;
}

# ($card->{VideoRam} || ($card->{server} eq 'FBDev' ? 2048 : 32768))
sub filter_using_VideoRam {
    my ($VideoRam, @resolutions) = @_;
    my $mem = 1024 * $VideoRam;
    grep { $_->{X} * $_->{Y} * $_->{Depth}/8 <= $mem } @resolutions;
    
}
sub filter_using_HorizSync_VertRefresh {
    my ($HorizSync, $VertRefresh, @resolutions) = @_;
    my $max_hsync = 1000 * max(split(/[,-]/, $HorizSync));
    my ($min_vsync, $max_vsync) = (min(split(/[,-]/, $VertRefresh)), max(split(/[,-]/, $VertRefresh)));

    #- enforce at least 60Hz, if max_vsync > 100 (ie don't do it on LCDs which are ok with low vsync)
    $min_vsync = max(60, $min_vsync) if $max_vsync > 100;

    #- computing with {Y} which is active sync instead of total sync, but that's ok
    grep { $max_hsync / $_->{Y} > $min_vsync } @resolutions;
}

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), 
			       (map { { automatic => 1, Depth => $_ } } @Depths) ],
		     format => \&to_string,
		    } ]) or return;
    $resolution;
}


sub choices {
    my ($_raw_X, $resolution_wanted, $card, $monitors) = @_;
    $resolution_wanted ||= {};

    my ($prefered_depth, @resolutions) = allowed($card);

    @resolutions = filter_using_HorizSync_VertRefresh($monitors->[0]{HorizSync}, $monitors->[0]{VertRefresh}, @resolutions) if $monitors->[0]{HorizSync};
    @resolutions = filter_using_VideoRam($card->{VideoRam}, @resolutions) if $card->{VideoRam};

    #- sort it, so we can take the first one when we want the "best"
    @resolutions = sort { $b->{X} <=> $a->{X} || $b->{Y} <=> $a->{Y} || $b->{Depth} <=> $a->{Depth} } @resolutions;

    $_->{ratio} ||= Xconfig::xfree::resolution2ratio($_) foreach @resolutions;

    if ($resolution_wanted->{automatic} || !$resolution_wanted->{X} && !$monitors->[0]{HorizSync}) {
	return { automatic => 1, Depth => $resolution_wanted->{Depth} }, @resolutions;
    }

    if ($resolution_wanted->{X} && !$resolution_wanted->{Y}) {
	#- assuming ratio 4/3
	$resolution_wanted->{Y} = round($resolution_wanted->{X} * 3 / 4);
    } elsif (!$resolution_wanted->{X}) {
	if ($monitors->[0]{preferred_resolution}) {
	    put_in_hash($resolution_wanted, $monitors->[0]{preferred_resolution});
	} elsif ($monitors->[0]{ModelName} =~ /^Flat Panel (\d+)x(\d+)$/) {
	    put_in_hash($resolution_wanted, { X => $1, Y => $2 });
	} else {
	    return { automatic => 1, Depth => $resolution_wanted->{Depth} }, @resolutions;
	}
    }
    my @matching = grep { $_->{X} eq $resolution_wanted->{X} && $_->{Y} eq $resolution_wanted->{Y} } @resolutions;
    if (!@matching) {
	#- hard choice :-(
	#- first trying the greater resolution with same ratio
	my $ratio = $resolution_wanted->{X} / $resolution_wanted->{Y};
	@matching = grep { abs($ratio - $_->{X} / $_->{Y}) < 0.01 } @resolutions;
    }
    if (!@matching) {
	#- really hard choice :'-(
	#- take the first available resolution <= the wanted resolution
	@matching = grep { $_->{X} < $resolution_wanted->{X} } @resolutions;
    }
    if (!@matching) {
	@matching = @resolutions;
    }

    my $default_resolution;
    foreach my $Depth ($resolution_wanted->{Depth}, $prefered_depth) {
	$Depth and $default_resolution ||= find { $_->{Depth} eq $Depth } @matching;
    }
    $default_resolution ||= $matching[0];

    $default_resolution, @resolutions;
}

sub configure {
    my ($in, $raw_X, $card, $monitors, $b_auto, $o_resolution) = @_;

    my ($default_resolution, @resolutions) = choices($raw_X, $o_resolution || $raw_X->get_resolution, $card, $monitors);

    my $resolution;
    if ($b_auto) {
	#- use $default_resolution
	if ($card->{Driver} eq 'fglrx' && !$default_resolution->{automatic}) {
	    $resolution = first(find { $default_resolution->{Y} eq $_->{Y} && $_->{Depth} == 24 }
					$default_resolution, @resolutions);
	    $resolution ||= first(find { $_->{Depth} == 24 } $resolution, @resolutions);
	}
    } elsif ($in->isa('interactive::gtk')) {
	$resolution = choose_gtk($in, $card, $default_resolution, @resolutions) or return;
    } else {
	$resolution = choose($in, $default_resolution, @resolutions) or return;
    }
    set_resolution_($raw_X, $card, $monitors, $default_resolution, $resolution, @resolutions);
}

sub configure_auto_install {
    my ($raw_X, $card, $monitors, $old_X) = @_;

    my ($default_resolution, @resolutions);
    if ($old_X->{resolution_wanted} eq 'automatic') {
	$default_resolution = { automatic => 1 };
    } else {
	my $resolution_wanted = $old_X->{resolution_wanted} && do {
	    my ($X, $Y) = split('x', $old_X->{resolution_wanted});
	    { X => $X, Y => $Y, Depth => $old_X->{default_depth} };
	};

	($default_resolution, @resolutions) = choices($raw_X, $resolution_wanted, $card, $monitors);
	$default_resolution or die "you selected an unusable depth";
    }
    set_resolution($raw_X, $card, $monitors, $default_resolution, @resolutions);
}

sub set_resolution {
    my ($raw_X, $card, $monitors, $resolution, @other) = @_; 
    set_resolution_($raw_X, $card, $monitors, $resolution, $resolution, @other);
}
sub set_resolution_ {
    my ($raw_X, $card, $monitors, $default_resolution, $resolution, @other) = @_; 

    my $PreferredMode;
    if (!$resolution->{automatic}) {
	my $ratio = Xconfig::xfree::resolution2ratio($resolution, 'non-strict');
	@other = uniq_ { XxY($_) } @other;
	@other = grep { $_->{X} < $resolution->{X} } @other;
	@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);
    }
    if ($card->{Driver} eq 'geode') {
	$card->{Options}{PanelGeometry} = XxY($resolution);
	Xconfig::card::to_raw_X($card, $raw_X);	
    }

    set_default_background($resolution);
    my $resolutions = [ $resolution, @other ];
    $raw_X->set_resolutions($resolutions);
    $resolutions;
}
sub set_default_background {
    my ($resolution) = @_;
    
    $resolution->{X} && $resolution->{Y} or do {
	$resolution = { X => 1600, Y => 1200 };
	log::l("defaulting background resolution to $resolution->{X}x$resolution->{Y}");
    };

    my $ratio = $resolution->{X} / $resolution->{Y};
    my $dir = "$::prefix/usr/share/mga/backgrounds";
    my %theme = getVarsFromSh("$::prefix/etc/sysconfig/bootsplash");

    my @l = map {
	if (my ($X, $Y, undef, $hour) = /^\Q$theme{THEME}\E-(\d+)x(\d+)(-(.*))?.png$/) {
	    { file => $_, X => $X, Y => $Y, hour => $hour };
	} else { () }
    } all($dir);

    my ($best, $_other) = 
      sort {
	  $a->[2] <=> $b->[2] || $b->[3] <=> $a->[3] || $a->[4] <=> $b->[4];
      } map {
	  [
	      $_->{X}, $_->{Y},
	      int(abs($ratio - $_->{X} / $_->{Y}) * 100), #- we want the nearest ratio (precision .01)
	      $_->{X} >= $resolution->{X}, #- then we don't want a resolution smaller
	      abs($_->{X} - $resolution->{X}), #- the nearest resolution
	  ];
      } @l;

    my @wanted = grep { $best->[0] == $_->{X} && $best->[1] == $_->{Y} } @l;

    if (-e "$dir/$theme{THEME}.xml") {
	symlinkf "$theme{THEME}.xml", "$dir/Mageia.xml";
    }
    
    foreach (@wanted) {
	if ($_->{hour}) {
	    symlinkf $_->{file}, "$dir/$theme{THEME}-$_->{hour}.png";
	} else {
	    symlinkf $_->{file}, "$dir/default.png";
	}
    }
}
sub is_915resolution_configured() {
    my $f = "$::prefix/etc/sysconfig/915resolution";    
    -e $f && { getVarsFromSh($f) }->{XRESO};
}
sub set_915resolution {
    my ($resolution) = @_;

    my $f = "$::prefix/etc/sysconfig/915resolution";    
    setVarsInSh($f, { 
	MODE => 'best', 
	XRESO => $resolution->{X}, 
	YRESO => $resolution->{Y},
    });
    run_program::rooted($::prefix, 'service', '915resolution', 'start');
}

sub filter_on_ratio {
    my ($ratio, @l) = @_;
    grep {
	!$ratio
	      || $_->{ratio} eq $ratio 
	      || $ratio eq '4/3' && "$_->{X}x$_->{Y}" eq '1280x1024';
    } @l;
}

sub choose_gtk {
    my ($in, $card, $default_resolution, @resolutions) = @_;

    my $chosen_Depth = $default_resolution->{Depth};
    my $chosen_res = { X => $default_resolution->{X} || 1024, Y => $default_resolution->{Y} };
    my $chosen_ratio = Xconfig::xfree::resolution2ratio($chosen_res, 'non-strict') || '4/3';

    my $filter_on_Depth = sub {
	grep { $_->{Depth} == $chosen_Depth } @_;
    };
    my $filter_on_res = sub {