diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-10-01 13:57:30 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-10-01 13:57:30 +0000 |
commit | bd481389539995593b50c849de43ad3a71fac915 (patch) | |
tree | 5271e28dc49ab1cd470bcbbd274f587e92ae564e /lib/Xconfig/xfree.pm | |
parent | fe68e8f9e418e3bc61d578744525fa7f719e1bf2 (diff) | |
download | drakx-kbd-mouse-x11-bd481389539995593b50c849de43ad3a71fac915.tar drakx-kbd-mouse-x11-bd481389539995593b50c849de43ad3a71fac915.tar.gz drakx-kbd-mouse-x11-bd481389539995593b50c849de43ad3a71fac915.tar.bz2 drakx-kbd-mouse-x11-bd481389539995593b50c849de43ad3a71fac915.tar.xz drakx-kbd-mouse-x11-bd481389539995593b50c849de43ad3a71fac915.zip |
- XFdrake:
o explicitly Load or Disable module "dri"
(to be independent of Xorg's default choice)
Diffstat (limited to 'lib/Xconfig/xfree.pm')
-rw-r--r-- | lib/Xconfig/xfree.pm | 31 |
1 files changed, 29 insertions, 2 deletions
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); + } } |