summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-02-05 13:34:08 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-02-05 13:34:08 +0000
commit702d47173101dd8bb132cb22170f38bf82b55344 (patch)
tree27d22d6f80b0693281dc50ada5a64bee7a2e6421
parent8b346ef435ed5dd491b2e49a278b5b746e6dd142 (diff)
downloaddrakx-702d47173101dd8bb132cb22170f38bf82b55344.tar
drakx-702d47173101dd8bb132cb22170f38bf82b55344.tar.gz
drakx-702d47173101dd8bb132cb22170f38bf82b55344.tar.bz2
drakx-702d47173101dd8bb132cb22170f38bf82b55344.tar.xz
drakx-702d47173101dd8bb132cb22170f38bf82b55344.zip
- add ->prepare_write to allow comparing raw_X's
- ensure "config_changed" is returned only if the config file really changed
-rw-r--r--perl-install/Xconfig/main.pm30
-rw-r--r--perl-install/Xconfig/parse.pm7
-rw-r--r--perl-install/Xconfig/xfree.pm4
-rw-r--r--perl-install/Xconfig/xfreeX.pm4
4 files changed, 36 insertions, 9 deletions
diff --git a/perl-install/Xconfig/main.pm b/perl-install/Xconfig/main.pm
index 3dd95f195..1e11b2b49 100644
--- a/perl-install/Xconfig/main.pm
+++ b/perl-install/Xconfig/main.pm
@@ -16,9 +16,14 @@ use any;
sub configure_monitor {
my ($in, $raw_X) = @_;
+ my $before = $raw_X->prepare_write;
Xconfig::monitor::configure($in, $raw_X) or return;
- $raw_X->write;
- 'config_changed';
+ if ($raw_X->prepare_write ne $before) {
+ $raw_X->write;
+ 'config_changed';
+ } else {
+ '';
+ }
}
sub configure_resolution {
@@ -26,9 +31,14 @@ sub configure_resolution {
my $card = Xconfig::card::from_raw_X($raw_X);
my $monitor = Xconfig::monitor::from_raw_X($raw_X);
+ my $before = $raw_X->prepare_write;
Xconfig::resolution_and_depth::configure($in, $raw_X, $card, $monitor) or return;
- $raw_X->write;
- 'config_changed';
+ if ($raw_X->prepare_write ne $before) {
+ $raw_X->write;
+ 'config_changed';
+ } else {
+ '';
+ }
}
@@ -134,11 +144,15 @@ sub configure_chooser {
monitor => $raw_X->get_monitors && Xconfig::monitor::from_raw_X($raw_X),
resolution => scalar eval { $raw_X->get_resolution },
};
- my ($ok, $modified) = configure_chooser_raw($in, $raw_X, $do_pkgs, $options, $X);
-
- $modified && may_write($in, $raw_X, $X, $ok) or return;
+ my $before = $raw_X->prepare_write;
+ my ($ok) = configure_chooser_raw($in, $raw_X, $do_pkgs, $options, $X);
- 'config_changed';
+ if ($raw_X->prepare_write ne $before) {
+ may_write($in, $raw_X, $X, $ok) or return;
+ 'config_changed';
+ } else {
+ '';
+ }
}
sub configure_everything_or_configure_chooser {
diff --git a/perl-install/Xconfig/parse.pm b/perl-install/Xconfig/parse.pm
index 36aad26f3..ae270b9e8 100644
--- a/perl-install/Xconfig/parse.pm
+++ b/perl-install/Xconfig/parse.pm
@@ -13,9 +13,14 @@ sub read_XF86Config {
$raw_X;
}
+sub prepare_write_XF86Config {
+ my ($raw_X) = @_;
+ map { raw_to_string(before_to_string({ %$_ }, 0)) } @$raw_X;
+}
+
sub write_XF86Config {
my ($raw_X, $file) = @_;
- my @blocks = map { raw_to_string(before_to_string({ %$_ }, 0)) } @$raw_X;
+ my @blocks = prepare_write_XF86Config($raw_X);
@blocks ? output($file, @blocks) : unlink $file;
}
diff --git a/perl-install/Xconfig/xfree.pm b/perl-install/Xconfig/xfree.pm
index 8df42bd8a..df6c0d3e0 100644
--- a/perl-install/Xconfig/xfree.pm
+++ b/perl-install/Xconfig/xfree.pm
@@ -20,6 +20,10 @@ sub write {
$both->{xfree3} ? $both->{xfree3}->write($o_xfree3_file) : unlink($o_xfree3_file);
$both->{xfree4} ? $both->{xfree4}->write($o_xfree4_file) : unlink($o_xfree4_file);
}
+sub prepare_write {
+ my ($both) = @_;
+ ($both->{xfree4} || $both->{xfree3})->prepare_write;
+}
sub empty_config {
my ($class) = @_;
diff --git a/perl-install/Xconfig/xfreeX.pm b/perl-install/Xconfig/xfreeX.pm
index b6223a7fa..7d830ddee 100644
--- a/perl-install/Xconfig/xfreeX.pm
+++ b/perl-install/Xconfig/xfreeX.pm
@@ -26,6 +26,10 @@ sub write {
rename $file, "$file.old";
Xconfig::parse::write_XF86Config($raw_X, $file);
}
+sub prepare_write {
+ my ($raw_X) = @_;
+ join('', Xconfig::parse::prepare_write_XF86Config($raw_X));
+}
my @monitor_fields = qw(VendorName ModelName HorizSync VertRefresh);