先看一个完整的xorg.conf文件,如下:
1: # /.../
2: # SaX generated X11 config file
3: # Created on: 2009-05-31T19:02:32+0800.
4: #
5: # Version: 8.1
6: # Contact: Marcus Schaefer <[email protected]>, 2005
7: # Contact: SaX-User list <https://lists.berlios.de/mailman/listinfo/sax-users>
8: #
9: # Automatically generated by [ISaX] (8.1)
10: # PLEASE DO NOT EDIT THIS FILE!
11: #
12: Section "Files"
13: FontPath "/usr/share/fonts/misc:unscaled"
14: FontPath "/usr/share/fonts/local"
15: FontPath "/usr/share/fonts/75dpi:unscaled"
16: FontPath "/usr/share/fonts/100dpi:unscaled"
17: FontPath "/usr/share/fonts/Type1"
18: FontPath "/usr/share/fonts/URW"
19: FontPath "/usr/share/fonts/Speedo"
20: FontPath "/usr/share/fonts/PEX"
21: FontPath "/usr/share/fonts/cyrillic"
22: FontPath "/usr/share/fonts/latin2/misc:unscaled"
23: FontPath "/usr/share/fonts/latin2/75dpi:unscaled"
24: FontPath "/usr/share/fonts/latin2/100dpi:unscaled"
25: FontPath "/usr/share/fonts/latin2/Type1"
26: FontPath "/usr/share/fonts/latin7/75dpi:unscaled"
27: FontPath "/usr/share/fonts/baekmuk:unscaled"
28: FontPath "/usr/share/fonts/japanese:unscaled"
29: FontPath "/usr/share/fonts/kwintv"
30: FontPath "/usr/share/fonts/truetype"
31: FontPath "/usr/share/fonts/uni:unscaled"
32: FontPath "/usr/share/fonts/CID"
33: FontPath "/usr/share/fonts/ucs/misc:unscaled"
34: FontPath "/usr/share/fonts/ucs/75dpi:unscaled"
35: FontPath "/usr/share/fonts/ucs/100dpi:unscaled"
36: FontPath "/usr/share/fonts/hellas/misc:unscaled"
37: FontPath "/usr/share/fonts/hellas/75dpi:unscaled"
38: FontPath "/usr/share/fonts/hellas/100dpi:unscaled"
39: FontPath "/usr/share/fonts/hellas/Type1"
40: FontPath "/usr/share/fonts/misc/sgi:unscaled"
41: FontPath "/usr/share/fonts/xtest"
42: FontPath "/opt/kde3/share/fonts"
43: FontPath "unix/:7100"
44: InputDevices "/dev/gpmdata"
45: InputDevices "/dev/input/mice"
46: EndSection
47: Section "ServerFlags"
48: Option "AllowMouseOpenFail" "on"
49: EndSection
50: Section "Module"
51: Load "extmod"
52: Load "type1"
53: Load "glx"
54: Load "freetype"
55: Load "dbe"
56: Load "v4l"
57: EndSection
58: Section "InputDevice"
59: Driver "kbd"
60: Identifier "Keyboard[0]"
61: Option "Protocol" "Standard"
62: Option "XkbLayout" "us"
63: Option "XkbModel" "pc104"
64: Option "XkbRules" "xfree86"
65: EndSection
66: Section "InputDevice"
67: Driver "mouse"
68: Identifier "Mouse[1]"
69: Option "Buttons" "5"
70: Option "Device" "/dev/input/mice"
71: Option "Name" "ImPS/2 Generic Wheel Mouse"
72: Option "Protocol" "explorerps/2"
73: Option "Vendor" "Sysp"
74: Option "ZAxisMapping" "4 5"
75: EndSection
76: Section "Monitor"
77: DisplaySize 305 230
78: HorizSync 29-35
79: Identifier "Monitor[0]"
80: ModelName "800X600@56HZ"
81: VendorName "--> VESA"
82: VertRefresh 50-60
83: UseModes "Modes[0]"
84: EndSection
85: Section "Modes"
86: Identifier "Modes[0]"
87: Modeline "800x600" 35.55 800 832 912 1024 600 601 604 620
88: Modeline "768x576" 33.74 768 792 872 976 576 577 580 596
89: Modeline "640x480" 23.86 640 656 720 800 480 481 484 497
90: EndSection
91: Section "Screen"
92: DefaultDepth 16
93: SubSection "Display"
94: Depth 15
95: Modes "800x600" "768x576" "640x480"
96: EndSubSection
97: SubSection "Display"
98: Depth 16
99: Modes "800x600" "768x576" "640x480"
100: EndSubSection
101: SubSection "Display"
102: Depth 24
103: Modes "800x600" "768x576" "640x480"
104: EndSubSection
105: SubSection "Display"
106: Depth 8
107: Modes "800x600" "768x576" "640x480"
108: EndSubSection
109: Device "Device[0]"
110: Identifier "Screen[0]"
111: Monitor "Monitor[0]"
112: EndSection
113: Section "Device"
114: BoardName "VMWARE0405"
115: BusID "0:15:0"
116: Driver "vmware"
117: Identifier "Device[0]"
118: Screen 0
119: VendorName "VMWare Inc"
120: EndSection
121: Section "ServerLayout"
122: Identifier "Layout[all]"
123: InputDevice "Keyboard[0]" "CoreKeyboard"
124: InputDevice "Mouse[1]" "CorePointer"
125: Option "Clone" "off"
126: Option "Xinerama" "off"
127: Screen "Screen[0]"
128: EndSection
129: Section "DRI"
130: Group "video"
131: Mode 0660
132: EndSection
133: Section "Extensions"
134: EndSection
通过上述代码会发现xorg.conf文件由
Section "xxxx"
.........
EndSection
对组成.下面我们主要解释一下每个节点的含义。
一、输入设备--键盘
1: Section "InputDevice"
2: Driver "kbd"
3: Identifier "Keyboard[0]"
4: Option "Protocol" "Standard"
5: Option "XkbLayout" "us"
6: Option "XkbModel" "pc104"
7: Option "XkbRules" "xfree86"
8: EndSection
二、输入设备--鼠标
1: Section "InputDevice"
2: Driver "mouse"
3: Identifier "Mouse[1]"
4: Option "Buttons" "5"
5: Option "Device" "/dev/input/mice"
6: Option "Name" "ImPS/2 Generic Wheel Mouse"
7: Option "Protocol" "explorerps/2"
8: Option "Vendor" "Sysp"
9: Option "ZAxisMapping" "4 5"
10: EndSection
三、显示器
1: Section "Monitor"
2: DisplaySize 305 230
3: HorizSync 29-35
4: Identifier "Monitor[0]"
5: ModelName "800X600@56HZ"
6: VendorName "--> VESA"
7: VertRefresh 50-60
8: UseModes "Modes[0]"
9: EndSection
其中,
Identifier:显示器的惟一名称。在这些名称后面都会加上一个数字,而第一个显示器的代表数字为0(Monitor[0])。
VendorName:显示器制造商名称。
ModelName:显示器类型名称。
HorizSync:与显示器兼容的水平刷新频率范围,其单位为kHz。这个设置值会同时指出是否在此显示器中使用特定的Modeline值。
四、显卡
1: Section "Device"
2: BoardName "VMWARE0405"
3: BusID "0:15:0"
4: Driver "vmware"
5: Identifier "Device[0]"
6: Screen 0
7: VendorName "VMWare Inc"
8: EndSection
五、Screen
一个显示器和一个显卡组成一个screen,用Section "Screen"描述,如:
1: Section "Screen"
2: DefaultDepth 16
3: SubSection "Display"
4: Depth 15
5: Modes "800x600" "768x576" "640x480"
6: EndSubSection
7: SubSection "Display"
8: Depth 16
9: Modes "800x600" "768x576" "640x480"
10: EndSubSection
11: SubSection "Display"
12: Depth 24
13: Modes "800x600" "768x576" "640x480"
14: EndSubSection
15: SubSection "Display"
16: Depth 8
17: Modes "800x600" "768x576" "640x480"
18: EndSubSection
19: Device "Device[0]"
20: Identifier "Screen[0]"
21: Monitor "Monitor[0]"
22: EndSection
其中,
Identifier:定义一个“Screen”名称,以便在“ServerLayout”Section中进行参照。
Device:指定“Device”Section中的名称。
Monitor:指定“Monitor”Section中的名称。
DefaultDepth:默认的色深(Color Depth)位数。
Modes "800x600" "768x576" "640x480" 表示系统会默认先按照800x600的分辨率去适配,如果适配失败,则选择768x576的分辨率继续。
六、Modes
1: Section "Modes"
2: Identifier "Modes[0]"
3: Modeline "800x600" 35.55 800 832 912 1024 600 601 604 620
4: Modeline "768x576" 33.74 768 792 872 976 576 577 580 596
5: Modeline "640x480" 23.86 640 656 720 800 480 481 484 497
6: EndSection
和screen章节中的Modes对应。
7、ServerLayout
1: Section "ServerLayout"
2: Identifier "Layout[all]"
3: InputDevice "Keyboard[0]" "CoreKeyboard"
4: InputDevice "Mouse[1]" "CorePointer"
5: Option "Clone" "off"
6: Option "Xinerama" "off"
7: Screen "Screen[0]"
8: EndSection
ServerLayout”Section主要用于建立X Server启动时的外观,其中:
Identifier:此ServerLayout Section的惟一名称。
Screen:“Screen”Section指定的名称
InputDevice:在X Server中的“InputDevice”Section名称。通常在此仅有两行设置,即Mouse[0]和Keyboard[0],也就是系统中的第一个鼠标和键盘,而其他的设备大多可以忽略。