diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-07-28 22:02:39 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-07-28 22:02:39 +0000 |
commit | ee295df5670f73b285e3de0cea0fdae7d92941bd (patch) | |
tree | 1dbff785561e08dd894473b3c3b223fb1b68e081 /perl-install/Xconfig/xfree4.pm | |
parent | 70fd8ae05409bb33818da725015daf181c6e6a83 (diff) | |
download | drakx-backup-do-not-use-ee295df5670f73b285e3de0cea0fdae7d92941bd.tar drakx-backup-do-not-use-ee295df5670f73b285e3de0cea0fdae7d92941bd.tar.gz drakx-backup-do-not-use-ee295df5670f73b285e3de0cea0fdae7d92941bd.tar.bz2 drakx-backup-do-not-use-ee295df5670f73b285e3de0cea0fdae7d92941bd.tar.xz drakx-backup-do-not-use-ee295df5670f73b285e3de0cea0fdae7d92941bd.zip |
14 new modules, will it be enough?? :)
Diffstat (limited to 'perl-install/Xconfig/xfree4.pm')
-rw-r--r-- | perl-install/Xconfig/xfree4.pm | 95 |
1 files changed, 90 insertions, 5 deletions
diff --git a/perl-install/Xconfig/xfree4.pm b/perl-install/Xconfig/xfree4.pm index a160da458..c65245b75 100644 --- a/perl-install/Xconfig/xfree4.pm +++ b/perl-install/Xconfig/xfree4.pm @@ -3,12 +3,13 @@ package Xconfig::xfree4; # $Id$ use diagnostics; use strict; -use MDK::Common; +use common; use Xconfig::parse; use Xconfig::xfree; our @ISA = 'Xconfig::xfreeX'; +sub name { 'xfree4' } sub config_file { '/etc/X11/XF86Config-4' } @@ -23,8 +24,8 @@ sub new_keyboard_section { my $raw_kbd = { Identifier => { val => 'Keyboard1' }, Driver => { val => 'Keyboard' } }; $raw_X->add_Section('InputDevice', $raw_kbd); - my $ServerLayout = get_ServerLayout($raw_X); - push @{$ServerLayout->{InputDevice}}, { val => '"Keyboard1" "CoreKeyboard"' }; + my $layout = get_ServerLayout($raw_X)->{InputDevice} ||= []; + push @$layout, { val => '"Keyboard1" "CoreKeyboard"' }; $raw_kbd; } @@ -53,6 +54,85 @@ sub new_mouse_sections { @l; } +sub set_wacoms { + my ($raw_X, @wacoms) = @_; + $raw_X->remove_InputDevices('wacom'); + + my $layout = get_ServerLayout($raw_X)->{InputDevice} ||= []; + @$layout = grep { $_->{val} !~ /^"(Stylus|Eraser|Cursor)/ } @$layout; + + @wacoms or return; + + my %Modes = (Stylus => 'Absolute', Erasor => 'Absolute', Cursor => 'Relative'); + + each_index { + my ($wacom) = @_; + foreach (keys %Modes) { + my $h = { Identifier => { val => $_ . ($::i + 1) }, + Driver => { val => 'wacom' }, + Style => { val => lc $_, Option => 1 }, + Device => { val => $wacom->{Device}, Option => 1 }, + Mode => { val => $Modes{$_}, Option => 1 }, + if_($wacom->{USB}, USB => { Option => 1 }) + }; + $raw_X->add_Section('InputDevice', $h); + push @$layout, { val => qq("$_$::i" "AlwaysCore") }; + } + } @wacoms; +} + +sub set_monitors { + my ($raw_X, @monitors) = @_; + + @monitors = map { + my %monitor = %$_; + delete @monitor{'HorizSync', 'VertRefresh'} if $monitor{VendorName} eq "Plug'n Play"; + \%monitor; + } @monitors; + + $raw_X->SUPER::set_monitors(@monitors); +} + +sub depths { 8, 15, 16, 24 } +sub set_resolution { + my ($raw_X, $resolution, $Screen) = @_; + $Screen ||= $raw_X->get_default_screen or return {}; + + $resolution = +{ %$resolution }; + + #- use framebuffer if corresponding Device has Driver framebuffer + my $Device = $raw_X->get_Section_by_Identifier('Device', val($Screen->{Device})) or internal_error("no device named $Screen->{Device}"); + $resolution->{fbdev} = 1 if val($Device->{Driver}) eq 'fbdev'; + + #- XFree4 doesn't like depth 32, silently replacing it with 24 + $resolution->{Depth} = 24 if $resolution->{Depth} eq '32'; + $raw_X->SUPER::set_resolution($resolution, $Screen); +} + +sub get_device_section_fields { + qw(VendorName BoardName Driver VideoRam Screen BusID); #-); +} + +sub new_device_sections { + my ($raw_X, $nb_new) = @_; + my @l = $raw_X->SUPER::new_device_sections($nb_new); + $_->{DPMS} = { Option => 1 } foreach @l; + @l; +} + +sub new_screen_sections { + my ($raw_X, $nb_new) = @_; + my @l = $raw_X->SUPER::new_screen_sections($nb_new); + each_index { $_->{Identifier} = { val => "screen" . ($::i+1) } } @l; + + get_ServerLayout($raw_X)->{Screen} = [ + { val => qq("screen1") }, #-) + map { { val => sprintf('"screen%d" RightOf "screen%d"', $_-1, $_) } } (2 .. $nb_new) + ]; + + @l; +} + sub set_Option { my ($raw_X, $category, $node, @names) = @_; @@ -68,11 +148,11 @@ sub set_Option { #-############################################################################## sub get_InputDevices { my ($raw_X, $Driver) = @_; - $raw_X->get_Sections('InputDevice', sub { $_[0]{Driver}{val} eq $Driver }); + $raw_X->get_Sections('InputDevice', sub { val($_[0]{Driver}) eq $Driver }); } sub remove_InputDevices { my ($raw_X, $Driver) = @_; - $raw_X->remove_Section('InputDevice', sub { $_[0]{Driver}{val} ne $Driver }); + $raw_X->remove_Section('InputDevice', sub { val($_[0]{Driver}) ne $Driver }); } sub get_ServerLayout { @@ -81,4 +161,9 @@ sub get_ServerLayout { $raw_X->add_Section('ServerLayout', { Identifier => { val => 'layout1' } }); } +sub val { + my ($ref) = @_; + $ref && $ref->{val}; +} + 1; |