From bd481389539995593b50c849de43ad3a71fac915 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 1 Oct 2008 13:57:30 +0000 Subject: - XFdrake: o explicitly Load or Disable module "dri" (to be independent of Xorg's default choice) --- NEWS | 4 ++++ lib/Xconfig/parse.pm | 2 +- lib/Xconfig/xfree.pm | 31 +++++++++++++++++++++++++++++-- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 2be4c15..0753d66 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +- XFdrake: + o explicitly Load or Disable module "dri" + (to be independent of Xorg's default choice) + Version 0.63 - 30 September 2008 - translations updates diff --git a/lib/Xconfig/parse.pm b/lib/Xconfig/parse.pm index 1454b56..9a5ff1c 100644 --- a/lib/Xconfig/parse.pm +++ b/lib/Xconfig/parse.pm @@ -153,7 +153,7 @@ my %kind_names = ( WacomEraser => [ qw(Port) ], #-/ ServerLayout => [ qw(Identifier) ], ); -my @want_string = qw(Identifier DeviceName VendorName ModelName BoardName Driver Device Chipset Monitor Protocol XkbModel XkbLayout XkbOptions XkbCompat Load ModulePath BusID PreferredMode); +my @want_string = qw(Identifier DeviceName VendorName ModelName BoardName Driver Device Chipset Monitor Protocol XkbModel XkbLayout XkbOptions XkbCompat Load Disable ModulePath BusID PreferredMode); %kind_names = map_each { lc $::a => [ map { lc } @$::b ] } %kind_names; @want_string = map { lc } @want_string; diff --git a/lib/Xconfig/xfree.pm b/lib/Xconfig/xfree.pm index 6b52ff5..b70948b 100644 --- a/lib/Xconfig/xfree.pm +++ b/lib/Xconfig/xfree.pm @@ -493,6 +493,12 @@ sub get_modules { my $Module = raw_export_section($raw_Module, ['Load']); @{$Module->{Load} || []}; } +sub get_disabled_modules { + my ($raw_X) = @_; + my $raw_Module = $raw_X->get_Section('Module') or return; + my $Module = raw_export_section($raw_Module, ['Disable']); + @{$Module->{Disable} || []}; +} sub add_load_module { my ($raw_X, $module) = @_; my $raw_Module = $raw_X->get_Section('Module') || $raw_X->add_Section('Module', {}); @@ -509,18 +515,39 @@ sub add_load_module { comment_on_line => $comment && " # $comment", } if !member($module, $raw_X->get_modules); } +sub add_disable_module { + my ($raw_X, $module) = @_; + my $raw_Module = $raw_X->get_Section('Module') || $raw_X->add_Section('Module', {}); + + push @{$raw_Module->{Disable}}, { val => $module } if !member($module, $raw_X->get_disabled_modules); +} sub remove_load_module { my ($raw_X, $module) = @_; my $raw_Module = $raw_X->get_Section('Module') or return; if (my @l = grep { $_->{val} ne $module } @{$raw_Module->{Load}}) { $raw_Module->{Load} = \@l; } else { - $raw_X->remove_Section('Module'); + delete $raw_Module->{Load}; + } +} +sub remove_disable_module { + my ($raw_X, $module) = @_; + my $raw_Module = $raw_X->get_Section('Module') or return; + if (my @l = grep { $_->{val} ne $module } @{$raw_Module->{Disable}}) { + $raw_Module->{Disable} = \@l; + } else { + delete $raw_Module->{Disable}; } } sub set_load_module { my ($raw_X, $module, $bool) = @_; - $bool ? add_load_module($raw_X, $module) : remove_load_module($raw_X, $module); + if ($bool) { + remove_disable_module($raw_X, $module); + add_load_module($raw_X, $module); + } else { + remove_load_module($raw_X, $module); + add_disable_module($raw_X, $module); + } } -- cgit v1.2.1