summaryrefslogtreecommitdiffstats
path: root/perl-install/Xconfig/xfree.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/Xconfig/xfree.pm')
-rw-r--r--perl-install/Xconfig/xfree.pm14
1 files changed, 10 insertions, 4 deletions
diff --git a/perl-install/Xconfig/xfree.pm b/perl-install/Xconfig/xfree.pm
index c567192c9..33600f9c0 100644
--- a/perl-install/Xconfig/xfree.pm
+++ b/perl-install/Xconfig/xfree.pm
@@ -217,10 +217,16 @@ sub set_monitors {
raw_import_section($raw_monitor, $monitor, \@monitor_fields);
} \@raw_monitors, \@monitors;
}
-sub get_monitor {
- my ($raw_X) = @_;
- $raw_X->get_monitors or _new_monitor_sections($raw_X, 1);
- first($raw_X->get_monitors);
+sub get_or_new_monitors {
+ my ($raw_X, $nb_new) = @_;
+ my @monitors = $raw_X->get_monitors;
+
+ #- ensure we have exactly $nb_new monitors;
+ if ($nb_new > @monitors) {
+ @monitors, ({}) x ($nb_new - @monitors);
+ } else {
+ splice(@monitors, 0, $nb_new);
+ }
}
sub _new_monitor_sections {
my ($raw_X, $nb_new) = @_;