summaryrefslogtreecommitdiffstats
path: root/perl-install/Xconfig/xfreeX.pm
blob: e809e693b0c5171f8537fb1712eff4fd5985f905 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
package Xconfig::xfreeX; # $Id$

use diagnostics;
use strict;

use Xconfig::parse;
use common;
use log;


sub empty_config {
    my ($class) = @_;
    my $raw_X = Xconfig::parse::read_XF86Config_from_string(our $default_header);
    bless $raw_X, $class;
}

sub read {
    my ($class, $file) = @_;
    $file ||= ($::prefix || '') . (bless {}, $class)->config_file;
    my $raw_X = Xconfig::parse::read_XF86Config($file);
    bless $raw_X, $class;
}
sub write {
    my ($raw_X, $file) = @_;
    $file ||= ($::prefix || '') . $raw_X->config_file;
    rename $file, "$file.old";
    Xconfig::parse::write_XF86Config($raw_X, $file);
}


my @monitor_fields = qw(VendorName ModelName HorizSync VertRefresh);
sub get_monitors {
    my ($raw_X) = @_;
    my @raw_monitors = $raw_X->get_monitor_sections;
    map { raw_export_section($_, [ 'Identifier', @monitor_fields ]) } @raw_monitors;
}
sub set_monitors {
    my ($raw_X, @monitors) = @_;
    my @raw_monitors = $raw_X->new_monitor_sections(int @monitors);
    mapn { 
	my ($raw_monitor, $monitor) = @_;
	raw_import_section($raw_monitor, $monitor, \@monitor_fields);
    } \@raw_monitors, \@monitors;
}
sub get_monitor {
    my ($raw_X) = @_;
    my @l = $raw_X->get_monitors;
    if (!@l) {
	$raw_X->new_monitor_sections(1);
	@l = $raw_X->get_monitors;
    }
    $l[0]
}

my @keyboard_fields = qw(XkbLayout XkbModel XkbDisable XkbOptions XkbCompat);
sub get_keyboard {
    my ($raw_X) = @_;
    my $raw_kbd = $raw_X->get_keyboard_section;
    raw_export_section($raw_kbd, \@keyboard_fields);
}
sub set_keyboard {
    my ($raw_X, $kbd) = @_;
    my $raw_kbd = eval { $raw_X->get_keyboard_section } || $raw_X->new_keyboard_section;
    raw_import_section($raw_kbd, $kbd);
    $raw_X->set_Option('keyboard', $raw_kbd, keys %$kbd);
}

#- example: { Protocol => 'IMPS/2', Device => '/dev/psaux', Emulate3Buttons => undef, Emulate3Timeout => 50, ZAxisMapping => [ '4 5', '6 7' ] }
my @mouse_fields = qw(Protocol Device ZAxisMapping Emulate3Buttons Emulate3Timeout); #-);
sub get_mice {
    my ($raw_X) = @_;
    my @raw_mice = $raw_X->get_mouse_sections;
    map { raw_export_section($_, \@mouse_fields) } @raw_mice;
}
sub set_mice {
    my ($raw_X, @mice) = @_;
    my @raw_mice = $raw_X->new_mouse_sections(int @mice);
    mapn { 
	my ($raw_mouse, $mouse) = @_;
	raw_import_section($raw_mouse, $mouse);
	$raw_X->set_Option('mouse', $raw_mouse, keys %$mouse);
    } \@raw_mice, \@mice;
}

sub get_devices {
    my ($raw_X) = @_;
    my @raw_devices = $raw_X->get_device_sections;
    map {
	my $raw_device = $_;
	my $device = raw_export_section($raw_device, [ 'Identifier', $raw_X->get_device_section_fields ]);
	$device->{Options} = raw_export_section($raw_device, [ grep { (deref_array($raw_device->{$_}))[0]->{Option} } keys %$raw_device ]);
	$device;
    } @raw_devices;
}
sub set_devices {
    my ($raw_X, @devices) = @_;
    my @raw_devices = $raw_X->new_device_sections(int @devices);
    mapn { 
	my ($raw_device, $device) = @_;
	my %Options  = %{$device->{Options} || {}};
	add2hash(\%Options, $device->{'Options_' . $raw_X->name});
	raw_import_section($raw_device, $device, [ $raw_X->get_device_section_fields ]);
	raw_import_section($raw_device, \%Options);
	$_->{Option} = 1 foreach map { deref_array($raw_device->{$_}) } keys %Options;
	$raw_device->{''} = [ { post_comment => $device->{raw_LINES} } ] if $device->{raw_LINES};
    } \@raw_devices, \@devices;
}

sub get_device {
    my ($raw_X) = @_;
    first(get_devices($raw_X));
}

sub get_screens {
    my ($raw_X) = @_;
    $raw_X->get_Sections('Screen');
}
sub get_default_screen {
    my ($raw_X) = @_;
    my @l = get_screens($raw_X);
    my @m = grep { $_->{Identifier} && val($_->{Identifier}) eq 'screen1' || 
		   $_->{Driver} && val($_->{Driver}) =~ /svga|accel/ } @l;
    first(@m ? @m : @l);
}
sub set_screens {
    my ($raw_X, @screens) = @_;
    my @raw_screens = $raw_X->new_screen_sections(int @screens);
    mapn { 
	my ($raw_screen, $screen) = @_;
	raw_import_section($raw_screen, $screen);
    } \@raw_screens, \@screens;
}

sub get_modules {
    my ($raw_X) = @_;
    my $raw_Module = $raw_X->get_Section('Module') or return;
    my $Module = raw_export_section($raw_Module, ['Load']);
    @{$Module->{Load} || []};
}
sub add_load_module {
    my ($raw_X, $module) = @_;
    my $raw_Module = $raw_X->get_Section('Module') || $raw_X->new_module_section;

    my %load_modules_comment = (
	dbe => 'Double-Buffering Extension',
	v4l => 'Video for Linux',
	dri => 'direct rendering',
	glx => '3D layer',
	'glx-3.so' => '3D layer',
    );
    my $comment = $load_modules_comment{$module};
    push @{$raw_Module->{Load}}, { val => $module,
				   comment_on_line => $comment && " # $comment",
				 } if !member($module, $raw_X->get_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');
    }
}
sub set_load_module {
    my ($raw_X, $module, $bool) = @_;
    $bool ? add_load_module($raw_X, $module) : remove_load_module($raw_X, $module);
}

sub get_resolution {
    my ($raw_X, $Screen) = @_;
    $Screen ||= $raw_X->get_default_screen or return {};

    my $depth = val($Screen->{DefaultColorDepth});
    my ($Display) = grep { !$depth || val($_->{l}{Depth}) eq $depth } @{$Screen->{Display} || []} or return {};
    val($Display->{l}{Modes}) =~ /(\d+)x(\d+)/ or return {};
    { X => $1, Y => $2, Depth => val($Display->{l}{Depth}) };
}

sub set_resolution {
    my ($raw_X, $resolution, $Screen_) = @_;
    
    foreach my $Screen ($Screen_ ? $Screen_ : $raw_X->get_screens) {
	$Screen ||= $raw_X->get_default_screen or internal_error('no screen');

	$Screen->{DefaultColorDepth} = { val => $resolution->{Depth} };
	$Screen->{Display} = [ map {
	    my $modes = do {
		if ($resolution->{fbdev}) {
		    '"default"';
		} else {
		    my @Modes = grep { 
			m/(\d+)x(\d+)/;
			$1 <= $resolution->{X} && (!$resolution->{Y} || $2 <= $resolution->{Y});
		    } reverse our @resolutions;
		    join(" ", map { qq("$_") } @Modes);
		}
	    };
	    { l => { Depth => { val => $_ }, Modes => { val => $modes } } };
	} $raw_X->depths ];
    }
}


#-##############################################################################
#- common to xfree3 and xfree4
#-##############################################################################
sub default_ModeLine { our $default_ModeLine }


sub get_device_sections {
    my ($raw_X) = @_;
    $raw_X->get_Sections('Device');
}
sub new_device_sections {
    my ($raw_X, $nb_new) = @_;
    $raw_X->remove_Section('Device');
    map { $raw_X->add_Section('Device', { Identifier => { val => "device$_" } }) } (1 .. $nb_new);
}

sub get_monitor_sections {
    my ($raw_X) = @_;
    $raw_X->get_Sections('Monitor');
}
sub new_monitor_sections {
    my ($raw_X, $nb_new) = @_;
    my $ModeLine = ModeLine_from_string(qq(Section "Monitor"\n) . $raw_X->default_ModeLine . qq(EndSection\n));
    $raw_X->remove_Section('Monitor');
    map { $raw_X->add_Section('Monitor', { Identifier => { val => "monitor$_" }, ModeLine => $ModeLine }) } (1 .. $nb_new);
}

sub new_screen_sections {
    my ($raw_X, $nb_new) = @_;
    $raw_X->remove_Section('Screen');
    map { $raw_X->add_Section('Screen', {}) } (1 .. $nb_new);
}

sub new_module_section {
    my ($raw_X) = @_;
    return $raw_X->add_Section('Module', {});
}


#-##############################################################################
#- helpers
#-##############################################################################
sub raw_export_section {
    my ($section, $fields) = @_;

    my $export_name = sub {
	my ($name) = @_;
	my $h = $section->{$name} or return;

	my @l = map { if_(!$_->{commented}, $_->{val}) } deref_array($h) or return;    
	$name => (ref($h) eq 'ARRAY' ? \@l : $l[0]);
    };

    my %h = map { $export_name->($_) } @$fields;
    \%h;
}

sub raw_import_section {
    my ($section, $h, $fields) = @_;
    foreach ($fields ? grep { exists $h->{$_} } @$fields : keys %$h) {
	my @l = map { ref($_) eq 'HASH' ? $_ : { val => $_ } } deref_array($h->{$_});
	$section->{$_} = (ref($h->{$_}) eq 'ARRAY' ? \@l : $l[0]);
    }
}

sub add_Section {
    my ($raw_X, $Section, $h) = @_;
    my @suggested_ordering = qw(Files ServerFlags Module DRI Keyboard Pointer XInput InputDevice Monitor Device Screen ServerLayout);
    my %order = map_index { { lc($_) => $::i } } @suggested_ordering;
    my $e = { name => $Section, l => $h };
    my $added;
    @$raw_X = map { 
	if ($order{lc $_->{name}} > $order{lc $Section} && !$added) {
	    $added = 1;
	    ($e, $_);
	} else { $_ }
    } @$raw_X;
    push @$raw_X, $e if !$added;
    $h;
}
sub remove_Section {
    my ($raw_X, $Section, $when) = @_;
    @$raw_X = grep { $_->{name} ne $Section || ($when && $when->($_->{l})) } @$raw_X;
    $raw_X;
}
sub get_Sections {
    my ($raw_X, $Section, $when) = @_;
    map { if_($_->{name} eq $Section && (!$when || $when->($_->{l})), $_->{l}) } @$raw_X;
}
sub get_Section {
    my ($raw_X, $Section, $when) = @_;
    my @l = get_Sections($raw_X, $Section, $when);
    @l > 1 and log::l("Xconfig: found more than one Section $Section");
    $l[0];
}
sub get_Section_by_Identifier {
    my ($raw_X, $Section, $Identifier) = @_;
    my @l = get_Sections($raw_X, $Section, sub { val($_[0]{Identifier}) eq $Identifier });
    @l > 1 and die "more than one Section $Section has Identifier $Identifier";
    $l[0];
}

sub val {
    my ($ref) = @_;
    $ref && $ref->{val};
}

sub ModeLine_from_string {
    my ($s) = @_;
    my $raw_X_for_ModeLine = Xconfig::parse::read_XF86Config_from_string($s);
    get_Section($raw_X_for_ModeLine, 'Monitor')->{ModeLine};
}



our @resolutions = ('640x480', '800x600', '1024x768', if_(arch() =~ /ppc/, '1152x768'), '1152x864', '1280x960', '1280x1024', '1400x1050', '1600x1200', '1920x1440', '2048x1536');

our $default_header = << 'END';
# File generated by XFdrake.

# **********************************************************************
# Refer to the XF86Config man page for details about the format of
# this file.
# **********************************************************************

Section "Files"
    # Multiple FontPath entries are allowed (they are concatenated together)
    # By default, Mandrake 6.0 and later now use a font server independent of
    # the X server to render fonts.
    FontPath "unix/:-1"
EndSection

Section "ServerFlags"
    #DontZap # disable <Crtl><Alt><BS> (server abort)
    #DontZoom # disable <Crtl><Alt><KP_+>/<KP_-> (resolution switching)
    AllowMouseOpenFail # allows the server to start up even if the mouse doesn't work
EndSection
END

our $default_ModeLine = arch() =~ /ppc/ ? << 'END_PPC' : << 'END';
    # Apple iMac modes
    ModeLine "1024x768"   78.525 1024 1049 1145 1312   768  769  772  800 +hsync +vsync
    ModeLine "800x600"    62.357  800  821  901 1040   600  601  604  632 +hsync +vsync
    ModeLine "640x480"    49.886  640  661  725  832   480  481  484  514 +hsync +vsync
    # Apple monitors tend to do 832x624
    ModeLine "832x624"    57      832  876  940 1152   624  625  628  667 -hsync -vsync
    # Apple PowerBook G3
    ModeLine "800x600"    100     800  816  824  840   600  616  624  640 -hsync -vsync
    # Apple TI Powerbook 
    ModeLine "1152x768"   78.741 1152 1173 1269 1440   768  769  772  800 +vsync +vsync
    # Pismo Firewire G3   
    ModeLine "1024x768"   65     1024 1032 1176 1344   768  771  777  806 -hsync -vsync
    # iBook2
    ModeLine "1024x768"   65     1024 1048 1184 1344   768  771  777  806 -hsync -vsync
    # 17" Apple Studio Display
    ModeLine "1024x768"   112.62 1024 1076 1248 1420 768 768 780 808 +hsync +vsync
    # HiRes Apple Studio Display
    ModeLine "1280x1024"  135    1280 1288 1392 1664  1024 1027 1030 1064
    # Another variation
    ModeLine "1280x1024"  134.989 1280 1317 1429 1688  1024 1025 1028 1066 +hsync +vsync
END_PPC
    # Sony Vaio C1(X,XS,VE,VN)?
    # 1024x480 @ 85.6 Hz, 48 kHz hsync
    ModeLine "1024x480"    65.00 1024 1032 1176 1344   480  488  494  563 -hsync -vsync
    
    # TV fullscreen mode or DVD fullscreen output.
    # 768x576 @ 79 Hz, 50 kHz hsync
    ModeLine "768x576"     50.00  768  832  846 1000   576  590  595  630
    # 768x576 @ 100 Hz, 61.6 kHz hsync
    ModeLine "768x576"     63.07  768  800  960 1024   576  578  590  616
END

1;

, 'Cirrus' ], [ 'tgui_pci_read_on', 'SVGA', 'Trident' ], [ 'tgui_pci_write_on', 'SVGA', 'Trident' ], [ 'no_program_clocks', 'SVGA', 'Trident' ], [ 'mmio', 'SVGA', 'Cirrus|C&T|Neomagic' ], [ 'sync_on_green', 'SVGA', 'C&T|MGA' ], [ 'pci_retry', 'SVGA', 'Tseng|MGA|Cirrus' ], [ 'hw_cursor', 'SVGA', 'C&T|SiS|ARK|ET6000|i740|Tseng' ], [ 'xaa_no_color_exp', 'SVGA', 'C&T|Cirrus|Trident|Tseng' ], [ 'xaa_benchmarks', 'SVGA', 'C&T' ], [ 'pci_burst_on', 'SVGA', 'Trident|Tseng' ], [ 'prog_lcd_mode_regs', 'SVGA', 'Neomagic' ], [ 'no_prog_lcd_mode_stretch', 'SVGA', 'Neomagic' ], [ 'no_wait', 'SVGA', 'Oak' ], #- [ 'med_dram', 'SVGA', 'Cirrus|Trident|Western Digital' ], #- WARNING, MAY DAMAGE CARD #- [ 'fast_dram', 'SVGA', 'C&T|Cirrus|ET[46]000|Trident|Western Digital' ], #- WARNING, MAY DAMAGE CARD #- [ 'fast_vram', 'SVGA', 'SiS' ], #- WARNING, MAY DAMAGE CARD #- [ 'clock_50', 'SVGA', 'Oak' ], #- WARNING, MAY DAMAGE CARD #- [ 'clock_66', 'SVGA', 'Oak' ], #- WARNING, MAY DAMAGE CARD #- [ 'fifo_aggressive', 'SVGA', 'Cirrus|ARK|SiS|Oak' ], #- WARNING, MAY DAMAGE CARD #- [ 'override_validate_mode', 'SVGA', 'Neomagic' ], #- WARNING, MAY DAMAGE CARD #- [ 'tgui_mclk_66', 'SVGA', 'Trident' ], #- WARNING, MAY DAMAGE CARD #- [ 'favour_bitblt', 'SVGA', 'Cirrus' ], #- OBSELETE [ 'sw_cursor', '3DLabs', '.*' ], [ 'no_pixmap_cache', '3DLabs', '.*' ], [ 'no_accel', '3DLabs', '.*' ], [ 'firegl_3000', '3DLabs', '.*' ], [ 'sync_on_green', '3DLabs', '.*' ], [ 'pci_retry', '3DLabs', '.*' ], #- [ 'overclock_mem', '3DLabs', '.*' ], #- WARNING, MAY DAMAGE CARD [ 'dac_8_bit', 'I128', '.*' ], [ 'no_accel', 'I128', '.*' ], [ 'sync_on_green', 'I128', '.*' ], [ 'composite', 'Mach32', '.*' ], [ 'sw_cursor', 'Mach32', '.*' ], [ 'dac_8_bit', 'Mach32', '.*' ], [ 'ast_mach32', 'Mach32', '.*' ], [ 'intel_gx', 'Mach32', '.*' ], [ 'no_linear', 'Mach32', '.*' ], [ 'sw_cursor', 'Mach64', '.*' ], [ 'nolinear', 'Mach64', '.*' ], [ 'no_block_write', 'Mach64', '.*' ], [ 'block_write', 'Mach64', '.*' ], [ 'fifo_conservative', 'Mach64', '.*' ], [ 'no_font_cache', 'Mach64', '.*' ], [ 'no_pixmap_cache', 'Mach64', '.*' ], [ 'composite', 'Mach64', '.*' ], [ 'power_saver', 'Mach64', '.*' ], [ 'no_program_clocks', 'Mach64', '.*' ], [ 'no_bios_clocks', 'Mach64', '.*' ], [ 'dac_6_bit', 'Mach64', '.*' ], [ 'dac_8_bit', 'Mach64', '.*' ], [ 'hw_cursor', 'Mach64', '.*' ], #- [ 'override_bios', 'Mach64', '.*' ], #- WARNING, MAY DAMAGE CARD [ 'sw_cursor', 'P9000', '.*' ], [ 'noaccel', 'P9000', '.*' ], [ 'sync_on_green', 'P9000', '.*' ], [ 'vram_128', 'P9000', '.*' ], [ 'nolinear', 'S3', '.*' ], [ 'dac_8_bit', 'S3', '.*' ], [ 'slow_vram', 'S3', 'S3.*964' ], [ 'stb_pegasus', 'S3', 'S3.*928' ], [ 'SPEA_Mercury', 'S3', 'S3.*(928|964)' ], [ 'number_nine', 'S3', 'S3.*(864|928)' ], [ 'lcd_center', 'S3', 'S3.*Aurora64V' ], [ 'noaccel', 'S3V', '.*' ], [ 'slow_edodram', 'S3V', '.*' ], [ 'pci_burst_on', 'S3V', '.*' ], [ 'early_ras_precharge', 'S3V', '.*' ], [ 'late_ras_precharge', 'S3V', '.*' ], [ 'fifo_conservative', 'S3V', '.*' ], [ 'fifo_aggressive', 'S3V', '.*' ], [ 'fifo_moderate', 'S3V', '.*' ], [ 'lcd_center', 'S3V', 'S3.*ViRGE\/MX' ], [ 'hw_cursor', 'S3V', '.*' ], [ 'pci_retry', 'S3V', '.*' ], [ 'dac_6_bit', 'AGX', '.*' ], [ 'dac_8_bit', 'AGX', '.*' ], [ 'sync_on_green', 'AGX', '.*' ], [ '8_bit_bus', 'AGX', '.*' ], [ 'wait_state', 'AGX', '.*' ], [ 'no_wait_state', 'AGX', '.*' ], [ 'noaccel', 'AGX', '.*' ], [ 'crtc_delay', 'AGX', '.*' ], [ 'fifo_conserv', 'AGX', '.*' ], [ 'fifo_aggressive', 'AGX', '.*' ], [ 'fifo_moderate', 'AGX', '.*' ], [ 'vram_delay_latch', 'AGX', '.*' ], [ 'vram_delay_ras', 'AGX', '.*' ], [ 'vram_extend_ras', 'AGX', '.*' ], [ 'slow_dram', 'AGX', '.*' ], [ 'slow_vram', 'AGX', '.*' ], [ 'med_dram', 'AGX', '.*' ], [ 'med_vram', 'AGX', '.*' ], [ 'fast_dram', 'AGX', '.*' ], [ 'fast_vram', 'AGX', '.*' ], [ 'engine_delay', 'AGX', '.*' ], [ 'vram_128', 'AGX', '.*' ], [ 'vram_256', 'AGX', '.*' ], [ 'refresh_20', 'AGX', '.*' ], [ 'refresh_25', 'AGX', '.*' ], [ 'screen_refresh', 'AGX', '.*' ], [ 'vlb_a', 'AGX', '.*' ], [ 'vlb_b', 'AGX', '.*' ], [ 'slow_dram', 'W32', '.*' ], [ 'pci_burst_off', 'W32', '.*' ], [ 'w32_interleave_off', 'W32', '.*' ], [ 'no_accel', 'W32', '.*' ], [ 'nolinear', '8514', '.*' ], [ 'sw_cursor', '8514', '.*' ], [ 'no_block_write', '8514', '.*' ], [ 'block_write', '8514', '.*' ], [ 'fifo_conservative', '8514', '.*' ], [ 'no_font_cache', '8514', '.*' ], [ 'no_pixmap_cache', '8514', '.*' ], [ 'composite', '8514', '.*' ], [ 'power_saver', '8514', '.*' ], [ 'power_saver', 'FBDev', '.*' ], ); %xkb_options = ( 'ru(winkeys)' => [ 'XkbVariant "winkeys"', 'XkbOptions "grp:caps_toggle"' ], 'jp' => [ 'XkbModel "jp106"' ], ); $XF86firstchunk_text = q( # File generated by XFdrake. # ********************************************************************** # Refer to the XF86Config(4/5) man page for details about the format of # this file. # ********************************************************************** Section "Files" RgbPath "/usr/X11R6/lib/X11/rgb" # Multiple FontPath entries are allowed (they are concatenated together) # By default, Mandrake 6.0 and later now use a font server independent of # the X server to render fonts. FontPath "unix/:-1" EndSection # ********************************************************************** # Server flags section. # ********************************************************************** Section "ServerFlags" # Uncomment this to cause a core dump at the spot where a signal is # received. This may leave the console in an unusable state, but may # provide a better stack trace in the core dump to aid in debugging #NoTrapSignals # Uncomment this to disable the <Crtl><Alt><BS> server abort sequence # This allows clients to receive this key event. #DontZap # Uncomment this to disable the <Crtl><Alt><KP_+>/<KP_-> mode switching # sequences. This allows clients to receive these key events. #DontZoom # This allows the server to start up even if the # mouse device can't be opened/initialised. AllowMouseOpenFail ); $XF86firstchunk_text2 = q( EndSection # ********************************************************************** # Input devices # ********************************************************************** ); $keyboardsection_start = ' # ********************************************************************** # Keyboard section # ********************************************************************** Section "Keyboard" Protocol "Standard" # when using XQUEUE, comment out the above line, and uncomment the # following line #Protocol "Xqueue" AutoRepeat 250 30 # Let the server do the NumLock processing. This should only be # required when using pre-R6 clients #ServerNumLock # Specify which keyboard LEDs can be user-controlled (eg, with xset(1)) #Xleds "1 2 3" #To set the LeftAlt to Meta, RightAlt key to ModeShift, #RightCtl key to Compose, and ScrollLock key to ModeLock: LeftAlt Meta RightAlt Meta ScrollLock Compose RightCtl Control # To disable the XKEYBOARD extension, uncomment XkbDisable. # XkbDisable '; $keyboardsection_start_v4 = ' # ********************************************************************** # Keyboard section # ********************************************************************** Section "InputDevice" Identifier "Keyboard1" Driver "Keyboard" Option "AutoRepeat" "250 30" '; if (arch() =~ /^sparc/) { $keyboardsection_part3 = ' # To customise the XKB settings to suit your keyboard, modify the # lines below (which are the defaults). For example: # XkbModel "type6" # If you have a SUN keyboard, you may use: # XkbModel "sun" # # Then to change the language, change the Layout setting. # For example, a german layout can be obtained with: # XkbLayout "de" # or: # XkbLayout "de" # XkbVariant "nodeadkeys" # # If you\'d like to switch the positions of your capslock and # control keys, use: # XkbOptions "ctrl:swapcaps" # These are the default XKB settings for XFree86 on SUN: # XkbRules "sun" # XkbModel "type5_unix" # XkbLayout "us" # XkbCompat "compat/complete" # XkbTypes "types/complete" # XkbKeycodes "sun(type5)" # XkbGeometry "sun(type5)" # XkbSymbols "sun/us(sun5)" XkbRules "sun" XkbModel "sun" XkbLayout "us" XkbCompat "compat/complete" XkbTypes "types/complete" XkbKeycodes "sun(type5)" XkbGeometry "sun(type5)" XkbSymbols "sun/us(sun5)" '; $keyboardsection_part3_v4 = ' Option "XkbRules" "sun" Option "XkbModel" "sun" Option "XkbLayout" "us" Option "XkbCompat" "compat/complete" Option "XkbTypes" "types/complete" Option "XkbKeycodes" "sun(type5)" Option "XkbGeometry" "sun(type5)" Option "XkbSymbols" "sun/us(sun5)" '; } else { $keyboardsection_part3 = ' # To customise the XKB settings to suit your keyboard, modify the # lines below (which are the defaults). For example, for a non-U.S. # keyboard, you will probably want to use: # XkbModel "pc102" # If you have a US Microsoft Natural keyboard, you can use: # XkbModel "microsoft" # # Then to change the language, change the Layout setting. # For example, a german layout can be obtained with: # XkbLayout "de" # or: # XkbLayout "de" # XkbVariant "nodeadkeys" # # If you\'d like to switch the positions of your capslock and # control keys, use: # XkbOptions "ctrl:swapcaps" # These are the default XKB settings for XFree86 # XkbRules "xfree86" # XkbModel "pc101" # XkbLayout "us" # XkbVariant "" # XkbOptions "" XkbKeycodes "xfree86" XkbTypes "default" XkbCompat "default" XkbSymbols "us(pc105)" XkbGeometry "pc" XkbRules "xfree86" XkbModel "pc105" '; $keyboardsection_part3_v4 = ' Option "XkbRules" "xfree86" Option "XkbModel" "pc105" '; } $keyboardsection_end = ' EndSection '; $pointersection_text = ' # ********************************************************************** # Pointer section # ********************************************************************** Section "Pointer" '; $pointersection_text_v4 = ' # ********************************************************************** # Pointer section # ********************************************************************** Section "InputDevice" Identifier "Mouse1" Driver "mouse" '; $monitorsection_text1 = ' # ********************************************************************** # Monitor section # ********************************************************************** # Any number of monitor sections may be present Section "Monitor" '; $monitorsection_text2 = ' # HorizSync is in kHz unless units are specified. # HorizSync may be a comma separated list of discrete values, or a # comma separated list of ranges of values. # NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR\'S # USER MANUAL FOR THE CORRECT NUMBERS. '; $monitorsection_text3 = ' # VertRefresh is in Hz unless units are specified. # VertRefresh may be a comma separated list of discrete values, or a # comma separated list of ranges of values. # NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR\'S # USER MANUAL FOR THE CORRECT NUMBERS. '; $monitorsection_text4 = ' # Modes can be specified in two formats. A compact one-line format, or # a multi-line format. # These two are equivalent # ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace # Mode "1024x768i" # DotClock 45 # HTimings 1024 1048 1208 1264 # VTimings 768 776 784 817 # Flags "Interlace" # EndMode '; $modelines_text_Trident_TG_96xx = ' # This is a set of standard mode timings. Modes that are out of monitor spec # are automatically deleted by the server (provided the HorizSync and # VertRefresh lines are correct), so there\'s no immediate need to # delete mode timings (unless particular mode timings don\'t work on your # monitor). With these modes, the best standard mode that your monitor # and video card can support for a given resolution is automatically # used. # These are special modelines for Trident Providia 9685. It is for VA Linux # systems only. # 640x480 @ 72 Hz, 36.5 kHz hsync Modeline "640x480" 31.5 640 680 720 864 480 488 491 521 # 800x600 @ 72 Hz, 48.0 kHz hsync Modeline "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync # 1024x768 @ 60 Hz, 48.4 kHz hsync #Modeline "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync # 1024x768 @ 70 Hz, 56.5 kHz hsync Modeline "1024x768" 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync '; $modelines_text = ' # This is a set of standard mode timings. Modes that are out of monitor spec # are automatically deleted by the server (provided the HorizSync and # VertRefresh lines are correct), so there\'s no immediate need to # delete mode timings (unless particular mode timings don\'t work on your # monitor). With these modes, the best standard mode that your monitor # and video card can support for a given resolution is automatically # used. # 640x400 @ 70 Hz, 31.5 kHz hsync Modeline "640x400" 25.175 640 664 760 800 400 409 411 450 # 640x480 @ 60 Hz, 31.5 kHz hsync Modeline "640x480" 25.175 640 664 760 800 480 491 493 525 # 800x600 @ 56 Hz, 35.15 kHz hsync ModeLine "800x600" 36 800 824 896 1024 600 601 603 625 # 1024x768 @ 87 Hz interlaced, 35.5 kHz hsync Modeline "1024x768" 44.9 1024 1048 1208 1264 768 776 784 817 Interlace # 640x400 @ 85 Hz, 37.86 kHz hsync Modeline "640x400" 31.5 640 672 736 832 400 401 404 445 -HSync +VSync # 640x480 @ 72 Hz, 36.5 kHz hsync Modeline "640x480" 31.5 640 680 720 864 480 488 491 521 # 640x480 @ 75 Hz, 37.50 kHz hsync ModeLine "640x480" 31.5 640 656 720 840 480 481 484 500 -HSync -VSync # 800x600 @ 60 Hz, 37.8 kHz hsync Modeline "800x600" 40 800 840 968 1056 600 601 605 628 +hsync +vsync # 640x480 @ 85 Hz, 43.27 kHz hsync Modeline "640x480" 36 640 696 752 832 480 481 484 509 -HSync -VSync # 1152x864 @ 89 Hz interlaced, 44 kHz hsync ModeLine "1152x864" 65 1152 1168 1384 1480 864 865 875 985 Interlace # 800x600 @ 72 Hz, 48.0 kHz hsync Modeline "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync # 1024x768 @ 60 Hz, 48.4 kHz hsync Modeline "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync # 640x480 @ 100 Hz, 53.01 kHz hsync Modeline "640x480" 45.8 640 672 768 864 480 488 494 530 -HSync -VSync # 1152x864 @ 60 Hz, 53.5 kHz hsync Modeline "1152x864" 89.9 1152 1216 1472 1680 864 868 876 892 -HSync -VSync # 800x600 @ 85 Hz, 55.84 kHz hsync Modeline "800x600" 60.75 800 864 928 1088 600 616 621 657 -HSync -VSync # 1024x768 @ 70 Hz, 56.5 kHz hsync Modeline "1024x768" 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync # 1280x1024 @ 87 Hz interlaced, 51 kHz hsync Modeline "1280x1024" 80 1280 1296 1512 1568 1024 1025 1037 1165 Interlace # 800x600 @ 100 Hz, 64.02 kHz hsync Modeline "800x600" 69.65 800 864 928 1088 600 604 610 640 -HSync -VSync # 1024x768 @ 76 Hz, 62.5 kHz hsync Modeline "1024x768" 85 1024 1032 1152 1360 768 784 787 823 # 1152x864 @ 70 Hz, 62.4 kHz hsync Modeline "1152x864" 92 1152 1208 1368 1474 864 865 875 895 # 1280x1024 @ 61 Hz, 64.2 kHz hsync Modeline "1280x1024" 110 1280 1328 1512 1712 1024 1025 1028 1054 # 1024x768 @ 85 Hz, 70.24 kHz hsync Modeline "1024x768" 98.9 1024 1056 1216 1408 768 782 788 822 -HSync -VSync # 1152x864 @ 78 Hz, 70.8 kHz hsync Modeline "1152x864" 110 1152 1240 1324 1552 864 864 876 908 # 1280x1024 @ 70 Hz, 74.59 kHz hsync Modeline "1280x1024" 126.5 1280 1312 1472 1696 1024 1032 1040 1068 -HSync -VSync # 1600x1200 @ 60Hz, 75.00 kHz hsync Modeline "1600x1200" 162 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync # 1152x864 @ 84 Hz, 76.0 kHz hsync Modeline "1152x864" 135 1152 1464 1592 1776 864 864 876 908 # 1280x1024 @ 74 Hz, 78.85 kHz hsync Modeline "1280x1024" 135 1280 1312 1456 1712 1024 1027 1030 1064 # 1024x768 @ 100Hz, 80.21 kHz hsync Modeline "1024x768" 115.5 1024 1056 1248 1440 768 771 781 802 -HSync -VSync # 1280x1024 @ 76 Hz, 81.13 kHz hsync Modeline "1280x1024" 135 1280 1312 1416 1664 1024 1027 1030 1064 # 1600x1200 @ 70 Hz, 87.50 kHz hsync Modeline "1600x1200" 189 1600 1664 1856 2160 1200 1201 1204 1250 -HSync -VSync # 1152x864 @ 100 Hz, 89.62 kHz hsync Modeline "1152x864" 137.65 1152 1184 1312 1536 864 866 885 902 -HSync -VSync # 1280x1024 @ 85 Hz, 91.15 kHz hsync Modeline "1280x1024" 157.5 1280 1344 1504 1728 1024 1025 1028 1072 +HSync +VSync # 1600x1200 @ 75 Hz, 93.75 kHz hsync Modeline "1600x1200" 202.5 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync # 1600x1200 @ 85 Hz, 105.77 kHz hsync Modeline "1600x1200" 220 1600 1616 1808 2080 1200 1204 1207 1244 +HSync +VSync # 1280x1024 @ 100 Hz, 107.16 kHz hsync Modeline "1280x1024" 181.75 1280 1312 1440 1696 1024 1031 1046 1072 -HSync -VSync # 1800x1440 @ 64Hz, 96.15 kHz hsync ModeLine "1800X1440" 230 1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync # 1800x1440 @ 70Hz, 104.52 kHz hsync ModeLine "1800X1440" 250 1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync # 512x384 @ 78 Hz, 31.50 kHz hsync Modeline "512x384" 20.160 512 528 592 640 384 385 388 404 -HSync -VSync # 512x384 @ 85 Hz, 34.38 kHz hsync Modeline "512x384" 22 512 528 592 640 384 385 388 404 -HSync -VSync # Low-res Doublescan modes # If your chipset does not support doublescan, you get a \'squashed\' # resolution like 320x400. # 320x200 @ 70 Hz, 31.5 kHz hsync, 8:5 aspect ratio Modeline "320x200" 12.588 320 336 384 400 200 204 205 225 Doublescan # 320x240 @ 60 Hz, 31.5 kHz hsync, 4:3 aspect ratio Modeline "320x240" 12.588 320 336 384 400 240 245 246 262 Doublescan # 320x240 @ 72 Hz, 36.5 kHz hsync Modeline "320x240" 15.750 320 336 384 400 240 244 246 262 Doublescan # 400x300 @ 56 Hz, 35.2 kHz hsync, 4:3 aspect ratio ModeLine "400x300" 18 400 416 448 512 300 301 302 312 Doublescan # 400x300 @ 60 Hz, 37.8 kHz hsync Modeline "400x300" 20 400 416 480 528 300 301 303 314 Doublescan # 400x300 @ 72 Hz, 48.0 kHz hsync Modeline "400x300" 25 400 424 488 520 300 319 322 333 Doublescan # 480x300 @ 56 Hz, 35.2 kHz hsync, 8:5 aspect ratio ModeLine "480x300" 21.656 480 496 536 616 300 301 302 312 Doublescan # 480x300 @ 60 Hz, 37.8 kHz hsync Modeline "480x300" 23.890 480 496 576 632 300 301 303 314 Doublescan # 480x300 @ 63 Hz, 39.6 kHz hsync Modeline "480x300" 25 480 496 576 632 300 301 303 314 Doublescan # 480x300 @ 72 Hz, 48.0 kHz hsync Modeline "480x300" 29.952 480 504 584 624 300 319 322 333 Doublescan '; $devicesection_text = ' # ********************************************************************** # Graphics device section # ********************************************************************** Section "Device" Identifier "Generic VGA" Chipset "generic" EndSection '; $devicesection_text_v4 = ' # ********************************************************************** # Graphics device section # ********************************************************************** Section "Device" Identifier "Generic VGA" Driver "vga" EndSection '; $screensection_text1 = ' # ********************************************************************** # Screen sections # ********************************************************************** ';