diff options
Diffstat (limited to 'perl-install/Xconfig')
-rw-r--r-- | perl-install/Xconfig/main.pm | 6 | ||||
-rw-r--r-- | perl-install/Xconfig/xfree.pm | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/perl-install/Xconfig/main.pm b/perl-install/Xconfig/main.pm index 3b1189e79..724dc111f 100644 --- a/perl-install/Xconfig/main.pm +++ b/perl-install/Xconfig/main.pm @@ -16,8 +16,7 @@ use any; sub configure_monitor { my ($in) = @_; - my $raw_X = Xconfig::xfree->read; - my $before = $raw_X->prepare_write; + my ($raw_X, $before) = Xconfig::xfree->read_and_prepare_write; Xconfig::monitor::configure($in, $raw_X, int($raw_X->get_devices)) or return; if ($raw_X->prepare_write ne $before) { $raw_X->write; @@ -30,12 +29,11 @@ sub configure_monitor { sub configure_resolution { my ($in) = @_; - my $raw_X = Xconfig::xfree->read; + my ($raw_X, $before) = Xconfig::xfree->read_and_prepare_write; my $X = { card => Xconfig::card::from_raw_X($raw_X), monitors => [ $raw_X->get_monitors ], }; - my $before = $raw_X->prepare_write; $X->{resolution} = Xconfig::resolution_and_depth::configure($in, $raw_X, $X->{card}, $X->{monitors}) or return; if ($raw_X->prepare_write ne $before) { &write($raw_X, $X); diff --git a/perl-install/Xconfig/xfree.pm b/perl-install/Xconfig/xfree.pm index d1d45e406..eadceda3f 100644 --- a/perl-install/Xconfig/xfree.pm +++ b/perl-install/Xconfig/xfree.pm @@ -19,15 +19,20 @@ sub _conf_files() { ################################################################################ # I/O ########################################################################## ################################################################################ -sub read { +sub read_and_prepare_write { my ($class) = @_; my $file = find { -f $_ } _conf_files(); my $raw_X = $class->new(Xconfig::parse::read_XF86Config($file)); + my $before = $raw_X->prepare_write; if (my ($Keyboard) = $raw_X->get_InputDevices('Keyboard')) { $Keyboard->{Driver}{val} = 'keyboard'; } - $raw_X; + $raw_X, $before; +} +sub read { + my ($class) = @_; + first(read_and_prepare_write($class)); } sub write { my ($raw_X, $o_file) = @_; |