# /etc/X11/xorg.conf (xorg X Window System server configuration file)
#
# JB's Dell Latitude D420 xorg.conf
#
#-------------------------------------------------------------------
# 2007.11.15 modified by ESF for use on a Dell Latitude D630
#            with a Dell 1280x1024 laptop (dual mode) and
#            for use with data projectors (1024x768 non-dual mode).
#-------------------------------------------------------------------
#
# The first version of this file was automatically created at 
# installation, with the following comments :
#
## This file was generated by dexconf, the Debian X Configuration tool, 
## using values from the debconf database.
##
## Edit this file with caution, and see the /etc/X11/xorg.conf manual 
## page. (Type "man /etc/X11/xorg.conf" at the shell prompt.)
##
## This file is automatically updated on xserver-xorg package upgrades 
## *only* if it has not been modified since the last upgrade of the 
## xserver-xorg package.
##
## If you have edited this file but would like it to be automatically 
## updated again, run the following command:
##   sudo dpkg-reconfigure -phigh xserver-xorg
#
# The xorg.conf file consists of several sections, and the order should 
# not matter.
#
# So let's begin with the original xorg.conf (almost unchanged), which 
# defines a setting ("ServerLayout") that works fine with the internal 
# screen (in native resolution 1280x800, with 3D/video acceleration, 
# etc), provided that you installed 915resolution. Since it comes first 
# in the file, it will be the default setting for the X server.

Section "Files"
	FontPath	"/usr/share/fonts/X11/misc"
	FontPath	"/usr/X11R6/lib/X11/fonts/misc"
	FontPath	"/usr/share/fonts/X11/cyrillic"
	FontPath	"/usr/X11R6/lib/X11/fonts/cyrillic"
	FontPath	"/usr/share/fonts/X11/100dpi/:unscaled"
	FontPath	"/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
	FontPath	"/usr/share/fonts/X11/75dpi/:unscaled"
	FontPath	"/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
	FontPath	"/usr/share/fonts/X11/Type1"
	FontPath	"/usr/X11R6/lib/X11/fonts/Type1"
	FontPath	"/usr/share/fonts/X11/100dpi"
	FontPath	"/usr/X11R6/lib/X11/fonts/100dpi"
	FontPath	"/usr/share/fonts/X11/75dpi"
	FontPath	"/usr/X11R6/lib/X11/fonts/75dpi"
	# path to defoma fonts
	FontPath	"/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
EndSection

Section "Module"
	Load	"i2c"
	Load	"bitmap"
	Load	"ddc"
	Load	"dri"
	Load	"extmod"
	Load	"freetype"
	Load	"glx"
	Load	"int10"
	Load	"vbe"
EndSection

Section "InputDevice"
	Identifier	"Generic Keyboard"
	Driver		"kbd"
	Option		"CoreKeyboard"
	Option		"XkbRules"	"xorg"
	Option		"XkbModel"	"pc105"
	Option		"XkbLayout"	"gb"
	Option		"KkbDisable"	"true"
EndSection

Section "InputDevice"
	Identifier	"Configured Mouse"
	Driver		"mouse"
	Option		"CorePointer"
	Option		"Device"		"/dev/input/mice"
	Option		"Protocol"		"ImPS/2"
	Option		"Emulate3Buttons"	"true"
EndSection

Section "InputDevice"
	Identifier	"Synaptics Touchpad"
	Driver		"synaptics"
	Option		"SendCoreEvents"	"true"
	Option		"Device"		"/dev/psaux"
	Option		"Protocol"		"auto-dev"
	Option		"HorizScrollDelta"	"0"
	Option		"SHMConfig"		"true"
EndSection

Section "Device"
	Identifier	"Intel Corporation Mobile 945GM/GMS/940GML Express Integrated Graphics Controller"
#	Driver		"i810"
	Driver		"vesa"
	BusID		"PCI:0:2:0"
EndSection

Section "Monitor"
	Identifier	"Generic Monitor"
	Option		"DPMS"
EndSection

Section "Screen"
	Identifier	"Default Screen"
	Device		"Intel Corporation Mobile 945GM/GMS/940GML Express Integrated Graphics Controller"
	Monitor		"Generic Monitor"
	DefaultDepth	24
	SubSection "Display"
		Depth		1
		Modes		"1280x800"
	EndSubSection
	SubSection "Display"
		Depth		4
		Modes		"1280x800"
	EndSubSection
	SubSection "Display"
		Depth		8
		Modes		"1280x800"
	EndSubSection
	SubSection "Display"
		Depth		15
		Modes		"1280x800"
	EndSubSection
	SubSection "Display"
		Depth		16
		Modes		"1280x800" "1024x768"
	EndSubSection
	SubSection "Display"
		Depth		24
		Modes		"1280x800" "1024x768"
	EndSubSection
EndSection

Section "ServerLayout"
	Identifier	"Default Layout"
	Screen		"Default Screen"
	InputDevice	"Generic Keyboard"
	InputDevice	"Configured Mouse"
	InputDevice	"Synaptics Touchpad"
EndSection

Section "DRI"
	Mode	0666
EndSection

# This is the end of default settings.
#
# Let's now define alternative settings for special occasions (e.g. when 
# an external display must be used). Of course if everyday is special 
# for you, you should make them default.
#
# An easy way to start the X server in an alternative setting is to log 
# in from a Linux console (obtained with Ctrl + Alt + F1/F2/.../F6) and 
# run :
#   "startx -- :1 -layout mylayout"
# (assuming another X server is running on :0 aka vt7 ; switch between 
# them with Ctrl + Alt + F7/F8).
#
# We first define a low resolution setting, in order to start X in a 
# more traditional resolution, for compatibility with external displays 
# like video projectors (1024x768, 800x600, 640x480). This is not for 
# dual display, see below. Ideally one would first start X with
#   "startx -- :1 -layout lowres"
# then plug the video cable, and toggle between internal/external/both 
# displays with Fn+F8. This almost works... but a bug (in the i810 
# driver ?) causes the machine to crash if one presses Fn+F8 too many 
# times. This looks similar to the bug reported here :
#   https://launchpad.net/ubuntu/+source/xserver-xorg-driver-i810/+bug/50243
# So though this setting might be helpful it is not recommended until 
# the bug is fixed.

Section "ServerLayout"
	Identifier	"lowres"
	Screen		"LowRes Screen"
	InputDevice	"Generic Keyboard"
	InputDevice	"Configured Mouse"
	InputDevice	"Synaptics Touchpad"
EndSection

Section "Screen"
	Identifier	"LowRes Screen"
	Device		"Intel Corporation Mobile 945GM/GMS/940GML Express Integrated Graphics Controller"
	Monitor		"Generic Monitor"
	DefaultDepth	24
	SubSection "Display"
		Depth		1
		Modes		"1024x768" "800x600" "640x480"
	EndSubSection
	SubSection "Display"
		Depth		4
		Modes		"1024x768" "800x600" "640x480"
	EndSubSection
	SubSection "Display"
		Depth		8
		Modes		"1024x768" "800x600" "640x480"
	EndSubSection
	SubSection "Display"
		Depth		15
		Modes		"1024x768" "800x600" "640x480"
	EndSubSection
	SubSection "Display"
		Depth		16
		Modes		"1024x768" "800x600" "640x480"
	EndSubSection
	SubSection "Display"
		Depth		24
		Modes		"1024x768" "800x600" "640x480"
	EndSubSection
EndSection

# Now the dual screen setting, thanks to Olivier Carton. The desktop is 
# "split" between the internal LCD and the external display (you go with 
# the mouse from one to another, windows can be dragged, etc). This has 
# been tested (and works) with a screen plugged either on the laptop or 
# MediaBase VGA output, DVI is untested yet.
#
# A few remarks :
#
# - the actual effect of each option is not entirely clear to me... 
# (e.g. what is the interaction between Screen and MonitorLayout ?)
#
# - you may also find that your fonts appear smaller on the internal LCD 
# than with the default setting : this is probably because the X server 
# uses the pitch (number of dots per inch) of the external screen which 
# is typically lower than that of the LCD (125). Declaring the actual 
# DisplaySize of the LCD seems to change this behaviour...
#
# - DRI (3D acceleration) seems to be disabled in any case, maybe it is 
# something expected with Xinerama ?
#
# - there are issues when another X server is running on :0 (I have the 
# external screen pick a wrong resolution), so disable it before and 
# start X from the console (e.g. from the KDM login screen, look for 
# "Console login"). Is there any trick for changing the server layout 
# from KDM ?

Section "ServerLayout"
	Identifier	"dual"
	# Screen0 will correspond to the internal LCD
        Screen         0	"Screen0"
	# Screen1 will correspond to the external screen, you can choose 
	# its "position" wrt the other (Above, Below, LeftOf, 
	# RightOf...)
        Screen         1	"Screen1"	RightOf	"Screen0"
	# this is the magic word :
#	Option		"Xinerama"	"on"
	# nothing new here :
	InputDevice	"Generic Keyboard"
	InputDevice	"Configured Mouse"
	InputDevice	"Synaptics Touchpad"
EndSection

Section	"Monitor"
	Identifier	"Monitor0"
	VendorName	"Monitor Vendor"
	ModelName	"Monitor Model"
        Option		"dpms"
	# actual size of the internal LCD (in mm)
	DisplaySize	260 162
EndSection

Section "Monitor"
	Identifier	"Monitor1"
	VendorName	"Monitor Vendor"
	ModelName	"Monitor Model"
        Option		"dpms"
	# does this play a role ?
	# DisplaySize	342 271
EndSection

Section "Device"
	Identifier	"Card0"
#	Driver		"i810"
	Driver		"vesa"
	VendorName	"Intel Corporation"
	BoardName	"Mobile 945GM/GMS/940GML Express Integrated Graphics Controller"
	BusID		"PCI:0:2:0"
	Option		"MonitorLayout" "CRT,LFP"
	Screen	    	0
EndSection

Section	"Device"
	Identifier	"Card1"
#	Driver		"i810"
	Driver		"vesa"
	VendorName	"Intel Corporation"
	BoardName	"Mobile 945GM/GMS/940GML Express Integrated Graphics Controller"
	BusID		"PCI:0:2:0"
	Option		"MonitorLayout" "CRT,LFP"
	Screen	    	1
EndSection

Section	"Screen"
	Identifier	"Screen0"
	Device		"Card0"
	Monitor		"Monitor0"
	DefaultDepth     24
	# we only specify 24 bit depth, this ought to be enough for anybody
	SubSection	"Display"
		Depth	24
		# resolutions for the internal LCD
		# switch with Ctrl + Alt + Keypad-Plus/Minus (note that 
		# Fn allows to emulate a keypad)
		Modes	"1280x800" "1024x768"  "800x600" "640x480"
	EndSubSection
EndSection

Section "Screen"
	Identifier	"Screen1"
	Device		"Card1"
	Monitor		"Monitor1"
	DefaultDepth     24
	SubSection	"Display"
		Depth	24
		# resolutions for the external screen
		# What if we plug screens with various maximal resolutions ?
		Modes	"1280x1024" "1024x768" "800x600" "640x480"
	EndSubSection
EndSection
