summaryrefslogtreecommitdiffstats
path: root/perl-install/Xconfig/xfree.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/xfree.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/xfree.pm')
-rw-r--r--perl-install/Xconfig/xfree.pm76
1 files changed, 76 insertions, 0 deletions
diff --git a/perl-install/Xconfig/xfree.pm b/perl-install/Xconfig/xfree.pm
new file mode 100644
index 000000000..7b6ba3e37
--- /dev/null
+++ b/perl-install/Xconfig/xfree.pm
@@ -0,0 +1,76 @@
+package Xconfig::xfree; # $Id$
+
+use diagnostics;
+use strict;
+
+use MDK::Common;
+use Xconfig::parse;
+use Xconfig::xfree3;
+use Xconfig::xfree4;
+use log;
+
+
+sub read {
+ my ($class) = @_;
+ bless { xfree3 => Xconfig::xfree3->read,
+ xfree4 => Xconfig::xfree4->read }, $class;
+}
+sub write {
+ my ($both) = @_;
+ $both->{xfree3}->write;
+ $both->{xfree4}->write;
+}
+
+sub empty_config {
+ my ($class) = @_;
+ bless { xfree3 => Xconfig::xfree3->empty_config,
+ xfree4 => Xconfig::xfree4->empty_config }, $class;
+}
+
+sub get_keyboard { get_both('get_keyboard', @_) }
+sub set_keyboard { set_both('set_keyboard', @_) }
+sub get_mice { get_both('get_mice', @_) }
+sub set_mice { set_both('set_mice', @_) }
+
+
+
+
+#-##############################################################################
+#- helpers
+#-##############################################################################
+sub get_both {
+ my ($getter, $both) = @_;
+
+ my @l3 = $both->{xfree3}->$getter;
+ my @l4 = $both->{xfree4}->$getter;
+ mapn {
+ my ($h3, $h4) = @_;
+ my %h = %$h4;
+ foreach (keys %$h3) {
+ if (exists $h{$_}) {
+ my $s4 = join(", ", deref_array($h{$_}));
+ my $s3 = join(", ", deref_array($h3->{$_}));
+ my $s3_ = join(", ", map { qq("$_") } deref_array($h3->{$_}));
+ if ($s4 eq $s3_) {
+ #- keeping the non-double-quoted value
+ $h{$_} = $h3->{$_};
+ } else {
+ $s4 eq $s3 or log::l(qq(XFree: conflicting value for $_, "$s4" and "$s3" are different));
+ }
+ } else {
+ $h{$_} = $h3->{$_};
+ }
+ }
+ \%h;
+ } \@l3, \@l4;
+}
+sub set_both {
+ my ($setter, $both, @l) = @_;
+
+ $both->{xfree3}->$setter(@l);
+ $both->{xfree4}->$setter(@l);
+}
+
+
+
+1;