summaryrefslogtreecommitdiffstats
path: root/perl-install/Xconfig/xfree3.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-07-24 22:16:08 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-07-24 22:16:08 +0000
commitb2e794d733c54ac59f9e15220746099bd2e7e2fc (patch)
tree3e4309aaad0e0e53326c0e872c52fceb35f63ec5 /perl-install/Xconfig/xfree3.pm
parentefcd2b112baacf97b784f965a4188733969f2b67 (diff)
downloaddrakx-b2e794d733c54ac59f9e15220746099bd2e7e2fc.tar
drakx-b2e794d733c54ac59f9e15220746099bd2e7e2fc.tar.gz
drakx-b2e794d733c54ac59f9e15220746099bd2e7e2fc.tar.bz2
drakx-b2e794d733c54ac59f9e15220746099bd2e7e2fc.tar.xz
drakx-b2e794d733c54ac59f9e15220746099bd2e7e2fc.zip
new XFree handling library
- only keyboard and mice functions are done, but adding the others is quite easy - so for now only used in mousedrake - but keyboarddrake and (of course) XFdrake will come
Diffstat (limited to 'perl-install/Xconfig/xfree3.pm')
-rw-r--r--perl-install/Xconfig/xfree3.pm56
1 files changed, 56 insertions, 0 deletions
diff --git a/perl-install/Xconfig/xfree3.pm b/perl-install/Xconfig/xfree3.pm
new file mode 100644
index 000000000..7b2081dfc
--- /dev/null
+++ b/perl-install/Xconfig/xfree3.pm
@@ -0,0 +1,56 @@
+package Xconfig::xfree3; # $Id$
+
+use diagnostics;
+use strict;
+
+use MDK::Common;
+use Xconfig::parse;
+use Xconfig::xfreeX;
+
+our @ISA = 'Xconfig::xfreeX';
+
+sub config_file { '/etc/X11/XF86Config' }
+
+
+sub get_keyboard_section {
+ my ($raw_X) = @_;
+ return $raw_X->get_Section('Keyboard') or die "no keyboard section";
+}
+
+sub new_keyboard_section {
+ my ($raw_X) = @_;
+ return $raw_X->add_Section('Keyboard', { Protocol => { val => 'Standard' } });
+}
+
+sub get_mouse_sections {
+ my ($raw_X) = @_;
+ my $main = $raw_X->get_Section('Pointer') or die "no mouse section";
+ my $XInput = $raw_X->get_Section('XInput');
+ $main, if_($XInput, map { $_->{l} } @{$XInput->{Mouse} || []});
+}
+
+sub new_mouse_sections {
+ my ($raw_X, $nb_new) = @_;
+
+ $raw_X->remove_Section('Pointer');
+ my $XInput = $raw_X->get_Section('XInput');
+ delete $XInput->{Mouse} if $XInput;
+ $raw_X->remove_Section('XInput') if $nb_new <= 1 && $XInput && !%$XInput;
+
+ $nb_new or return;
+
+ my $main = $raw_X->add_Section('Pointer', {});
+
+ if ($nb_new == 1) {
+ $main;
+ } else {
+ my @l = map { { DeviceName => { val => "Mouse$_" }, AlwaysCore => {} } } (2 .. $nb_new);
+ $XInput ||= $raw_X->add_Section('XInput', {});
+ $XInput->{Mouse} = [ map { { l => $_ } } @l ];
+ $main, @l;
+ }
+}
+
+sub set_Option {}
+
+1;