[Xquartz-changes] xserver: Branch 'master' - 75 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Sun Jan 23 22:40:55 PST 2011


Rebased ref, commits from common ancestor:
commit effaf9459c450f13e35bf263835d3e37d48ff29d
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun Jan 23 22:35:34 2011 -0800

    XQuartz: Use the default signal handler
    
    This allows better interaction with CrashTracer
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 156de13..222a5ea 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -63,6 +63,7 @@
 #include <fcntl.h>
 #include <IOKit/pwr_mgt/IOPMLib.h>
 #include <pthread.h>
+#include <signal.h>
 
 #include <rootlessCommon.h>
 #include <Xplugin.h>
@@ -143,6 +144,26 @@ void QuartzInitOutput(
     int argc,
     char **argv )
 {
+    /* For XQuartz, we want to just use the default signal handler to work better with CrashTracer */
+    signal(SIGSEGV, SIG_DFL);
+    signal(SIGILL, SIG_DFL);
+#ifdef SIGEMT
+    signal(SIGEMT, SIG_DFL);
+#endif
+    signal(SIGFPE, SIG_DFL);
+#ifdef SIGBUS
+    signal(SIGBUS, SIG_DFL);
+#endif
+#ifdef SIGSYS
+    signal(SIGSYS, SIG_DFL);
+#endif
+#ifdef SIGXCPU
+    signal(SIGXCPU, SIG_DFL);
+#endif
+#ifdef SIGXFSZ
+    signal(SIGXFSZ, SIG_DFL);
+#endif
+
     if (!RegisterBlockAndWakeupHandlers(QuartzBlockHandler,
                                         QuartzWakeupHandler,
                                         NULL))
commit 418bb57a3923311338baa8a85c0794a72e15ceeb
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Jan 13 17:12:17 2011 -0800

    XQuartz: Call RRScreenSizeNotify after handling externally-generated XP_EVENT_DISPLAY_CHANGED
    
    We get an XP_EVENT_DISPLAY_CHANGED event when our display configuration is
    changed.  If this change was caused by hotplugging a monitor or Mac Display
    Preferences changes by the user, we need to call RRScreenSizeNotify in order
    to ensure new connections get the correct screen size.
    
    http://xquartz.macosforge.org/trac/ticket/460
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 9e03525..16fec4a 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -280,10 +280,9 @@ static void DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr de
         case kXquartzDisplayChanged:
             DEBUG_LOG("kXquartzDisplayChanged\n");
             QuartzUpdateScreens();
-#ifdef RANDR
+
             /* Update our RandR info */
             QuartzRandRUpdateFakeModes(TRUE);
-#endif
             break;
             
         default:
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 6c185a8..156de13 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -244,6 +244,9 @@ void QuartzUpdateScreens(void) {
     DeliverEvents(pRoot, &e, 1, NullWindow);
 
     quartzProcs->UpdateScreen(pScreen);
+
+    /* Tell RandR about the new size, so new connections get the correct info */
+    RRScreenSizeNotify(pScreen);
 }
 
 static void pokeActivityCallback(CFRunLoopTimerRef timer, void *info) {
commit 6f52b10b9e8068e3deafb2bbb64b62175a208c49
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Jan 13 16:08:46 2011 -0800

    XQuartz: Bump version string to 2.6.1
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/bundle/Info.plist.cpp b/hw/xquartz/bundle/Info.plist.cpp
index eb193bf..2e568ff 100644
--- a/hw/xquartz/bundle/Info.plist.cpp
+++ b/hw/xquartz/bundle/Info.plist.cpp
@@ -19,9 +19,9 @@
 	<key>CFBundlePackageType</key>
 		<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-		<string>2.6.0</string>
+		<string>2.6.1</string>
 	<key>CFBundleVersion</key>
-		<string>2.6.0</string>
+		<string>2.6.1</string>
 	<key>CFBundleSignature</key>
 		<string>x11a</string>
 	<key>CSResourcesFileMapped</key>
commit 1cfb96dd6151ebe84a9a26a428005db97e5d5577
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Jan 13 16:08:29 2011 -0800

    XQuartz: Update copyright dates in bundle's plist
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/bundle/Info.plist.cpp b/hw/xquartz/bundle/Info.plist.cpp
index 85b439a..eb193bf 100644
--- a/hw/xquartz/bundle/Info.plist.cpp
+++ b/hw/xquartz/bundle/Info.plist.cpp
@@ -35,9 +35,9 @@
                 <string>http://xquartz.macosforge.org/downloads/sparkle/release.xml</string>
 #endif
 	<key>NSHumanReadableCopyright</key>
-		<string>© 2003-2010 Apple Inc.
+		<string>© 2003-2011 Apple Inc.
 © 2003 XFree86 Project, Inc.
-© 2003-2010 X.org Foundation, Inc.
+© 2003-2011 X.org Foundation, Inc.
 </string>
 	<key>NSMainNibFile</key>
 		<string>main</string>
commit be3be7580b6f6fd2f7fa4d4abfe5e1ab19470223
Merge: 57a1d9b... a1d885f...
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Jan 20 21:21:21 2011 -0800

    Merge remote branch 'ajax/for-keithp'

commit 57a1d9b85331f6fe19d5111f5163139572ffbf02
Merge: 24ce650... 6423769...
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Jan 20 21:16:24 2011 -0800

    Merge remote branch 'whot/for-keith'

commit 24ce650cf4f0c6fa72faecd38c53d40703e6c959
Merge: bbdf81a... 09fd010...
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Jan 20 21:11:53 2011 -0800

    Merge remote branch 'jturney/jturney-framebuffer-resize-for-master'

commit bbdf81a056be0ea645da17a642dad5eadef3a906
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue Jan 18 19:26:20 2011 -0800

    Add xorg.conf.d shadow man page pointing to xorg.conf man page
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Gaetan Nadon <memsize at videotron.ca>
    Tested-by: Gaetan Nadon <memsize at videotron.ca>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/doc/man/Makefile.am b/hw/xfree86/doc/man/Makefile.am
index fe330a7..80e22cb 100644
--- a/hw/xfree86/doc/man/Makefile.am
+++ b/hw/xfree86/doc/man/Makefile.am
@@ -1,3 +1,3 @@
 include $(top_srcdir)/manpages.am
 appman_PRE = Xorg.man
-fileman_PRE = xorg.conf.man
+fileman_PRE = xorg.conf.man xorg.conf.d.man
diff --git a/hw/xfree86/doc/man/xorg.conf.d.man b/hw/xfree86/doc/man/xorg.conf.d.man
new file mode 100644
index 0000000..6b3379e
--- /dev/null
+++ b/hw/xfree86/doc/man/xorg.conf.d.man
@@ -0,0 +1 @@
+.so man__filemansuffix__/xorg.conf.__filemansuffix__
commit a1d885fdd67503a442b348626d2eddf6d22419e8
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Jun 23 13:28:55 2010 -0400

    resource: Fix indentation
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/resource.c b/dix/resource.c
index f558ed2..26d2c72 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -881,21 +881,21 @@ LegalNewID(XID id, ClientPtr client)
 #ifdef PANORAMIX
     XID 	minid, maxid;
 
-	if (!noPanoramiXExtension) { 
-	    minid = client->clientAsMask | (client->index ? 
-			                    SERVER_BIT : SERVER_MINID);
-	    maxid = (clientTable[client->index].fakeID | RESOURCE_ID_MASK) + 1;
-            if ((id >= minid) && (id <= maxid))
-	        return TRUE;
-	}
+    if (!noPanoramiXExtension) {
+        minid = client->clientAsMask | (client->index ?
+                                        SERVER_BIT : SERVER_MINID);
+        maxid = (clientTable[client->index].fakeID | RESOURCE_ID_MASK) + 1;
+        if ((id >= minid) && (id <= maxid))
+            return TRUE;
+    }
 #endif /* PANORAMIX */
-	if (client->clientAsMask == (id & ~RESOURCE_ID_MASK))
-	{
-	    rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
-					  DixGetAttrAccess);
-	    return rc == BadValue;
-	}
-	return FALSE;
+    if (client->clientAsMask == (id & ~RESOURCE_ID_MASK))
+    {
+        rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
+                                      DixGetAttrAccess);
+        return rc == BadValue;
+    }
+    return FALSE;
 }
 
 int
commit cb61cf5c99004ba3c76b504220c6728b5f2d2de6
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Apr 15 18:36:55 2010 -0400

    resource: Remove expectID hack
    
    This is clearly meant to short-circuit the (modestly) expensive resource
    lookup in LegalNewID.  The problem is that long-lived clients will
    eventually run completely through their XID space and start asking
    XC-MISC for IDs to reuse.  Once that happens, the comparison against
    expectID will always be true, and we'll no longer catch XID collisions
    at all.
    
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/resource.c b/dix/resource.c
index 18ed682..f558ed2 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -175,7 +175,6 @@ typedef struct _ClientResource {
     int		hashsize;	/* log(2)(buckets) */
     XID		fakeID;
     XID		endFakeID;
-    XID		expectID;
 } ClientResourceRec;
 
 RESTYPE lastResourceType;
@@ -322,7 +321,6 @@ InitClientResources(ClientPtr client)
     clientTable[i].fakeID = client->clientAsMask |
 			    (client->index ? SERVER_BIT : SERVER_MINID);
     clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1;
-    clientTable[i].expectID = client->clientAsMask;
     for (j=0; j<INITBUCKETS; j++) 
     {
         clientTable[i].resources[j] = NULL;
@@ -511,8 +509,6 @@ AddResource(XID id, RESTYPE type, pointer value)
     res->value = value;
     *head = res;
     rrec->elements++;
-    if (!(id & SERVER_BIT) && (id >= rrec->expectID))
-	rrec->expectID = id + 1;
     CallResourceStateCallback(ResourceStateAdding, res);
     return TRUE;
 }
@@ -895,9 +891,6 @@ LegalNewID(XID id, ClientPtr client)
 #endif /* PANORAMIX */
 	if (client->clientAsMask == (id & ~RESOURCE_ID_MASK))
 	{
-	    if (clientTable[client->index].expectID <= id)
-		return TRUE;
-
 	    rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
 					  DixGetAttrAccess);
 	    return rc == BadValue;
commit 3282e3c627f97f079e3a9af756a6b13bd9a5f227
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Apr 15 08:46:28 2010 -0400

    resource: s/NullResource/NULL/g
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/resource.c b/dix/resource.c
index 6bd2403..18ed682 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -167,7 +167,6 @@ typedef struct _Resource {
     RESTYPE		type;
     pointer		value;
 } ResourceRec, *ResourcePtr;
-#define NullResource ((ResourcePtr)NULL)
 
 typedef struct _ClientResource {
     ResourcePtr *resources;
@@ -326,7 +325,7 @@ InitClientResources(ClientPtr client)
     clientTable[i].expectID = client->clientAsMask;
     for (j=0; j<INITBUCKETS; j++) 
     {
-        clientTable[i].resources[j] = NullResource;
+        clientTable[i].resources[j] = NULL;
     }
     return TRUE;
 }
@@ -543,7 +542,7 @@ RebuildTable(int client)
     }
     for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++)
     {
-	*rptr = NullResource;
+	*rptr = NULL;
 	*tptr = rptr;
     }
     clientTable[client].hashsize++;
@@ -555,7 +554,7 @@ RebuildTable(int client)
 	for (res = *rptr; res; res = next)
 	{
 	    next = res->next;
-	    res->next = NullResource;
+	    res->next = NULL;
 	    tptr = &tails[Hash(client, res->id)];
 	    **tptr = res;
 	    *tptr = &res->next;
commit f953ae7d8a578d135a6faaf69d9c06eae7c85ede
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Dec 14 14:38:10 2009 -0500

    os: Reduce smart scheduler setup calls
    
    We can return from WaitForSomething with no clients ready for any number
    of reasons.  There's no reason to set up the scheduler timer when this
    happens.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/os/WaitFor.c b/os/WaitFor.c
index e663004..867cb04 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -153,13 +153,17 @@ WaitForSomething(int *pClientsReady)
     fd_set clientsWritable;
     int curclient;
     int selecterr;
-    int nready;
+    static int nready;
     fd_set devicesReadable;
     CARD32 now = 0;
     Bool    someReady = FALSE;
 
     FD_ZERO(&clientsReadable);
 
+    if (nready)
+        SmartScheduleStopTimer();
+    nready = 0;
+
     /* We need a while loop here to handle 
        crashed connections and the screen saver timeout */
     while (1)
@@ -211,7 +215,6 @@ WaitForSomething(int *pClientsReady)
 	}
 	XFD_COPYSET(&AllSockets, &LastSelectMask);
 	}
-	SmartScheduleStopTimer ();
 
 	BlockHandler((pointer)&wt, (pointer)&LastSelectMask);
 	if (NewOutputPending)
@@ -230,7 +233,6 @@ WaitForSomething(int *pClientsReady)
 	}
 	selecterr = GetErrno();
 	WakeupHandler(i, (pointer)&LastSelectMask);
-	SmartScheduleStartTimer ();
 	if (i <= 0) /* An error or timeout occurred */
 	{
 	    if (dispatchException)
@@ -388,6 +390,10 @@ WaitForSomething(int *pClientsReady)
 #endif
 	}
     }
+
+    if (nready)
+        SmartScheduleStartTimer();
+
     return nready;
 }
 
commit d127075da06239852c1cc745abfe63d0d180d984
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Jan 20 19:03:33 2011 -0500

    xdmxconfig: warning fix
    
    xdmxconfig.c: In function ‘dmxConfigCanvasDraw’:
    xdmxconfig.c:299:23: warning: ‘maxHeight’ may be used uninitialized in this function
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/dmx/config/xdmxconfig.c b/hw/dmx/config/xdmxconfig.c
index 033b525..c67077a 100644
--- a/hw/dmx/config/xdmxconfig.c
+++ b/hw/dmx/config/xdmxconfig.c
@@ -142,7 +142,7 @@ static void dmxConfigGetDims(int *maxWidth, int *maxHeight)
     DMXConfigEntryPtr e;
     
     *maxWidth = dmxConfigWallWidth  = 0;
-    *maxWidth = dmxConfigWallHeight = 0;
+    *maxHeight = dmxConfigWallHeight = 0;
     if (!dmxConfigCurrent) return;
     
     dmxConfigWallWidth  = dmxConfigCurrent->width;
commit 7a08f9abef7219fabdab8d1d49e8d3afb042e36a
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Jan 20 18:59:39 2011 -0500

    dmx: warning fixes
    
    dmxinputinit.c: In function ‘dmxBlockHandler’:
    dmxinputinit.c:610:44: warning: cast from pointer to integer of different size
    dmxinputinit.c: In function ‘dmxWakeupHandler’:
    dmxinputinit.c:637:41: warning: cast from pointer to integer of different size
    dmxinputinit.c: In function ‘dmxInputInit’:
    dmxinputinit.c:1041:36: warning: cast to pointer from integer of different size
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 6fc11cd..5cbd620 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -607,7 +607,7 @@ static void dmxCollectAll(DMXInputInfo *dmxInput)
 static void dmxBlockHandler(pointer blockData, OSTimePtr pTimeout,
                             pointer pReadMask)
 {
-    DMXInputInfo    *dmxInput = &dmxInputs[(int)blockData];
+    DMXInputInfo    *dmxInput = &dmxInputs[(uintptr_t)blockData];
     static unsigned long generation = 0;
     
     if (generation != serverGeneration) {
@@ -634,7 +634,7 @@ static void dmxSwitchReturn(pointer p)
 
 static void dmxWakeupHandler(pointer blockData, int result, pointer pReadMask)
 {
-    DMXInputInfo *dmxInput = &dmxInputs[(int)blockData];
+    DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t)blockData];
     int          i;
 
     if (dmxInput->vt_switch_pending) {
@@ -1036,9 +1036,8 @@ void dmxInputInit(DMXInputInfo *dmxInput)
     dmxInput->processInputEvents    = dmxProcessInputEvents;
     dmxInput->detached              = False;
     
-    RegisterBlockAndWakeupHandlers(dmxBlockHandler,
-                                   dmxWakeupHandler,
-                                   (void *)dmxInput->inputIdx);
+    RegisterBlockAndWakeupHandlers(dmxBlockHandler, dmxWakeupHandler,
+                                   (void *)(uintptr_t)dmxInput->inputIdx);
 }
 
 static void dmxInputFreeLocal(DMXLocalInputInfoRec *local)
commit ffd323b7c0212ed9b348e51cd9b36363d7c4d1f2
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Jan 20 18:55:20 2011 -0500

    dmx: warning fix
    
    dmxinputinit.c: At top level:
    dmxinputinit.c:135:29: warning: ‘DMXCommonOth’ defined but not used
    
    DMXCommonOth is actually mentioned in a #if 0 block, so delete it and
    the block that references it.  If anyone needs it, git remembers.
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 7cac86f..6fc11cd 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -132,14 +132,6 @@ static DMXLocalInputInfoRec DMXConsoleKbd = {
     NULL, dmxCommonKbdCtrl, dmxCommonKbdBell
 };
 
-static DMXLocalInputInfoRec DMXCommonOth = {
-    "common-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_COMMON, 1,
-    dmxCommonCopyPrivate, NULL,
-    NULL, NULL, NULL, dmxCommonOthGetInfo,
-    dmxCommonOthOn, dmxCommonOthOff
-};
-
-
 static DMXLocalInputInfoRec DMXLocalDevices[] = {
                                 /* Dummy drivers that can compile on any OS */
 #ifdef __linux__
@@ -897,29 +889,6 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
                     }
                 }
                 break;
-#if 0
-            case IsXExtensionDevice:
-            case IsXExtensionKeyboard:
-            case IsXExtensionPointer:
-                if (doXI) {
-                    if (!dmxInput->numDevs) {
-                        dmxLog(dmxWarning,
-                               "Cannot use remote (%s) XInput devices if"
-                               " not also using core devices\n",
-                               dmxInput->name);
-                    } else {
-                        dmxLocal             = dmxInputCopyLocal(dmxInput,
-                                                                &DMXCommonOth);
-                        dmxLocal->isCore     = FALSE;
-                        dmxLocal->sendsCore  = FALSE;
-                        dmxLocal->deviceId   = devices[i].id;
-                        dmxLocal->deviceName = (devices[i].name
-                                                ? strdup(devices[i].name)
-                                                : NULL);
-                    }
-                }
-                break;
-#endif
             }
         }
         XFreeDeviceList(devices);
commit c1fe0b155d0567440228aa5d9e36036f37670e3b
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Jan 20 18:52:57 2011 -0500

    dmx: warning fix
    
    dmxgc.c: In function ‘dmxChangeClip’:
    dmxgc.c:386:5: warning: case label value exceeds maximum value for type
    dmxgc.c:387:5: warning: case label value exceeds maximum value for type
    dmxgc.c:388:5: warning: case label value exceeds maximum value for type
    dmxgc.c:389:5: warning: case label value exceeds maximum value for type
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c
index 829200e..f10f9a0 100644
--- a/hw/dmx/dmxgc.c
+++ b/hw/dmx/dmxgc.c
@@ -383,12 +383,7 @@ void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
 	break;
 
     case CT_PIXMAP:
-    case CT_UNSORTED:
-    case CT_YSORTED:
-    case CT_YXSORTED:
-    case CT_YXBANDED:
-	/* These clip types are condensed down to either NONE or REGION
-           in the mi code */
+	/* Condensed down to REGION in the mi code */
 	break;
     }
 
commit b02e006b2733ea457df41791f6054309e4edf7f6
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Jan 20 18:46:00 2011 -0500

    dmx: warning fixes
    
    Dear gcc: I do not care about machines where sizeof(void *) <
    sizeof(int), and neither should you.
    
    dmxextension.c: In function ‘dmxBECreateResources’:
    dmxextension.c:858:26: warning: cast from pointer to integer of different size
    dmxextension.c: In function ‘dmxBERestoreRenderPict’:
    dmxextension.c:1062:29: warning: cast from pointer to integer of different size
    dmxextension.c: In function ‘dmxBERestoreRenderGlyph’:
    dmxextension.c:1084:35: warning: cast from pointer to integer of different size
    dmxextension.c: In function ‘dmxAttachScreen’:
    dmxextension.c:1277:8: warning: cast to pointer from integer of different size
    dmxextension.c:1286:34: warning: cast to pointer from integer of different size
    dmxextension.c:1292:35: warning: cast to pointer from integer of different size
    dmxextension.c: In function ‘dmxBEDestroyResources’:
    dmxextension.c:1456:26: warning: cast from pointer to integer of different size
    dmxextension.c: In function ‘dmxDetachScreen’:
    dmxextension.c:1599:8: warning: cast to pointer from integer of different size
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c
index 45cb3db..bd326ce 100644
--- a/hw/dmx/dmxextension.c
+++ b/hw/dmx/dmxextension.c
@@ -855,7 +855,7 @@ static void dmxBERestorePixmap(PixmapPtr pPixmap)
 static void dmxBECreateResources(pointer value, XID id, RESTYPE type,
 				 pointer n)
 {
-    int        scrnNum = (int)n;
+    int        scrnNum = (uintptr_t)n;
     ScreenPtr  pScreen = screenInfo.screens[scrnNum];
 
     if ((type & TypeMask) == (RT_WINDOW & TypeMask)) {
@@ -1059,7 +1059,7 @@ static void dmxBERestoreRenderPict(pointer value, XID id, pointer n)
 {
     PicturePtr   pPicture = value;               /* The picture */
     DrawablePtr  pDraw    = pPicture->pDrawable; /* The picture's drawable */
-    int          scrnNum  = (int)n;
+    int          scrnNum  = (uintptr_t)n;
 
     if (pDraw->pScreen->myNum != scrnNum) {
 	/* Picture not on the screen we are restoring*/
@@ -1081,7 +1081,7 @@ static void dmxBERestoreRenderPict(pointer value, XID id, pointer n)
 static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
 {
     GlyphSetPtr      glyphSet   = value;
-    int              scrnNum    = (int)n;
+    int              scrnNum    = (uintptr_t)n;
     dmxGlyphPrivPtr  glyphPriv  = DMX_GET_GLYPH_PRIV(glyphSet);
     DMXScreenInfo   *dmxScreen  = &dmxScreens[scrnNum];
     GlyphRefPtr      table;
@@ -1274,7 +1274,7 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
     for (i = currentMaxClients; --i >= 0; )
 	if (clients[i])
 	    FindAllClientResources(clients[i], dmxBECreateResources,
-				   (pointer)idx);
+				   (pointer)(uintptr_t)idx);
 
     /* Create window hierarchy (top down) */
     dmxBECreateWindowTree(idx);
@@ -1283,13 +1283,15 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
     for (i = currentMaxClients; --i >= 0; )
 	if (clients[i])
 	    FindClientResourcesByType(clients[i],PictureType, 
-				      dmxBERestoreRenderPict,(pointer)idx);
+				      dmxBERestoreRenderPict,
+				      (pointer)(uintptr_t)idx);
 
     /* Restore the glyph state for RENDER */
     for (i = currentMaxClients; --i >= 0; )
 	if (clients[i])
 	    FindClientResourcesByType(clients[i],GlyphSetType, 
-				      dmxBERestoreRenderGlyph,(pointer)idx);
+				      dmxBERestoreRenderGlyph,
+				      (pointer)(uintptr_t)idx);
 
     /* Refresh screen by generating exposure events for all windows */
     dmxForceExposures(idx);
@@ -1453,7 +1455,7 @@ static void dmxBESavePixmap(PixmapPtr pPixmap)
 static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type,
 				  pointer n)
 {
-    int        scrnNum = (int)n;
+    int        scrnNum = (uintptr_t)n;
     ScreenPtr  pScreen = screenInfo.screens[scrnNum];
 
     if ((type & TypeMask) == (RT_WINDOW & TypeMask)) {
@@ -1596,7 +1598,7 @@ int dmxDetachScreen(int idx)
     for (i = currentMaxClients; --i >= 0; )
 	if (clients[i])
 	    FindAllClientResources(clients[i], dmxBEDestroyResources,
-				   (pointer)idx);
+				   (pointer)(uintptr_t)idx);
 
     /* Free scratch GCs */
     dmxBEDestroyScratchGCs(idx);
commit 64237697994871adfcf4905b5784e75cd7281579
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jan 13 12:20:38 2011 +1000

    xkb: after making changes to the xkb ctrls, copy them back into kbdfeed.
    
    enabled_ctrls_changes nowhere near the usual event or config paths. So this
    condition always evaluated to false and the memcpy would thus never been
    hit. As a result, any modification to the XKB struct during
    XkbUpdateDescActions was not reflected in the kbdfeed ctrls.
    The flag that is set by XkbUpdateDescActions() if ctrls were changed are in
    enabled_ctrls.
    
    This mainly affected keyboard repeat control as XKB uses the kbdfeed ctrls,
    not XKB's per_key_repeats, to determine if a key needs to be repeated. Thus,
    adding a "repeat= False" to the XKB map of any action did not have any
    effect.
    
    Test case:
    assign Mode_switch to any key that by default repeats, e.g. the menu key.
    
        key <COMP> {         [     Mode_switch ] };
    
    Then modify the Mode_switch action to not repeat the key.
    
        interpret Mode_switch+AnyOfOrNone(all) {
            virtualModifier= AltGr;
            useModMapMods=level1;
            action= SetGroup(group=+1);
            // Add this line
            repeat= False;
        };
    
    Though the flags are correctly reflected in the description loaded in the
    server, the change is not handed back to the kbdfeed struct and XKB will
    trigger softrepeats of this key.
    
    This patch also adds two explanatory comments and an extra check, as this
    path may be hit before the CtrlProc for the kbdfeed struct is set.
    
    Red Hat Bug 537708 <https://bugzilla.redhat.com/show_bug.cgi?id=537708>
    
    Also fixes broken auto-repeat of the backspace key in the colemak layout
    (mapped to CapsLock).
    
    X.Org Bug 16318 <http://bugs.freedesktop.org/show_bug.cgi?id=16318>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Tested-by: Dirk Wallenstein <halsmit at t-online.de>
    Reviewed-by: Dirk Wallenstein <halsmit at t-online.de>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 14dc784..3a56bea 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -342,15 +342,18 @@ CARD8 *			repeat;
     xkb= xkbi->desc;
     repeat= xkb->ctrls->per_key_repeat;
 
+    /* before letting XKB do any changes, copy the current core values */
     if (pXDev->kbdfeed)
 	memcpy(repeat,pXDev->kbdfeed->ctrl.autoRepeats,XkbPerKeyBitArraySize);
 
     XkbUpdateDescActions(xkb,first,num,changes);
 
     if ((pXDev->kbdfeed)&&
-	(changes->ctrls.enabled_ctrls_changes&XkbPerKeyRepeatMask)) {
-        memcpy(pXDev->kbdfeed->ctrl.autoRepeats,repeat, XkbPerKeyBitArraySize);
-	(*pXDev->kbdfeed->CtrlProc)(pXDev, &pXDev->kbdfeed->ctrl);
+	(changes->ctrls.changed_ctrls&XkbPerKeyRepeatMask)) {
+	/* now copy the modified changes back to core */
+	memcpy(pXDev->kbdfeed->ctrl.autoRepeats,repeat, XkbPerKeyBitArraySize);
+	if (pXDev->kbdfeed->CtrlProc)
+	    (*pXDev->kbdfeed->CtrlProc)(pXDev, &pXDev->kbdfeed->ctrl);
     }
     return;
 }
commit f1326ed2910bd985fafdb48714b1d6f38116b083
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jan 13 09:19:28 2011 +1000

    xkb: Replace a few manual bitflips with SetBit & friends.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dirk Wallenstein <halsmit at t-online.de>

diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c
index efe2911..96688be 100644
--- a/xkb/XKBMisc.c
+++ b/xkb/XKBMisc.c
@@ -454,11 +454,12 @@ unsigned		changed,tmp;
 	    }
 	    if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) {
 		CARD8 old;
-		old= xkb->ctrls->per_key_repeat[key/8];
+		old= BitIsOn(xkb->ctrls->per_key_repeat, key);
 		if (interps[0]->flags&XkbSI_AutoRepeat)
-		     xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8));
-		else xkb->ctrls->per_key_repeat[key/8]&= ~(1<<(key%8));
-		if (changes && (old!=xkb->ctrls->per_key_repeat[key/8]))
+		    SetBit(xkb->ctrls->per_key_repeat, key);
+		else
+		    ClearBit(xkb->ctrls->per_key_repeat, key);
+		if (changes && old != BitIsOn(xkb->ctrls->per_key_repeat, key))
 		    changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask;
 	    }
 	}
@@ -466,9 +467,9 @@ unsigned		changed,tmp;
     if ((!found)||(interps[0]==NULL)) {
 	if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) {
 	    CARD8 old;
-	    old= xkb->ctrls->per_key_repeat[key/8];
-            xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8));
-	    if (changes && (old!=xkb->ctrls->per_key_repeat[key/8]))
+	    old = BitIsOn(xkb->ctrls->per_key_repeat, key);
+	    SetBit(xkb->ctrls->per_key_repeat, key);
+	    if (changes && (old != BitIsOn(xkb->ctrls->per_key_repeat, key)))
 		changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask;
 	}
 	if (((explicit&XkbExplicitBehaviorMask)==0)&&
commit 16eb4f2a7b67ee169785973f9e0a3773e13fdea6
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jan 7 09:53:35 2011 +1000

    Xi: reset remainders when warping the device.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Simon Thum <simon.thum at gmx.de>

diff --git a/Xi/xiwarppointer.c b/Xi/xiwarppointer.c
index 7276e6f..c01b115 100644
--- a/Xi/xiwarppointer.c
+++ b/Xi/xiwarppointer.c
@@ -192,6 +192,8 @@ ProcXIWarpPointer(ClientPtr client)
     /* if we don't update the device, we get a jump next time it moves */
     pDev->last.valuators[0] = x;
     pDev->last.valuators[1] = y;
+    pDev->last.remainder[0] = 0;
+    pDev->last.remainder[1] = 0;
     miPointerUpdateSprite(pDev);
 
     /* FIXME: XWarpPointer is supposed to generate an event. It doesn't do it
commit 09fd010902fad56735b8069b1becb80d85bd6a35
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Sep 29 22:54:22 2010 +0100

    Cygwin/X: DirectDraw engines shouldn't try to blit if the surface wasn't allocated
    
    Fix winShadowUpdateDD(|NL) so we don't try to blit to primary surface if it didn't get allocated
    
    (Intel drivers, in particular, seem to like to issue a WM_DISPLAYCHANGE during a suspend/resume
    cycle, but not allow surface to be allocated right then)
    
    Also:
    Use winReleasePrimarySurfaceShadowDD(|NL) in winFreeFBShadowDD(|NL) rather than open coding it
    Don't mess about recreating surface if we're going to resize it anyhow
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winshaddd.c b/hw/xwin/winshaddd.c
index b14d0a9..00d7a37 100644
--- a/hw/xwin/winshaddd.c
+++ b/hw/xwin/winshaddd.c
@@ -514,25 +514,16 @@ winFreeFBShadowDD (ScreenPtr pScreen)
       pScreenPriv->pddsShadow = NULL;
     }
 
-  /* Detach the clipper from the primary surface and release the clipper. */
+  /* Detach the clipper from the primary surface and release the primary surface, if there is one */
+  winReleasePrimarySurfaceShadowDD(pScreen);
+
+  /* Release the clipper object */
   if (pScreenPriv->pddcPrimary)
     {
-      /* Detach the clipper */
-      IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary,
-				      NULL);
-
-      /* Release the clipper object */
       IDirectDrawClipper_Release (pScreenPriv->pddcPrimary);
       pScreenPriv->pddcPrimary = NULL;
     }
 
-  /* Release the primary surface, if there is one */
-  if (pScreenPriv->pddsPrimary)
-    {
-      IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary);
-      pScreenPriv->pddsPrimary = NULL;
-    }
-
   /* Free the DirectDraw2 object, if there is one */
   if (pScreenPriv->pdd2)
     {
@@ -577,6 +568,10 @@ winShadowUpdateDD (ScreenPtr pScreen,
   if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
       || pScreenPriv->fBadDepth) return;
 
+  /* Return immediately if we didn't get needed surfaces */
+  if (!pScreenPriv->pddsPrimary || !pScreenPriv->pddsShadow)
+    return;
+
   /* Get the origin of the window in the screen coords */
   ptOrigin.x = pScreenInfo->dwXOffset;
   ptOrigin.y = pScreenInfo->dwYOffset;
diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c
index c74a2ff..0a0b4ae 100644
--- a/hw/xwin/winshadddnl.c
+++ b/hw/xwin/winshadddnl.c
@@ -546,25 +546,16 @@ winFreeFBShadowDDNL(ScreenPtr pScreen)
       pScreenPriv->pddsShadow4 = NULL;
     }
 
-  /* Detach the clipper from the primary surface and release the clipper. */
+  /* Detach the clipper from the primary surface and release the primary surface, if there is one */
+  winReleasePrimarySurfaceShadowDDNL(pScreen);
+
+  /* Release the clipper object */
   if (pScreenPriv->pddcPrimary)
     {
-      /* Detach the clipper */
-      IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4,
-				      NULL);
-
-      /* Release the clipper object */
       IDirectDrawClipper_Release (pScreenPriv->pddcPrimary);
       pScreenPriv->pddcPrimary = NULL;
     }
 
-  /* Release the primary surface, if there is one */
-  if (pScreenPriv->pddsPrimary4)
-    {
-      IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4);
-      pScreenPriv->pddsPrimary4 = NULL;
-    }
-
   /* Free the DirectDraw4 object, if there is one */
   if (pScreenPriv->pdd4)
     {
@@ -658,6 +649,10 @@ winShadowUpdateDDNL (ScreenPtr pScreen,
   if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
       || pScreenPriv->fBadDepth) return;
 
+  /* Return immediately if we didn't get needed surfaces */
+  if (!pScreenPriv->pddsPrimary4 || !pScreenPriv->pddsShadow4)
+    return;
+
   /* Get the origin of the window in the screen coords */
   ptOrigin.x = pScreenInfo->dwXOffset;
   ptOrigin.y = pScreenInfo->dwYOffset;
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index dd8f27e..bccd6f9 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -231,18 +231,7 @@ winWindowProc (HWND hwnd, UINT message,
         (this is probably usually the case so that might be an
         overoptimization)
       */
-
-      /*
-       * We can simply recreate the same-sized primary surface when
-       * the display dimensions change.
-       */
 	{
-
-#if CYGDEBUG
-	  winDebug ("winWindowProc - WM_DISPLAYCHANGE - Recreated "
-		  "primary surface\n");
-#endif
-
 	  /*
              In rootless modes which are monitor or virtual desktop size
              use RandR to resize the X screen
@@ -311,13 +300,8 @@ winWindowProc (HWND hwnd, UINT message,
           else
             {
               /*
-                If we get here, we are either windowed and using the GDI engine
-                or windowed and non-fullscreen using any engine
-              */
-
-              /*
-               * For ddraw engines, we need to (try to) recreate the same-sized primary surface
-               * when display dimensions change (but not depth, that is disruptive)
+               * We can simply recreate the same-sized primary surface when
+               * the display dimensions change.
                */
 
               /*
commit 625ab9701fd75b879c1dafc05fa979591eea87c0
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Aug 31 13:45:43 2010 +0100

    Cygwin/X: Simplify and consolidate reporting of the bpp value we are going to use
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winnativegdi.c b/hw/xwin/winnativegdi.c
index b0a551a..4d7afe8 100644
--- a/hw/xwin/winnativegdi.c
+++ b/hw/xwin/winnativegdi.c
@@ -301,28 +301,9 @@ winAdjustVideoModeNativeGDI (ScreenPtr pScreen)
       break;
   }
 
-  /* GDI cannot change the screen depth */
-  if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP)
-    {
-      /* No -depth parameter passed, let the user know the depth being used */
-      ErrorF ("winAdjustVideoModeNativeGDI - Using Windows display "
-	      "depth of %d bits per pixel, %d depth\n",
-	      (int) dwBPP, (int) pScreenInfo->dwDepth);
-
-      /* Use GDI's depth */
-      pScreenInfo->dwBPP = dwBPP;
-    }
-  else if (dwBPP != pScreenInfo->dwBPP)
-    {
-      /* Warn user if GDI depth is different than -depth parameter */
-      ErrorF ("winAdjustVideoModeNativeGDI - Command line bpp: %d, "\
-	      "using bpp: %d\n",
-	      (int) pScreenInfo->dwBPP, (int) dwBPP);
+  /* GDI cannot change the screen depth, so we'll use GDI's depth */
+  pScreenInfo->dwBPP = dwBPP;
 
-      /* We'll use GDI's depth */
-      pScreenInfo->dwBPP = dwBPP;
-    }
-  
   /* Release our DC */
   ReleaseDC (NULL, hdc);
 
diff --git a/hw/xwin/winpfbdd.c b/hw/xwin/winpfbdd.c
index 4145717..c0bca71 100644
--- a/hw/xwin/winpfbdd.c
+++ b/hw/xwin/winpfbdd.c
@@ -436,33 +436,13 @@ winAdjustVideoModePrimaryDD (ScreenPtr pScreen)
   dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
 
   /* DirectDraw can only change the depth in fullscreen mode */
-  if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP)
+  if (!(pScreenInfo->fFullScreen &&
+        (pScreenInfo->dwBPP != WIN_DEFAULT_BPP)))
     {
-      /* No -depth parameter passed, let the user know the depth being used */
-      ErrorF ("winAdjustVideoModePrimaryDD - Using Windows display "
-	      "depth of %d bits per pixel\n", (int) dwBPP);
-
-      /* Use GDI's depth */
+      /* Otherwise, We'll use GDI's depth */
       pScreenInfo->dwBPP = dwBPP;
     }
-  else if (pScreenInfo->fFullScreen
-	   && pScreenInfo->dwBPP != dwBPP)
-    {
-      /* FullScreen, and GDI depth differs from -depth parameter */
-      ErrorF ("winAdjustVideoModePrimaryDD - FullScreen, using command "
-	      "line depth: %d\n", (int) pScreenInfo->dwBPP);
-    }
-  else if (dwBPP != pScreenInfo->dwBPP)
-    {
-      /* Windowed, and GDI depth differs from -depth parameter */
-      ErrorF ("winAdjustVideoModePrimaryDD - Windowed, command line "
-	      "depth: %d, using depth: %d\n",
-	      (int) pScreenInfo->dwBPP, (int) dwBPP);
 
-      /* We'll use GDI's depth */
-      pScreenInfo->dwBPP = dwBPP;
-    }
-  
   /* Release our DC */
   ReleaseDC (NULL, hdc);
 
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index 699ed94..691237e 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -91,6 +91,7 @@ winScreenInit (int index,
   winScreenInfoPtr      pScreenInfo = &g_ScreenInfo[index];
   winPrivScreenPtr	pScreenPriv;
   HDC			hdc;
+  DWORD dwInitialBPP;
 
 #if CYGDEBUG || YES
   winDebug ("winScreenInit - dwWidth: %ld dwHeight: %ld\n",
@@ -127,12 +128,29 @@ winScreenInit (int index,
     }
 
   /* Horribly misnamed function: Allow engine to adjust BPP for screen */
+  dwInitialBPP = pScreenInfo->dwBPP;
+
   if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen))
     {
       ErrorF ("winScreenInit - winAdjustVideoMode () failed\n");
       return FALSE;
     }
 
+  if (dwInitialBPP == WIN_DEFAULT_BPP)
+    {
+      /* No -depth parameter was passed, let the user know the depth being used */
+      ErrorF ("winScreenInit - Using Windows display depth of %d bits per pixel\n", (int) pScreenInfo->dwBPP);
+    }
+  else if (dwInitialBPP != pScreenInfo->dwBPP)
+    {
+      /* Warn user if engine forced a depth different to -depth parameter */
+      ErrorF ("winScreenInit - Command line depth of %d bpp overidden by engine, using %d bpp\n", (int) dwInitialBPP, (int) pScreenInfo->dwBPP);
+    }
+  else
+    {
+      ErrorF ("winScreenInit - Using command line depth of %d bpp\n", (int) pScreenInfo->dwBPP);
+    }
+
   /* Check for supported display depth */
   if (!(WIN_SUPPORTED_BPPS & (1 << (pScreenInfo->dwBPP - 1))))
     {
diff --git a/hw/xwin/winshaddd.c b/hw/xwin/winshaddd.c
index b551bef..b14d0a9 100644
--- a/hw/xwin/winshaddd.c
+++ b/hw/xwin/winshaddd.c
@@ -909,31 +909,13 @@ winAdjustVideoModeShadowDD (ScreenPtr pScreen)
   dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
 
   /* DirectDraw can only change the depth in fullscreen mode */
-  if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP)
+  if (!(pScreenInfo->fFullScreen &&
+        (pScreenInfo->dwBPP != WIN_DEFAULT_BPP)))
     {
-      /* No -depth parameter passed, let the user know the depth being used */
-      ErrorF ("winAdjustVideoModeShadowDD - Using Windows display "
-	      "depth of %d bits per pixel\n", (int) dwBPP);
-
-      /* Use GDI's depth */
+      /* Otherwise, We'll use GDI's depth */
       pScreenInfo->dwBPP = dwBPP;
     }
-  else if (pScreenInfo->fFullScreen
-	   && pScreenInfo->dwBPP != dwBPP)
-    {
-      /* FullScreen, and GDI depth differs from -depth parameter */
-      ErrorF ("winAdjustVideoModeShadowDD - FullScreen, using command line "
-	      "bpp: %d\n", (int) pScreenInfo->dwBPP);
-    }
-  else if (dwBPP != pScreenInfo->dwBPP)
-    {
-      /* Windowed, and GDI depth differs from -depth parameter */
-      ErrorF ("winAdjustVideoModeShadowDD - Windowed, command line bpp: "
-	      "%d, using bpp: %d\n", (int) pScreenInfo->dwBPP, (int) dwBPP);
 
-      /* We'll use GDI's depth */
-      pScreenInfo->dwBPP = dwBPP;
-    }
   /* Release our DC */
   ReleaseDC (NULL, hdc);
   return TRUE;
diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c
index 52a4ce2..c74a2ff 100644
--- a/hw/xwin/winshadddnl.c
+++ b/hw/xwin/winshadddnl.c
@@ -983,30 +983,10 @@ winAdjustVideoModeShadowDDNL (ScreenPtr pScreen)
   dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
 
   /* DirectDraw can only change the depth in fullscreen mode */
-  if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP)
+  if (!(pScreenInfo->fFullScreen &&
+        (pScreenInfo->dwBPP != WIN_DEFAULT_BPP)))
     {
-      /* No -depth parameter passed, let the user know the depth being used */
-      winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - Using Windows display "
-	      "depth of %d bits per pixel\n", (int) dwBPP);
-
-      /* Use GDI's depth */
-      pScreenInfo->dwBPP = dwBPP;
-    }
-  else if (pScreenInfo->fFullScreen
-	   && pScreenInfo->dwBPP != dwBPP)
-    {
-      /* FullScreen, and GDI depth differs from -depth parameter */
-      winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - FullScreen, using command "
-	      "line bpp: %d\n", (int) pScreenInfo->dwBPP);
-    }
-  else if (dwBPP != pScreenInfo->dwBPP)
-    {
-      /* Windowed, and GDI depth differs from -depth parameter */
-      winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - Windowed, command line "
-	      "bpp: %d, using bpp: %d\n",
-	      (int) pScreenInfo->dwBPP, (int) dwBPP);
-
-      /* We'll use GDI's depth */
+      /* Otherwise, We'll use GDI's depth */
       pScreenInfo->dwBPP = dwBPP;
     }
 
diff --git a/hw/xwin/winshadgdi.c b/hw/xwin/winshadgdi.c
index e9c51ee..4990376 100644
--- a/hw/xwin/winshadgdi.c
+++ b/hw/xwin/winshadgdi.c
@@ -798,26 +798,9 @@ winAdjustVideoModeShadowGDI (ScreenPtr pScreen)
   /* Query GDI for current display depth */
   dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
 
-  /* GDI cannot change the screen depth */
-  if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP)
-    {
-      /* No -depth parameter passed, let the user know the depth being used */
-      ErrorF ("winAdjustVideoModeShadowGDI - Using Windows display "
-	      "depth of %d bits per pixel\n", (int) dwBPP);
-
-      /* Use GDI's depth */
-      pScreenInfo->dwBPP = dwBPP;
-    }
-  else if (dwBPP != pScreenInfo->dwBPP)
-    {
-      /* Warn user if GDI depth is different than -depth parameter */
-      ErrorF ("winAdjustVideoModeShadowGDI - Command line bpp: %d, "\
-	      "using bpp: %d\n", (int) pScreenInfo->dwBPP, (int) dwBPP);
+  /* GDI cannot change the screen depth, so always use GDI's depth */
+  pScreenInfo->dwBPP = dwBPP;
 
-      /* We'll use GDI's depth */
-      pScreenInfo->dwBPP = dwBPP;
-    }
-  
   /* Release our DC */
   ReleaseDC (NULL, hdc);
   hdc = NULL;
commit 3f7339a7c5d3dcd05909b041865125f4cb6fa29e
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Aug 31 10:13:01 2010 +0100

    Cygwin/X: Deal with RANDR depth changes correctly in ShadowGDI drawing engine
    
    Make ShadowGDI drawing engine only change the size of the screen
    pixmap/shadow framebuffer on an RANDR change, not the bpp/depth
    as well.
    
    The server requires the screen pixmap's depth to be invariant.
    
    Other drawing engines aren't quite as affected by this issue as
    they won't draw to the display, if it has changed colour depth,
    but probably still need some attention.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 96a868e..3f40fdb 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -504,7 +504,8 @@ typedef struct _winPrivScreenRec
   HDC			hdcScreen;
   HDC			hdcShadow;
   HWND			hwndScreen;
-  
+  BITMAPINFOHEADER      *pbmih;
+
   /* Privates used by shadow fb and primary fb DirectDraw servers */
   LPDIRECTDRAW		pdd;
   LPDIRECTDRAWSURFACE2	pddsPrimary;
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index f505ddd..699ed94 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -126,7 +126,7 @@ winScreenInit (int index,
       return FALSE;
     }
 
-  /* Adjust the video mode for our engine type */
+  /* Horribly misnamed function: Allow engine to adjust BPP for screen */
   if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen))
     {
       ErrorF ("winScreenInit - winAdjustVideoMode () failed\n");
@@ -269,7 +269,8 @@ winFinishScreenInitFB (int index,
     }
 
   /*
-   * Grab the number of bits that are used to represent color in each pixel.
+   * Calculate the number of bits that are used to represent color in each pixel,
+   * the color depth for the screen
    */
   if (pScreenInfo->dwBPP == 8)
     pScreenInfo->dwDepth = 8;
@@ -277,7 +278,7 @@ winFinishScreenInitFB (int index,
     pScreenInfo->dwDepth = winCountBits (pScreenPriv->dwRedMask)
       + winCountBits (pScreenPriv->dwGreenMask)
       + winCountBits (pScreenPriv->dwBlueMask);
-  
+
   winErrorFVerb (2, "winFinishScreenInitFB - Masks: %08x %08x %08x\n",
 	  (unsigned int) pScreenPriv->dwRedMask,
 	  (unsigned int) pScreenPriv->dwGreenMask,
diff --git a/hw/xwin/winshadgdi.c b/hw/xwin/winshadgdi.c
index 721234e..e9c51ee 100644
--- a/hw/xwin/winshadgdi.c
+++ b/hw/xwin/winshadgdi.c
@@ -338,33 +338,20 @@ winAllocateFBShadowGDI (ScreenPtr pScreen)
 {
   winScreenPriv(pScreen);
   winScreenInfo		*pScreenInfo = pScreenPriv->pScreenInfo;
-  BITMAPINFOHEADER	*pbmih = NULL;
   DIBSECTION		dibsection;
   Bool			fReturn = TRUE;
 
-  /* Allocate bitmap info header */
-  pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER)
-				      + 256 * sizeof (RGBQUAD));
-  if (pbmih == NULL)
-    {
-      ErrorF ("winAllocateFBShadowGDI - malloc () failed\n");
-      return FALSE;
-    }
-
-  /* Query the screen format */
-  fReturn = winQueryScreenDIBFormat (pScreen, pbmih);
-
   /* Describe shadow bitmap to be created */
-  pbmih->biWidth = pScreenInfo->dwWidth;
-  pbmih->biHeight = -pScreenInfo->dwHeight;
-  
+  pScreenPriv->pbmih->biWidth = pScreenInfo->dwWidth;
+  pScreenPriv->pbmih->biHeight = -pScreenInfo->dwHeight;
+
   ErrorF ("winAllocateFBShadowGDI - Creating DIB with width: %d height: %d "
 	  "depth: %d\n",
-	  (int) pbmih->biWidth, (int) -pbmih->biHeight, pbmih->biBitCount);
+	  (int) pScreenPriv->pbmih->biWidth, (int) -pScreenPriv->pbmih->biHeight, pScreenPriv->pbmih->biBitCount);
 
   /* Create a DI shadow bitmap with a bit pointer */
   pScreenPriv->hbmpShadow = CreateDIBSection (pScreenPriv->hdcScreen,
-					      (BITMAPINFO *) pbmih,
+					      (BITMAPINFO *) pScreenPriv->pbmih,
 					      DIB_RGB_COLORS,
 					      (VOID**) &pScreenInfo->pfb,
 					      NULL,
@@ -445,13 +432,6 @@ winAllocateFBShadowGDI (ScreenPtr pScreen)
 	  (int) pScreenInfo->dwStride);
 #endif
 
-  /* Determine our color masks */
-  if (!winQueryRGBBitsAndMasks (pScreen))
-    {
-      ErrorF ("winAllocateFBShadowGDI - winQueryRGBBitsAndMasks failed\n");
-      return FALSE;
-    }
-
 #ifdef XWIN_MULTIWINDOW
   /* Redraw all windows */
   if (pScreenInfo->fMultiWindow)
@@ -607,6 +587,29 @@ winInitScreenShadowGDI (ScreenPtr pScreen)
   pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
   pScreenPriv->hdcShadow = CreateCompatibleDC (pScreenPriv->hdcScreen);
 
+  /* Allocate bitmap info header */
+  pScreenPriv->pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER)
+                                                   + 256 * sizeof (RGBQUAD));
+  if (pScreenPriv->pbmih == NULL)
+    {
+      ErrorF ("winInitScreenShadowGDI - malloc () failed\n");
+      return FALSE;
+    }
+
+  /* Query the screen format */
+  if (!winQueryScreenDIBFormat (pScreen, pScreenPriv->pbmih))
+    {
+      ErrorF ("winInitScreenShadowGDI - winQueryScreenDIBFormat failed\n");
+      return FALSE;
+    }
+
+  /* Determine our color masks */
+  if (!winQueryRGBBitsAndMasks (pScreen))
+    {
+      ErrorF ("winInitScreenShadowGDI - winQueryRGBBitsAndMasks failed\n");
+      return FALSE;
+    }
+
   return winAllocateFBShadowGDI(pScreen);
 }
 
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index 80f5e1a..dd8f27e 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -183,28 +183,6 @@ winWindowProc (HWND hwnd, UINT message,
 	      LOWORD (lParam), HIWORD (lParam), wParam);
 
       /*
-       * TrueColor --> TrueColor depth changes are disruptive for:
-       *	Windowed:
-       *		Shadow DirectDraw
-       *		Shadow DirectDraw Non-Locking
-       *		Primary DirectDraw
-       *
-       * TrueColor --> TrueColor depth changes are non-optimal for:
-       *	Windowed:
-       *		Shadow GDI
-       *
-       *	FullScreen:
-       *		Shadow GDI
-       *
-       * TrueColor --> PseudoColor or vice versa are disruptive for:
-       *	Windowed:
-       *		Shadow DirectDraw
-       *		Shadow DirectDraw Non-Locking
-       *		Primary DirectDraw
-       *		Shadow GDI
-       */
-
-      /*
        * Check for a disruptive change in depth.
        * We can only display a message for a disruptive depth change,
        * we cannot do anything to correct the situation.
@@ -213,31 +191,38 @@ winWindowProc (HWND hwnd, UINT message,
         XXX: maybe we need to check if GetSystemMetrics(SM_SAMEDISPLAYFORMAT)
         has changed as well...
       */
-      if ((s_pScreenInfo->dwBPP != GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL))
-	  && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
-	      || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
+      if (s_pScreenInfo->dwBPP != GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL))
+        {
+          if ((s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
+               || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
 #ifdef XWIN_PRIMARYFB
-	      || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
+               || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
 #endif
-	      ))
-	{
-	  /* Cannot display the visual until the depth is restored */
-	  ErrorF ("winWindowProc - Disruptive change in depth\n");
+               ))
+            {
+              /* Cannot display the visual until the depth is restored */
+              ErrorF ("winWindowProc - Disruptive change in depth\n");
 
-	  /* Display depth change dialog */
-	  winDisplayDepthChangeDialog (s_pScreenPriv);
+              /* Display depth change dialog */
+              winDisplayDepthChangeDialog (s_pScreenPriv);
 
-	  /* Flag that we have an invalid screen depth */
-	  s_pScreenPriv->fBadDepth = TRUE;
+              /* Flag that we have an invalid screen depth */
+              s_pScreenPriv->fBadDepth = TRUE;
 
-	  /* Minimize the display window */
-	  ShowWindow (hwnd, SW_MINIMIZE);
-	}
+              /* Minimize the display window */
+              ShowWindow (hwnd, SW_MINIMIZE);
+            }
+          else
+            {
+              /* For GDI, performance may suffer until original depth is restored */
+              ErrorF ("winWindowProc - Performance may be non-optimal after change in depth\n");
+            }
+        }
       else
-	{
-	  /* Flag that we have a valid screen depth */
-	  s_pScreenPriv->fBadDepth = FALSE;
-	}
+        {
+          /* Flag that we have a valid screen depth */
+          s_pScreenPriv->fBadDepth = FALSE;
+        }
 
       /*
         If we could cheaply check if this WM_DISPLAYCHANGE change
commit 8b22f83113fbdc09b932b5ad7e44f629fc15e3b5
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Mon Aug 30 17:17:57 2010 +0100

    Cygwin/X: Use winUpdateFBPointer() in winshaddd.c rather than duplicating it inline
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winshaddd.c b/hw/xwin/winshaddd.c
index e23e100..b551bef 100644
--- a/hw/xwin/winshaddd.c
+++ b/hw/xwin/winshaddd.c
@@ -695,22 +695,7 @@ winShadowUpdateDD (ScreenPtr pScreen,
 	      "%s file to " BUILDERADDR "\n", g_pszLogFile);
 
       /* Location of shadow framebuffer has changed */
-      pScreenInfo->pfb = pScreenPriv->pddsdShadow->lpSurface;
-      
-      /* Update the screen pixmap */
-      if (!(*pScreen->ModifyPixmapHeader)(pScreen->devPrivate,
-					  pScreen->width,
-					  pScreen->height,
-					  pScreen->rootDepth,
-					  BitsPerPixel (pScreen->rootDepth),
-					  PixmapBytePad (pScreenInfo->dwStride,
-							 pScreenInfo->dwBPP),
-					  pScreenInfo->pfb))
-	{
-	  ErrorF ("winShadowUpdateDD - Bits changed, could not "
-		  "notify fb.\n");
-	  return;
-	}
+      winUpdateFBPointer(pScreen, pScreenPriv->pddsdShadow->lpSurface);
     }
 }
 
commit 8385c426f86e9955e9e570a46f75bddd3c10ca01
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Aug 10 21:55:15 2010 +0100

    Cygwin/X: Remove WIN_DIB_MAXIMUM_SIZE check
    
    This is only relevant to pre-NT versions of Windows, which are all EOL.
    
    Also, it's in the wrong place now as framebuffer can get resized.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 2eea345..96a868e 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -74,9 +74,6 @@
 #endif
 #define WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH	FALSE
 
-#define WIN_DIB_MAXIMUM_SIZE	0x08000000 /* 16 MB on Windows 95, 98, Me */
-#define WIN_DIB_MAXIMUM_SIZE_MB (WIN_DIB_MAXIMUM_SIZE / 8 / 1024 / 1024)
-
 /*
  * Windows only supports 256 color palettes
  */
diff --git a/hw/xwin/winshaddd.c b/hw/xwin/winshaddd.c
index 45d1548..e23e100 100644
--- a/hw/xwin/winshaddd.c
+++ b/hw/xwin/winshaddd.c
@@ -949,19 +949,6 @@ winAdjustVideoModeShadowDD (ScreenPtr pScreen)
       /* We'll use GDI's depth */
       pScreenInfo->dwBPP = dwBPP;
     }
-  
-  /* See if the shadow bitmap will be larger than the DIB size limit */
-  if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP
-      >= WIN_DIB_MAXIMUM_SIZE)
-    {
-      ErrorF ("winAdjustVideoModeShadowDD - Requested DirectDraw surface "
-	      "will be larger than %d MB.  The surface may fail to be "
-	      "allocated on Windows 95, 98, or Me, due to a %d MB limit in "
-	      "DIB size.  This limit does not apply to Windows NT/2000, and "
-	      "this message may be ignored on those platforms.\n",
-	      WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB);
-    }
-
   /* Release our DC */
   ReleaseDC (NULL, hdc);
   return TRUE;
diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c
index dd2e9b5..52a4ce2 100644
--- a/hw/xwin/winshadddnl.c
+++ b/hw/xwin/winshadddnl.c
@@ -1010,18 +1010,6 @@ winAdjustVideoModeShadowDDNL (ScreenPtr pScreen)
       pScreenInfo->dwBPP = dwBPP;
     }
 
-  /* See if the shadow bitmap will be larger than the DIB size limit */
-  if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP
-      >= WIN_DIB_MAXIMUM_SIZE)
-    {
-      winErrorFVerb (1, "winAdjustVideoModeShadowDDNL - Requested DirectDraw surface "
-	      "will be larger than %d MB.  The surface may fail to be "
-	      "allocated on Windows 95, 98, or Me, due to a %d MB limit in "
-	      "DIB size.  This limit does not apply to Windows NT/2000, and "
-	      "this message may be ignored on those platforms.\n",
-	      WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB);
-    }
-  
   /* Release our DC */
   ReleaseDC (NULL, hdc);
 
diff --git a/hw/xwin/winshadgdi.c b/hw/xwin/winshadgdi.c
index a165d80..721234e 100644
--- a/hw/xwin/winshadgdi.c
+++ b/hw/xwin/winshadgdi.c
@@ -445,18 +445,6 @@ winAllocateFBShadowGDI (ScreenPtr pScreen)
 	  (int) pScreenInfo->dwStride);
 #endif
 
-  /* See if the shadow bitmap will be larger than the DIB size limit */
-  if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP
-      >= WIN_DIB_MAXIMUM_SIZE)
-    {
-      ErrorF ("winAllocateFBShadowGDI - Requested DIB (bitmap) "
-	      "will be larger than %d MB.  The surface may fail to be "
-	      "allocated on Windows 95, 98, or Me, due to a %d MB limit in "
-	      "DIB size.  This limit does not apply to Windows NT/2000, and "
-	      "this message may be ignored on those platforms.\n",
-	      WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB);
-    }
-
   /* Determine our color masks */
   if (!winQueryRGBBitsAndMasks (pScreen))
     {
commit 981ad1f364cf4fe8008c0f3592eb0f73dd14a118
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Aug 10 16:24:57 2010 +0100

    Cygwin/X: Fix a typo in command line argument validation code
    
    Fortunately, these swapped constants are benign as they have the same
    value, 0
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winvalargs.c b/hw/xwin/winvalargs.c
index 6680aba..04db777 100644
--- a/hw/xwin/winvalargs.c
+++ b/hw/xwin/winvalargs.c
@@ -154,8 +154,8 @@ winValidateArgs (void)
       
       /* Check for !fullscreen and any fullscreen-only parameters */
       if (!g_ScreenInfo[i].fFullScreen
-	  && (g_ScreenInfo[i].dwRefreshRate != WIN_DEFAULT_BPP
-	      || g_ScreenInfo[i].dwBPP != WIN_DEFAULT_REFRESH))
+	  && (g_ScreenInfo[i].dwRefreshRate != WIN_DEFAULT_REFRESH
+	      || g_ScreenInfo[i].dwBPP != WIN_DEFAULT_BPP))
 	{
 	  ErrorF ("winValidateArgs - -refresh and -depth are only valid "
 		  "with -fullscreen.\n");
commit 5390b494672393506466d8afdb9b146b0e585cc0
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Aug 10 13:16:13 2010 +0100

    Cygwin/X: Don't turn off -multiplemonitors when all monitors don't have the same pixel format when using shadow GDI engine
    
    Don't turn off -multiplemonitors when all monitors don't have the
    same pixel format and when using shadow GDI engine, just warn that
    performance may be degraded
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index e0686e2..f505ddd 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -151,13 +151,20 @@ winScreenInit (int index,
    * Check that all monitors have the same display depth if we are using
    * multiple monitors
    */
-  if (pScreenInfo->fMultipleMonitors 
+  if (pScreenInfo->fMultipleMonitors
       && !GetSystemMetrics (SM_SAMEDISPLAYFORMAT))
     {
       ErrorF ("winScreenInit - Monitors do not all have same pixel format / "
-	      "display depth.\n"
-	      "Using primary display only.\n");
-      pScreenInfo->fMultipleMonitors = FALSE;
+	      "display depth.\n");
+      if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI)
+        {
+          ErrorF ("winScreenInit - Performance may suffer off primary display.\n");
+        }
+      else
+        {
+          ErrorF ("winScreenInit - Using primary display only.\n");
+          pScreenInfo->fMultipleMonitors = FALSE;
+        }
     }
 
   /* Create display window */
commit 33106e1e807a828208b306512e78c5e3e93960d3
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Mar 30 19:49:41 2010 +0100

    Cygwin/X: Generate RANDR change on WM_DISPLAYCHANGE for rootless modes
    
    When RANDR resizing is enabled, generate an internal RANDR change when
    WM_DISPLAYCHANGE occurs in rootless modes for screens which occupy an
    entire monitor or the virtual desktop.
    
    Store the monitor number and use that to handle WM_DISPLAYCHANGE for a
    screen specified with '-screen @monitor'
    
    In rooted mode, WM_DISPLAYCHANGE isn't relevant (except where display
    depth changes may cause problems). (A maximized screen window will get
    WM_SIZE to adjust it to the new monitor size)
    
    In rooted fullscreen mode, WM_DISPLAYCHANGE shouldn't be seen, as we
    have the resolution we have selected for the fullscreen session)
    (Could client randr requests be handled in fullscreen to cause a change
    of the fullscreen resolution? )
    
    Don't bother do a RANDR resize if the dimensions aren't actually changing
    when WM_DISPLAYCHANGE is sent (should handle WM_DISPLAYCHANGE to size 0x0
    that the intel driver seems to like to send)
    
    Various debug output improvements
    
    Also, remove the note that XWin can't handle display mode changes from
    the man page
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man
index 39cdf5e..e7933c9 100644
--- a/hw/xwin/man/XWin.man
+++ b/hw/xwin/man/XWin.man
@@ -376,12 +376,9 @@ X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), XWinrc(__filemansuffix__), s
 
 .SH BUGS
 .I XWin
-and this man page still have many limitations.  Some of the more obvious
-ones are:
-.br
-- The display mode can not be changed once the X server has started.
-.br
-- The \fIXWin\fP software is continuously developing; it is therefore possible that
+and this man page still have many limitations.
+
+The \fIXWin\fP software is continuously developing; it is therefore possible that
 this man page is not up to date.  It is always prudent to
 look also at the output of \fIXWin -help\fP in order to
 check the options that are operative.
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index bbc0f2f..2eea345 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -400,6 +400,8 @@ typedef struct
   Bool			fUserGaveHeightAndWidth;
 
   DWORD			dwScreen;
+
+  int			iMonitor;
   DWORD			dwUserWidth;
   DWORD			dwUserHeight;
   DWORD			dwWidth;
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index e4c52ef..ddfe1f5 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -95,6 +95,7 @@ winInitializeScreenDefaults(void)
   if (monitorResolution == 0)
     monitorResolution = WIN_DEFAULT_DPI;
 
+  defaultScreenInfo.iMonitor = 1;
   defaultScreenInfo.dwWidth  = dwWidth;
   defaultScreenInfo.dwHeight = dwHeight;
   defaultScreenInfo.dwUserWidth  = dwWidth;
@@ -318,6 +319,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
 		  iArgsProcessed = 3;
 		  g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
 		  g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
+		  g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
 		  g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth;
 		  g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight;
 		  g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth;
@@ -370,6 +372,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
                       "Querying monitors is not supported on NT4 and Win95\n");
           } else if (data.bMonitorSpecifiedExists == TRUE) 
           {
+			g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
 			g_ScreenInfo[nScreenNum].dwInitialX += data.monitorOffsetX;
 			g_ScreenInfo[nScreenNum].dwInitialY += data.monitorOffsetY;
 		  }
@@ -399,6 +402,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
         {
 		  winErrorFVerb (2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor);
 		  g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
+		  g_ScreenInfo[nScreenNum].iMonitor = iMonitor;
 		  g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
 		  g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
 		}
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index 04a3a6b..80f5e1a 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -40,6 +40,7 @@
 #include "winprefs.h"
 #include "winconfig.h"
 #include "winmsg.h"
+#include "winmonitors.h"
 #include "inputstr.h"
 
 /*
@@ -177,12 +178,9 @@ winWindowProc (HWND hwnd, UINT message,
 	  break;
 	}
 
-      ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new bpp: %d\n",
-	      wParam);
-
       ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new width: %d "
-	      "new height: %d\n",
-	      LOWORD (lParam), HIWORD (lParam));
+	      "new height: %d new bpp: %d\n",
+	      LOWORD (lParam), HIWORD (lParam), wParam);
 
       /*
        * TrueColor --> TrueColor depth changes are disruptive for:
@@ -254,41 +252,105 @@ winWindowProc (HWND hwnd, UINT message,
        * the display dimensions change.
        */
 	{
-	  /*
-	   * NOTE: The non-DirectDraw engines set the ReleasePrimarySurface
-	   * and CreatePrimarySurface function pointers to point
-	   * to the no operation function, NoopDDA.  This allows us
-	   * to blindly call these functions, even if they are not
-	   * relevant to the current engine (e.g., Shadow GDI).
-	   */
-
-#if CYGDEBUG
-	  winDebug ("winWindowProc - WM_DISPLAYCHANGE - Dimensions changed\n");
-#endif
-
-	  /* Release the old primary surface */
-	  (*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen);
-
-#if CYGDEBUG
-	  winDebug ("winWindowProc - WM_DISPLAYCHANGE - Released "
-		  "primary surface\n");
-#endif
-
-	  /* Create the new primary surface */
-	  (*s_pScreenPriv->pwinCreatePrimarySurface) (s_pScreen);
 
 #if CYGDEBUG
 	  winDebug ("winWindowProc - WM_DISPLAYCHANGE - Recreated "
 		  "primary surface\n");
 #endif
 
-#if 0
-	  /* Multi-Window mode uses RandR for resizes */
-	  if (s_pScreenInfo->fMultiWindow)
+	  /*
+             In rootless modes which are monitor or virtual desktop size
+             use RandR to resize the X screen
+          */
+          if ((!s_pScreenInfo->fUserGaveHeightAndWidth) &&
+              (s_pScreenInfo->iResizeMode == resizeWithRandr) &&
+              (FALSE
+#ifdef XWIN_MULTIWINDOWEXTWM
+               || s_pScreenInfo->fMWExtWM
+#endif
+               || s_pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOW
+               || s_pScreenInfo->fMultiWindow
+#endif
+               ))
 	    {
-	      RRSetScreenConfig ();
+              DWORD dwWidth, dwHeight;
+
+              if (s_pScreenInfo->fMultipleMonitors)
+                {
+                  /* resize to new virtual desktop size */
+                  dwWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+                  dwHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
+                }
+              else
+                {
+                  /* resize to new size of specified monitor */
+                  struct GetMonitorInfoData data;
+                  if (QueryMonitor(s_pScreenInfo->iMonitor, &data))
+                    {
+                      if (data.bMonitorSpecifiedExists == TRUE)
+                        {
+                          dwWidth = data.monitorWidth;
+                          dwHeight = data.monitorHeight;
+                          /*
+                             XXX: monitor may have changed position,
+                             so we might need to update xinerama data
+                          */
+                        }
+                      else
+                        {
+                          ErrorF ("Monitor number %d no longer exists!\n", s_pScreenInfo->iMonitor);
+                        }
+                    }
+                }
+
+              /*
+                XXX: probably a small bug here: we don't compute the work area
+                and allow for task bar
+
+                XXX: generally, we don't allow for the task bar being moved after
+                the server is started
+               */
+
+              /* Set screen size to match new size, if it is different to current */
+              if ((s_pScreenInfo->dwWidth != dwWidth) ||
+                  (s_pScreenInfo->dwHeight != dwHeight))
+                {
+                  winDoRandRScreenSetSize(s_pScreen,
+                                          dwWidth,
+                                          dwHeight,
+                                          (dwWidth * 25.4) / monitorResolution,
+                                          (dwHeight * 25.4) / monitorResolution);
+                }
 	    }
-#endif
+          else
+            {
+              /*
+                If we get here, we are either windowed and using the GDI engine
+                or windowed and non-fullscreen using any engine
+              */
+
+              /*
+               * For ddraw engines, we need to (try to) recreate the same-sized primary surface
+               * when display dimensions change (but not depth, that is disruptive)
+               */
+
+              /*
+               * NOTE: The non-DirectDraw engines set the ReleasePrimarySurface
+               * and CreatePrimarySurface function pointers to point
+               * to the no operation function, NoopDDA.  This allows us
+               * to blindly call these functions, even if they are not
+               * relevant to the current engine (e.g., Shadow GDI).
+               */
+
+              winDebug ("winWindowProc - WM_DISPLAYCHANGE - Releasing and recreating primary surface\n");
+
+              /* Release the old primary surface */
+              (*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen);
+
+              /* Create the new primary surface */
+              (*s_pScreenPriv->pwinCreatePrimarySurface) (s_pScreen);
+            }
 	}
 
       break;
commit bbc511e80b2a9365f6a1528bc1595772f83be654
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Mon Feb 15 13:42:04 2010 +0000

    Cygwin/X: Make WM_SIZE use RandR resizing when -resize=randr
    
    To avoid recursion, WM_SIZE requests shouldn't generate XRANDR requests
    when no change is neeeded.
    
    We do the actual resize on WM_EXITSIZEMOVE, as resizing occurs in
    a modal loop, to avoid a backlog of resize events building up as
    the X server doesn't get a change to process anything until the resize
    is completed.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index 27fc840..04a3a6b 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -303,7 +303,7 @@ winWindowProc (HWND hwnd, UINT message,
 	winDebug ("winWindowProc - WM_SIZE\n");
 #endif
 
-	/* Break if we do not use scrollbars */
+	/* Break if we do not allow resizing */
 	if ((s_pScreenInfo->iResizeMode == notAllowed)
 	    || !s_pScreenInfo->fDecoration
 #ifdef XWIN_MULTIWINDOWEXTWM
@@ -320,6 +320,17 @@ winWindowProc (HWND hwnd, UINT message,
 	if (wParam == SIZE_MINIMIZED)
 	  return 0;
 
+        ErrorF ("winWindowProc - WM_SIZE - new client area w: %d h: %d\n",
+                LOWORD (lParam), HIWORD (lParam));
+
+        if (s_pScreenInfo->iResizeMode == resizeWithRandr)
+          {
+            /* Actual resizing is done on WM_EXITSIZEMOVE */
+            return 0;
+          }
+
+        /* Otherwise iResizeMode == resizeWithScrollbars */
+
 	/*
 	 * Get the size of the whole window, including client area,
 	 * scrollbars, and non-client area decorations (caption, borders).
@@ -337,10 +348,6 @@ winWindowProc (HWND hwnd, UINT message,
 	iWidth = rcWindow.right - rcWindow.left;
 	iHeight = rcWindow.bottom - rcWindow.top;
 
-	ErrorF ("winWindowProc - WM_SIZE - window w: %d h: %d, "
-		"new client area w: %d h: %d\n",
-		iWidth, iHeight, LOWORD (lParam), HIWORD (lParam));
-
 	/* Subtract the frame size from the window size. */
 	iWidth -= 2 * GetSystemMetrics (SM_CXSIZEFRAME);
 	iHeight -= (2 * GetSystemMetrics (SM_CYSIZEFRAME)
@@ -396,6 +403,37 @@ winWindowProc (HWND hwnd, UINT message,
       }
       return 0;
 
+    case WM_ENTERSIZEMOVE:
+      ErrorF("winWindowProc - WM_ENTERSIZEMOVE\n");
+      break;
+
+    case WM_EXITSIZEMOVE:
+      ErrorF("winWindowProc - WM_EXITSIZEMOVE\n");
+
+      if (s_pScreenInfo->iResizeMode == resizeWithRandr)
+        {
+          /* Set screen size to match new client area, if it is different to current */
+          RECT rcClient;
+          DWORD dwWidth, dwHeight;
+
+          GetClientRect (hwnd, &rcClient);
+          dwWidth = rcClient.right - rcClient.left;
+          dwHeight = rcClient.bottom - rcClient.top;
+
+          if ((s_pScreenInfo->dwWidth != dwWidth) ||
+              (s_pScreenInfo->dwHeight != dwHeight))
+            {
+              /* mm = dots * (25.4 mm / inch) / (dots / inch) */
+              winDoRandRScreenSetSize(s_pScreen,
+                                      dwWidth,
+                                      dwHeight,
+                                      (dwWidth * 25.4) / monitorResolution,
+                                      (dwHeight * 25.4) / monitorResolution);
+            }
+        }
+
+      break;
+
     case WM_VSCROLL:
       {
 	SCROLLINFO		si;
commit 85c497a8b6c488ef9ea2c6d7b49e6f9b992fb4a2
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Mar 30 20:48:10 2010 +0100

    Cygwin/X: Implement framebuffer resizing in RANDR extension
    
    Implement framebuffer resizing in RANDR extension:
    
    Resize the frame buffer, the screen's root window and the native window
    containing the root window image.
    
    Correctly allow for decorations in new native window size when resizing native window
    to fit the new framebuffer size with AdjustWindowRectEx()
    
    Update physical size info for a screen when it is changed by RANDR
    
    Forbid client-requested RANDR changes in fullscreen and rootless modes
    
    Only resize window on an external RandR request, to avoid recursing on
    a WM_SIZE requested resize.
    
    Also, add prototypes for winRandRInit() and winDoRandRScreenSetSize() to header file
    
    Also, update the author list and copyright for winrandr.c
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 0df1d27..bbc0f2f 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -1472,6 +1472,18 @@ void
 winInitializeScreens(int maxscreens);
 
 /*
+ * winrandr.c
+ */
+Bool
+winRandRInit (ScreenPtr pScreen);
+void
+winDoRandRScreenSetSize (ScreenPtr  pScreen,
+                         CARD16	    width,
+                         CARD16	    height,
+                         CARD32	    mmWidth,
+                         CARD32	    mmHeight);
+
+/*
  * END DDX and DIX Function Prototypes
  */
 
diff --git a/hw/xwin/winrandr.c b/hw/xwin/winrandr.c
index fd1d97e..2484048 100644
--- a/hw/xwin/winrandr.c
+++ b/hw/xwin/winrandr.c
@@ -1,8 +1,9 @@
 /*
  *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *Copyright (C) 2009-2010 Jon TURNEY
  *
  *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
+ *a copy of this software and associated documentation files (the
  *"Software"), to deal in the Software without restriction, including
  *without limitation the rights to use, copy, modify, merge, publish,
  *distribute, sublicense, and/or sell copies of the Software, and to
@@ -20,101 +21,280 @@
  *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
- *Except as contained in this notice, the name of Harold L Hunt II
+ *Except as contained in this notice, the name of the author(s)
  *shall not be used in advertising or otherwise to promote the sale, use
  *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
+ *from the author(s)
  *
  * Authors:	Harold L Hunt II
+ *              Jon TURNEY
  */
 
 #ifdef HAVE_XWIN_CONFIG_H
 #include <xwin-config.h>
 #endif
 #include "win.h"
+#include "mivalidate.h" // for union _Validate used by windowstr.h
+
+#ifndef RANDR_12_INTERFACE
+#error X server must have RandR 1.2 interface
+#endif
 
 
 /*
- * Local prototypes
+ * Answer queries about the RandR features supported.
  */
 
 static Bool
-winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations);
+winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations)
+{
+  winDebug ("winRandRGetInfo ()\n");
 
-static Bool
-winRandRSetConfig (ScreenPtr		pScreen,
-		   Rotation		rotateKind,
-		   int			rate,
-		   RRScreenSizePtr	pSize);
+  /* Don't support rotations */
+  *pRotations = RR_Rotate_0;
 
-Bool
-winRandRInit (ScreenPtr pScreen);
+  /*
+    The screen doesn't have to be limited to the actual
+    monitor size (we can have scrollbars :-), so what is
+    the upper limit?
+  */
+  RRScreenSetSizeRange(pScreen, 0, 0, 4096, 4096);
+
+  return TRUE;
+}
 
 
 /*
- * Answer queries about the RandR features supported.
+  Copied from the xfree86 DDX
+
+  Why can't this be in DIX?
+  Does union _Validate vary depending on DDX??
  */
+static void
+xf86SetRootClip (ScreenPtr pScreen, Bool enable)
+{
+    WindowPtr	pWin = pScreen->root;
+    WindowPtr	pChild;
+    Bool	WasViewable = (Bool)(pWin->viewable);
+    Bool	anyMarked = FALSE;
+    WindowPtr   pLayerWin;
+    BoxRec	box;
 
-static Bool
-winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations)
+    if (WasViewable)
+    {
+	for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
+	{
+	    (void) (*pScreen->MarkOverlappedWindows)(pChild,
+						     pChild,
+						     &pLayerWin);
+	}
+	(*pScreen->MarkWindow) (pWin);
+	anyMarked = TRUE;
+	if (pWin->valdata)
+	{
+	    if (HasBorder (pWin))
+	    {
+		RegionPtr	borderVisible;
+
+		borderVisible = REGION_CREATE(pScreen, NullBox, 1);
+		REGION_SUBTRACT(pScreen, borderVisible,
+				&pWin->borderClip, &pWin->winSize);
+		pWin->valdata->before.borderVisible = borderVisible;
+	    }
+	    pWin->valdata->before.resized = TRUE;
+	}
+    }
+
+    /*
+     * Use REGION_BREAK to avoid optimizations in ValidateTree
+     * that assume the root borderClip can't change well, normally
+     * it doesn't...)
+     */
+    if (enable)
+    {
+	box.x1 = 0;
+	box.y1 = 0;
+	box.x2 = pScreen->width;
+	box.y2 = pScreen->height;
+	REGION_INIT (pScreen, &pWin->winSize, &box, 1);
+	REGION_INIT (pScreen, &pWin->borderSize, &box, 1);
+	if (WasViewable)
+	    REGION_RESET(pScreen, &pWin->borderClip, &box);
+	pWin->drawable.width = pScreen->width;
+	pWin->drawable.height = pScreen->height;
+        REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+    }
+    else
+    {
+	REGION_EMPTY(pScreen, &pWin->borderClip);
+	REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+    }
+
+    ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
+
+    if (WasViewable)
+    {
+	if (pWin->firstChild)
+	{
+	    anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
+							   pWin->firstChild,
+							   (WindowPtr *)NULL);
+	}
+	else
+	{
+	    (*pScreen->MarkWindow) (pWin);
+	    anyMarked = TRUE;
+	}
+
+
+	if (anyMarked)
+	    (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
+    }
+
+    if (WasViewable)
+    {
+	if (anyMarked)
+	    (*pScreen->HandleExposures)(pWin);
+	if (anyMarked && pScreen->PostValidateTree)
+	    (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
+    }
+    if (pWin->realized)
+	WindowsRestructured ();
+    FlushAllOutput ();
+}
+
+/*
+
+*/
+void
+winDoRandRScreenSetSize (ScreenPtr  pScreen,
+                         CARD16	    width,
+                         CARD16	    height,
+                         CARD32	    mmWidth,
+                         CARD32	    mmHeight)
 {
   winScreenPriv(pScreen);
-  winScreenInfo			*pScreenInfo = pScreenPriv->pScreenInfo;
-  int				n;
-  Rotation			rotateKind;
-  RRScreenSizePtr		pSize;
+  winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+  WindowPtr pRoot = pScreen->root;
 
-  winDebug ("winRandRGetInfo ()\n");
+  // Prevent screen updates while we change things around
+  xf86SetRootClip(pScreen, FALSE);
 
-  /* Don't support rotations, yet */
-  *pRotations = RR_Rotate_0;
+  /* Update the screen size as requested */
+  pScreenInfo->dwWidth = width;
+  pScreenInfo->dwHeight = height;
 
-  /* Bail if no depth has a visual associated with it */
-  for (n = 0; n < pScreen->numDepths; n++)
-    if (pScreen->allowedDepths[n].numVids)
-      break;
-  if (n == pScreen->numDepths)
-    return FALSE;
+  /* Reallocate the framebuffer used by the drawing engine */
+  (*pScreenPriv->pwinFreeFB)(pScreen);
+  if (!(*pScreenPriv->pwinAllocateFB)(pScreen))
+    {
+      ErrorF ("winDoRandRScreenSetSize - Could not reallocate framebuffer\n");
+    }
 
-  /* Only one allowed rotation for now */
-  rotateKind = RR_Rotate_0;
+  pScreen->width = width;
+  pScreen->height = height;
+  pScreen->mmWidth = mmWidth;
+  pScreen->mmHeight = mmHeight;
 
-  /*
-   * Register supported sizes.  This can be called many times, but
-   * we only support one size for now.
-   */
-  pSize = RRRegisterSize (pScreen,
-			  pScreenInfo->dwWidth,
-			  pScreenInfo->dwHeight,
-                          (pScreenInfo->dwWidth / monitorResolution) * 25.4,
-                          (pScreenInfo->dwHeight / monitorResolution) * 25.4);
-
-  /* Tell RandR what the current config is */
-  RRSetCurrentConfig (pScreen,
-		      rotateKind,
-		      0, /* refresh rate, not needed */
-		      pSize);
-  
-  return TRUE;
-}
+  /* Update the screen pixmap to point to the new framebuffer */
+  winUpdateFBPointer(pScreen, pScreenInfo->pfb);
+
+  // pScreen->devPrivate == pScreen->GetScreenPixmap(screen) ?
+  // resize the root window
+  //pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL);
+  // does this emit a ConfigureNotify??
 
+  // Restore the ability to update screen, now with new dimensions
+  xf86SetRootClip(pScreen, TRUE);
+
+  // and arrange for it to be repainted
+  miPaintWindow(pRoot, &pRoot->borderClip,  PW_BACKGROUND);
+
+  /* Indicate that a screen size change took place */
+  RRScreenSizeNotify(pScreen);
+}
 
 /*
- * Respond to resize/rotate request from either X Server or X client app
+ * Respond to resize request
  */
-
-static Bool
-winRandRSetConfig (ScreenPtr		pScreen,
-		   Rotation		rotateKind,
-		   int			rate,
-		   RRScreenSizePtr	pSize)
+static
+Bool
+winRandRScreenSetSize (ScreenPtr  pScreen,
+		       CARD16	    width,
+		       CARD16	    height,
+		       CARD16       pixWidth,
+		       CARD16       pixHeight,
+		       CARD32	    mmWidth,
+		       CARD32	    mmHeight)
 {
-  winDebug ("winRandRSetConfig ()\n");
+  winScreenPriv(pScreen);
+  winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+  winDebug ("winRandRScreenSetSize ()\n");
+
+  /*
+    It doesn't currently make sense to allow resize in fullscreen mode
+    (we'd actually have to list the supported resolutions)
+  */
+  if (pScreenInfo->fFullScreen)
+    {
+      ErrorF ("winRandRScreenSetSize - resize not supported in fullscreen mode\n");
+      return FALSE;
+    }
+
+  /*
+    Client resize requests aren't allowed in rootless modes, even if
+    the X screen is monitor or virtual desktop size, we'd need to
+    resize the native display size
+  */
+  if (FALSE
+#ifdef XWIN_MULTIWINDOWEXTWM
+      || pScreenInfo->fMWExtWM
+#endif
+      || pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOW
+      || pScreenInfo->fMultiWindow
+#endif
+      )
+    {
+      ErrorF ("winRandRScreenSetSize - resize not supported in rootless modes\n");
+      return FALSE;
+    }
+
+  winDoRandRScreenSetSize(pScreen, width, height, mmWidth, mmHeight);
+
+  /* Cause the native window for the screen to resize itself */
+  {
+    DWORD dwStyle, dwExStyle;
+    RECT rcClient;
+
+    rcClient.left = 0;
+    rcClient.top = 0;
+    rcClient.right = width;
+    rcClient.bottom = height;
+
+    ErrorF ("winRandRScreenSetSize new client area w: %d h: %d\n", width, height);
+
+    /* Get the Windows window style and extended style */
+    dwExStyle = GetWindowLongPtr(pScreenPriv->hwndScreen, GWL_EXSTYLE);
+    dwStyle = GetWindowLongPtr(pScreenPriv->hwndScreen, GWL_STYLE);
+
+    /*
+     * Calculate the window size needed for the given client area
+     * adjusting for any decorations it will have
+     */
+    AdjustWindowRectEx(&rcClient, dwStyle, FALSE, dwExStyle);
+
+    ErrorF ("winRandRScreenSetSize new window area w: %ld h: %ld\n", rcClient.right-rcClient.left, rcClient.bottom-rcClient.top);
+
+    SetWindowPos(pScreenPriv->hwndScreen, NULL,
+                 0, 0, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top,
+                 SWP_NOZORDER | SWP_NOMOVE);
+  }
 
   return TRUE;
 }
 
-
 /*
  * Initialize the RandR layer.
  */
@@ -122,8 +302,7 @@ winRandRSetConfig (ScreenPtr		pScreen,
 Bool
 winRandRInit (ScreenPtr pScreen)
 {
-  rrScrPrivPtr		pRRScrPriv;
-
+  rrScrPrivPtr pRRScrPriv;
   winDebug ("winRandRInit ()\n");
 
   if (!RRScreenInit (pScreen))
@@ -135,7 +314,10 @@ winRandRInit (ScreenPtr pScreen)
   /* Set some RandR function pointers */
   pRRScrPriv = rrGetScrPriv (pScreen);
   pRRScrPriv->rrGetInfo = winRandRGetInfo;
-  pRRScrPriv->rrSetConfig = winRandRSetConfig;
+  pRRScrPriv->rrSetConfig = NULL;
+  pRRScrPriv->rrScreenSetSize = winRandRScreenSetSize;
+  pRRScrPriv->rrCrtcSet = NULL;
+  pRRScrPriv->rrCrtcSetGamma = NULL;
 
   return TRUE;
 }
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index 74ca115..e0686e2 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -69,10 +69,6 @@ winMWExtWMProcs = {
  * Prototypes
  */
 
-Bool
-winRandRInit (ScreenPtr pScreen);
-
-
 /*
  * Local functions
  */
commit 873abef315f5d947b864428891381bff539c5869
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Mar 30 20:07:19 2010 +0100

    Cygwin/X: Add -resize command line option
    
    Add -resize command line option to configure how native window sizing frame
    is used.
    
    In additions to the existing fixed and scrollbars modes, add a new mode to
    allow framebuffer to be resized using native window frame
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index bf04cf1..7faed01 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -826,6 +826,11 @@ winUseMsg (void)
 	  "\tSpecify an optional refresh rate to use in fullscreen mode\n"
 	  "\twith a DirectDraw engine.\n");
 
+  ErrorF ("-resize=none|scrollbars|randr"
+	  "\tIn windowed mode, [don't] allow resizing of the window. 'scrollbars'\n"
+	  "\tmode gives the window scrollbars as needed, 'randr' mode uses the RANR\n"
+	  "\textension to resize the X screen.\n");
+
   ErrorF ("-rootless\n"
 	  "\tRun the server in rootless mode.\n");
 
@@ -839,11 +844,6 @@ winUseMsg (void)
       "\t -screen 0 1024x768 at 3        ; 3rd monitor size 1024x768\n"
       "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n");
 
-  ErrorF ("-scrollbars\n"
-	  "\tIn windowed mode, allow screens bigger than the Windows desktop.\n"
-	  "\tMoreover, if the window has decorations, one can now resize\n"
-	  "\tit.\n");
-
   ErrorF ("-silent-dup-error\n"
 	  "\tIf another instance of " EXECUTABLE_NAME " with the same display number is running\n"
 	  "\texit silently and don't display any error message.\n");
diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man
index 76abdca..39cdf5e 100644
--- a/hw/xwin/man/XWin.man
+++ b/hw/xwin/man/XWin.man
@@ -103,7 +103,7 @@ Examples:
 
 .SH OPTIONS CONTROLLING THE APPEARANCE OF THE X SCREEN WINDOWS
 These parameters only apply to windowed mode screens i.e. not
-in \fB-multwindow\fP or \fB-rootless\fP mode
+in \fB-multiwindow\fP or \fB-rootless\fP mode.
 .TP 8
 .B "\-fullscreen"
 The X server window takes the full screen, covering completely the
@@ -115,10 +115,52 @@ etc.
 This parameter is ignored when the \fB\-fullscreen\fP parameter is specified.
 .TP 8
 .B \-scrollbars
-In windowed mode, allow screens bigger than the \fIWindows\fP desktop.
-Moreover, if the window has decorations, one can now resize it.
-This parameter is ignored when the \fB\-fullscreen\fP parameter is specified.
+Alternative name for \fB\-resize=scrollbars\fP.
+
+.SH OPTIONS CONTROLLING RESIZE BEHAVIOUR
+.TP 8
+.B \-resize[=none|scrollbars|randr]
+Select the resize mode of an X screen.
+
+.RS
+.IP \fB\-resize=none\fP 8
+(default). The screen is not resizable.
+
+In windowed mode, if the window has decorations, a fixed frame is used.
+
+.IP \fB\-resize=scrollbars\fP 8
+The screen window is resizeable, but the screen is not resizable.
+
+In windowed mode, if the window has decorations, a resizing frame is used.
+Scrollbars are drawn when needed to allow the entire X screen
+to viewed by adjusting them.
 
+This also permits screens bigger than the \fIWindows\fP virtual desktop to be used.
+
+This parameter is ignored in \fB-multiwindow\fP or \fB-rootless\fP mode.
+Alternative name is \fB\-scrollbars\fP.
+
+.IP \fB\-resize=randr\fP 8
+The screen is resizable and the screen window is resizeable.
+
+In windowed mode, if the window has decorations, a resizing frame is used.
+
+Resizing the  \fIWindows\fP window will use the RANDR extension to change
+the size of the X screen.  Likewise, changing the size of
+the X screen using the RANDR extension will cause the size
+of the \fIWindows\fP window containing the X screen to be changed.
+
+In \fB-multiwindow\fP or \fB-rootless\fP mode, if the X screen is
+of the same dimensions as a Windows monitor or the virtual desktop,
+the X server will respond to the WM_DISPLAYCHANGED sent when those
+dimensions change by resizing the X screen.  Changing the size
+of the X screen using the RANDR extension is not permitted.
+
+The maximum dimensions of the screen are the dimensions of the \fIWindows\fP virtual desktop.
+
+.IP \fB\--resize\fP 8
+on its own is equivalent to \fB\--resize=randr\fP
+.RE
 
 .SH OPTIONS CONTROLLING WINDOWS INTEGRATION
 .TP 8
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index ceb001c..0df1d27 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -379,6 +379,15 @@ typedef struct {
 } winCursorRec;
 
 /*
+ * Resize modes
+ */
+typedef enum {
+  notAllowed,
+  resizeWithScrollbars,
+  resizeWithRandr
+} winResizeMode;
+
+/*
  * Screen information structure that we need before privates are available
  * in the server startup sequence.
  */
@@ -439,7 +448,7 @@ typedef struct
 #endif
   Bool                  fMultipleMonitors;
   Bool			fLessPointer;
-  Bool			fScrollbars;
+  winResizeMode		iResizeMode;
   Bool			fNoTrayIcon;
   int			iE3BTimeout;
   /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
diff --git a/hw/xwin/wincreatewnd.c b/hw/xwin/wincreatewnd.c
index 0c342e1..7553739 100644
--- a/hw/xwin/wincreatewnd.c
+++ b/hw/xwin/wincreatewnd.c
@@ -192,7 +192,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
           fForceShowWindow = TRUE;
         } 
         dwWindowStyle |= WS_CAPTION;
-        if (pScreenInfo->fScrollbars)
+        if (pScreenInfo->iResizeMode != notAllowed)
             dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX;
     }
   else
@@ -233,6 +233,22 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
       iPosY = rcWorkArea.top;
     }
 
+  /* Clean up the scrollbars flag, if necessary */
+  if ((!pScreenInfo->fDecoration
+#ifdef XWIN_MULTIWINDOWEXTWM
+       || pScreenInfo->fMWExtWM
+#endif
+       || pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOW
+       || pScreenInfo->fMultiWindow
+#endif
+       )
+      && (pScreenInfo->iResizeMode == resizeWithScrollbars))
+    {
+      /* We cannot have scrollbars if we do not have a window border */
+      pScreenInfo->iResizeMode = notAllowed;
+    }
+
   /* Did the user specify a height and width? */
   if (pScreenInfo->fUserGaveHeightAndWidth)
     {
@@ -256,12 +272,12 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
 #if CYGDEBUG
 	  winDebug ("winCreateBoundingWindowWindowed - Window has decoration\n");
 #endif
-	  /* Are we using scrollbars? */
-	  if (pScreenInfo->fScrollbars)
+
+          /* Are we resizable */
+          if (pScreenInfo->iResizeMode != notAllowed)
 	    {
 #if CYGDEBUG
-	      winDebug ("winCreateBoundingWindowWindowed - Window has "
-		      "scrollbars\n");
+	      winDebug ("winCreateBoundingWindowWindowed - Window is resizable\n");
 #endif
 
 	      iWidth += 2 * GetSystemMetrics (SM_CXSIZEFRAME);
@@ -271,8 +287,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
 	  else
 	    {
 #if CYGDEBUG
-	      winDebug ("winCreateBoundingWindowWindowed - Window does not have "
-		      "scrollbars\n");
+	      winDebug ("winCreateBoundingWindowWindowed - Window is not resizable\n");
 #endif
 
 	      iWidth += 2 * GetSystemMetrics (SM_CXFIXEDFRAME);
@@ -296,22 +311,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
 	}
     }
 
-  /* Clean up the scrollbars flag, if necessary */
-  if ((!pScreenInfo->fDecoration
-#ifdef XWIN_MULTIWINDOWEXTWM
-       || pScreenInfo->fMWExtWM
-#endif
-       || pScreenInfo->fRootless
-#ifdef XWIN_MULTIWINDOW
-       || pScreenInfo->fMultiWindow
-#endif
-       )
-      && pScreenInfo->fScrollbars)
-    {
-      /* We cannot have scrollbars if we do not have a window border */
-      pScreenInfo->fScrollbars = FALSE;
-    }
- 
+  /* Make sure window is no bigger than work area */
   if (TRUE 
 #ifdef XWIN_MULTIWINDOWEXTWM
        && !pScreenInfo->fMWExtWM
@@ -396,7 +396,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
 	  rcClient.bottom, rcClient.top);
   
   /* We adjust the visual size if the user did not specify it */
-  if (!(pScreenInfo->fScrollbars && pScreenInfo->fUserGaveHeightAndWidth))
+  if (!((pScreenInfo->iResizeMode == resizeWithScrollbars) && pScreenInfo->fUserGaveHeightAndWidth))
     {
       /*
        * User did not give a height and width with scrollbars enabled,
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index fe9d7c2..e4c52ef 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -123,7 +123,7 @@ winInitializeScreenDefaults(void)
 #endif
   defaultScreenInfo.fMultipleMonitors = FALSE;
   defaultScreenInfo.fLessPointer = FALSE;
-  defaultScreenInfo.fScrollbars = FALSE;
+  defaultScreenInfo.iResizeMode = notAllowed;
   defaultScreenInfo.fNoTrayIcon = FALSE;
   defaultScreenInfo.iE3BTimeout = WIN_E3B_OFF;
   defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
@@ -656,12 +656,51 @@ ddxProcessArgument (int argc, char *argv[], int i)
    */
   if (IS_OPTION ("-scrollbars"))
     {
-      screenInfoPtr->fScrollbars = TRUE;
+
+      screenInfoPtr->iResizeMode = resizeWithScrollbars;
 
       /* Indicate that we have processed this argument */
       return 1;
     }
 
+  /*
+   * Look for the '-resize' argument
+   */
+  if (IS_OPTION ("-resize") || IS_OPTION ("-noresize") ||
+      (strncmp(argv[i], "-resize=",strlen("-resize=")) == 0))
+    {
+      winResizeMode mode;
+
+      if (IS_OPTION ("-resize"))
+        mode = resizeWithRandr;
+      else if (IS_OPTION ("-noresize"))
+        mode = notAllowed;
+      else if (strncmp(argv[i], "-resize=",strlen("-resize=")) == 0)
+        {
+          char *option = argv[i] + strlen("-resize=");
+          if (strcmp(option, "randr") == 0)
+            mode = resizeWithRandr;
+          else if (strcmp(option, "scrollbars") == 0)
+            mode = resizeWithScrollbars;
+          else if (strcmp(option, "none") == 0)
+            mode = notAllowed;
+          else
+            {
+              ErrorF ("ddxProcessArgument - resize - Invalid resize mode %s\n", option);
+              return 0;
+            }
+        }
+      else
+        {
+          ErrorF ("ddxProcessArgument - resize - Invalid resize option %s\n", argv[i]);
+          return 0;
+        }
+
+      screenInfoPtr->iResizeMode = mode;
+
+      /* Indicate that we have processed this argument */
+      return 1;
+    }
 
 #ifdef XWIN_CLIPBOARD
   /*
diff --git a/hw/xwin/winvalargs.c b/hw/xwin/winvalargs.c
index 357d3d7..6680aba 100644
--- a/hw/xwin/winvalargs.c
+++ b/hw/xwin/winvalargs.c
@@ -164,12 +164,12 @@ winValidateArgs (void)
 
       /* Check for fullscreen and any non-fullscreen parameters */
       if (g_ScreenInfo[i].fFullScreen
-	  && (g_ScreenInfo[i].fScrollbars
+	  && ((g_ScreenInfo[i].iResizeMode != notAllowed)
 	      || !g_ScreenInfo[i].fDecoration
 	      || g_ScreenInfo[i].fLessPointer))
 	{
 	  ErrorF ("winValidateArgs - -fullscreen is invalid with "
-		  "-scrollbars, -nodecoration, or -lesspointer.\n");
+		  "-scrollbars, -resize, -nodecoration, or -lesspointer.\n");
 	  return FALSE;
 	}
     }
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index 7983e9a..27fc840 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -304,7 +304,7 @@ winWindowProc (HWND hwnd, UINT message,
 #endif
 
 	/* Break if we do not use scrollbars */
-	if (!s_pScreenInfo->fScrollbars
+	if ((s_pScreenInfo->iResizeMode == notAllowed)
 	    || !s_pScreenInfo->fDecoration
 #ifdef XWIN_MULTIWINDOWEXTWM
 	    || s_pScreenInfo->fMWExtWM
@@ -579,7 +579,7 @@ winWindowProc (HWND hwnd, UINT message,
 
 	/* Can't do anything without screen info */
 	if (s_pScreenInfo == NULL
-	    || !s_pScreenInfo->fScrollbars
+	    || (s_pScreenInfo->iResizeMode != resizeWithScrollbars)
 	    || s_pScreenInfo->fFullScreen
 	    || !s_pScreenInfo->fDecoration
 #ifdef XWIN_MULTIWINDOWEXTWM
commit 46c57788539d8a5f0246528b4f88ad4ed6d867d1
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Feb 23 15:44:36 2010 +0000

    Cygwin/X: Move QueryMonitor() out of windprocarg.c
    
    Move QueryMonitor() out of windprocarg.c into a new file, winmonitors.c,
    as we use to use it from other places as well
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am
index f6a75df..ce2edb2 100644
--- a/hw/xwin/Makefile.am
+++ b/hw/xwin/Makefile.am
@@ -87,6 +87,7 @@ SRCS =	InitInput.c \
 	winkeybd.c \
 	winkeyhook.c \
 	winmisc.c \
+	winmonitors.c \
 	winmouse.c \
 	winmsg.c \
 	winmultiwindowclass.c \
diff --git a/hw/xwin/winmonitors.c b/hw/xwin/winmonitors.c
new file mode 100644
index 0000000..63af803
--- /dev/null
+++ b/hw/xwin/winmonitors.c
@@ -0,0 +1,92 @@
+/*
+
+Copyright 1993, 1998  The Open Group
+Copyright (C) Colin Harrison 2005-2008
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+
+#include "win.h"
+#include "winmonitors.h"
+
+/*
+ * getMonitorInfo - callback function used to return information from the enumeration of monitors attached
+ */
+
+static
+wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data)
+{
+  struct GetMonitorInfoData* data = (struct GetMonitorInfoData*)_data;
+  // only get data for monitor number specified in <data>
+  data->monitorNum++;
+  if (data->monitorNum == data->requestedMonitor)
+  {
+	data->bMonitorSpecifiedExists = TRUE;
+	data->monitorOffsetX = rect->left;
+	data->monitorOffsetY = rect->top;
+	data->monitorHeight  = rect->bottom - rect->top;
+	data->monitorWidth   = rect->right  - rect->left;
+    return FALSE;
+  }
+  return TRUE;
+}
+
+typedef wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
+ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors;
+
+wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data);
+
+Bool QueryMonitor(int index, struct GetMonitorInfoData *data)
+{
+    /* Load EnumDisplayMonitors from DLL */
+    HMODULE user32;
+    FARPROC func;
+    user32 = LoadLibrary("user32.dll");
+    if (user32 == NULL)
+    {
+        winW32Error(2, "Could not open user32.dll");
+        return FALSE;
+    }
+    func = GetProcAddress(user32, "EnumDisplayMonitors");
+    if (func == NULL)
+    {
+        winW32Error(2, "Could not resolve EnumDisplayMonitors: ");
+        return FALSE;
+    }
+    _EnumDisplayMonitors = (ENUMDISPLAYMONITORSPROC)func;
+
+    /* prepare data */
+    if (data == NULL)
+        return FALSE;
+    memset(data, 0, sizeof(*data));
+    data->requestedMonitor = index;
+
+    /* query information */
+    _EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
+
+    /* cleanup */
+    FreeLibrary(user32);
+    return TRUE;
+}
diff --git a/hw/xwin/winmonitors.h b/hw/xwin/winmonitors.h
new file mode 100644
index 0000000..180566b
--- /dev/null
+++ b/hw/xwin/winmonitors.h
@@ -0,0 +1,14 @@
+
+/* data returned for monitor information */
+struct GetMonitorInfoData {
+    int  requestedMonitor;
+    int  monitorNum;
+    Bool bUserSpecifiedMonitor;
+    Bool bMonitorSpecifiedExists;
+    int  monitorOffsetX;
+    int  monitorOffsetY;
+    int  monitorHeight;
+    int  monitorWidth;
+};
+
+Bool QueryMonitor(int index, struct GetMonitorInfoData *data);
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index c931696..fe9d7c2 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -35,6 +35,7 @@ from The Open Group.
 #include "win.h"
 #include "winconfig.h"
 #include "winmsg.h"
+#include "winmonitors.h"
 
 /*
  * References to external symbols
@@ -44,55 +45,6 @@ from The Open Group.
 extern Bool			g_fUnicodeClipboard;
 extern Bool			g_fClipboard;
 #endif
-/* globals required by callback function for monitor information */
-struct GetMonitorInfoData {
-    int  requestedMonitor;
-    int  monitorNum;
-    Bool bUserSpecifiedMonitor;
-    Bool bMonitorSpecifiedExists;
-    int  monitorOffsetX;
-    int  monitorOffsetY;
-    int  monitorHeight;
-    int  monitorWidth;
-};
-
-typedef wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
-ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors;
-
-wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data);
-
-static Bool QueryMonitor(int index, struct GetMonitorInfoData *data)
-{
-    /* Load EnumDisplayMonitors from DLL */
-    HMODULE user32;
-    FARPROC func;
-    user32 = LoadLibrary("user32.dll");
-    if (user32 == NULL)
-    {
-        winW32Error(2, "Could not open user32.dll");
-        return FALSE;
-    }
-    func = GetProcAddress(user32, "EnumDisplayMonitors");
-    if (func == NULL)
-    {
-        winW32Error(2, "Could not resolve EnumDisplayMonitors: ");
-        return FALSE;
-    }
-    _EnumDisplayMonitors = (ENUMDISPLAYMONITORSPROC)func;
-    
-    /* prepare data */
-    if (data == NULL)
-        return FALSE;
-    memset(data, 0, sizeof(*data));
-    data->requestedMonitor = index;
-
-    /* query information */
-    _EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
-
-    /* cleanup */
-    FreeLibrary(user32);
-    return TRUE;
-}
 
 /*
  * Function prototypes
@@ -1220,24 +1172,3 @@ winLogVersionInfo (void)
   ErrorF ("%s\n\n", BUILDERSTRING);
   ErrorF ("Contact: %s\n", BUILDERADDR);
 }
-
-/*
- * getMonitorInfo - callback function used to return information from the enumeration of monitors attached
- */
-
-wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data) 
-{
-  struct GetMonitorInfoData* data = (struct GetMonitorInfoData*)_data;
-  // only get data for monitor number specified in <data>
-  data->monitorNum++;
-  if (data->monitorNum == data->requestedMonitor) 
-  {
-	data->bMonitorSpecifiedExists = TRUE;
-	data->monitorOffsetX = rect->left;
-	data->monitorOffsetY = rect->top;
-	data->monitorHeight  = rect->bottom - rect->top;
-	data->monitorWidth   = rect->right  - rect->left;
-    return FALSE;
-  }
-  return TRUE;
-}
commit 73b02e964787ea9fb2d139dc781c9b2495ccb031
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Fri Feb 12 12:29:30 2010 +0000

    Cygwin/X: Remove an attempt at detecting if WM_DISPLAYCHANGE affects the X screen
    
    Remove an attempt at the rather difficult optimization of detecting
    if WM_DISPLAYCHANGE affects any of the monitors which intersect the
    native window for the X screen.
    
    We'll always act as if it does, which it probably usually the case.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 8b7b699..ceb001c 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -481,11 +481,6 @@ typedef struct _winPrivScreenRec
   /* Handle to icons that must be freed */
   HICON			hiconNotifyIcon;
 
-  /* Last width, height, and depth of the Windows display */
-  DWORD			dwLastWindowsWidth;
-  DWORD			dwLastWindowsHeight;
-  DWORD			dwLastWindowsBitsPixel;
-
   /* Palette management */
   ColormapPtr		pcmapInstalled;
 
diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c
index 679b3fa..c3a1497 100644
--- a/hw/xwin/windialogs.c
+++ b/hw/xwin/windialogs.c
@@ -482,11 +482,11 @@ winChangeDepthDlgProc (HWND hwndDialog, UINT message,
 
 #if CYGDEBUG
       winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, "
-	      "last bpp: %d\n",
+	      "current bpp: %d\n",
 	      s_pScreenInfo->dwBPP,
-	      s_pScreenPriv->dwLastWindowsBitsPixel);
+              GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
 #endif
-      
+
       winInitDialog( hwndDialog );
 
       return TRUE;
@@ -494,14 +494,13 @@ winChangeDepthDlgProc (HWND hwndDialog, UINT message,
     case WM_DISPLAYCHANGE:
 #if CYGDEBUG
       winDebug ("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, "
-	      "last bpp: %d, new bpp: %d\n",
+	      "new bpp: %d\n",
 	      s_pScreenInfo->dwBPP,
-	      s_pScreenPriv->dwLastWindowsBitsPixel,
-	      wParam);
+              GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
 #endif
 
       /* Dismiss the dialog if the display returns to the original depth */
-      if (wParam == s_pScreenInfo->dwBPP)
+      if (GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL) == s_pScreenInfo->dwBPP)
 	{
 	  ErrorF ("winChangeDelthDlgProc - wParam == s_pScreenInfo->dwBPP\n");
 
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index 46f6693..74ca115 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -175,13 +175,9 @@ winScreenInit (int index,
   /* Get a device context */
   hdc = GetDC (pScreenPriv->hwndScreen);
 
-  /* Store the initial height, width, and depth of the display */
   /* Are we using multiple monitors? */
   if (pScreenInfo->fMultipleMonitors)
     {
-      pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
-      pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
-
       /* 
        * In this case, some of the defaults set in
        * winInitializeScreenDefaults() are not correct ...
@@ -192,14 +188,6 @@ winScreenInit (int index,
 	  pScreenInfo->dwHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
 	}
     }
-  else
-    {
-      pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN);
-      pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN);
-    }
-
-  /* Save the original bits per pixel */
-  pScreenPriv->dwLastWindowsBitsPixel = GetDeviceCaps (hdc, BITSPIXEL);
 
   /* Release the device context */
   ReleaseDC (pScreenPriv->hwndScreen, hdc);
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index 6d2270a..7983e9a 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -148,6 +148,13 @@ winWindowProc (HWND hwnd, UINT message,
       return 0;
 
     case WM_DISPLAYCHANGE:
+      /*
+        WM_DISPLAYCHANGE seems to be sent when the monitor layout or
+        any monitor's resolution or depth changes, but it's lParam and
+        wParam always indicate the resolution and bpp for the primary
+        monitor (so ignore that as we could be on any monitor...)
+       */
+
       /* We cannot handle a display mode change during initialization */
       if (s_pScreenInfo == NULL)
 	FatalError ("winWindowProc - WM_DISPLAYCHANGE - The display "
@@ -167,22 +174,10 @@ winWindowProc (HWND hwnd, UINT message,
 #endif
 	      ))
 	{
-	  /* 
-	   * Store the new display dimensions and depth.
-	   * We do this here for future compatibility in case we
-	   * ever allow switching from fullscreen to windowed mode.
-	   */
-	  s_pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN);
-	  s_pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN);
-	  s_pScreenPriv->dwLastWindowsBitsPixel
-	    = GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL);	  
 	  break;
 	}
-      
-      ErrorF ("winWindowProc - WM_DISPLAYCHANGE - orig bpp: %d, last bpp: %d, "
-	      "new bpp: %d\n",
-	      (int) s_pScreenInfo->dwBPP,
-	      (int) s_pScreenPriv->dwLastWindowsBitsPixel,
+
+      ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new bpp: %d\n",
 	      wParam);
 
       ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new width: %d "
@@ -216,7 +211,11 @@ winWindowProc (HWND hwnd, UINT message,
        * We can only display a message for a disruptive depth change,
        * we cannot do anything to correct the situation.
        */
-      if ((s_pScreenInfo->dwBPP != wParam)
+      /*
+        XXX: maybe we need to check if GetSystemMetrics(SM_SAMEDISPLAYFORMAT)
+        has changed as well...
+      */
+      if ((s_pScreenInfo->dwBPP != GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL))
 	  && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
 	      || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
 #ifdef XWIN_PRIMARYFB
@@ -227,7 +226,7 @@ winWindowProc (HWND hwnd, UINT message,
 	  /* Cannot display the visual until the depth is restored */
 	  ErrorF ("winWindowProc - Disruptive change in depth\n");
 
-	  /* Display Exit dialog */
+	  /* Display depth change dialog */
 	  winDisplayDepthChangeDialog (s_pScreenPriv);
 
 	  /* Flag that we have an invalid screen depth */
@@ -241,14 +240,19 @@ winWindowProc (HWND hwnd, UINT message,
 	  /* Flag that we have a valid screen depth */
 	  s_pScreenPriv->fBadDepth = FALSE;
 	}
-      
+
+      /*
+        If we could cheaply check if this WM_DISPLAYCHANGE change
+        affects the monitor(s) which this X screen is displayed on
+        then we should do so here.  For the moment, assume it does.
+        (this is probably usually the case so that might be an
+        overoptimization)
+      */
+
       /*
-       * Check for a change in display dimensions.
        * We can simply recreate the same-sized primary surface when
        * the display dimensions change.
        */
-      if (s_pScreenPriv->dwLastWindowsWidth != LOWORD (lParam)
-	  || s_pScreenPriv->dwLastWindowsHeight != HIWORD (lParam))
 	{
 	  /*
 	   * NOTE: The non-DirectDraw engines set the ReleasePrimarySurface
@@ -261,7 +265,7 @@ winWindowProc (HWND hwnd, UINT message,
 #if CYGDEBUG
 	  winDebug ("winWindowProc - WM_DISPLAYCHANGE - Dimensions changed\n");
 #endif
-	  
+
 	  /* Release the old primary surface */
 	  (*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen);
 
@@ -286,31 +290,7 @@ winWindowProc (HWND hwnd, UINT message,
 	    }
 #endif
 	}
-      else
-	{
-#if CYGDEBUG
-	  winDebug ("winWindowProc - WM_DISPLAYCHANGE - Dimensions did not "
-		  "change\n");
-#endif
-	}
 
-      /* Store the new display dimensions and depth */
-      if (s_pScreenInfo->fMultipleMonitors)
-	{
-	  s_pScreenPriv->dwLastWindowsWidth
-	    = GetSystemMetrics (SM_CXVIRTUALSCREEN);
-	  s_pScreenPriv->dwLastWindowsHeight
-	    = GetSystemMetrics (SM_CYVIRTUALSCREEN);
-	}
-      else
-	{
-	  s_pScreenPriv->dwLastWindowsWidth
-	    = GetSystemMetrics (SM_CXSCREEN);
-	  s_pScreenPriv->dwLastWindowsHeight
-	    = GetSystemMetrics (SM_CYSCREEN);
-	}
-      s_pScreenPriv->dwLastWindowsBitsPixel
-	= GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL);
       break;
 
     case WM_SIZE:
commit a46146af5f6c2d96728c43f0df369ea00bcae017
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Apr 1 21:00:43 2010 +0100

    Cygwin/X: Rather than storing calculated physical display sizes, calculate them when needed
    
    (This stored calculation was wrong if -dpi came after -screen on the command
    line, anyhow)
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 3c706c4..8b7b699 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -395,8 +395,6 @@ typedef struct
   DWORD			dwUserHeight;
   DWORD			dwWidth;
   DWORD			dwHeight;
-  DWORD			dwWidth_mm;
-  DWORD			dwHeight_mm;
   DWORD			dwPaddedWidth;
 
   /* Did the user specify a screen position? */
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index 1ce5c2d..c931696 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -174,8 +174,6 @@ winInitializeScreenDefaults(void)
   defaultScreenInfo.fScrollbars = FALSE;
   defaultScreenInfo.fNoTrayIcon = FALSE;
   defaultScreenInfo.iE3BTimeout = WIN_E3B_OFF;
-  defaultScreenInfo.dwWidth_mm = (dwWidth / WIN_DEFAULT_DPI) * 25.4;
-  defaultScreenInfo.dwHeight_mm = (dwHeight / WIN_DEFAULT_DPI) * 25.4;
   defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
   defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL;
   defaultScreenInfo.fIgnoreInput = FALSE;
@@ -500,17 +498,6 @@ ddxProcessArgument (int argc, char *argv[], int i)
 	  g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
 	}
 
-      /* Calculate the screen width and height in millimeters */
-      if (g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth)
-	{
-	  g_ScreenInfo[nScreenNum].dwWidth_mm
-	    = (g_ScreenInfo[nScreenNum].dwWidth
-	       / monitorResolution) * 25.4;
-	  g_ScreenInfo[nScreenNum].dwHeight_mm
-	    = (g_ScreenInfo[nScreenNum].dwHeight
-	       / monitorResolution) * 25.4;
-	}
-
       /* Flag that this screen was explicity specified by the user */
       g_ScreenInfo[nScreenNum].fExplicitScreen = TRUE;
 
diff --git a/hw/xwin/winrandr.c b/hw/xwin/winrandr.c
index 7b5b135..fd1d97e 100644
--- a/hw/xwin/winrandr.c
+++ b/hw/xwin/winrandr.c
@@ -86,8 +86,8 @@ winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations)
   pSize = RRRegisterSize (pScreen,
 			  pScreenInfo->dwWidth,
 			  pScreenInfo->dwHeight,
-			  pScreenInfo->dwWidth_mm,
-			  pScreenInfo->dwHeight_mm);
+                          (pScreenInfo->dwWidth / monitorResolution) * 25.4,
+                          (pScreenInfo->dwHeight / monitorResolution) * 25.4);
 
   /* Tell RandR what the current config is */
   RRSetCurrentConfig (pScreen,
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index bf6181a..46f6693 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -190,10 +190,6 @@ winScreenInit (int index,
 	{
 	  pScreenInfo->dwWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
 	  pScreenInfo->dwHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
-	  pScreenInfo->dwWidth_mm = (pScreenInfo->dwWidth /
-				     WIN_DEFAULT_DPI) * 25.4;
-	  pScreenInfo->dwHeight_mm = (pScreenInfo->dwHeight /
-				      WIN_DEFAULT_DPI) * 25.4;
 	}
     }
   else
commit df518001271dbc0c49935350b755f0c0562cdb92
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Oct 13 14:47:33 2009 +0100

    Cygwin/X: Refactor framebuffer allocation/release in drawing engines
    
    Refactor the drawing engines so we can explicitly allocate and release the framebuffer for a screen
    
    Move the setting of dwPaddedWidth into the DDNL engine, so it is updated when the framebuffer changes size
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 6ac48c5..3c706c4 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -276,8 +276,12 @@ static Atom func (void) {					\
 
 typedef Bool (*winAllocateFBProcPtr)(ScreenPtr);
 
+typedef void (*winFreeFBProcPtr)(ScreenPtr);
+
 typedef void (*winShadowUpdateProcPtr)(ScreenPtr, shadowBufPtr);
 
+typedef Bool (*winInitScreenProcPtr)(ScreenPtr);
+
 typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr);
 
 typedef Bool (*winInitVisualsProcPtr)(ScreenPtr);
@@ -549,7 +553,9 @@ typedef struct _winPrivScreenRec
   
   /* Engine specific functions */
   winAllocateFBProcPtr			pwinAllocateFB;
+  winFreeFBProcPtr			pwinFreeFB;
   winShadowUpdateProcPtr		pwinShadowUpdate;
+  winInitScreenProcPtr			pwinInitScreen;
   winCloseScreenProcPtr			pwinCloseScreen;
   winInitVisualsProcPtr			pwinInitVisuals;
   winAdjustVideoModeProcPtr		pwinAdjustVideoMode;
diff --git a/hw/xwin/winnativegdi.c b/hw/xwin/winnativegdi.c
index b8d2d35..b0a551a 100644
--- a/hw/xwin/winnativegdi.c
+++ b/hw/xwin/winnativegdi.c
@@ -92,6 +92,18 @@ winAllocateFBNativeGDI (ScreenPtr pScreen)
   return TRUE;
 }
 
+static void
+winFreeFBNativeGDI (ScreenPtr pScreen)
+{
+  FatalError ("winFreeFBNativeGDI\n");
+}
+
+
+static Bool
+winInitScreenNativeGDI(ScreenPtr pScreen)
+{
+  FatalError ("winInitScreenNativeGDI\n");
+}
 
 /*
  * We wrap whatever CloseScreen procedure was specified by fb;
@@ -506,7 +518,9 @@ winSetEngineFunctionsNativeGDI (ScreenPtr pScreen)
   
   /* Set our pointers */
   pScreenPriv->pwinAllocateFB = winAllocateFBNativeGDI;
+  pScreenPriv->pwinFreeFB = winFreeFBNativeGDI;
   pScreenPriv->pwinShadowUpdate = winShadowUpdateNativeGDI;
+  pScreenPriv->pwinInitScreen = winInitScreenNativeGDI;
   pScreenPriv->pwinCloseScreen = winCloseScreenNativeGDI;
   pScreenPriv->pwinInitVisuals = winInitVisualsNativeGDI;
   pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeNativeGDI;
diff --git a/hw/xwin/winpfbdd.c b/hw/xwin/winpfbdd.c
index 8251a37..4145717 100644
--- a/hw/xwin/winpfbdd.c
+++ b/hw/xwin/winpfbdd.c
@@ -233,6 +233,45 @@ winAllocateFBPrimaryDD (ScreenPtr pScreen)
   return TRUE;
 }
 
+static void
+winFreeFBPrimaryDD (ScreenPtr pScreen)
+{
+  winScreenPriv(pScreen);
+  winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+  /* Free the offscreen surface, if there is one */
+  if (pScreenPriv->pddsOffscreen)
+    {
+      IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen, NULL);
+      IDirectDrawSurface2_Release (pScreenPriv->pddsOffscreen);
+      pScreenPriv->pddsOffscreen = NULL;
+    }
+
+  /* Release the primary surface, if there is one */
+  if (pScreenPriv->pddsPrimary)
+    {
+      IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary, NULL);
+      IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary);
+      pScreenPriv->pddsPrimary = NULL;
+    }
+
+  /* Free the DirectDraw object, if there is one */
+  if (pScreenPriv->pdd)
+    {
+      IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd);
+      IDirectDraw2_Release (pScreenPriv->pdd);
+      pScreenPriv->pdd = NULL;
+    }
+
+  /* Invalidate the ScreenInfo's fb pointer */
+  pScreenInfo->pfb = NULL;
+}
+
+static Bool
+winInitScreenPrimaryDD(ScreenPtr pScreen)
+{
+  return winAllocateFBPrimaryDD(pScreen);
+}
 
 /*
  * Call the wrapped CloseScreen function.
@@ -260,29 +299,7 @@ winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen)
   /* Delete the window property */
   RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
 
-  /* Free the offscreen surface, if there is one */
-  if (pScreenPriv->pddsOffscreen)
-    {
-      IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen, NULL);
-      IDirectDrawSurface2_Release (pScreenPriv->pddsOffscreen);
-      pScreenPriv->pddsOffscreen = NULL;
-    }
-
-  /* Release the primary surface, if there is one */
-  if (pScreenPriv->pddsPrimary)
-    {
-      IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary, NULL);
-      IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary);
-      pScreenPriv->pddsPrimary = NULL;
-    }
-
-  /* Free the DirectDraw object, if there is one */
-  if (pScreenPriv->pdd)
-    {
-      IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd);
-      IDirectDraw2_Release (pScreenPriv->pdd);
-      pScreenPriv->pdd = NULL;
-    }
+  winFreeFBPrimaryDD(pScreen);
 
   /* Delete tray icon, if we have one */
   if (!pScreenInfo->fNoTrayIcon)
@@ -305,9 +322,6 @@ winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen)
   /* Kill our screeninfo's pointer to the screen */
   pScreenInfo->pScreen = NULL;
 
-  /* Invalidate the ScreenInfo's fb pointer */
-  pScreenInfo->pfb = NULL;
-
   /* Free the screen privates for this screen */
   free ((pointer) pScreenPriv);
 
@@ -653,8 +667,9 @@ winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen)
   
   /* Set our pointers */
   pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD;
-  pScreenPriv->pwinShadowUpdate
-    = (winShadowUpdateProcPtr) (void (*)(void))NoopDDA;
+  pScreenPriv->pwinFreeFB = winFreeFBPrimaryDD;
+  pScreenPriv->pwinShadowUpdate = (winShadowUpdateProcPtr) (void (*)(void))NoopDDA;
+  pScreenPriv->pwinInitScreen = winInitScreenPrimaryDD;
   pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD;
   pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD;
   pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD;
@@ -663,8 +678,7 @@ winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen)
   else
     pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
   pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
-  pScreenPriv->pwinBltExposedRegions
-    = (winBltExposedRegionsProcPtr) (void (*)(void))NoopDDA;
+  pScreenPriv->pwinBltExposedRegions = (winBltExposedRegionsProcPtr) (void (*)(void))NoopDDA;
   pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD;
   pScreenPriv->pwinRedrawScreen = NULL;
   pScreenPriv->pwinRealizeInstalledPalette = NULL;
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index 21036f4..bf6181a 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -210,10 +210,6 @@ winScreenInit (int index,
     
   /* Clear the visuals list */
   miClearVisualTypes ();
-  
-  /* Set the padded screen width */
-  pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth,
-					      pScreenInfo->dwBPP);
 
   /* Call the engine dependent screen initialization procedure */
   if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv)))
@@ -279,7 +275,7 @@ winFinishScreenInitFB (int index,
 #endif
 
   /* Create framebuffer */
-  if (!(*pScreenPriv->pwinAllocateFB) (pScreen))
+  if (!(*pScreenPriv->pwinInitScreen) (pScreen))
     {
       ErrorF ("winFinishScreenInitFB - Could not allocate framebuffer\n");
       return FALSE;
diff --git a/hw/xwin/winshaddd.c b/hw/xwin/winshaddd.c
index 4e284b9..45d1548 100644
--- a/hw/xwin/winshaddd.c
+++ b/hw/xwin/winshaddd.c
@@ -239,9 +239,6 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
   winDebug ("winAllocateFBShadowDD - Created a clipper\n");
 #endif
 
-  /* Get a device context for the screen  */
-  pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
-
   /* Attach the clipper to our display window */
   ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary,
 				       0,
@@ -503,6 +500,57 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
   return TRUE;
 }
 
+static void
+winFreeFBShadowDD (ScreenPtr pScreen)
+{
+  winScreenPriv(pScreen);
+  winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+  /* Free the shadow surface, if there is one */
+  if (pScreenPriv->pddsShadow)
+    {
+      IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL);
+      IDirectDrawSurface2_Release (pScreenPriv->pddsShadow);
+      pScreenPriv->pddsShadow = NULL;
+    }
+
+  /* Detach the clipper from the primary surface and release the clipper. */
+  if (pScreenPriv->pddcPrimary)
+    {
+      /* Detach the clipper */
+      IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary,
+				      NULL);
+
+      /* Release the clipper object */
+      IDirectDrawClipper_Release (pScreenPriv->pddcPrimary);
+      pScreenPriv->pddcPrimary = NULL;
+    }
+
+  /* Release the primary surface, if there is one */
+  if (pScreenPriv->pddsPrimary)
+    {
+      IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary);
+      pScreenPriv->pddsPrimary = NULL;
+    }
+
+  /* Free the DirectDraw2 object, if there is one */
+  if (pScreenPriv->pdd2)
+    {
+      IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd2);
+      IDirectDraw2_Release (pScreenPriv->pdd2);
+      pScreenPriv->pdd2 = NULL;
+    }
+
+  /* Free the DirectDraw object, if there is one */
+  if (pScreenPriv->pdd)
+    {
+      IDirectDraw_Release (pScreenPriv->pdd);
+      pScreenPriv->pdd = NULL;
+    }
+
+  /* Invalidate the ScreenInfo's fb pointer */
+  pScreenInfo->pfb = NULL;
+}
 
 /*
  * Transfer the damaged regions of the shadow framebuffer to the display.
@@ -666,6 +714,16 @@ winShadowUpdateDD (ScreenPtr pScreen,
     }
 }
 
+static Bool
+winInitScreenShadowDD (ScreenPtr pScreen)
+{
+  winScreenPriv(pScreen);
+
+  /* Get a device context for the screen  */
+  pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
+
+  return winAllocateFBShadowDD(pScreen);
+}
 
 /*
  * Call the wrapped CloseScreen function.
@@ -692,58 +750,18 @@ winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen)
   WIN_UNWRAP(CloseScreen);
   fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
 
+  winFreeFBShadowDD(pScreen);
+
   /* Free the screen DC */
   ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
 
   /* Delete the window property */
   RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
 
-  /* Free the shadow surface, if there is one */
-  if (pScreenPriv->pddsShadow)
-    {
-      IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL);
-      IDirectDrawSurface2_Release (pScreenPriv->pddsShadow);
-      pScreenPriv->pddsShadow = NULL;
-    }
-
-  /* Detach the clipper from the primary surface and release the clipper. */
-  if (pScreenPriv->pddcPrimary)
-    {
-      /* Detach the clipper */
-      IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary,
-				      NULL);
-
-      /* Release the clipper object */
-      IDirectDrawClipper_Release (pScreenPriv->pddcPrimary);
-      pScreenPriv->pddcPrimary = NULL;
-    }
-
-  /* Release the primary surface, if there is one */
-  if (pScreenPriv->pddsPrimary)
-    {
-      IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary);
-      pScreenPriv->pddsPrimary = NULL;
-    }
-
-  /* Free the DirectDraw2 object, if there is one */
-  if (pScreenPriv->pdd2)
-    {
-      IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd2);
-      IDirectDraw2_Release (pScreenPriv->pdd2);
-      pScreenPriv->pdd2 = NULL;
-    }
-
-  /* Free the DirectDraw object, if there is one */
-  if (pScreenPriv->pdd)
-    {
-      IDirectDraw_Release (pScreenPriv->pdd);
-      pScreenPriv->pdd = NULL;
-    }
-
   /* Delete tray icon, if we have one */
   if (!pScreenInfo->fNoTrayIcon)
     winDeleteNotifyIcon (pScreenPriv);
-  
+
   /* Free the exit confirmation dialog box, if it exists */
   if (g_hDlgExit != NULL)
     {
@@ -766,9 +784,6 @@ winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen)
   /* Kill our screeninfo's pointer to the screen */
   pScreenInfo->pScreen = NULL;
 
-  /* Invalidate the ScreenInfo's fb pointer */
-  pScreenInfo->pfb = NULL;
-
   /* Free the screen privates for this screen */
   free ((pointer) pScreenPriv);
 
@@ -1370,7 +1385,9 @@ winSetEngineFunctionsShadowDD (ScreenPtr pScreen)
   
   /* Set our pointers */
   pScreenPriv->pwinAllocateFB = winAllocateFBShadowDD;
+  pScreenPriv->pwinFreeFB = winFreeFBShadowDD;
   pScreenPriv->pwinShadowUpdate = winShadowUpdateDD;
+  pScreenPriv->pwinInitScreen = winInitScreenShadowDD;
   pScreenPriv->pwinCloseScreen = winCloseScreenShadowDD;
   pScreenPriv->pwinInitVisuals = winInitVisualsShadowDD;
   pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDD;
diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c
index 82fe4be..dd2e9b5 100644
--- a/hw/xwin/winshadddnl.c
+++ b/hw/xwin/winshadddnl.c
@@ -237,6 +237,10 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
 	  pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth);
 #endif
 
+  /* Set the padded screen width */
+  pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth,
+					      pScreenInfo->dwBPP);
+
   /* Allocate memory for our shadow surface */
   lpSurface = malloc (pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight);
   if (lpSurface == NULL)
@@ -266,9 +270,6 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
   winDebug ("winAllocateFBShadowDDNL - Created a clipper\n");
 #endif
 
-  /* Get a device context for the screen  */
-  pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
-
   /* Attach the clipper to our display window */
   ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary,
 				       0,
@@ -530,6 +531,58 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
   return TRUE;
 }
 
+static void
+winFreeFBShadowDDNL(ScreenPtr pScreen)
+{
+  winScreenPriv(pScreen);
+  winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+  /* Free the shadow surface, if there is one */
+  if (pScreenPriv->pddsShadow4)
+    {
+      IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4);
+      free (pScreenInfo->pfb);
+      pScreenInfo->pfb = NULL;
+      pScreenPriv->pddsShadow4 = NULL;
+    }
+
+  /* Detach the clipper from the primary surface and release the clipper. */
+  if (pScreenPriv->pddcPrimary)
+    {
+      /* Detach the clipper */
+      IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4,
+				      NULL);
+
+      /* Release the clipper object */
+      IDirectDrawClipper_Release (pScreenPriv->pddcPrimary);
+      pScreenPriv->pddcPrimary = NULL;
+    }
+
+  /* Release the primary surface, if there is one */
+  if (pScreenPriv->pddsPrimary4)
+    {
+      IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4);
+      pScreenPriv->pddsPrimary4 = NULL;
+    }
+
+  /* Free the DirectDraw4 object, if there is one */
+  if (pScreenPriv->pdd4)
+    {
+      IDirectDraw4_RestoreDisplayMode (pScreenPriv->pdd4);
+      IDirectDraw4_Release (pScreenPriv->pdd4);
+      pScreenPriv->pdd4 = NULL;
+    }
+
+  /* Free the DirectDraw object, if there is one */
+  if (pScreenPriv->pdd)
+    {
+      IDirectDraw_Release (pScreenPriv->pdd);
+      pScreenPriv->pdd = NULL;
+    }
+
+  /* Invalidate the ScreenInfo's fb pointer */
+  pScreenInfo->pfb = NULL;
+}
 
 #if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
 /*
@@ -720,6 +773,16 @@ winShadowUpdateDDNL (ScreenPtr pScreen,
     }
 }
 
+static Bool
+winInitScreenShadowDDNL(ScreenPtr pScreen)
+{
+  winScreenPriv(pScreen);
+
+  /* Get a device context for the screen  */
+  pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
+
+  return winAllocateFBShadowDDNL(pScreen);
+}
 
 /*
  * Call the wrapped CloseScreen function.
@@ -746,55 +809,14 @@ winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen)
   WIN_UNWRAP(CloseScreen);
   fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
 
+  winFreeFBShadowDDNL(pScreen);
+
   /* Free the screen DC */
   ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
 
   /* Delete the window property */
   RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
 
-  /* Free the shadow surface, if there is one */
-  if (pScreenPriv->pddsShadow4)
-    {
-      IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4);
-      free (pScreenInfo->pfb);
-      pScreenInfo->pfb = NULL;
-      pScreenPriv->pddsShadow4 = NULL;
-    }
-
-  /* Detach the clipper from the primary surface and release the clipper. */
-  if (pScreenPriv->pddcPrimary)
-    {
-      /* Detach the clipper */
-      IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4,
-				      NULL);
-
-      /* Release the clipper object */
-      IDirectDrawClipper_Release (pScreenPriv->pddcPrimary);
-      pScreenPriv->pddcPrimary = NULL;
-    }
-
-  /* Release the primary surface, if there is one */
-  if (pScreenPriv->pddsPrimary4)
-    {
-      IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4);
-      pScreenPriv->pddsPrimary4 = NULL;
-    }
-
-  /* Free the DirectDraw4 object, if there is one */
-  if (pScreenPriv->pdd4)
-    {
-      IDirectDraw4_RestoreDisplayMode (pScreenPriv->pdd4);
-      IDirectDraw4_Release (pScreenPriv->pdd4);
-      pScreenPriv->pdd4 = NULL;
-    }
-
-  /* Free the DirectDraw object, if there is one */
-  if (pScreenPriv->pdd)
-    {
-      IDirectDraw_Release (pScreenPriv->pdd);
-      pScreenPriv->pdd = NULL;
-    }
-
   /* Delete tray icon, if we have one */
   if (!pScreenInfo->fNoTrayIcon)
     winDeleteNotifyIcon (pScreenPriv);
@@ -821,9 +843,6 @@ winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen)
   /* Kill our screeninfo's pointer to the screen */
   pScreenInfo->pScreen = NULL;
 
-  /* Invalidate the ScreenInfo's fb pointer */
-  pScreenInfo->pfb = NULL;
-
   /* Free the screen privates for this screen */
   free ((pointer) pScreenPriv);
 
@@ -1382,7 +1401,9 @@ winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen)
   
   /* Set our pointers */
   pScreenPriv->pwinAllocateFB = winAllocateFBShadowDDNL;
+  pScreenPriv->pwinFreeFB = winFreeFBShadowDDNL;
   pScreenPriv->pwinShadowUpdate = winShadowUpdateDDNL;
+  pScreenPriv->pwinInitScreen = winInitScreenShadowDDNL;
   pScreenPriv->pwinCloseScreen = winCloseScreenShadowDDNL;
   pScreenPriv->pwinInitVisuals = winInitVisualsShadowDDNL;
   pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDDNL;
diff --git a/hw/xwin/winshadgdi.c b/hw/xwin/winshadgdi.c
index 4971851..a165d80 100644
--- a/hw/xwin/winshadgdi.c
+++ b/hw/xwin/winshadgdi.c
@@ -342,10 +342,6 @@ winAllocateFBShadowGDI (ScreenPtr pScreen)
   DIBSECTION		dibsection;
   Bool			fReturn = TRUE;
 
-  /* Get device contexts for the screen and shadow bitmap */
-  pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
-  pScreenPriv->hdcShadow = CreateCompatibleDC (pScreenPriv->hdcScreen);
-
   /* Allocate bitmap info header */
   pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER)
 				      + 256 * sizeof (RGBQUAD));
@@ -477,6 +473,18 @@ winAllocateFBShadowGDI (ScreenPtr pScreen)
   return fReturn;
 }
 
+static void
+winFreeFBShadowGDI (ScreenPtr pScreen)
+{
+  winScreenPriv(pScreen);
+  winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+  /* Free the shadow bitmap */
+  DeleteObject (pScreenPriv->hbmpShadow);
+
+  /* Invalidate the ScreenInfo's fb pointer */
+  pScreenInfo->pfb = NULL;
+}
 
 /*
  * Blit the damaged regions of the shadow fb to the screen
@@ -602,6 +610,18 @@ winShadowUpdateGDI (ScreenPtr pScreen,
 }
 
 
+static Bool
+winInitScreenShadowGDI (ScreenPtr pScreen)
+{
+  winScreenPriv(pScreen);
+
+  /* Get device contexts for the screen and shadow bitmap */
+  pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
+  pScreenPriv->hdcShadow = CreateCompatibleDC (pScreenPriv->hdcScreen);
+
+  return winAllocateFBShadowGDI(pScreen);
+}
+
 /* See Porting Layer Definition - p. 33 */
 /*
  * We wrap whatever CloseScreen procedure was specified by fb;
@@ -632,9 +652,8 @@ winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen)
 
   /* Free the shadow DC; which allows the bitmap to be freed */
   DeleteDC (pScreenPriv->hdcShadow);
-  
-  /* Free the shadow bitmap */
-  DeleteObject (pScreenPriv->hbmpShadow);
+
+  winFreeFBShadowGDI(pScreen);
 
   /* Free the screen DC */
   ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
@@ -665,9 +684,6 @@ winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen)
   /* Invalidate our screeninfo's pointer to the screen */
   pScreenInfo->pScreen = NULL;
 
-  /* Invalidate the ScreenInfo's fb pointer */
-  pScreenInfo->pfb = NULL;
-
   /* Free the screen privates for this screen */
   free ((pointer) pScreenPriv);
 
@@ -1235,7 +1251,9 @@ winSetEngineFunctionsShadowGDI (ScreenPtr pScreen)
   
   /* Set our pointers */
   pScreenPriv->pwinAllocateFB = winAllocateFBShadowGDI;
+  pScreenPriv->pwinFreeFB = winFreeFBShadowGDI;
   pScreenPriv->pwinShadowUpdate = winShadowUpdateGDI;
+  pScreenPriv->pwinInitScreen = winInitScreenShadowGDI;
   pScreenPriv->pwinCloseScreen = winCloseScreenShadowGDI;
   pScreenPriv->pwinInitVisuals = winInitVisualsShadowGDI;
   pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowGDI;
commit 708d0b9781c6f3f0c0ae7052f45223b1c2524809
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Oct 13 14:48:17 2009 +0100

    Cygwin/X: Enable building of nativegdi and primaryfb engines to avoid further rusting
    
    Some trivial build fixes required
    
    Also fill out all function pointers for primaryfb engine
    
    Also tidy up the man page section describing drawing engines.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/configure.ac b/configure.ac
index 45286ea..120321e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1903,8 +1903,8 @@ AM_CONDITIONAL(XWIN_MULTIWINDOW, [test "x$XWIN" = xyes])
 AM_CONDITIONAL(XWIN_MULTIWINDOWEXTWM, [test "x$XWIN" = xyes && test "x$WINDOWSWM" = xyes])
 AM_CONDITIONAL(XWIN_CLIPBOARD, [test "x$XWIN" = xyes])
 AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && false])
-AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes && false])
-AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes && false])
+AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes])
+AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes])
 AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes])
 AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes])
 
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 38a658d..bf04cf1 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -755,6 +755,9 @@ winUseMsg (void)
 	  "\t\t1 - Shadow GDI\n"
 	  "\t\t2 - Shadow DirectDraw\n"
 	  "\t\t4 - Shadow DirectDraw4 Non-Locking\n"
+#ifdef XWIN_PRIMARYFB
+	  "\t\t8 - Primary DirectDraw - obsolete\n"
+#endif
 #ifdef XWIN_NATIVEGDI
 	  "\t\t16 - Native GDI - experimental\n"
 #endif
diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man
index 51268f6..76abdca 100644
--- a/hw/xwin/man/XWin.man
+++ b/hw/xwin/man/XWin.man
@@ -190,15 +190,27 @@ respectively).
 .TP 8
 .B "\-engine \fIengine_type_id\fP"
 This option, which is intended for Cygwin/X developers,
-overrides the server's automatically selected engine type.  This
-parameter will be ignored if the specified engine type is not
-supported on the current system.  The supported engine type ids are 1
-- Shadow GDI, 2 - Shadow DirectDraw, and 4 - Shadow DirectDraw Non-Locking.
-Additionally, there are engines with type ids
-8 - Primary DirectDraw (obsolete) and 16 - Native GDI (experimental and barely functional).
-Default behavior is to determine the engine with optimum performance that
+overrides the server's automatically selected drawing engine type.  This
+parameter will be ignored if the specified drawing engine type is not
+supported on the current system.
+
+Default behavior is to select the drawing engine with optimum performance that
 supports the specified depth and window configuration.
 
+The engine type ids are:
+.RS
+.IP 1 4
+Shadow GDI
+.IP 2 4
+Shadow DirectDraw
+.IP 4 4
+Shadow DirectDraw Non-Locking
+.IP 8 4
+Primary DirectDraw (unsupported, obsolete)
+.IP 16 4
+Native GDI (unsupported, experimental and barely functional)
+.RE
+
 .SH FULLSCREEN OPTIONS
 .TP 8
 .B "\-depth \fIdepth\fP"
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 4430781..6ac48c5 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -315,6 +315,12 @@ typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin);
 
 typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr);
 
+#ifdef XWIN_NATIVEGDI
+/* Typedefs for native GDI wrappers */
+typedef Bool (*RealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont);
+typedef Bool (*UnrealizeFontPtr)(ScreenPtr pScreen, FontPtr pFont);
+#endif
+
 
 /*
  * GC (graphics context) privates
@@ -588,6 +594,12 @@ typedef struct _winPrivScreenRec
   SetShapeProcPtr			SetShape;
 
   winCursorRec                          cursor;
+
+#ifdef XWIN_NATIVEGDI
+  RealizeFontPtr                        RealizeFont;
+  UnrealizeFontPtr                      UnrealizeFont;
+#endif
+
 } winPrivScreenRec;
 
 
diff --git a/hw/xwin/winpfbdd.c b/hw/xwin/winpfbdd.c
index 7859c6b..8251a37 100644
--- a/hw/xwin/winpfbdd.c
+++ b/hw/xwin/winpfbdd.c
@@ -666,7 +666,15 @@ winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen)
   pScreenPriv->pwinBltExposedRegions
     = (winBltExposedRegionsProcPtr) (void (*)(void))NoopDDA;
   pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD;
+  pScreenPriv->pwinRedrawScreen = NULL;
+  pScreenPriv->pwinRealizeInstalledPalette = NULL;
+  pScreenPriv->pwinInstallColormap = NULL;
+  pScreenPriv->pwinStoreColors = NULL;
+  pScreenPriv->pwinCreateColormap = NULL;
+  pScreenPriv->pwinDestroyColormap = NULL;
   pScreenPriv->pwinHotKeyAltTab = winHotKeyAltTabPrimaryDD;
+  pScreenPriv->pwinCreatePrimarySurface = (winCreatePrimarySurfaceProcPtr) (void (*)(void))NoopDDA;
+  pScreenPriv->pwinReleasePrimarySurface = (winReleasePrimarySurfaceProcPtr) (void (*)(void))NoopDDA;
 #ifdef XWIN_MULTIWINDOW
   pScreenPriv->pwinFinishCreateWindowsWindow =
     (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA;
diff --git a/hw/xwin/winwindow.c b/hw/xwin/winwindow.c
index 783760f..7975d71 100644
--- a/hw/xwin/winwindow.c
+++ b/hw/xwin/winwindow.c
@@ -58,6 +58,7 @@ winReshapeRootless (WindowPtr pWin);
 Bool
 winCreateWindowNativeGDI (WindowPtr pWin)
 {
+  Bool			fResult = TRUE;
   ScreenPtr		pScreen = pWin->drawable.pScreen;
   winWindowPriv(pWin);
   winScreenPriv(pScreen);
commit c6aa4755ec355101a62bef86dbb090262fe806f6
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Jan 15 12:13:39 2011 -0800

    xkb/ddxLoad.c doesn't need <paths.h> any more
    
    Was previously used for _PATH_VARTMP, but that was removed in
    534fc5140b039a8c98ab715d0a6740d513b41209
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index e6904a5..51b5777 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -45,10 +45,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <X11/extensions/XI.h>
 #include "xkb.h"
 
-#if defined(CSRG_BASED) || defined(linux) || defined(__GNU__)
-#include <paths.h>
-#endif
-
 	/*
 	 * If XKM_OUTPUT_DIR specifies a path without a leading slash, it is
 	 * relative to the top-level XKB configuration directory.
commit abfea17342da774aa4e3a351a73c8f2af6e6fd28
Merge: 3611283... e65c3f8...
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Jan 18 15:19:34 2011 -0800

    Merge remote branch 'ajax/for-keithp'

commit 361128389e5cb0101cbd091ff8de77cf34608f6c
Merge: 65ceaad... d9225b9...
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Jan 18 15:18:08 2011 -0800

    Merge remote branch 'jcristau/for-keith'

commit 65ceaadbf0fb65f1962cb96d5b87fd1175f85a3b
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:28:31 2011 -0500

    Xquartz: rename man page directory from doc to man
    
    Following the convention makes it easier to locate man pages,
    user's or developer's documentation and specifications.
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 41d6e66..45286ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2256,7 +2256,7 @@ hw/xwin/man/Makefile
 hw/xquartz/Makefile
 hw/xquartz/GL/Makefile
 hw/xquartz/bundle/Makefile
-hw/xquartz/doc/Makefile
+hw/xquartz/man/Makefile
 hw/xquartz/mach-startup/Makefile
 hw/xquartz/pbproxy/Makefile
 hw/xquartz/xpr/Makefile
diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 96b1fb0..61b04e0 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -14,9 +14,9 @@ if GLX
 GL_DIR = GL
 endif
 
-SUBDIRS = bundle . $(GL_DIR) xpr pbproxy mach-startup doc
+SUBDIRS = bundle . $(GL_DIR) xpr pbproxy mach-startup man
 
-DIST_SUBDIRS = bundle . GL xpr pbproxy mach-startup doc
+DIST_SUBDIRS = bundle . GL xpr pbproxy mach-startup man
 
 libXquartz_la_SOURCES = \
 	$(top_srcdir)/fb/fbcmap_mi.c \
diff --git a/hw/xquartz/doc/Makefile.am b/hw/xquartz/doc/Makefile.am
deleted file mode 100644
index 5a0cde7..0000000
--- a/hw/xquartz/doc/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-include $(top_srcdir)/manpages.am
-appman_PRE = Xquartz.man
diff --git a/hw/xquartz/doc/Xquartz.man b/hw/xquartz/doc/Xquartz.man
deleted file mode 100644
index 4471947..0000000
--- a/hw/xquartz/doc/Xquartz.man
+++ /dev/null
@@ -1,162 +0,0 @@
-.TH XQUARTZ 1 __vendorversion__
-.SH NAME
-Xquartz \- X window system server for Mac OSX
-.SH SYNOPSIS
-.B Xquartz
-[ options ] ...
-.SH DESCRIPTION
-.I Xquartz
-is the X window server for Mac OS X provided by Apple.
-.I Xquartz
-runs in parallel with Aqua in rootless mode. In rootless mode, the X
-window system and Mac OS X share your display.  The root window of the
-X11 display is the size of the screen and contains all the other
-windows. The X11 root window is not displayed in rootless mode as Mac
-OS X handles the desktop background.
-.SH CUSTOMIZATION
-\fIXquartz\fP can be customized using the defaults(1) command. The available options are:
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 enable_fake_buttons -boolean true
-Emulates a 3 button mouse using modifier keys. By default, the Command modifier
-is used to emulate button 2 and Option is used for button 3. Thus, clicking the
-first mouse button while holding down Command will act like clicking
-button 2. Holding down Option will simulate button 3.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 fake_button2 \fImodifiers\fP
-Change the modifier keys used to emulate the second mouse button. By default,
-Command is used to emulate the second button. Any combination of the following
-modifier names may be used: {l,r,}shift, {l,r,}option, {l,r,}control, {l,r,}command, fn
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 fake_button3 \fImodifiers\fP
-Change the modifier keys used to emulate the second mouse button. By default,
-Command is used to emulate the second button. Any combination of the following
-modifier names may be used: {l,r,}shift, {l,r,}option, {l,r,}control, {l,r,}command, fn
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 fullscreen_hotkeys -boolean true
-Enable OSX hotkeys while in fullscreen
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 fullscreen_menu -boolean true
-Show the OSX menu while in fullscreen
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 no_quit_alert -boolean true
-Disables the alert dialog displayed when attempting to quit X11.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 no_auth -boolean true
-Stops the X server requiring that clients authenticate themselves when
-connecting.  See Xsecurity(__miscmansuffix__).
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 nolisten_tcp -boolean false
-This will tell the server to listen and accept TCP connections.  Doing this without enabling
-xauth is a possible security concern.  See Xsecurity(__miscmansuffix__).
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 enable_system_beep -boolean false
-Don't use the standard system beep effect for X11 alerts.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 enable_key_equivalents -boolean false
-Disable menu keyboard equivalents while X11 windows are focused.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 depth \fIdepth\fP
-Specifies the color bit depth to use. Currently only 15, and 24 color
-bits per pixel are supported. If not specified, or a value of -1 is specified,
-defaults to the depth of the main display.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 sync_keymap -boolean true
-Keep the X11 keymap up to date with the OSX system keymap.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 option_sends_alt -boolean true
-The Option key will send Alt_L and Alt_R instead of Mode_switch.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard -boolean true
-Enable syncing between the OSX pasteboard and clipboard/primary selection buffers in X11.  This option needs to be true for any of the other pasteboard sync options to have an effect.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard_to_clipboard -boolean true
-Update the X11 CLIPBOARD when the OSX NSPasteboard is updated.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard_to_primary -boolean true
-Update the the X11 PRIMARY buffer when the OSX NSPasteboard is updated.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 sync_clipboard_to_pasteboard -boolean true
-Update the the OSX NSPasteboard when the X11 CLIPBOARD is updated.  Note that enabling this option causes the clipboard synchronization to act as a clipboard manager in X11.  This makes it impossible to use xclipboard, klipper, or any other such clipboard managers.  If you want to use any of these programs, you must disable this option.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 sync_primary_on_select -boolean true
-This option defaults to false and is provided only "for experts."  It updates the NSPasteboard whenever a new X11 selection is made (rather than requiring you to hit cmd-c to copy the selection to the NSPasteboard).  Since the X11 protocol does not require applications to send notification when they change selection, this might not work in all cases (if you run into this problem, try selecting text in another application first, then selecting the text you want).
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 enable_test_extensions -boolean true
-This option defaults to false and is only accessible through the command line.  Enable this option to turn on the DEC-XTRAP, RECORD, and XTEST extensions in the server.
-.SH OPTIONS
-.PP
-In addition to the normal server options described in the \fIXserver(1)\fP
-manual page, \fIXquartz\fP accepts the following command line switches:
-.TP 8
-.B \-fakebuttons
-Same as enable_fake_buttons above with value true.
-.TP 8
-.B \-nofakebuttons
-Same as enable_fake_buttons above with value false.
-.TP 8
-.B "\-fakemouse2 \fImodifiers\fP"
-Same as fake_button2 above.
-.TP 8
-.B "\-fakemouse3 \fImodifiers\fP"
-Same as fake_button3 above.
-.TP 8
-.B "\-depth \fIdepth\fP"
-Same as depth above.
-.SH "SEE ALSO"
-.PP
-X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1)
-.PP
-http://xquartz.macosforge.org
-.PP
-.SH AUTHORS / HISTORY
-X11 was originally ported to Mac OS X Server by John Carmack.  Dave
-Zarzycki used this as the basis of his port of XFree86 4.0 to Darwin 1.0.
-Torrey T. Lyons improved and integrated this code into the XFree86
-Project's mainline for the 4.0.2 release.
-.PP
-The following members of the XonX Team contributed to the following
-releases (in alphabetical order):
-.TP 4
-XFree86 4.1.0:
-.br
-Rob Braun - Darwin x86 support
-.br
-Torrey T. Lyons - Project Lead
-.br
-Andreas Monitzer - Cocoa version of XDarwin front end
-.br
-Gregory Robert Parker - Original Quartz implementation
-.br
-Christoph Pfisterer - Dynamic shared X libraries
-.br
-Toshimitsu Tanaka - Japanese localization
-.TP 4
-XFree86 4.2.0:
-.br
-Rob Braun - Darwin x86 support
-.br
-Pablo Di Noto - Spanish localization
-.br
-Paul Edens - Dutch localization
-.br
-Kyunghwan Kim - Korean localization
-.br
-Mario Klebsch - Non-US keyboard support
-.br
-Torrey T. Lyons - Project Lead
-.br
-Andreas Monitzer - German localization
-.br
-Patrik Montgomery - Swedish localization
-.br
-Greg Parker - Rootless support
-.br
-Toshimitsu Tanaka - Japanese localization
-.br
-Olivier Verdier - French localization
-.PP
-Code from Apple's X11.app (which was based on XFree86 4.1) was integrated into X.org's XDarwin DDX by Ben Byer for xorg-server-1.2.
-The XDarwin DDX was renamed Xquartz to more accurately reflect its state (the pure-darwin backend was removed).
-Jeremy Huddleston took over as project lead and brought the project up to the X.org 1.4 server branch.
-.PP
-Jeremy Huddleston <jeremyhu at apple.com> is the current maintainer.
diff --git a/hw/xquartz/man/Makefile.am b/hw/xquartz/man/Makefile.am
new file mode 100644
index 0000000..5a0cde7
--- /dev/null
+++ b/hw/xquartz/man/Makefile.am
@@ -0,0 +1,2 @@
+include $(top_srcdir)/manpages.am
+appman_PRE = Xquartz.man
diff --git a/hw/xquartz/man/Xquartz.man b/hw/xquartz/man/Xquartz.man
new file mode 100644
index 0000000..4471947
--- /dev/null
+++ b/hw/xquartz/man/Xquartz.man
@@ -0,0 +1,162 @@
+.TH XQUARTZ 1 __vendorversion__
+.SH NAME
+Xquartz \- X window system server for Mac OSX
+.SH SYNOPSIS
+.B Xquartz
+[ options ] ...
+.SH DESCRIPTION
+.I Xquartz
+is the X window server for Mac OS X provided by Apple.
+.I Xquartz
+runs in parallel with Aqua in rootless mode. In rootless mode, the X
+window system and Mac OS X share your display.  The root window of the
+X11 display is the size of the screen and contains all the other
+windows. The X11 root window is not displayed in rootless mode as Mac
+OS X handles the desktop background.
+.SH CUSTOMIZATION
+\fIXquartz\fP can be customized using the defaults(1) command. The available options are:
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 enable_fake_buttons -boolean true
+Emulates a 3 button mouse using modifier keys. By default, the Command modifier
+is used to emulate button 2 and Option is used for button 3. Thus, clicking the
+first mouse button while holding down Command will act like clicking
+button 2. Holding down Option will simulate button 3.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 fake_button2 \fImodifiers\fP
+Change the modifier keys used to emulate the second mouse button. By default,
+Command is used to emulate the second button. Any combination of the following
+modifier names may be used: {l,r,}shift, {l,r,}option, {l,r,}control, {l,r,}command, fn
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 fake_button3 \fImodifiers\fP
+Change the modifier keys used to emulate the second mouse button. By default,
+Command is used to emulate the second button. Any combination of the following
+modifier names may be used: {l,r,}shift, {l,r,}option, {l,r,}control, {l,r,}command, fn
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 fullscreen_hotkeys -boolean true
+Enable OSX hotkeys while in fullscreen
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 fullscreen_menu -boolean true
+Show the OSX menu while in fullscreen
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 no_quit_alert -boolean true
+Disables the alert dialog displayed when attempting to quit X11.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 no_auth -boolean true
+Stops the X server requiring that clients authenticate themselves when
+connecting.  See Xsecurity(__miscmansuffix__).
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 nolisten_tcp -boolean false
+This will tell the server to listen and accept TCP connections.  Doing this without enabling
+xauth is a possible security concern.  See Xsecurity(__miscmansuffix__).
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 enable_system_beep -boolean false
+Don't use the standard system beep effect for X11 alerts.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 enable_key_equivalents -boolean false
+Disable menu keyboard equivalents while X11 windows are focused.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 depth \fIdepth\fP
+Specifies the color bit depth to use. Currently only 15, and 24 color
+bits per pixel are supported. If not specified, or a value of -1 is specified,
+defaults to the depth of the main display.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 sync_keymap -boolean true
+Keep the X11 keymap up to date with the OSX system keymap.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 option_sends_alt -boolean true
+The Option key will send Alt_L and Alt_R instead of Mode_switch.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard -boolean true
+Enable syncing between the OSX pasteboard and clipboard/primary selection buffers in X11.  This option needs to be true for any of the other pasteboard sync options to have an effect.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard_to_clipboard -boolean true
+Update the X11 CLIPBOARD when the OSX NSPasteboard is updated.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard_to_primary -boolean true
+Update the the X11 PRIMARY buffer when the OSX NSPasteboard is updated.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 sync_clipboard_to_pasteboard -boolean true
+Update the the OSX NSPasteboard when the X11 CLIPBOARD is updated.  Note that enabling this option causes the clipboard synchronization to act as a clipboard manager in X11.  This makes it impossible to use xclipboard, klipper, or any other such clipboard managers.  If you want to use any of these programs, you must disable this option.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 sync_primary_on_select -boolean true
+This option defaults to false and is provided only "for experts."  It updates the NSPasteboard whenever a new X11 selection is made (rather than requiring you to hit cmd-c to copy the selection to the NSPasteboard).  Since the X11 protocol does not require applications to send notification when they change selection, this might not work in all cases (if you run into this problem, try selecting text in another application first, then selecting the text you want).
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 enable_test_extensions -boolean true
+This option defaults to false and is only accessible through the command line.  Enable this option to turn on the DEC-XTRAP, RECORD, and XTEST extensions in the server.
+.SH OPTIONS
+.PP
+In addition to the normal server options described in the \fIXserver(1)\fP
+manual page, \fIXquartz\fP accepts the following command line switches:
+.TP 8
+.B \-fakebuttons
+Same as enable_fake_buttons above with value true.
+.TP 8
+.B \-nofakebuttons
+Same as enable_fake_buttons above with value false.
+.TP 8
+.B "\-fakemouse2 \fImodifiers\fP"
+Same as fake_button2 above.
+.TP 8
+.B "\-fakemouse3 \fImodifiers\fP"
+Same as fake_button3 above.
+.TP 8
+.B "\-depth \fIdepth\fP"
+Same as depth above.
+.SH "SEE ALSO"
+.PP
+X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1)
+.PP
+http://xquartz.macosforge.org
+.PP
+.SH AUTHORS / HISTORY
+X11 was originally ported to Mac OS X Server by John Carmack.  Dave
+Zarzycki used this as the basis of his port of XFree86 4.0 to Darwin 1.0.
+Torrey T. Lyons improved and integrated this code into the XFree86
+Project's mainline for the 4.0.2 release.
+.PP
+The following members of the XonX Team contributed to the following
+releases (in alphabetical order):
+.TP 4
+XFree86 4.1.0:
+.br
+Rob Braun - Darwin x86 support
+.br
+Torrey T. Lyons - Project Lead
+.br
+Andreas Monitzer - Cocoa version of XDarwin front end
+.br
+Gregory Robert Parker - Original Quartz implementation
+.br
+Christoph Pfisterer - Dynamic shared X libraries
+.br
+Toshimitsu Tanaka - Japanese localization
+.TP 4
+XFree86 4.2.0:
+.br
+Rob Braun - Darwin x86 support
+.br
+Pablo Di Noto - Spanish localization
+.br
+Paul Edens - Dutch localization
+.br
+Kyunghwan Kim - Korean localization
+.br
+Mario Klebsch - Non-US keyboard support
+.br
+Torrey T. Lyons - Project Lead
+.br
+Andreas Monitzer - German localization
+.br
+Patrik Montgomery - Swedish localization
+.br
+Greg Parker - Rootless support
+.br
+Toshimitsu Tanaka - Japanese localization
+.br
+Olivier Verdier - French localization
+.PP
+Code from Apple's X11.app (which was based on XFree86 4.1) was integrated into X.org's XDarwin DDX by Ben Byer for xorg-server-1.2.
+The XDarwin DDX was renamed Xquartz to more accurately reflect its state (the pure-darwin backend was removed).
+Jeremy Huddleston took over as project lead and brought the project up to the X.org 1.4 server branch.
+.PP
+Jeremy Huddleston <jeremyhu at apple.com> is the current maintainer.
commit 7ed0d426f616fe9e44ac7091622a798f2043dfe4
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:28:30 2011 -0500

    xfree86: use sed rather than cpp to perform string substitutions
    
    Makefile.am: there are only 4 string substitutions to be done in this file.
    SED is much simpler than the C pre processor which adds its own
    strings which must be substituted by sed, still.
    
    xorgconf.cpp: replaced __xconfigfile__ with xorg.conf as this file name
    is hard coded in the xserver configuration and cannot change.
    Replace XCOMM with # permanently.
    
    Delete cpprules.in as it isn't used anywhere else. Should one need
    cpprules for real cpp work, there is one in Xquartz from which the
    the old man pages code have been stripped.
    
    Fix trailing spaces.
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/cpprules.in b/cpprules.in
deleted file mode 100644
index 6e43578..0000000
--- a/cpprules.in
+++ /dev/null
@@ -1,49 +0,0 @@
-#							-*- Makefile -*-
-# Rules for generating files using the C pre-processor
-# (Replaces CppFileTarget from Imake)
-
-SUFFIXES = .pre .man .man.pre
-
-# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
-# to cpp, because that trick does not work on all ANSI C preprocessors.
-# Delete line numbers from the cpp output (-P is not portable, I guess).
-# Allow XCOMM to be preceded by whitespace and provide a means of generating
-# output lines with trailing backslashes.
-# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
-
-CPP_SED_MAGIC = $(SED) -e '/^\#  *[0-9][0-9]*  *.*$$/d' \
-                       -e '/^\#line  *[0-9][0-9]*  *.*$$/d' \
-                       -e '/^[         ]*XCOMM$$/s/XCOMM/\#/' \
-                       -e '/^[         ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
-                       -e '/^[         ]*XHASH/s/XHASH/\#/' \
-                       -e '/\@\@$$/s/\@\@$$/\\/'
-
-# Strings to replace in man pages
-XORGRELSTRING = @PACKAGE_STRING@
-  XORGMANNAME = X Version 11
-  XSERVERNAME = Xorg
-
-MANDEFS = \
-        -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
-        -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
-	-D__appmansuffix__=$(APP_MAN_SUFFIX) \
-	-D__filemansuffix__=$(FILE_MAN_SUFFIX) \
-	-D__libmansuffix__=$(LIB_MAN_SUFFIX) \
-	-D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
-	-D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
-	-D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
-	-D__mandir__=$(mandir) \
-	-D__projectroot__=$(prefix) \
-	-D__sysconfdir__=$(sysconfdir) \
-	-D__datadir__=$(datadir) \
-	-D__xconfigfile__=$(__XCONFIGFILE__) \
-	-D__xconfigdir__=$(__XCONFIGDIR__) \
-	-D__xkbdir__=$(XKB_BASE_DIRECTORY) \
-	-D__modulepath__="$(DEFAULT_MODULE_PATH)" \
-	-D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME) 
-
-.pre:
-	$(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
-
-.man.pre.man:
-	$(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
diff --git a/hw/xfree86/.gitignore b/hw/xfree86/.gitignore
index 813af0b..2ddca49 100644
--- a/hw/xfree86/.gitignore
+++ b/hw/xfree86/.gitignore
@@ -1,7 +1,4 @@
-#		Add & Override for this directory and it's subdirectories
 libxorg.c
 Xorg
 xorg.c
 xorg.conf.example
-xorg.conf.example.pre
-
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 575481e..c23b1fd 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -1,4 +1,3 @@
-include $(top_srcdir)/cpprules.in
 
 if DRI
 DRI_SUBDIR = dri
@@ -77,7 +76,7 @@ Xorg_LDADD = $(MAIN_LIB) libxorg.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS)
 Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
 
 BUILT_SOURCES = xorg.conf.example
-DISTCLEANFILES += xorg.conf.example xorg.conf.example.pre
+DISTCLEANFILES += xorg.conf.example
 EXTRA_DIST = xorgconf.cpp
 
 if SPECIAL_DTRACE_OBJECTS
@@ -108,13 +107,14 @@ if INSTALL_SETUID
 	chmod u+s $(DESTDIR)$(bindir)/Xorg
 endif
 
-CPP_FILES_FLAGS = \
-	$(MANDEFS) \
-	-DDEFAULTFONTPATH="\"$(COMPILEDDEFAULTFONTPATH)\"" \
-	-DMODULEPATH=\"$(DEFAULT_MODULE_PATH)\"
+# Use variables from XORG_MANPAGE_SECTIONS and X Server configuration
+# Do not include manpages.am as values are not appropriate for rc files
+CONF_SUBSTS =	-e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g' \
+		-e 's|MODULEPATH|$(DEFAULT_MODULE_PATH)|g' \
+		-e 's|DEFAULTFONTPATH|$(COMPILEDDEFAULTFONTPATH)|g'
+
+xorg.conf.example: xorgconf.cpp
+	$(AM_V_GEN)$(SED) $(CONF_SUBSTS) < $< > $@
 
 relink:
 	$(AM_V_at)rm -f Xorg && $(MAKE) Xorg
-
-xorg.conf.example.pre: xorgconf.cpp
-	cp $(srcdir)/xorgconf.cpp $@
diff --git a/hw/xfree86/xorgconf.cpp b/hw/xfree86/xorgconf.cpp
index 8f0c830..cd6d4a9 100644
--- a/hw/xfree86/xorgconf.cpp
+++ b/hw/xfree86/xorgconf.cpp
@@ -1,73 +1,73 @@
-XCOMM
-XCOMM Copyright (c) 1994-1998 by The XFree86 Project, Inc.
-XCOMM
-XCOMM Permission is hereby granted, free of charge, to any person obtaining a
-XCOMM copy of this software and associated documentation files (the "Software"),
-XCOMM to deal in the Software without restriction, including without limitation
-XCOMM the rights to use, copy, modify, merge, publish, distribute, sublicense,
-XCOMM and/or sell copies of the Software, and to permit persons to whom the
-XCOMM Software is furnished to do so, subject to the following conditions:
-XCOMM 
-XCOMM The above copyright notice and this permission notice shall be included in
-XCOMM all copies or substantial portions of the Software.
-XCOMM 
-XCOMM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-XCOMM IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-XCOMM FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-XCOMM THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-XCOMM WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-XCOMM OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-XCOMM SOFTWARE.
-XCOMM 
-XCOMM Except as contained in this notice, the name of the XFree86 Project shall
-XCOMM not be used in advertising or otherwise to promote the sale, use or other
-XCOMM dealings in this Software without prior written authorization from the
-XCOMM XFree86 Project.
-XCOMM
-XCOMM $XConsortium: XF86Conf.cpp /main/22 1996/10/23 11:43:51 kaleb $
-
-XCOMM **********************************************************************
-XCOMM This is a sample configuration file only, intended to illustrate
-XCOMM what a config file might look like.  Refer to the __xconfigfile__(__filemansuffix__)
-XCOMM man page for details about the format of this file. 
-XCOMM **********************************************************************
-
-XCOMM The ordering of sections is not important in XFree86 4.0 and later,
-XCOMM nor in any Xorg release.
-
-XCOMM **********************************************************************
-XCOMM Files section.  This allows default font and module paths to be set
-XCOMM **********************************************************************
+#
+# Copyright (c) 1994-1998 by The XFree86 Project, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+# Except as contained in this notice, the name of the XFree86 Project shall
+# not be used in advertising or otherwise to promote the sale, use or other
+# dealings in this Software without prior written authorization from the
+# XFree86 Project.
+#
+# $XConsortium: XF86Conf.cpp /main/22 1996/10/23 11:43:51 kaleb $
+
+# **********************************************************************
+# This is a sample configuration file only, intended to illustrate
+# what a config file might look like.  Refer to the xorg.conf(__filemansuffix__)
+# man page for details about the format of this file.
+# **********************************************************************
+
+# The ordering of sections is not important in XFree86 4.0 and later,
+# nor in any Xorg release.
+
+# **********************************************************************
+# Files section.  This allows default font and module paths to be set
+# **********************************************************************
 
 Section "Files"
 
-XCOMM Multiple FontPath entries are allowed (which are concatenated together),
-XCOMM as well as specifying multiple comma-separated entries in one FontPath
-XCOMM command (or a combination of both methods).
-XCOMM The default path is shown here.
+# Multiple FontPath entries are allowed (which are concatenated together),
+# as well as specifying multiple comma-separated entries in one FontPath
+# command (or a combination of both methods).
+# The default path is shown here.
 
-XCOMM    FontPath	DEFAULTFONTPATH
+#    FontPath	DEFAULTFONTPATH
 
-XCOMM ModulePath can be used to set a search path for the X server modules.
-XCOMM The default path is shown here.
+# ModulePath can be used to set a search path for the X server modules.
+# The default path is shown here.
 
-XCOMM    ModulePath	MODULEPATH
+#    ModulePath	MODULEPATH
 
 EndSection
 
-XCOMM **********************************************************************
-XCOMM Module section -- this is an optional section which is used to specify
-XCOMM which run-time loadable modules to load when the X server starts up.
-XCOMM **********************************************************************
+# **********************************************************************
+# Module section -- this is an optional section which is used to specify
+# which run-time loadable modules to load when the X server starts up.
+# **********************************************************************
 
 Section "Module"
 
-XCOMM This loads the DBE extension module.
+# This loads the DBE extension module.
 
     Load	"dbe"
 
-XCOMM This loads the miscellaneous extensions module, and disables
-XCOMM initialisation of the XFree86-DGA extension within that module.
+# This loads the miscellaneous extensions module, and disables
+# initialisation of the XFree86-DGA extension within that module.
 
     SubSection	"extmod"
 	Option	"omit xfree86-dga"
@@ -76,53 +76,53 @@ XCOMM initialisation of the XFree86-DGA extension within that module.
 EndSection
 
 
-XCOMM **********************************************************************
-XCOMM Server flags section.  This contains various server-wide Options.
-XCOMM **********************************************************************
+# **********************************************************************
+# Server flags section.  This contains various server-wide Options.
+# **********************************************************************
 
 Section "ServerFlags"
 
-XCOMM Uncomment this to cause a core dump at the spot where a signal is 
-XCOMM received.  This may leave the console in an unusable state, but may
-XCOMM provide a better stack trace in the core dump to aid in debugging
+# 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
 
-XCOMM    Option	"NoTrapSignals"
+#    Option	"NoTrapSignals"
 
-XCOMM Uncomment this to disable the <Ctrl><Alt><Fn> VT switch sequence
-XCOMM (where n is 1 through 12).  This allows clients to receive these key
-XCOMM events.
+# Uncomment this to disable the <Ctrl><Alt><Fn> VT switch sequence
+# (where n is 1 through 12).  This allows clients to receive these key
+# events.
 
-XCOMM    Option	"DontVTSwitch"
+#    Option	"DontVTSwitch"
 
-XCOMM Uncomment this to disable the <Ctrl><Alt><BS> server abort sequence
-XCOMM This allows clients to receive this key event.
+# Uncomment this to disable the <Ctrl><Alt><BS> server abort sequence
+# This allows clients to receive this key event.
 
-XCOMM    Option	"DontZap"	"false"
+#    Option	"DontZap"	"false"
 
-XCOMM Uncomment this to disable the <Ctrl><Alt><KP_+>/<KP_-> mode switching
-XCOMM sequences.  This allows clients to receive these key events.
+# Uncomment this to disable the <Ctrl><Alt><KP_+>/<KP_-> mode switching
+# sequences.  This allows clients to receive these key events.
 
-XCOMM    Option	"DontZoom"
+#    Option	"DontZoom"
 
-XCOMM Uncomment this to disable tuning with the xvidtune client. With
-XCOMM it the client can still run and fetch card and monitor attributes,
-XCOMM but it will not be allowed to change them. If it tries it will
-XCOMM receive a protocol error.
+# Uncomment this to disable tuning with the xvidtune client. With
+# it the client can still run and fetch card and monitor attributes,
+# but it will not be allowed to change them. If it tries it will
+# receive a protocol error.
 
-XCOMM    Option	"DisableVidModeExtension"
+#    Option	"DisableVidModeExtension"
 
-XCOMM Uncomment this to enable the use of a non-local xvidtune client.
+# Uncomment this to enable the use of a non-local xvidtune client.
 
-XCOMM    Option	"AllowNonLocalXvidtune"
+#    Option	"AllowNonLocalXvidtune"
 
-XCOMM Set the basic blanking screen saver timeout.
+# Set the basic blanking screen saver timeout.
 
     Option	"BlankTime"	"10"	# 10 minutes
 
-XCOMM Set the DPMS timeouts.  These are set here because they are global
-XCOMM rather than screen-specific.  These settings alone don't enable DPMS.
-XCOMM It is enabled per-screen (or per-monitor), and even then only when
-XCOMM the driver supports it.
+# Set the DPMS timeouts.  These are set here because they are global
+# rather than screen-specific.  These settings alone don't enable DPMS.
+# It is enabled per-screen (or per-monitor), and even then only when
+# the driver supports it.
 
     Option	"StandbyTime"	"10"	# 10 minutes
     Option	"SuspendTime"	"10"	# 10 minutes
@@ -130,115 +130,115 @@ XCOMM the driver supports it.
 
 EndSection
 
-XCOMM **********************************************************************
-XCOMM Input devices
-XCOMM **********************************************************************
+# **********************************************************************
+# Input devices
+# **********************************************************************
 
-XCOMM **********************************************************************
-XCOMM Core keyboard's InputDevice section
-XCOMM **********************************************************************
+# **********************************************************************
+# Core keyboard's InputDevice section
+# **********************************************************************
 
 Section "InputDevice"
 
     Identifier	"Keyboard1"
     Driver	"kbd"
 
-XCOMM Set the keyboard auto repeat parameters.  Not all platforms implement
-XCOMM this.
+# Set the keyboard auto repeat parameters.  Not all platforms implement
+# this.
 
     Option	"AutoRepeat"	"500 5"
 
-XCOMM Specifiy which keyboard LEDs can be user-controlled (eg, with xset(1)).
-
-XCOMM    Option	"Xleds"	"1 2 3"
-
-XCOMM To customise the XKB settings to suit your keyboard, modify the
-XCOMM lines below (which are the defaults).  For example, for a European
-XCOMM keyboard, you will probably want to use one of:
-XCOMM
-XCOMM    Option	"XkbModel"	"pc102"
-XCOMM    Option	"XkbModel"	"pc105"
-XCOMM
-XCOMM If you have a Microsoft Natural keyboard, you can use:
-XCOMM
-XCOMM    Option	"XkbModel"	"microsoft"
-XCOMM
-XCOMM If you have a US "windows" keyboard you will want:
-XCOMM
-XCOMM    Option	"XkbModel"	"pc104"
-XCOMM
-XCOMM Then to change the language, change the Layout setting.
-XCOMM For example, a german layout can be obtained with:
-XCOMM
-XCOMM    Option	"XkbLayout"	"de"
-XCOMM
-XCOMM or:
-XCOMM
-XCOMM    Option	"XkbLayout"	"de"
-XCOMM    Option	"XkbVariant"	"nodeadkeys"
-XCOMM
-XCOMM If you'd like to switch the positions of your capslock and
-XCOMM control keys, use:
-XCOMM
-XCOMM    Option	"XkbOptions"	"ctrl:swapcaps"
-
-
-XCOMM These are the default XKB settings for xorg
-XCOMM
-XCOMM    Option	"XkbRules"	"xorg"
-XCOMM    Option	"XkbModel"	"pc105"
-XCOMM    Option	"XkbLayout"	"us"
-XCOMM    Option	"XkbVariant"	""
-XCOMM    Option	"XkbOptions"	""
+# Specifiy which keyboard LEDs can be user-controlled (eg, with xset(1)).
+
+#    Option	"Xleds"	"1 2 3"
+
+# To customise the XKB settings to suit your keyboard, modify the
+# lines below (which are the defaults).  For example, for a European
+# keyboard, you will probably want to use one of:
+#
+#    Option	"XkbModel"	"pc102"
+#    Option	"XkbModel"	"pc105"
+#
+# If you have a Microsoft Natural keyboard, you can use:
+#
+#    Option	"XkbModel"	"microsoft"
+#
+# If you have a US "windows" keyboard you will want:
+#
+#    Option	"XkbModel"	"pc104"
+#
+# Then to change the language, change the Layout setting.
+# For example, a german layout can be obtained with:
+#
+#    Option	"XkbLayout"	"de"
+#
+# or:
+#
+#    Option	"XkbLayout"	"de"
+#    Option	"XkbVariant"	"nodeadkeys"
+#
+# If you'd like to switch the positions of your capslock and
+# control keys, use:
+#
+#    Option	"XkbOptions"	"ctrl:swapcaps"
+
+
+# These are the default XKB settings for xorg
+#
+#    Option	"XkbRules"	"xorg"
+#    Option	"XkbModel"	"pc105"
+#    Option	"XkbLayout"	"us"
+#    Option	"XkbVariant"	""
+#    Option	"XkbOptions"	""
 
 EndSection
 
 
-XCOMM **********************************************************************
-XCOMM Core Pointer's InputDevice section
-XCOMM **********************************************************************
+# **********************************************************************
+# Core Pointer's InputDevice section
+# **********************************************************************
 
 Section "InputDevice"
 
-XCOMM Identifier and driver
+# Identifier and driver
 
     Identifier	"Mouse1"
     Driver	"mouse"
 
-XCOMM The mouse protocol and device.  The device is normally set to /dev/mouse,
-XCOMM which is usually a symbolic link to the real device.
+# The mouse protocol and device.  The device is normally set to /dev/mouse,
+# which is usually a symbolic link to the real device.
 
     Option	"Protocol"	"Microsoft"
     Option	"Device"	"/dev/mouse"
 
-XCOMM On platforms where PnP mouse detection is supported the following
-XCOMM protocol setting can be used when using a newer PnP mouse:
+# On platforms where PnP mouse detection is supported the following
+# protocol setting can be used when using a newer PnP mouse:
 
-XCOMM    Option	"Protocol"	"Auto"
+#    Option	"Protocol"	"Auto"
 
-XCOMM When using mouse connected to a PS/2 port (aka "MousePort"), set the
-XCOMM the protocol as follows.  On some platforms some other settings may
-XCOMM be available.
+# When using mouse connected to a PS/2 port (aka "MousePort"), set the
+# the protocol as follows.  On some platforms some other settings may
+# be available.
 
-XCOMM    Option "Protocol"	"PS/2"
+#    Option "Protocol"	"PS/2"
 
-XCOMM Baudrate and SampleRate are only for some older Logitech mice.  In
-XCOMM almost every case these lines should be omitted.
+# Baudrate and SampleRate are only for some older Logitech mice.  In
+# almost every case these lines should be omitted.
 
-XCOMM    Option	"BaudRate"	"9600"
-XCOMM    Option	"SampleRate"	"150"
+#    Option	"BaudRate"	"9600"
+#    Option	"SampleRate"	"150"
 
-XCOMM Emulate3Buttons is an option for 2-button mice
-XCOMM Emulate3Timeout is the timeout in milliseconds (default is 50ms)
+# Emulate3Buttons is an option for 2-button mice
+# Emulate3Timeout is the timeout in milliseconds (default is 50ms)
 
-XCOMM    Option	"Emulate3Buttons"
-XCOMM    Option	"Emulate3Timeout"	"50"
+#    Option	"Emulate3Buttons"
+#    Option	"Emulate3Timeout"	"50"
 
-XCOMM ChordMiddle is an option for some 3-button Logitech mice, or any
-XCOMM 3-button mouse where the middle button generates left+right button
-XCOMM events.
+# ChordMiddle is an option for some 3-button Logitech mice, or any
+# 3-button mouse where the middle button generates left+right button
+# events.
 
-XCOMM    Option	"ChordMiddle"
+#    Option	"ChordMiddle"
 
 EndSection
 
@@ -249,91 +249,91 @@ Section "InputDevice"
     Option	"Device"	"/dev/mouse2"
 EndSection
 
-XCOMM Some examples of extended input devices
-
-XCOMM Section "InputDevice"
-XCOMM    Identifier	"spaceball"
-XCOMM    Driver	"magellan"
-XCOMM    Option	"Device"	"/dev/cua0"
-XCOMM EndSection
-XCOMM
-XCOMM Section "InputDevice"
-XCOMM    Identifier	"spaceball2"
-XCOMM    Driver	"spaceorb"
-XCOMM    Option	"Device"	"/dev/cua0"
-XCOMM EndSection
-XCOMM
-XCOMM Section "InputDevice"
-XCOMM    Identifier	"touchscreen0"
-XCOMM    Driver	"microtouch"
-XCOMM    Option	"Device"	"/dev/ttyS0"
-XCOMM    Option	"MinX"		"1412"
-XCOMM    Option	"MaxX"		"15184"
-XCOMM    Option	"MinY"		"15372"
-XCOMM    Option	"MaxY"		"1230"
-XCOMM    Option	"ScreenNumber"	"0"
-XCOMM    Option	"ReportingMode"	"Scaled"
-XCOMM    Option	"ButtonNumber"	"1"
-XCOMM    Option	"SendCoreEvents"
-XCOMM EndSection
-XCOMM
-XCOMM Section "InputDevice"
-XCOMM    Identifier	"touchscreen1"
-XCOMM    Driver	"elo2300"
-XCOMM    Option	"Device"	"/dev/ttyS0"
-XCOMM    Option	"MinX"		"231"
-XCOMM    Option	"MaxX"		"3868"
-XCOMM    Option	"MinY"		"3858"
-XCOMM    Option	"MaxY"		"272"
-XCOMM    Option	"ScreenNumber"	"0"
-XCOMM    Option	"ReportingMode"	"Scaled"
-XCOMM    Option	"ButtonThreshold"	"17"
-XCOMM    Option	"ButtonNumber"	"1"
-XCOMM    Option	"SendCoreEvents"
-XCOMM EndSection
-
-XCOMM **********************************************************************
-XCOMM Monitor section
-XCOMM **********************************************************************
-
-XCOMM Any number of monitor sections may be present
+# Some examples of extended input devices
+
+# Section "InputDevice"
+#    Identifier	"spaceball"
+#    Driver	"magellan"
+#    Option	"Device"	"/dev/cua0"
+# EndSection
+#
+# Section "InputDevice"
+#    Identifier	"spaceball2"
+#    Driver	"spaceorb"
+#    Option	"Device"	"/dev/cua0"
+# EndSection
+#
+# Section "InputDevice"
+#    Identifier	"touchscreen0"
+#    Driver	"microtouch"
+#    Option	"Device"	"/dev/ttyS0"
+#    Option	"MinX"		"1412"
+#    Option	"MaxX"		"15184"
+#    Option	"MinY"		"15372"
+#    Option	"MaxY"		"1230"
+#    Option	"ScreenNumber"	"0"
+#    Option	"ReportingMode"	"Scaled"
+#    Option	"ButtonNumber"	"1"
+#    Option	"SendCoreEvents"
+# EndSection
+#
+# Section "InputDevice"
+#    Identifier	"touchscreen1"
+#    Driver	"elo2300"
+#    Option	"Device"	"/dev/ttyS0"
+#    Option	"MinX"		"231"
+#    Option	"MaxX"		"3868"
+#    Option	"MinY"		"3858"
+#    Option	"MaxY"		"272"
+#    Option	"ScreenNumber"	"0"
+#    Option	"ReportingMode"	"Scaled"
+#    Option	"ButtonThreshold"	"17"
+#    Option	"ButtonNumber"	"1"
+#    Option	"SendCoreEvents"
+# EndSection
+
+# **********************************************************************
+# Monitor section
+# **********************************************************************
+
+# Any number of monitor sections may be present
 
 Section "Monitor"
 
-XCOMM The identifier line must be present.
+# The identifier line must be present.
 
     Identifier	"Generic Monitor"
 
-XCOMM HorizSync is in kHz unless units are specified.
-XCOMM HorizSync may be a comma separated list of discrete values, or a
-XCOMM comma separated list of ranges of values.
-XCOMM NOTE: THE VALUES HERE ARE EXAMPLES ONLY.  REFER TO YOUR MONITOR'S
-XCOMM USER MANUAL FOR THE CORRECT NUMBERS.
+# 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.
 
-XCOMM    HorizSync	31.5  # typical for a single frequency fixed-sync monitor
-XCOMM    HorizSync	30-64         # multisync
-XCOMM    HorizSync	31.5, 35.2    # multiple fixed sync frequencies
-XCOMM    HorizSync	15-25, 30-50  # multiple ranges of sync frequencies
+#    HorizSync	31.5  # typical for a single frequency fixed-sync monitor
+#    HorizSync	30-64         # multisync
+#    HorizSync	31.5, 35.2    # multiple fixed sync frequencies
+#    HorizSync	15-25, 30-50  # multiple ranges of sync frequencies
 
-XCOMM VertRefresh is in Hz unless units are specified.
-XCOMM VertRefresh may be a comma separated list of discrete values, or a
-XCOMM comma separated list of ranges of values.
-XCOMM NOTE: THE VALUES HERE ARE EXAMPLES ONLY.  REFER TO YOUR MONITOR'S
-XCOMM USER MANUAL FOR THE CORRECT NUMBERS.
+# 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.
 
-XCOMM    VertRefresh	60  # typical for a single frequency fixed-sync monitor
+#    VertRefresh	60  # typical for a single frequency fixed-sync monitor
 
-XCOMM    VertRefresh	50-100        # multisync
-XCOMM    VertRefresh	60, 65        # multiple fixed sync frequencies
-XCOMM    VertRefresh	40-50, 80-100 # multiple ranges of sync frequencies
+#    VertRefresh	50-100        # multisync
+#    VertRefresh	60, 65        # multiple fixed sync frequencies
+#    VertRefresh	40-50, 80-100 # multiple ranges of sync frequencies
 
-XCOMM Modes can be specified in two formats.  A compact one-line format, or
-XCOMM a multi-line format.
+# Modes can be specified in two formats.  A compact one-line format, or
+# a multi-line format.
 
-XCOMM A generic VGA 640x480 mode (hsync = 31.5kHz, refresh = 60Hz)
-XCOMM These two are equivalent
+# A generic VGA 640x480 mode (hsync = 31.5kHz, refresh = 60Hz)
+# These two are equivalent
 
-XCOMM    ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525
+#    ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525
 
     Mode "640x480"
         DotClock	25.175
@@ -341,75 +341,75 @@ XCOMM    ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525
         VTimings	480 491 493 525
     EndMode
 
-XCOMM These two are equivalent
+# These two are equivalent
 
-XCOMM    ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace
+#    ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace
 
-XCOMM    Mode "1024x768i"
-XCOMM        DotClock	45
-XCOMM        HTimings	1024 1048 1208 1264
-XCOMM        VTimings	768 776 784 817
-XCOMM        Flags		"Interlace"
-XCOMM    EndMode
+#    Mode "1024x768i"
+#        DotClock	45
+#        HTimings	1024 1048 1208 1264
+#        VTimings	768 776 784 817
+#        Flags		"Interlace"
+#    EndMode
 
-XCOMM If a monitor has DPMS support, that can be indicated here.  This will
-XCOMM enable DPMS when the monitor is used with drivers that support it.
+# If a monitor has DPMS support, that can be indicated here.  This will
+# enable DPMS when the monitor is used with drivers that support it.
 
-XCOMM    Option	"dpms"
+#    Option	"dpms"
 
-XCOMM If a monitor requires that the sync signals be superimposed on the
-XCOMM green signal, the following option will enable this when used with
-XCOMM drivers that support it.  Only a relatively small range of hardware
-XCOMM (and drivers) actually support this.
+# If a monitor requires that the sync signals be superimposed on the
+# green signal, the following option will enable this when used with
+# drivers that support it.  Only a relatively small range of hardware
+# (and drivers) actually support this.
 
-XCOMM    Option	"sync on green"
+#    Option	"sync on green"
 
 EndSection
 
-XCOMM **********************************************************************
-XCOMM Graphics device section
-XCOMM **********************************************************************
+# **********************************************************************
+# Graphics device section
+# **********************************************************************
 
-XCOMM Any number of graphics device sections may be present
+# Any number of graphics device sections may be present
 
 Section "Device"
 
-XCOMM The Identifier must be present.
+# The Identifier must be present.
 
     Identifier	"Generic VESA"
 
-XCOMM The Driver line must be present.  When using run-time loadable driver
-XCOMM modules, this line instructs the server to load the specified driver
-XCOMM module.  Even when not using loadable driver modules, this line
-XCOMM indicates which driver should interpret the information in this section.
+# The Driver line must be present.  When using run-time loadable driver
+# modules, this line instructs the server to load the specified driver
+# module.  Even when not using loadable driver modules, this line
+# indicates which driver should interpret the information in this section.
 
     Driver	"vesa"
 
-XCOMM The chipset line is optional in most cases.  It can be used to override
-XCOMM the driver's chipset detection, and should not normally be specified.
+# The chipset line is optional in most cases.  It can be used to override
+# the driver's chipset detection, and should not normally be specified.
 
-XCOMM    Chipset	"generic"
+#    Chipset	"generic"
 
-XCOMM Various other lines can be specified to override the driver's automatic
-XCOMM detection code.  In most cases they are not needed.
+# Various other lines can be specified to override the driver's automatic
+# detection code.  In most cases they are not needed.
 
-XCOMM    VideoRam	256
-XCOMM    Clocks	25.2 28.3
+#    VideoRam	256
+#    Clocks	25.2 28.3
 
-XCOMM The BusID line is used to specify which of possibly multiple devices
-XCOMM this section is intended for.  When this line isn't present, a device
-XCOMM section can only match up with the primary video device.  For PCI
-XCOMM devices a line like the following could be used.  This line should not
-XCOMM normally be included unless there is more than one video device
-XCOMM intalled.
+# The BusID line is used to specify which of possibly multiple devices
+# this section is intended for.  When this line isn't present, a device
+# section can only match up with the primary video device.  For PCI
+# devices a line like the following could be used.  This line should not
+# normally be included unless there is more than one video device
+# intalled.
 
-XCOMM    BusID	"PCI:0:10:0"
+#    BusID	"PCI:0:10:0"
 
-XCOMM Various option lines can be added here as required.  Some options
-XCOMM are more appropriate in Screen sections, Display subsections or even
-XCOMM Monitor sections.
+# Various option lines can be added here as required.  Some options
+# are more appropriate in Screen sections, Display subsections or even
+# Monitor sections.
 
-XCOMM    Option	"hw cursor" "off"
+#    Option	"hw cursor" "off"
 
 EndSection
 
@@ -433,24 +433,24 @@ Section "Device"
 EndSection
 
 
-XCOMM **********************************************************************
-XCOMM Screen sections.
-XCOMM **********************************************************************
+# **********************************************************************
+# Screen sections.
+# **********************************************************************
 
-XCOMM Any number of screen sections may be present.  Each describes
-XCOMM the configuration of a single screen.  A single specific screen section
-XCOMM may be specified from the X server command line with the "-screen"
-XCOMM option.
+# Any number of screen sections may be present.  Each describes
+# the configuration of a single screen.  A single specific screen section
+# may be specified from the X server command line with the "-screen"
+# option.
 
 Section "Screen"
 
-XCOMM The Identifier, Device and Monitor lines must be present
+# The Identifier, Device and Monitor lines must be present
 
     Identifier	"Screen 1"
     Device	"Generic VESA"
     Monitor	"Generic Monitor"
 
-XCOMM The favoured Depth and/or Bpp may be specified here
+# The favoured Depth and/or Bpp may be specified here
 
     DefaultDepth 8
 
@@ -480,7 +480,7 @@ Section "Screen"
     Monitor		"Generic Monitor"
     Option		"no accel"
     DefaultDepth	16
-XCOMM    DefaultDepth	24
+#    DefaultDepth	24
 
     SubSection "Display"
 	Depth		8
@@ -514,38 +514,38 @@ Section "Screen"
 EndSection
 
 
-XCOMM **********************************************************************
-XCOMM ServerLayout sections.
-XCOMM **********************************************************************
+# **********************************************************************
+# ServerLayout sections.
+# **********************************************************************
 
-XCOMM Any number of ServerLayout sections may be present.  Each describes
-XCOMM the way multiple screens are organised.  A specific ServerLayout
-XCOMM section may be specified from the X server command line with the
-XCOMM "-layout" option.  In the absence of this, the first section is used.
-XCOMM When now ServerLayout section is present, the first Screen section
-XCOMM is used alone.
+# Any number of ServerLayout sections may be present.  Each describes
+# the way multiple screens are organised.  A specific ServerLayout
+# section may be specified from the X server command line with the
+# "-layout" option.  In the absence of this, the first section is used.
+# When now ServerLayout section is present, the first Screen section
+# is used alone.
 
 Section "ServerLayout"
 
-XCOMM The Identifier line must be present
+# The Identifier line must be present
 
     Identifier	"Main Layout"
 
-XCOMM Each Screen line specifies a Screen section name, and optionally
-XCOMM the relative position of other screens.  The four names after
-XCOMM primary screen name are the screens to the top, bottom, left and right
-XCOMM of the primary screen.  In this example, screen 2 is located to the
-XCOMM right of screen 1.
+# Each Screen line specifies a Screen section name, and optionally
+# the relative position of other screens.  The four names after
+# primary screen name are the screens to the top, bottom, left and right
+# of the primary screen.  In this example, screen 2 is located to the
+# right of screen 1.
 
     Screen	"Screen MGA 1"	""	""	""	"Screen MGA 2"
     Screen	"Screen MGA 2"	""	""	"Screen MGA 1"	""
 
-XCOMM Each InputDevice line specifies an InputDevice section name and
-XCOMM optionally some options to specify the way the device is to be
-XCOMM used.  Those options include "CorePointer", "CoreKeyboard" and
-XCOMM "SendCoreEvents".  In this example, "Mouse1" is the core pointer,
-XCOMM and "Mouse2" is an extended input device that also generates core
-XCOMM pointer events (i.e., both mice will move the standard pointer).
+# Each InputDevice line specifies an InputDevice section name and
+# optionally some options to specify the way the device is to be
+# used.  Those options include "CorePointer", "CoreKeyboard" and
+# "SendCoreEvents".  In this example, "Mouse1" is the core pointer,
+# and "Mouse2" is an extended input device that also generates core
+# pointer events (i.e., both mice will move the standard pointer).
 
     InputDevice	"Mouse1" "CorePointer"
     InputDevice	"Mouse2" "SendCoreEvents"
commit 885a3330092c13786baa3aaabd728e71962486c4
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:28:29 2011 -0500

    man: refactor common code in the man pages makefiles
    
    Create a manpages.am makefile snippet in the root dir.
    Each man page makefile includes manpages.am.
    
    Now all man pages in xserver are generated the same way
    using the same method as all of other xorg modules.
    All ".man.pre" files in git are ".man" now.
    Links are no longer created between different file types.
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index dd08512..71d7049 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -2,19 +2,5 @@
 # (i.e. those handled in the os/utils.c options processing instead of in
 #  the DDX-level options processing)
 
-appmandir = $(APP_MAN_DIR)
+include $(top_srcdir)/manpages.am
 appman_PRE = Xserver.man
-appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
-
-EXTRA_DIST = $(appman_PRE)
-CLEANFILES = $(appman_DATA)
-SUFFIXES = .$(APP_MAN_SUFFIX) .man
-
-# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
-# 's|/,|/, |g' will add a space to help font path formatting
-MAN_SUBSTS += 	-e 's|__datadir__|$(datadir)|g' \
-		-e 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' \
-		-e '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g'
-
-.man.$(APP_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/dmx/config/man/Makefile.am b/hw/dmx/config/man/Makefile.am
index c12c78f..9bb62a4 100644
--- a/hw/dmx/config/man/Makefile.am
+++ b/hw/dmx/config/man/Makefile.am
@@ -1,10 +1,2 @@
-appmandir = $(APP_MAN_DIR)
+include $(top_srcdir)/manpages.am
 appman_PRE = xdmxconfig.man vdltodmx.man dmxtodmx.man
-appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
-
-EXTRA_DIST = $(appman_PRE)
-CLEANFILES = $(appman_DATA)
-SUFFIXES = .$(APP_MAN_SUFFIX) .man
-
-.man.$(APP_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/dmx/man/Makefile.am b/hw/dmx/man/Makefile.am
index a0522ae..e717aef 100644
--- a/hw/dmx/man/Makefile.am
+++ b/hw/dmx/man/Makefile.am
@@ -1,10 +1,2 @@
-appmandir = $(APP_MAN_DIR)
+include $(top_srcdir)/manpages.am
 appman_PRE = Xdmx.man
-appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
-
-EXTRA_DIST = $(appman_PRE)
-CLEANFILES = $(appman_DATA)
-SUFFIXES = .$(APP_MAN_SUFFIX) .man
-
-.man.$(APP_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/kdrive/ephyr/man/Makefile.am b/hw/kdrive/ephyr/man/Makefile.am
index 58f1cbd..e8a3721 100644
--- a/hw/kdrive/ephyr/man/Makefile.am
+++ b/hw/kdrive/ephyr/man/Makefile.am
@@ -1,10 +1,2 @@
-appmandir = $(APP_MAN_DIR)
+include $(top_srcdir)/manpages.am
 appman_PRE = Xephyr.man
-appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
-
-EXTRA_DIST = $(appman_PRE)
-CLEANFILES = $(appman_DATA)
-SUFFIXES = .$(APP_MAN_SUFFIX) .man
-
-.man.$(APP_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/vfb/man/Makefile.am b/hw/vfb/man/Makefile.am
index 5decadd..9394188 100644
--- a/hw/vfb/man/Makefile.am
+++ b/hw/vfb/man/Makefile.am
@@ -1,10 +1,2 @@
-appmandir = $(APP_MAN_DIR)
+include $(top_srcdir)/manpages.am
 appman_PRE = Xvfb.man
-appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
-
-EXTRA_DIST = $(appman_PRE)
-CLEANFILES = $(appman_DATA)
-SUFFIXES = .$(APP_MAN_SUFFIX) .man
-
-.man.$(APP_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/xfree86/doc/man/Makefile.am b/hw/xfree86/doc/man/Makefile.am
index 4fbc878..fe330a7 100644
--- a/hw/xfree86/doc/man/Makefile.am
+++ b/hw/xfree86/doc/man/Makefile.am
@@ -1,25 +1,3 @@
-appmandir = $(APP_MAN_DIR)
+include $(top_srcdir)/manpages.am
 appman_PRE = Xorg.man
-appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
-
-filemandir = $(FILE_MAN_DIR)
 fileman_PRE = xorg.conf.man
-fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX))
-
-EXTRA_DIST = $(appman_PRE) $(fileman_PRE)
-CLEANFILES = $(appman_DATA) $(fileman_DATA)
-SUFFIXES = .$(APP_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man
-
-# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
-MAN_SUBSTS += 	-e 's|__logdir__|$(logdir)|g' \
-		-e 's|__datadir__|$(datadir)|g' \
-		-e 's|__mandir__|$(mandir)|g' \
-		-e 's|__sysconfdir__|$(sysconfdir)|g' \
-		-e 's|__xconfigdir__|$(__XCONFIGDIR__)|g' \
-		-e 's|__xkbdir__|$(XKB_BASE_DIRECTORY)|g' \
-		-e 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g'
-
-.man.$(APP_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
-.man.$(FILE_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/xfree86/exa/man/Makefile.am b/hw/xfree86/exa/man/Makefile.am
index db287db..51da4fd 100644
--- a/hw/xfree86/exa/man/Makefile.am
+++ b/hw/xfree86/exa/man/Makefile.am
@@ -1,11 +1,2 @@
-drivermandir = $(DRIVER_MAN_DIR)
+include $(top_srcdir)/manpages.am
 driverman_PRE = exa.man
-driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX))
-
-EXTRA_DIST = $(driverman_PRE)
-CLEANFILES = $(driverman_DATA)
-SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
-
-# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
-.man.$(DRIVER_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/xfree86/fbdevhw/man/Makefile.am b/hw/xfree86/fbdevhw/man/Makefile.am
index 5da5c55..7f22a12 100644
--- a/hw/xfree86/fbdevhw/man/Makefile.am
+++ b/hw/xfree86/fbdevhw/man/Makefile.am
@@ -1,11 +1,2 @@
-drivermandir = $(DRIVER_MAN_DIR)
+include $(top_srcdir)/manpages.am
 driverman_PRE = fbdevhw.man
-driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX))
-
-EXTRA_DIST = $(driverman_PRE)
-CLEANFILES = $(driverman_DATA)
-SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
-
-# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
-.man.$(DRIVER_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/xfree86/utils/man/Makefile.am b/hw/xfree86/utils/man/Makefile.am
index fd2af8e..7afc5bc 100644
--- a/hw/xfree86/utils/man/Makefile.am
+++ b/hw/xfree86/utils/man/Makefile.am
@@ -1,10 +1,2 @@
-appmandir = $(APP_MAN_DIR)
+include $(top_srcdir)/manpages.am
 appman_PRE = cvt.man gtf.man
-appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
-
-EXTRA_DIST = $(appman_PRE)
-CLEANFILES = $(appman_DATA)
-SUFFIXES = .$(APP_MAN_SUFFIX) .man
-
-.man.$(APP_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/xnest/man/Makefile.am b/hw/xnest/man/Makefile.am
index ff3468f..30b6370 100644
--- a/hw/xnest/man/Makefile.am
+++ b/hw/xnest/man/Makefile.am
@@ -1,10 +1,2 @@
-appmandir = $(APP_MAN_DIR)
+include $(top_srcdir)/manpages.am
 appman_PRE = Xnest.man
-appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
-
-EXTRA_DIST = $(appman_PRE)
-CLEANFILES = $(appman_DATA)
-SUFFIXES = .$(APP_MAN_SUFFIX) .man
-
-.man.$(APP_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/xquartz/doc/Makefile.am b/hw/xquartz/doc/Makefile.am
index 287dc7a..5a0cde7 100644
--- a/hw/xquartz/doc/Makefile.am
+++ b/hw/xquartz/doc/Makefile.am
@@ -1,13 +1,2 @@
-appmandir = $(APP_MAN_DIR)
+include $(top_srcdir)/manpages.am
 appman_PRE = Xquartz.man
-appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
-
-EXTRA_DIST = $(appman_PRE)
-CLEANFILES = $(appman_DATA)
-SUFFIXES = .$(APP_MAN_SUFFIX) .man
-
-# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
-MAN_SUBSTS += 	-e 's|__laucnd_id_prefix__|$(LAUNCHD_ID_PREFIX)|g'
-
-.man.$(APP_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/xwin/man/Makefile.am b/hw/xwin/man/Makefile.am
index 98a89a5..d19c272 100644
--- a/hw/xwin/man/Makefile.am
+++ b/hw/xwin/man/Makefile.am
@@ -1,21 +1,3 @@
-appmandir = $(APP_MAN_DIR)
+include $(top_srcdir)/manpages.am
 appman_PRE = XWin.man
-appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
-
-filemandir = $(FILE_MAN_DIR)
 fileman_PRE = XWinrc.man
-fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX))
-
-EXTRA_DIST = $(appman_PRE) $(fileman_PRE)
-CLEANFILES = $(appman_DATA) $(fileman_DATA)
-SUFFIXES = .$(APP_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man
-
-# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
-MAN_SUBSTS += 	-e 's|__logdir__|$(logdir)|g' \
-		-e 's|__datadir__|$(datadir)|g' \
-		-e 's|__sysconfdir__|$(sysconfdir)|g'
-
-.man.$(APP_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
-.man.$(FILE_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/manpages.am b/manpages.am
new file mode 100644
index 0000000..69ee005
--- /dev/null
+++ b/manpages.am
@@ -0,0 +1,37 @@
+appmandir = $(APP_MAN_DIR)
+#appman_PRE = list of application man page files set by calling Makefile.am
+appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
+
+drivermandir = $(DRIVER_MAN_DIR)
+#driverman_PRE = list of driver man page files set by calling Makefile.am
+driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX))
+
+filemandir = $(FILE_MAN_DIR)
+#fileman_PRE = list of file man page files set by calling Makefile.am
+fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX))
+
+# The calling Makefile should only contain man page targets
+# Otherwise the following three global variables may conflict
+EXTRA_DIST = $(appman_PRE) $(driverman_PRE) $(fileman_PRE)
+CLEANFILES = $(appman_DATA) $(driverman_DATA) $(fileman_DATA)
+SUFFIXES = .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man
+
+# Add server specific man pages string substitution from XORG_MANPAGE_SECTIONS
+# 's|/,|/, |g' will add a space to help font path formatting
+MAN_SUBSTS += 	-e 's|__logdir__|$(logdir)|g' \
+		-e 's|__datadir__|$(datadir)|g' \
+		-e 's|__mandir__|$(mandir)|g' \
+		-e 's|__sysconfdir__|$(sysconfdir)|g' \
+		-e 's|__xconfigdir__|$(__XCONFIGDIR__)|g' \
+		-e 's|__xkbdir__|$(XKB_BASE_DIRECTORY)|g' \
+		-e 's|__laucnd_id_prefix__|$(LAUNCHD_ID_PREFIX)|g' \
+		-e 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' \
+		-e 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' \
+		-e '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g'
+
+.man.$(APP_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+.man.$(DRIVER_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+.man.$(FILE_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
commit c86f7c2b8eedd3126066a3aff44bc8767eb5e277
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:28:28 2011 -0500

    Xdmx: build all man pages using XORG_MANPAGE_SECTIONS
    
    Use standard directory and makefile.
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 45756ed..41d6e66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2239,11 +2239,13 @@ hw/xfree86/utils/man/Makefile
 hw/xfree86/utils/cvt/Makefile
 hw/xfree86/utils/gtf/Makefile
 hw/dmx/config/Makefile
+hw/dmx/config/man/Makefile
 hw/dmx/doc/Makefile
 hw/dmx/examples/Makefile
 hw/dmx/input/Makefile
 hw/dmx/glxProxy/Makefile
 hw/dmx/Makefile
+hw/dmx/man/Makefile
 hw/vfb/Makefile
 hw/vfb/man/Makefile
 hw/xnest/Makefile
diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am
index 2a87c39..e0b201b 100644
--- a/hw/dmx/Makefile.am
+++ b/hw/dmx/Makefile.am
@@ -1,5 +1,5 @@
 
-SUBDIRS = input config examples doc
+SUBDIRS = input config examples doc man
 bin_PROGRAMS = Xdmx
 
 if XINERAMA
@@ -85,28 +85,5 @@ Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
 Xdmx_DEPENDENCIES= $(XDMX_LIBS)
 Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS)
 
-# Man page
-appmandir = $(APP_MAN_DIR)
-
-appman_PRE = Xdmx.man
-appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
-
-CLEANFILES = $(appman_DATA)
-
-# Strings to replace in man pages
-XORGRELSTRING = @PACKAGE_STRING@
-  XORGMANNAME = X Version 11
-
-MAN_SUBSTS = \
-	-e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
-	-e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g'
-
-SUFFIXES = .$(APP_MAN_SUFFIX) .man
-
-.man.$(APP_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
-
-EXTRA_DIST = $(appman_PRE)
-
 relink:
 	$(AM_V_at)rm -f Xdmx$(EXEEXT) && $(MAKE) Xdmx$(EXEEXT)
diff --git a/hw/dmx/Xdmx.man b/hw/dmx/Xdmx.man
deleted file mode 100644
index 9c8bdea..0000000
--- a/hw/dmx/Xdmx.man
+++ /dev/null
@@ -1,741 +0,0 @@
-.\" $XFree86$
-.\"
-.\" Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
-.\" All Rights Reserved.
-.\"
-.\" Permission is hereby granted, free of charge, to any person obtaining
-.\" a copy of this software and associated documentation files (the
-.\" "Software"), to deal in the Software without restriction, including
-.\" without limitation on the rights to use, copy, modify, merge,
-.\" publish, distribute, sublicense, and/or sell copies of the Software,
-.\" and to permit persons to whom the Software is furnished to do so,
-.\" subject to the following conditions:
-.\"
-.\" he above copyright notice and this permission notice (including the
-.\" next paragraph) shall be included in all copies or substantial
-.\" portions of the Software.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-.\" NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
-.\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-.\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-.\" SOFTWARE.
-.TH Xdmx 1 __vendorversion__
-.SH NAME
-Xdmx - Distributed Multi-head X server
-.SH SYNOPSIS
-.B Xdmx
-[:display] [option ...]
-.SH DESCRIPTION
-.I Xdmx
-is a proxy X server that uses one or more other X servers as its display
-devices.  It provides multi-head X functionality for displays that might
-be located on different machines.
-.I Xdmx
-functions as a front-end X server that acts as a proxy to a set of
-back-end X servers.  All of the visible rendering is passed to the
-back-end X servers.  Clients connect to the
-.I Xdmx
-front-end, and everything appears as it would in a regular multi-head
-configuration.  If Xinerama is enabled (e.g., with
-.B +xinerama
-on the command line), the clients see a single large screen.
-.PP
-.I Xdmx
-communicates to the back-end X servers using the standard X11 protocol,
-and standard and/or commonly available X server extensions.
-.SH OPTIONS
-In addition to the normal X server options described in the
-.I Xserver(1)
-manual page,
-.I Xdmx
-accepts the following command line switches:
-.TP 8
-.BI "\-display " display-name
-This specifies the name(s) of the back-end X server display(s) to connect
-to.  This option may be specified multiple times to connect to more than
-one back-end display.  The first is used as screen 0, the second as screen 1,
-etc.  If this option is omitted, the
-.B $DISPLAY
-environment variable is used as the single back-end X server display.
-.sp
-.TP 8
-.BI "\-xinput " input-source
-This specifies the source to use for XInput extension devices.  The
-choices are the same as for
-.BR "\-input " ,
-described below, except that core devices on backend servers cannot be
-treated as XInput extension devices.  (Although extension devices on
-backend and console servers are supported as extension devices under
-.IR Xdmx ).
-.sp
-.TP 8
-.BI "\-input " input-source
-This specifies the source to use for the core input devices.  The choices are:
-.RS
-.TP 4
-.B dummy
-A set of dummy core input drivers are used.  These never generate any
-input events.
-.sp
-.TP 4
-.B local
-The raw keyboard and pointer from the local computer are used.  A
-comma-separated list of driver names can be appended.  For example, to
-select the example Linux keyboard and PS/2 mouse driver use:
-.BR "-input local,kbd,ps2" .
-The following drivers have been implemented for Linux: kbd, ms (a
-two-button Microsoft mouse driver), ps2 (a PS/2 mouse driver), usb-mou
-(a USB mouse driver), usb-kbd (a USB keyboard driver), and usb-oth (a
-USB non-keyboard, non-mouse driver).  Additional drivers may be
-implemented in the future.  Appropriate defaults will be used if no
-comma-separated list is provided.
-.sp
-.TP 4
-.I display-name
-If the display-name is a back-end server, then core input events are
-taken from the server specified.  Otherwise, a console window will be
-opened on the specified display.
-.sp
-If the
-.I display-name
-is followed by ",xi" then XInput extension devices on the display will
-be used as
-.I Xdmx
-XInput extension devices.  If the
-.I display-name
-is followed by ",noxi" then XInput extension devices on the display will
-.B not
-be used as
-.I Xdmx
-XInput extension devices.  Currently, the default is ",xi".
-.sp
-If the
-.I display-name
-is followed by ",console" and the
-.I display-name
-refers to a display that is used as a backend display, then a console
-window will be opened on that display
-.B and
-that display will be treated as a backend display.  Otherwise (or if
-",noconsole" is used), the display will be treated purely as a backend
-or a console display, as described above.
-.sp
-If the
-.I display-name
-is followed by ",windows", then outlines of the windows on the backend
-will be displayed inside the console window.  Otherwise (or if
-",nowindows" is used), the console window will not display the outlines
-of backend windows.  (This option only applies to console input.)
-.sp
-If the
-.I display-name
-is followed by ",xkb", then the next 1 to 3 comma-separated parameters
-will specify the keycodes, symbols, and geometry of the keyboard for
-this input device.  For example, ",xkb,xfree86,pc104" will specify that
-the "xfree86" keycodes and the "pc104" symbols should be used to
-initialize the keyboard.  For an SGI keyboard, ",xkb,sgi/indy(pc102)"
-might be useful.  A list of keycodes, symbols, and geometries can be
-found in
-.IR /usr/X11R6/lib/X11/xkb .
-If this option is not specified, the input device will be queried,
-perhaps using the XKEYBOARD extension.
-.RE
-.sp
-.RS
-If this option isn't specified, the default input source is the first
-back-end server (the one used for screen 0).  The console window shows
-the layout of the back-end display(s) and pointer movements and key
-presses within the console window will be used as core input devices.
-.sp
-Several special function keys are active, depending on the input
-source:
-.sp
-.RS
-.B Ctrl-Alt-q
-will terminate the
-.I Xdmx
-server in all modes.
-.sp
-.B Ctrl-Alt-g
-will toggle a
-server grab in console mode (a special cursor, currently a spider, is
-used to indicate an active server grab).
-.sp
-.B Ctrl-Alt-f
-will toggle fine-grain motion in console mode (a special cursor,
-currently a cross hair, is used to indicate this mode).  If this mode is
-combined with a server grab, then the cursor will have 4 lines instead
-of only 2.
-.sp
-.BR Ctrl-Alt-F1 " through " Ctrl-Alt-F12
-will switch to another VC in local (raw) mode.
-.RE
-.RE
-.sp
-.TP 8
-.BI "-shadowfb"
-This option turns on (legacy) support for the shadow frame buffer.
-.sp
-.TP 8
-.BI "-noshadowfb"
-This option turns off (legacy) support for the shadow frame buffer.
-Note that this option has been deprecated and will be removed in the
-next release.
-.sp
-.TP 8
-.BI "-nomulticursor"
-This option turns off support for displaying multiple cursors on
-overlapped back-end displays.  This option is available for testing and
-benchmarking purposes.
-.sp
-.TP 8
-.BI "-fontpath"
-This option sets the
-.I Xdmx
-server's default font path.  This option can be specified multiple times
-to accommodate multiple font paths.  See the
-.B "FONT PATHS"
-section below for very important information regarding setting the
-default font path.
-.sp
-.TP 8
-.BI "-configfile " filename
-Specify the configuration file that should be read.  Note that if the
-.B \-display
-command-line option is used, then the configuration file will be
-ignored.
-.sp
-.TP 8
-.BI "-config " name
-Specify a configuration to use.  The
-.I name
-will be the name following the
-.B virtual
-keyword in the configuration file.
-.sp
-.TP 8
-.BI "-stat " "interval screens"
-This option enables the display of performance statistics.  The interval
-is in seconds.  The screens is a count of the number of back-end screens
-for which data is printed each interval.  Specifying 0 for screens will
-display data for all screens.
-.sp
-For each screen, the following information is printed: the screen
-number, an absolute count of the number of XSync() calls made
-(SyncCount), the rate of these calls during the previous interval
-(Sync/s), the average round-trip time (in microseconds) of the last 10
-XSync() calls (avSync), the maximum round-trip time (in microseconds) of
-the last 10 XSync calls (mxSync), the average number of XSync() requests
-that were pending but not yet processed for each of the last 10
-processed XSync() calls, the maximum number of XSync() requests that
-were pending but not yet processed for each of the last 10 processed
-XSync() calls, and a histogram showing the distribution of the times of
-all of the XSync() calls that were made during the previous interval.
-.sp
-(The length of the moving average and the number and value of histogram
-bins are configurable at compile time in the
-.B dmxstat.h
-header file.)
-.sp
-.TP 8
-.BI "-syncbatch " interval
-This option sets the
-.I interval
-in milliseconds for XSync() batching.  An
-.I interval
-less than or equal to 0 will disable XSync() batching.  The default
-.I interval
-is 100 ms.
-.sp
-.TP 8
-.BI "-nooffscreenopt"
-This option disables the offscreen optimization.  Since the lazy window
-creation optimization requires the offscreen optimization to be enabled,
-this option will also disable the lazy window creation optimization.
-.sp
-.TP 8
-.BI "-nowindowopt"
-This option disables the lazy window creation optimization.
-.sp
-.TP 8
-.BI "-nosubdivprims"
-This option disables the primitive subdivision optimization.
-.sp
-.TP 8
-.BI "-noxkb"
-Disable use of the XKB extension for communication with the back end
-displays.  (Combine with
-.B "-kb"
-to disable all use of XKB.)
-.sp
-.TP 8
-.BI "-depth " int
-This option sets the root window's default depth.  When choosing a
-default visual from those available on the back-end X server, the first
-visual with that matches the depth specified is used.
-.sp
-This option can be combined with the
-.BI "-cc"
-option, which specifies the default color visual class, to force the use
-of a specific depth and color class for the root window.
-.sp
-.TP 8
-.BI "-norender"
-This option disables the RENDER extension.
-.sp
-.TP 8
-.BI "-noglxproxy"
-This option disables GLX proxy -- the build-in GLX extension
-implementation that is DMX aware.
-.sp
-.TP 8
-.BI "-noglxswapgroup"
-This option disables the swap group and swap barrier extensions in GLX
-proxy.
-.sp
-.TP 8
-.BI "-glxsyncswap"
-This option enables synchronization after a swap buffers call by waiting
-until all X protocol has been processed.  When a client issues a
-glXSwapBuffers request, Xdmx relays that request to each back-end X
-server, and those requests are buffered along with all other protocol
-requests.  However, in systems that have large network buffers, this
-buffering can lead to the set of back-end X servers handling the swap
-buffers request asynchronously.  With this option, an XSync() request is
-issued to each back-end X server after sending the swap buffers request.
-The XSync() requests will flush all buffered protocol (including the
-swap buffers requests) and wait until the back-end X servers have
-processed those requests before continuing.  This option does not wait
-until all GL commands have been processed so there might be previously
-issued commands that are still being processed in the GL pipe when the
-XSync() request returns.  See the
-.BI "-glxfinishswap"
-option below if Xdmx should wait until the GL commands have been
-processed.
-.sp
-.TP 8
-.BI "-glxfinishswap"
-This option enables synchronization after a swap buffers call by waiting
-until all GL commands have been completed.  It is similar to the
-.BI "-glxsyncswap"
-option above; however, instead of issuing an XSync(), it issues a
-glFinish() request to each back-end X server after sending the swap
-buffers requests.  The glFinish() request will flush all buffered
-protocol requests, process both X and GL requests, and wait until all
-previously called GL commands are complete before returning.
-.sp
-.TP 8
-.BI "-ignorebadfontpaths"
-This option ignores font paths that are not available on all back-end
-servers by removing the bad font path(s) from the default font path
-list.  If no valid font paths are left after removing the bad paths, an
-error to that effect is printed in the log.
-.sp
-.TP 8
-.BI "-addremovescreens"
-This option enables the dynamic addition and removal of screens, which
-is disabled by default.  Note that GLXProxy and Render do not yet
-support dynamic addition and removal of screens, and must be disabled
-via the
-.BI "-noglxproxy"
-and
-.BI "-norender"
-command line options described above.
-.sp
-.TP 8
-.BI "-param"
-This option specifies parameters on the command line.  Currently, only
-parameters dealing with XKEYBOARD configuration are supported.  These
-parameters apply only to the core keyboard.  Parameter values are
-installation-dependent.  Please see
-.I /usr/X11R6/lib/X11/xkb
-or a similar directory for complete information.
-.RS
-.TP 8
-.B XkbRules
-Defaults to "xfree86".  Other values may include "sgi" and "sun".
-.sp
-.TP 8
-.B XkbModel
-Defaults to "pc101".  When used with "xfree86" rules, other values may
-include "pc102", "pc104", "pc105", "microsoft", and many others.  When
-used with "sun" rules, other values may include "type4" and "type5".
-.sp
-.TP 8
-.B XkbLayout
-Defaults to "us".  Other country codes and "dvorak" are usually
-available.
-.sp
-.TP 8
-.B XkbVariant
-Defaults to "".
-.sp
-.TP 8
-.B XkbOptions
-Defaults to "".
-.RE
-.SH "CONFIGURATION FILE GRAMMAR"
-The following words and tokens are reserved:
-.RS
-.B virtual
-.B display
-.B wall
-.B option
-.B param
-.B {
-.B }
-.B ;
-.B #
-.RE
-.PP
-Comments start with a
-.B #
-mark and extend to the end of the line.  They may appear anywhere.  If a
-configuration file is read into
-.BR xdmxconfig ,
-the comments in that file will be preserved, but will not be editable.
-.PP
-The grammar is as follows:
-.RS
-virtual-list ::= [ virtual-list ] | virtual
-
-virtual ::=
-.B virtual
-[ name ] [ dim ]
-.B {
-dw-list
-.B }
-
-dw-list ::= [ dw-list ] | dw
-
-dw ::= display | wall | option
-
-display ::=
-.B display
-name [ geometry ] [ / geometry ] [ origin ]
-.B ;
-
-wall ::=
-.B wall
-[ dim ] [ dim ] name-list
-.B ;
-
-option ::=
-.B option
-name-list
-.B ;
-
-param ::=
-.B param
-name-list
-.B ;
-
-param ::=
-.B param {
-param-list
-.B }
-
-param-list ::= [ param-list ] | name-list
-.B ;
-
-name-list ::= [ name-list ] | name
-
-name ::= string | double-quoted-string
-
-dim ::= integer
-.B x
-integer
-
-geometry ::= [ integer
-.B x
-integer ] [ signed-integer signed-integer ]
-
-origin ::=
-.B @
-integer
-.B x
-integer
-.RE
-.PP
-The name following
-.B virtual
-is used as an identifier for the configuration, and may be passed to
-.B Xdmx
-using the
-.B \-config
-command line option.  The name of a display should be standard X display
-name, although no checking is performed (e.g., "machine:0").
-.PP
-For names, double quotes are optional unless the name is reserved or
-contains spaces.
-.PP
-The first dimension following
-.B wall
-is the dimension for tiling (e.g., 2x4 or 4x4).  The second dimension
-following
-.B wall
-is the dimension of each display in the wall (e.g., 1280x1024).
-.PP
-The first geometry following
-.B display
-is the geometry of the screen window on the backend server.  The second
-geometry, which is always preceeded by a slash, is the geometry of the
-root window.  By default, the root window has the same geometry as the
-screen window.
-.PP
-The
-.B option
-line can be used to specify any command-line options (e.g.,
-.BR \-input ).
-(It cannot be used to specify the name of the front-end display.)  The
-option line is processed once at server startup, just line command line
-options.  This behavior may be unexpected.
-.SH "CONFIGURATION FILE EXAMPLES"
-Two displays being used for a desktop may be specified in any of the
-following formats:
-.RS
-.nf
-virtual example0 {
-    display d0:0 1280x1024 @0x0;
-    display d1:0 1280x1024 @1280x0;
-}
-.sp
-virtual example1 {
-    display d0:0 1280x1024;
-    display d1:0 @1280x0;
-}
-.sp
-virtual example2 {
-    display "d0:0";
-    display "d1:0" @1280x0;
-}
-.sp
-virtual example3 { wall 2x1 d0:0 d1:0; }
-.fi
-.RE
-A 4x4 wall of 16 total displays could be specified as follows (if no
-tiling dimension is specified, an approximate square is used):
-.RS
-.nf
-virtual example4 {
-    wall d0:0 d1:0 d2:0 d3:0
-         d4:0 d5:0 d6:0 d7:0
-         d8:0 d9:0 da:0 db:0
-         dc:0 dd:0 de:0 df:0;
-}
-.fi
-.RE
-.SH "FONT PATHS"
-The font path used by the
-.I Xdmx
-front-end server will be propagated to each back-end server,which
-requires that each back-end server have access to the exact same font
-paths as the front-end server.  This can be most easily handled by
-either using a font server (e.g., xfs) or by remotely mounting the font
-paths on each back-end server, and then setting the
-.I Xdmx
-server's default font path with the
--I "-fontpath"
-command line option described above.
-.PP
-For example, if you specify a font path with the following command line:
-.RS
-Xdmx :1 -display d0:0 -fontpath /usr/fonts/75dpi/ -fontpath /usr/fonts/Type1/ +xinerama
-.RE
-Then, /usr/fonts/75dpi/ and /usr/fonts/Type1/ must be valid font paths
-on the
-.I Xdmx
-server and all back-end server, which is d0 in this example.
-.PP
-Font servers can also be specified with the
-.I "-fontpath"
-option.  For example, let's assume that a properly configured font
-server is running on host d0.  Then, the following command line
-.RS
-Xdmx :1 -display d0:0 -display d1:0 -fontpath tcp/d0:7100 +xinerama
-.RE
-will initialize the front-end
-.I Xdmx
-server and each of the back-end servers to use the font server on d0.
-.PP
-Some fonts might not be supported by either the front-end or the
-back-end servers.  For example, let's assume the front-end
-.I Xdmx
-server includes support Type1 fonts, but one of the back-end servers
-does not.  Let's also assume that the default font path for
-.I Xdmx
-includes Type1 fonts in its font path.  Then, when
-.I Xdmx
-initializes the default font path to load the default font, the font
-path that includes Type1 fonts (along with the other default font paths
-that are used by the
-.I Xdmx
-server) is sent to the back-end server that cannot handle Type1 fonts.
-That back-end server then rejects the font path and sends an error back
-to the
-.I Xdmx
-server.
-.I Xdmx
-then prints an error message and exits because it failed to set the
-default font path and was unable load the default font.
-.PP
-To fix this error, the offending font path must be removed from the
-default font path by using a different
-.I "-fontpath"
-command line option.
-.PP
-The
-.I "-fontpath"
-option can also be added to the configuration file as described above.
-.SH "COMMAND-LINE EXAMPLES"
-The back-end machines are d0 and d1, core input is from the pointer and
-keyboard attached to d0, clients will refer to :1 when opening windows:
-.RS
-Xdmx :1 -display d0:0 -display d1:0 +xinerama
-.RE
-.PP
-As above, except with core input from d1:
-.RS
-Xdmx :1 -display d0:0 -display d1:0 -input d1:0 +xinerama
-.RE
-.PP
-As above, except with core input from a console window on the local
-display:
-.RS
-Xdmx :1 -display d0:0 -display d1:0 -input :0 +xinerama
-.RE
-.PP
-As above, except with core input from the local keyboard and mouse:
-.RS
-Xdmx :1 -display d0:0 -display d1:0 -input local,kbd,ps2 +xinerama
-.RE
-Note that local input can be used under Linux while another X session is
-running on :0 (assuming the user can access the Linux console tty and
-mouse devices): a new (blank) VC will be used for keyboard input on the
-local machine and the Ctrl-Alt-F* sequence will be available to change
-to another VC (possibly back to another X session running on the local
-machine).  Using Ctrl-Alt-Backspace on the blank VC will terminate the
-Xdmx session and return to the original VC.
-.PP
-This example uses the configuration file shown in the previous section:
-.RS
-Xdmx :1 -input :0 +xinerama -configfile filename -config example2
-.RE
-With this configuration file line:
-.RS
-option -input :0 +xinerama;
-.RE
-the command line can be shortened to:
-.RS
-Xdmx :1 -configfile filename -config example2
-.RE
-.SH "USING THE USB DEVICE DRIVERS"
-.P
-The USB device drivers use the devices called
-.IR /dev/input/event0 ", " /dev/input/event1 ", etc."
-under Linux.  These devices are driven using the
-.I evdev
-Linux kernel module, which is part of the hid suite.  Please note that
-if you load the
-.I mousedev
-or
-.I kbddev
-Linux kernel modules, then USB devices will appear as core Linux input
-devices and you will not be able to select between using the device only
-as an
-.I Xdmx
-core device or an
-.I Xdmx
-XInput extension device.  Further, you may be unable to unload the
-.I mousedev
-Linux kernel module if
-.I XFree86
-is configured to use
-.I /dev/input/mice
-as an input device (this is quite helpful for laptop users and is set up
-by default under some Linux distributions, but should be changed if USB
-devices are to be used with
-.IR Xdmx ).
-.PP
-The USB device drivers search through the Linux devices for the first
-mouse, keyboard, or non-mouse-non-keyboard Linux device and use that
-device.
-.SH "KEYBOARD INITIALIZATION"
-.PP
-If
-.I Xdmx
-was invoked with
-.I \-xkb
-or was
-.B not
-compiled to use the XKEYBOARD extension, then a keyboard on a backend or
-console will be initialized using the map that the host X server
-provides.
-.PP
-If the XKEYBOARD extension is used for both
-.I Xdmx
-and the host X server for the keyboard (i.e., the backend or console X
-server), then the type of the keyboard will
-be obtained from the host X server and the keyboard under
-.I Xdmx
-will be initialized with that information.  Otherwise, the default type
-of keyboard will be initialized.  In both cases, the map from the host X
-server will
-.B not
-be used.  This means that different initial behavior may be noted with
-and without XKEYBOARD.  Consistent and expected results will be obtained
-by running XKEYBOARD on all servers and by avoiding the use of
-.I xmodmap
-on the backend or console X servers prior to starting
-.IR Xdmx .
-.PP
-If
-.I \-xkbmap
-is specified on the
-.I Xdmx
-command line, then that map will currently be used for all keyboards.
-.SH "MULTIPLE CORE KEYBOARDS"
-X was not designed to support multiple core keyboards.  However,
-.I Xdmx
-provides some support for multiple core keyboards.  Best results will be
-obtained if all of the keyboards are of the same type and are using the
-same keyboard map.  Because the X server passes raw key code information
-to the X client, key symbols for keyboards with different key maps would
-be different if the key code for each keyboard was sent without
-translation to the client.  Therefore,
-.I Xdmx
-will attempt to translate the key code from a core keyboard to the key
-code for the key with the same key symbol of the
-.B first
-core keyboard that was loaded.  If the key symbol appears in both maps,
-the results will be expected.  Otherwise, the second core keyboard will
-return a NoSymbol key symbol for some keys that would have been
-translated if it was the first core keyboard.
-.ig
-.SH ENVIRONMENT
-..
-.ig
-.SH FILES
-..
-.SH "SEE ALSO"
-.BR DMX "(3X), " X "(__miscmansuffix__), " Xserver "(1), " xdmxconfig "(1), "
-.BR vdltodmx "(1), " xfs "(1), " xkbcomp (1)
-.SH AUTHORS
-Kevin E. Martin
-.I <kem at redhat.com>,
-David H. Dawes
-.I <dawes at xfree86.org>,
-and
-Rickard E. (Rik) Faith
-.IR <faith at redhat.com> .
-.PP
-Portions of
-.I Xdmx
-are based on code from The XFree86 Project
-.RI ( http://www.xfree86.org )
-and X.Org
-.RI ( http://www.x.org ).
diff --git a/hw/dmx/config/Makefile.am b/hw/dmx/config/Makefile.am
index 25a814e..de4ce31 100644
--- a/hw/dmx/config/Makefile.am
+++ b/hw/dmx/config/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = man
+
 noinst_LIBRARIES = libdmxconfig.a
 
 LIBSRCS = parser.y \
@@ -53,26 +55,7 @@ dmxtodmx_DEPENDENCIES = libdmxconfig.a
 dmxtodmx_SOURCES = dmxtodmx.c
 dmxtodmx_LDADD = -L. -ldmxconfig
 
-appmandir = $(APP_MAN_DIR)
-
-appman_PRE = xdmxconfig.man vdltodmx.man dmxtodmx.man
-appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
-
-CLEANFILES = $(appman_DATA)
-
-SUFFIXES = .$(APP_MAN_SUFFIX) .man
-
-# Strings to replace in man pages
-XORGRELSTRING = @PACKAGE_STRING@
-  XORGMANNAME = X Version 11
-
-MAN_SUBSTS = -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' 
-
-.man.$(APP_MAN_SUFFIX):
-	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
-
 EXTRA_DIST = \
-	$(appman_PRE) \
 	test-a.in test-a.out \
 	test-b.in test-b.out \
 	test-c.in test-c.out \
diff --git a/hw/dmx/config/dmxtodmx.man b/hw/dmx/config/dmxtodmx.man
deleted file mode 100644
index 68c7f5b..0000000
--- a/hw/dmx/config/dmxtodmx.man
+++ /dev/null
@@ -1,41 +0,0 @@
-.\" $XFree86$
-.\" Copyright 2002 Red Hat Inc., Durham, North Carolina.
-.\" All Rights Reserved.
-.\"
-.\" Permission is hereby granted, free of charge, to any person obtaining
-.\" a copy of this software and associated documentation files (the
-.\" "Software"), to deal in the Software without restriction, including
-.\" without limitation on the rights to use, copy, modify, merge,
-.\" publish, distribute, sublicense, and/or sell copies of the Software,
-.\" and to permit persons to whom the Software is furnished to do so,
-.\" subject to the following conditions:
-.\"
-.\" The above copyright notice and this permission notice (including the
-.\" next paragraph) shall be included in all copies or substantial
-.\" portions of the Software.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-.\" NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
-.\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-.\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-.\" SOFTWARE.
-.\"
-.\" Authors:
-.\"   Rickard E. (Rik) Faith <faith at redhat.com>
-.\"
-.TH dmxtodmx 1 __vendorversion__
-.SH NAME
-dmxtodmx - dmx configuration file parser and printer
-.SH SYNOPSIS
-.B dmxtodmx
-.SH DESCRIPTION
-.I dmxtodmx
-reads the standard input, parsing a configuration file for the
-.I Xdmx
-distributed multi-head X server.  After a successful parse, the file is
-pretty-printed to standard output.
-.SH "SEE ALSO"
-Xdmx(1), vdltodmx(1), xdmxconfig(1)
diff --git a/hw/dmx/config/man/Makefile.am b/hw/dmx/config/man/Makefile.am
new file mode 100644
index 0000000..c12c78f
--- /dev/null
+++ b/hw/dmx/config/man/Makefile.am
@@ -0,0 +1,10 @@
+appmandir = $(APP_MAN_DIR)
+appman_PRE = xdmxconfig.man vdltodmx.man dmxtodmx.man
+appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
+
+EXTRA_DIST = $(appman_PRE)
+CLEANFILES = $(appman_DATA)
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/dmx/config/man/dmxtodmx.man b/hw/dmx/config/man/dmxtodmx.man
new file mode 100644
index 0000000..68c7f5b
--- /dev/null
+++ b/hw/dmx/config/man/dmxtodmx.man
@@ -0,0 +1,41 @@
+.\" $XFree86$
+.\" Copyright 2002 Red Hat Inc., Durham, North Carolina.
+.\" All Rights Reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining
+.\" a copy of this software and associated documentation files (the
+.\" "Software"), to deal in the Software without restriction, including
+.\" without limitation on the rights to use, copy, modify, merge,
+.\" publish, distribute, sublicense, and/or sell copies of the Software,
+.\" and to permit persons to whom the Software is furnished to do so,
+.\" subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the
+.\" next paragraph) shall be included in all copies or substantial
+.\" portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+.\" NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+.\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+.\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+.\" SOFTWARE.
+.\"
+.\" Authors:
+.\"   Rickard E. (Rik) Faith <faith at redhat.com>
+.\"
+.TH dmxtodmx 1 __vendorversion__
+.SH NAME
+dmxtodmx - dmx configuration file parser and printer
+.SH SYNOPSIS
+.B dmxtodmx
+.SH DESCRIPTION
+.I dmxtodmx
+reads the standard input, parsing a configuration file for the
+.I Xdmx
+distributed multi-head X server.  After a successful parse, the file is
+pretty-printed to standard output.
+.SH "SEE ALSO"
+Xdmx(1), vdltodmx(1), xdmxconfig(1)
diff --git a/hw/dmx/config/man/vdltodmx.man b/hw/dmx/config/man/vdltodmx.man
new file mode 100644
index 0000000..b733db7
--- /dev/null
+++ b/hw/dmx/config/man/vdltodmx.man
@@ -0,0 +1,95 @@
+.\" $XFree86$
+.\" Copyright 2002 Red Hat Inc., Durham, North Carolina.
+.\" All Rights Reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining
+.\" a copy of this software and associated documentation files (the
+.\" "Software"), to deal in the Software without restriction, including
+.\" without limitation on the rights to use, copy, modify, merge,
+.\" publish, distribute, sublicense, and/or sell copies of the Software,
+.\" and to permit persons to whom the Software is furnished to do so,
+.\" subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the
+.\" next paragraph) shall be included in all copies or substantial
+.\" portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+.\" NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+.\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+.\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+.\" SOFTWARE.
+.\"
+.\" Authors:
+.\"   Rickard E. (Rik) Faith <faith at redhat.com>
+.\"
+.TH vdltodmx 1 __vendorversion__
+.SH NAME
+vdltodmx - dmx configuration file parser and printer
+.SH SYNOPSIS
+.B vdltodmx
+.I infile
+.I outfile
+.SH DESCRIPTION
+.I vdltodmx
+reads the input file, which should be in VDL configuration file format.
+After a successful parse, a file in Xdmx configuration file format is
+written to the output file.
+.P
+The VDL file format is used with
+.IR xmovie ,
+which is available from
+http://www.llnl.gov/icc/lc/img/xmovie/xmovie.html
+.SH EXAMPLE
+Given the following VDL-format file:
+.RS
+.nf
+0
+2
+#
+#
+2560 2048 Left two-thirds [restrict=*:2]
+2
+:2.1 1280 2048   0    0 0 0
+:2.2 1280 2048   1280 0 0 0
+4
+1280 1024 0      0
+1280 1024 0      1024
+1280 1024 1280   0
+1280 1024 1280   1024
+#
+2560 2048 Right two-thirds [restrict=*:2]
+2
+:2.2 1280 2048   0   0 0 0
+:2.3 1280 2048   1280 0 0 0
+4
+1280 1024 1280    0
+1280 1024 1280    1024
+1280 1024 2560 0
+1280 1024 2560 1024
+.fi
+.RE
+the following DMX-format file will be produced:
+.RS
+.nf
+#
+#
+virtual "Left two-thirds" 2560x2048 {
+    display :2.1 1280x2048;
+    display :2.2 1280x2048 @1280x0;
+}
+#
+virtual "Right two-thirds" 2560x2048 {
+    display :2.2 1280x2048;
+    display :2.3 1280x2048 @1280x0;
+}
+.fi
+.RE
+.SH BUGS
+If the VDL file is not in the expected format, the program will probably
+dump core.
+.SH "SEE ALSO"
+Xdmx(1), xdmxconfig(1), vdl(3), xmovie(1)
diff --git a/hw/dmx/config/man/xdmxconfig.man b/hw/dmx/config/man/xdmxconfig.man
new file mode 100644
index 0000000..dcceea0
--- /dev/null
+++ b/hw/dmx/config/man/xdmxconfig.man
@@ -0,0 +1,63 @@
+.\" $XFree86$
+.\" Copyright 2002 Red Hat Inc., Durham, North Carolina.
+.\" All Rights Reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining
+.\" a copy of this software and associated documentation files (the
+.\" "Software"), to deal in the Software without restriction, including
+.\" without limitation on the rights to use, copy, modify, merge,
+.\" publish, distribute, sublicense, and/or sell copies of the Software,
+.\" and to permit persons to whom the Software is furnished to do so,
+.\" subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the
+.\" next paragraph) shall be included in all copies or substantial
+.\" portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+.\" NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+.\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+.\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+.\" SOFTWARE.
+.\"
+.\" Authors:
+.\"   Rickard E. (Rik) Faith <faith at redhat.com>
+.\"
+.TH xdmxconfig 1 __vendorversion__
+.SH NAME
+xdmxconfig - a graphical configuration tool for Xdmx configuration files
+.SH SYNOPSIS
+.B xdmxconfig
+[filename]
+.SH DESCRIPTION
+.I xdmxconfig
+reads, edits, and writes configuration files for the Xdmx server.  The
+grammar for the configuration file is specified in the Xdmx(1) manual
+page.
+.PP
+To start from scratch, create a "New Global" and specify the name and
+overall dimensions for the configuration.  Then use "New Display" to
+enter more displays.
+.PP
+If there is more than one configuration, the configuration name button
+will bring up a selection menu.
+.PP
+In the right-hand pannel, the left mouse button will move the
+highlighted display at "tool resolution"; the middle mouse button will
+move the highlighted display by a single pixel (at "wall resolution");
+and the right mouse button will bring up a menu allowing the highlighted
+display to be edited or deleted.  The arrow keys will also move the
+highlighted display by a single pixel.
+.SH BUGS
+Currently, entries with the
+.B wall
+keyword are not editable, but will be preserved in the new output file.
+The tool will quit when requested by the user, even if a configuration
+file has not been written out (i.e., without warning).  The menu
+interaction should be improved (menu entries that don't currently work
+should be greyed-out, for example).  The Help button does not work.
+.SH "SEE ALSO"
+Xdmx(1), vdltodmx(1)
diff --git a/hw/dmx/config/vdltodmx.man b/hw/dmx/config/vdltodmx.man
deleted file mode 100644
index b733db7..0000000
--- a/hw/dmx/config/vdltodmx.man
+++ /dev/null
@@ -1,95 +0,0 @@
-.\" $XFree86$
-.\" Copyright 2002 Red Hat Inc., Durham, North Carolina.
-.\" All Rights Reserved.
-.\"
-.\" Permission is hereby granted, free of charge, to any person obtaining
-.\" a copy of this software and associated documentation files (the
-.\" "Software"), to deal in the Software without restriction, including
-.\" without limitation on the rights to use, copy, modify, merge,
-.\" publish, distribute, sublicense, and/or sell copies of the Software,
-.\" and to permit persons to whom the Software is furnished to do so,
-.\" subject to the following conditions:
-.\"
-.\" The above copyright notice and this permission notice (including the
-.\" next paragraph) shall be included in all copies or substantial
-.\" portions of the Software.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-.\" NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
-.\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-.\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-.\" SOFTWARE.
-.\"
-.\" Authors:
-.\"   Rickard E. (Rik) Faith <faith at redhat.com>
-.\"
-.TH vdltodmx 1 __vendorversion__
-.SH NAME
-vdltodmx - dmx configuration file parser and printer
-.SH SYNOPSIS
-.B vdltodmx
-.I infile
-.I outfile
-.SH DESCRIPTION
-.I vdltodmx
-reads the input file, which should be in VDL configuration file format.
-After a successful parse, a file in Xdmx configuration file format is
-written to the output file.
-.P
-The VDL file format is used with
-.IR xmovie ,
-which is available from
-http://www.llnl.gov/icc/lc/img/xmovie/xmovie.html
-.SH EXAMPLE
-Given the following VDL-format file:
-.RS
-.nf
-0
-2
-#
-#
-2560 2048 Left two-thirds [restrict=*:2]
-2
-:2.1 1280 2048   0    0 0 0
-:2.2 1280 2048   1280 0 0 0
-4
-1280 1024 0      0
-1280 1024 0      1024
-1280 1024 1280   0
-1280 1024 1280   1024
-#
-2560 2048 Right two-thirds [restrict=*:2]
-2
-:2.2 1280 2048   0   0 0 0
-:2.3 1280 2048   1280 0 0 0
-4
-1280 1024 1280    0
-1280 1024 1280    1024
-1280 1024 2560 0
-1280 1024 2560 1024
-.fi
-.RE
-the following DMX-format file will be produced:
-.RS
-.nf
-#
-#
-virtual "Left two-thirds" 2560x2048 {
-    display :2.1 1280x2048;
-    display :2.2 1280x2048 @1280x0;
-}
-#
-virtual "Right two-thirds" 2560x2048 {
-    display :2.2 1280x2048;
-    display :2.3 1280x2048 @1280x0;
-}
-.fi
-.RE
-.SH BUGS
-If the VDL file is not in the expected format, the program will probably
-dump core.
-.SH "SEE ALSO"
-Xdmx(1), xdmxconfig(1), vdl(3), xmovie(1)
diff --git a/hw/dmx/config/xdmxconfig.man b/hw/dmx/config/xdmxconfig.man
deleted file mode 100644
index dcceea0..0000000
--- a/hw/dmx/config/xdmxconfig.man
+++ /dev/null
@@ -1,63 +0,0 @@
-.\" $XFree86$
-.\" Copyright 2002 Red Hat Inc., Durham, North Carolina.
-.\" All Rights Reserved.
-.\"
-.\" Permission is hereby granted, free of charge, to any person obtaining
-.\" a copy of this software and associated documentation files (the
-.\" "Software"), to deal in the Software without restriction, including
-.\" without limitation on the rights to use, copy, modify, merge,
-.\" publish, distribute, sublicense, and/or sell copies of the Software,
-.\" and to permit persons to whom the Software is furnished to do so,
-.\" subject to the following conditions:
-.\"
-.\" The above copyright notice and this permission notice (including the
-.\" next paragraph) shall be included in all copies or substantial
-.\" portions of the Software.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-.\" NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
-.\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-.\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-.\" SOFTWARE.
-.\"
-.\" Authors:
-.\"   Rickard E. (Rik) Faith <faith at redhat.com>
-.\"
-.TH xdmxconfig 1 __vendorversion__
-.SH NAME
-xdmxconfig - a graphical configuration tool for Xdmx configuration files
-.SH SYNOPSIS
-.B xdmxconfig
-[filename]
-.SH DESCRIPTION
-.I xdmxconfig
-reads, edits, and writes configuration files for the Xdmx server.  The
-grammar for the configuration file is specified in the Xdmx(1) manual
-page.
-.PP
-To start from scratch, create a "New Global" and specify the name and
-overall dimensions for the configuration.  Then use "New Display" to
-enter more displays.
-.PP
-If there is more than one configuration, the configuration name button
-will bring up a selection menu.
-.PP
-In the right-hand pannel, the left mouse button will move the
-highlighted display at "tool resolution"; the middle mouse button will
-move the highlighted display by a single pixel (at "wall resolution");
-and the right mouse button will bring up a menu allowing the highlighted
-display to be edited or deleted.  The arrow keys will also move the
-highlighted display by a single pixel.
-.SH BUGS
-Currently, entries with the
-.B wall
-keyword are not editable, but will be preserved in the new output file.
-The tool will quit when requested by the user, even if a configuration
-file has not been written out (i.e., without warning).  The menu
-interaction should be improved (menu entries that don't currently work
-should be greyed-out, for example).  The Help button does not work.
-.SH "SEE ALSO"
-Xdmx(1), vdltodmx(1)
diff --git a/hw/dmx/man/Makefile.am b/hw/dmx/man/Makefile.am
new file mode 100644
index 0000000..a0522ae
--- /dev/null
+++ b/hw/dmx/man/Makefile.am
@@ -0,0 +1,10 @@
+appmandir = $(APP_MAN_DIR)
+appman_PRE = Xdmx.man
+appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
+
+EXTRA_DIST = $(appman_PRE)
+CLEANFILES = $(appman_DATA)
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/dmx/man/Xdmx.man b/hw/dmx/man/Xdmx.man
new file mode 100644
index 0000000..9c8bdea
--- /dev/null
+++ b/hw/dmx/man/Xdmx.man
@@ -0,0 +1,741 @@
+.\" $XFree86$
+.\"
+.\" Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+.\" All Rights Reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining
+.\" a copy of this software and associated documentation files (the
+.\" "Software"), to deal in the Software without restriction, including
+.\" without limitation on the rights to use, copy, modify, merge,
+.\" publish, distribute, sublicense, and/or sell copies of the Software,
+.\" and to permit persons to whom the Software is furnished to do so,
+.\" subject to the following conditions:
+.\"
+.\" he above copyright notice and this permission notice (including the
+.\" next paragraph) shall be included in all copies or substantial
+.\" portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+.\" NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+.\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+.\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+.\" SOFTWARE.
+.TH Xdmx 1 __vendorversion__
+.SH NAME
+Xdmx - Distributed Multi-head X server
+.SH SYNOPSIS
+.B Xdmx
+[:display] [option ...]
+.SH DESCRIPTION
+.I Xdmx
+is a proxy X server that uses one or more other X servers as its display
+devices.  It provides multi-head X functionality for displays that might
+be located on different machines.
+.I Xdmx
+functions as a front-end X server that acts as a proxy to a set of
+back-end X servers.  All of the visible rendering is passed to the
+back-end X servers.  Clients connect to the
+.I Xdmx
+front-end, and everything appears as it would in a regular multi-head
+configuration.  If Xinerama is enabled (e.g., with
+.B +xinerama
+on the command line), the clients see a single large screen.
+.PP
+.I Xdmx
+communicates to the back-end X servers using the standard X11 protocol,
+and standard and/or commonly available X server extensions.
+.SH OPTIONS
+In addition to the normal X server options described in the
+.I Xserver(1)
+manual page,
+.I Xdmx
+accepts the following command line switches:
+.TP 8
+.BI "\-display " display-name
+This specifies the name(s) of the back-end X server display(s) to connect
+to.  This option may be specified multiple times to connect to more than
+one back-end display.  The first is used as screen 0, the second as screen 1,
+etc.  If this option is omitted, the
+.B $DISPLAY
+environment variable is used as the single back-end X server display.
+.sp
+.TP 8
+.BI "\-xinput " input-source
+This specifies the source to use for XInput extension devices.  The
+choices are the same as for
+.BR "\-input " ,
+described below, except that core devices on backend servers cannot be
+treated as XInput extension devices.  (Although extension devices on
+backend and console servers are supported as extension devices under
+.IR Xdmx ).
+.sp
+.TP 8
+.BI "\-input " input-source
+This specifies the source to use for the core input devices.  The choices are:
+.RS
+.TP 4
+.B dummy
+A set of dummy core input drivers are used.  These never generate any
+input events.
+.sp
+.TP 4
+.B local
+The raw keyboard and pointer from the local computer are used.  A
+comma-separated list of driver names can be appended.  For example, to
+select the example Linux keyboard and PS/2 mouse driver use:
+.BR "-input local,kbd,ps2" .
+The following drivers have been implemented for Linux: kbd, ms (a
+two-button Microsoft mouse driver), ps2 (a PS/2 mouse driver), usb-mou
+(a USB mouse driver), usb-kbd (a USB keyboard driver), and usb-oth (a
+USB non-keyboard, non-mouse driver).  Additional drivers may be
+implemented in the future.  Appropriate defaults will be used if no
+comma-separated list is provided.
+.sp
+.TP 4
+.I display-name
+If the display-name is a back-end server, then core input events are
+taken from the server specified.  Otherwise, a console window will be
+opened on the specified display.
+.sp
+If the
+.I display-name
+is followed by ",xi" then XInput extension devices on the display will
+be used as
+.I Xdmx
+XInput extension devices.  If the
+.I display-name
+is followed by ",noxi" then XInput extension devices on the display will
+.B not
+be used as
+.I Xdmx
+XInput extension devices.  Currently, the default is ",xi".
+.sp
+If the
+.I display-name
+is followed by ",console" and the
+.I display-name
+refers to a display that is used as a backend display, then a console
+window will be opened on that display
+.B and
+that display will be treated as a backend display.  Otherwise (or if
+",noconsole" is used), the display will be treated purely as a backend
+or a console display, as described above.
+.sp
+If the
+.I display-name
+is followed by ",windows", then outlines of the windows on the backend
+will be displayed inside the console window.  Otherwise (or if
+",nowindows" is used), the console window will not display the outlines
+of backend windows.  (This option only applies to console input.)
+.sp
+If the
+.I display-name
+is followed by ",xkb", then the next 1 to 3 comma-separated parameters
+will specify the keycodes, symbols, and geometry of the keyboard for
+this input device.  For example, ",xkb,xfree86,pc104" will specify that
+the "xfree86" keycodes and the "pc104" symbols should be used to
+initialize the keyboard.  For an SGI keyboard, ",xkb,sgi/indy(pc102)"
+might be useful.  A list of keycodes, symbols, and geometries can be
+found in
+.IR /usr/X11R6/lib/X11/xkb .
+If this option is not specified, the input device will be queried,
+perhaps using the XKEYBOARD extension.
+.RE
+.sp
+.RS
+If this option isn't specified, the default input source is the first
+back-end server (the one used for screen 0).  The console window shows
+the layout of the back-end display(s) and pointer movements and key
+presses within the console window will be used as core input devices.
+.sp
+Several special function keys are active, depending on the input
+source:
+.sp
+.RS
+.B Ctrl-Alt-q
+will terminate the
+.I Xdmx
+server in all modes.
+.sp
+.B Ctrl-Alt-g
+will toggle a
+server grab in console mode (a special cursor, currently a spider, is
+used to indicate an active server grab).
+.sp
+.B Ctrl-Alt-f
+will toggle fine-grain motion in console mode (a special cursor,
+currently a cross hair, is used to indicate this mode).  If this mode is
+combined with a server grab, then the cursor will have 4 lines instead
+of only 2.
+.sp
+.BR Ctrl-Alt-F1 " through " Ctrl-Alt-F12
+will switch to another VC in local (raw) mode.
+.RE
+.RE
+.sp
+.TP 8
+.BI "-shadowfb"
+This option turns on (legacy) support for the shadow frame buffer.
+.sp
+.TP 8
+.BI "-noshadowfb"
+This option turns off (legacy) support for the shadow frame buffer.
+Note that this option has been deprecated and will be removed in the
+next release.
+.sp
+.TP 8
+.BI "-nomulticursor"
+This option turns off support for displaying multiple cursors on
+overlapped back-end displays.  This option is available for testing and
+benchmarking purposes.
+.sp
+.TP 8
+.BI "-fontpath"
+This option sets the
+.I Xdmx
+server's default font path.  This option can be specified multiple times
+to accommodate multiple font paths.  See the
+.B "FONT PATHS"
+section below for very important information regarding setting the
+default font path.
+.sp
+.TP 8
+.BI "-configfile " filename
+Specify the configuration file that should be read.  Note that if the
+.B \-display
+command-line option is used, then the configuration file will be
+ignored.
+.sp
+.TP 8
+.BI "-config " name
+Specify a configuration to use.  The
+.I name
+will be the name following the
+.B virtual
+keyword in the configuration file.
+.sp
+.TP 8
+.BI "-stat " "interval screens"
+This option enables the display of performance statistics.  The interval
+is in seconds.  The screens is a count of the number of back-end screens
+for which data is printed each interval.  Specifying 0 for screens will
+display data for all screens.
+.sp
+For each screen, the following information is printed: the screen
+number, an absolute count of the number of XSync() calls made
+(SyncCount), the rate of these calls during the previous interval
+(Sync/s), the average round-trip time (in microseconds) of the last 10
+XSync() calls (avSync), the maximum round-trip time (in microseconds) of
+the last 10 XSync calls (mxSync), the average number of XSync() requests
+that were pending but not yet processed for each of the last 10
+processed XSync() calls, the maximum number of XSync() requests that
+were pending but not yet processed for each of the last 10 processed
+XSync() calls, and a histogram showing the distribution of the times of
+all of the XSync() calls that were made during the previous interval.
+.sp
+(The length of the moving average and the number and value of histogram
+bins are configurable at compile time in the
+.B dmxstat.h
+header file.)
+.sp
+.TP 8
+.BI "-syncbatch " interval
+This option sets the
+.I interval
+in milliseconds for XSync() batching.  An
+.I interval
+less than or equal to 0 will disable XSync() batching.  The default
+.I interval
+is 100 ms.
+.sp
+.TP 8
+.BI "-nooffscreenopt"
+This option disables the offscreen optimization.  Since the lazy window
+creation optimization requires the offscreen optimization to be enabled,
+this option will also disable the lazy window creation optimization.
+.sp
+.TP 8
+.BI "-nowindowopt"
+This option disables the lazy window creation optimization.
+.sp
+.TP 8
+.BI "-nosubdivprims"
+This option disables the primitive subdivision optimization.
+.sp
+.TP 8
+.BI "-noxkb"
+Disable use of the XKB extension for communication with the back end
+displays.  (Combine with
+.B "-kb"
+to disable all use of XKB.)
+.sp
+.TP 8
+.BI "-depth " int
+This option sets the root window's default depth.  When choosing a
+default visual from those available on the back-end X server, the first
+visual with that matches the depth specified is used.
+.sp
+This option can be combined with the
+.BI "-cc"
+option, which specifies the default color visual class, to force the use
+of a specific depth and color class for the root window.
+.sp
+.TP 8
+.BI "-norender"
+This option disables the RENDER extension.
+.sp
+.TP 8
+.BI "-noglxproxy"
+This option disables GLX proxy -- the build-in GLX extension
+implementation that is DMX aware.
+.sp
+.TP 8
+.BI "-noglxswapgroup"
+This option disables the swap group and swap barrier extensions in GLX
+proxy.
+.sp
+.TP 8
+.BI "-glxsyncswap"
+This option enables synchronization after a swap buffers call by waiting
+until all X protocol has been processed.  When a client issues a
+glXSwapBuffers request, Xdmx relays that request to each back-end X
+server, and those requests are buffered along with all other protocol
+requests.  However, in systems that have large network buffers, this
+buffering can lead to the set of back-end X servers handling the swap
+buffers request asynchronously.  With this option, an XSync() request is
+issued to each back-end X server after sending the swap buffers request.
+The XSync() requests will flush all buffered protocol (including the
+swap buffers requests) and wait until the back-end X servers have
+processed those requests before continuing.  This option does not wait
+until all GL commands have been processed so there might be previously
+issued commands that are still being processed in the GL pipe when the
+XSync() request returns.  See the
+.BI "-glxfinishswap"
+option below if Xdmx should wait until the GL commands have been
+processed.
+.sp
+.TP 8
+.BI "-glxfinishswap"
+This option enables synchronization after a swap buffers call by waiting
+until all GL commands have been completed.  It is similar to the
+.BI "-glxsyncswap"
+option above; however, instead of issuing an XSync(), it issues a
+glFinish() request to each back-end X server after sending the swap
+buffers requests.  The glFinish() request will flush all buffered
+protocol requests, process both X and GL requests, and wait until all
+previously called GL commands are complete before returning.
+.sp
+.TP 8
+.BI "-ignorebadfontpaths"
+This option ignores font paths that are not available on all back-end
+servers by removing the bad font path(s) from the default font path
+list.  If no valid font paths are left after removing the bad paths, an
+error to that effect is printed in the log.
+.sp
+.TP 8
+.BI "-addremovescreens"
+This option enables the dynamic addition and removal of screens, which
+is disabled by default.  Note that GLXProxy and Render do not yet
+support dynamic addition and removal of screens, and must be disabled
+via the
+.BI "-noglxproxy"
+and
+.BI "-norender"
+command line options described above.
+.sp
+.TP 8
+.BI "-param"
+This option specifies parameters on the command line.  Currently, only
+parameters dealing with XKEYBOARD configuration are supported.  These
+parameters apply only to the core keyboard.  Parameter values are
+installation-dependent.  Please see
+.I /usr/X11R6/lib/X11/xkb
+or a similar directory for complete information.
+.RS
+.TP 8
+.B XkbRules
+Defaults to "xfree86".  Other values may include "sgi" and "sun".
+.sp
+.TP 8
+.B XkbModel
+Defaults to "pc101".  When used with "xfree86" rules, other values may
+include "pc102", "pc104", "pc105", "microsoft", and many others.  When
+used with "sun" rules, other values may include "type4" and "type5".
+.sp
+.TP 8
+.B XkbLayout
+Defaults to "us".  Other country codes and "dvorak" are usually
+available.
+.sp
+.TP 8
+.B XkbVariant
+Defaults to "".
+.sp
+.TP 8
+.B XkbOptions
+Defaults to "".
+.RE
+.SH "CONFIGURATION FILE GRAMMAR"
+The following words and tokens are reserved:
+.RS
+.B virtual
+.B display
+.B wall
+.B option
+.B param
+.B {
+.B }
+.B ;
+.B #
+.RE
+.PP
+Comments start with a
+.B #
+mark and extend to the end of the line.  They may appear anywhere.  If a
+configuration file is read into
+.BR xdmxconfig ,
+the comments in that file will be preserved, but will not be editable.
+.PP
+The grammar is as follows:
+.RS
+virtual-list ::= [ virtual-list ] | virtual
+
+virtual ::=
+.B virtual
+[ name ] [ dim ]
+.B {
+dw-list
+.B }
+
+dw-list ::= [ dw-list ] | dw
+
+dw ::= display | wall | option
+
+display ::=
+.B display
+name [ geometry ] [ / geometry ] [ origin ]
+.B ;
+
+wall ::=
+.B wall
+[ dim ] [ dim ] name-list
+.B ;
+
+option ::=
+.B option
+name-list
+.B ;
+
+param ::=
+.B param
+name-list
+.B ;
+
+param ::=
+.B param {
+param-list
+.B }
+
+param-list ::= [ param-list ] | name-list
+.B ;
+
+name-list ::= [ name-list ] | name
+
+name ::= string | double-quoted-string
+
+dim ::= integer
+.B x
+integer
+
+geometry ::= [ integer
+.B x
+integer ] [ signed-integer signed-integer ]
+
+origin ::=
+.B @
+integer
+.B x
+integer
+.RE
+.PP
+The name following
+.B virtual
+is used as an identifier for the configuration, and may be passed to
+.B Xdmx
+using the
+.B \-config
+command line option.  The name of a display should be standard X display
+name, although no checking is performed (e.g., "machine:0").
+.PP
+For names, double quotes are optional unless the name is reserved or
+contains spaces.
+.PP
+The first dimension following
+.B wall
+is the dimension for tiling (e.g., 2x4 or 4x4).  The second dimension
+following
+.B wall
+is the dimension of each display in the wall (e.g., 1280x1024).
+.PP
+The first geometry following
+.B display
+is the geometry of the screen window on the backend server.  The second
+geometry, which is always preceeded by a slash, is the geometry of the
+root window.  By default, the root window has the same geometry as the
+screen window.
+.PP
+The
+.B option
+line can be used to specify any command-line options (e.g.,
+.BR \-input ).
+(It cannot be used to specify the name of the front-end display.)  The
+option line is processed once at server startup, just line command line
+options.  This behavior may be unexpected.
+.SH "CONFIGURATION FILE EXAMPLES"
+Two displays being used for a desktop may be specified in any of the
+following formats:
+.RS
+.nf
+virtual example0 {
+    display d0:0 1280x1024 @0x0;
+    display d1:0 1280x1024 @1280x0;
+}
+.sp
+virtual example1 {
+    display d0:0 1280x1024;
+    display d1:0 @1280x0;
+}
+.sp
+virtual example2 {
+    display "d0:0";
+    display "d1:0" @1280x0;
+}
+.sp
+virtual example3 { wall 2x1 d0:0 d1:0; }
+.fi
+.RE
+A 4x4 wall of 16 total displays could be specified as follows (if no
+tiling dimension is specified, an approximate square is used):
+.RS
+.nf
+virtual example4 {
+    wall d0:0 d1:0 d2:0 d3:0
+         d4:0 d5:0 d6:0 d7:0
+         d8:0 d9:0 da:0 db:0
+         dc:0 dd:0 de:0 df:0;
+}
+.fi
+.RE
+.SH "FONT PATHS"
+The font path used by the
+.I Xdmx
+front-end server will be propagated to each back-end server,which
+requires that each back-end server have access to the exact same font
+paths as the front-end server.  This can be most easily handled by
+either using a font server (e.g., xfs) or by remotely mounting the font
+paths on each back-end server, and then setting the
+.I Xdmx
+server's default font path with the
+-I "-fontpath"
+command line option described above.
+.PP
+For example, if you specify a font path with the following command line:
+.RS
+Xdmx :1 -display d0:0 -fontpath /usr/fonts/75dpi/ -fontpath /usr/fonts/Type1/ +xinerama
+.RE
+Then, /usr/fonts/75dpi/ and /usr/fonts/Type1/ must be valid font paths
+on the
+.I Xdmx
+server and all back-end server, which is d0 in this example.
+.PP
+Font servers can also be specified with the
+.I "-fontpath"
+option.  For example, let's assume that a properly configured font
+server is running on host d0.  Then, the following command line
+.RS
+Xdmx :1 -display d0:0 -display d1:0 -fontpath tcp/d0:7100 +xinerama
+.RE
+will initialize the front-end
+.I Xdmx
+server and each of the back-end servers to use the font server on d0.
+.PP
+Some fonts might not be supported by either the front-end or the
+back-end servers.  For example, let's assume the front-end
+.I Xdmx
+server includes support Type1 fonts, but one of the back-end servers
+does not.  Let's also assume that the default font path for
+.I Xdmx
+includes Type1 fonts in its font path.  Then, when
+.I Xdmx
+initializes the default font path to load the default font, the font
+path that includes Type1 fonts (along with the other default font paths
+that are used by the
+.I Xdmx
+server) is sent to the back-end server that cannot handle Type1 fonts.
+That back-end server then rejects the font path and sends an error back
+to the
+.I Xdmx
+server.
+.I Xdmx
+then prints an error message and exits because it failed to set the
+default font path and was unable load the default font.
+.PP
+To fix this error, the offending font path must be removed from the
+default font path by using a different
+.I "-fontpath"
+command line option.
+.PP
+The
+.I "-fontpath"
+option can also be added to the configuration file as described above.
+.SH "COMMAND-LINE EXAMPLES"
+The back-end machines are d0 and d1, core input is from the pointer and
+keyboard attached to d0, clients will refer to :1 when opening windows:
+.RS
+Xdmx :1 -display d0:0 -display d1:0 +xinerama
+.RE
+.PP
+As above, except with core input from d1:
+.RS
+Xdmx :1 -display d0:0 -display d1:0 -input d1:0 +xinerama
+.RE
+.PP
+As above, except with core input from a console window on the local
+display:
+.RS
+Xdmx :1 -display d0:0 -display d1:0 -input :0 +xinerama
+.RE
+.PP
+As above, except with core input from the local keyboard and mouse:
+.RS
+Xdmx :1 -display d0:0 -display d1:0 -input local,kbd,ps2 +xinerama
+.RE
+Note that local input can be used under Linux while another X session is
+running on :0 (assuming the user can access the Linux console tty and
+mouse devices): a new (blank) VC will be used for keyboard input on the
+local machine and the Ctrl-Alt-F* sequence will be available to change
+to another VC (possibly back to another X session running on the local
+machine).  Using Ctrl-Alt-Backspace on the blank VC will terminate the
+Xdmx session and return to the original VC.
+.PP
+This example uses the configuration file shown in the previous section:
+.RS
+Xdmx :1 -input :0 +xinerama -configfile filename -config example2
+.RE
+With this configuration file line:
+.RS
+option -input :0 +xinerama;
+.RE
+the command line can be shortened to:
+.RS
+Xdmx :1 -configfile filename -config example2
+.RE
+.SH "USING THE USB DEVICE DRIVERS"
+.P
+The USB device drivers use the devices called
+.IR /dev/input/event0 ", " /dev/input/event1 ", etc."
+under Linux.  These devices are driven using the
+.I evdev
+Linux kernel module, which is part of the hid suite.  Please note that
+if you load the
+.I mousedev
+or
+.I kbddev
+Linux kernel modules, then USB devices will appear as core Linux input
+devices and you will not be able to select between using the device only
+as an
+.I Xdmx
+core device or an
+.I Xdmx
+XInput extension device.  Further, you may be unable to unload the
+.I mousedev
+Linux kernel module if
+.I XFree86
+is configured to use
+.I /dev/input/mice
+as an input device (this is quite helpful for laptop users and is set up
+by default under some Linux distributions, but should be changed if USB
+devices are to be used with
+.IR Xdmx ).
+.PP
+The USB device drivers search through the Linux devices for the first
+mouse, keyboard, or non-mouse-non-keyboard Linux device and use that
+device.
+.SH "KEYBOARD INITIALIZATION"
+.PP
+If
+.I Xdmx
+was invoked with
+.I \-xkb
+or was
+.B not
+compiled to use the XKEYBOARD extension, then a keyboard on a backend or
+console will be initialized using the map that the host X server
+provides.
+.PP
+If the XKEYBOARD extension is used for both
+.I Xdmx
+and the host X server for the keyboard (i.e., the backend or console X
+server), then the type of the keyboard will
+be obtained from the host X server and the keyboard under
+.I Xdmx
+will be initialized with that information.  Otherwise, the default type
+of keyboard will be initialized.  In both cases, the map from the host X
+server will
+.B not
+be used.  This means that different initial behavior may be noted with
+and without XKEYBOARD.  Consistent and expected results will be obtained
+by running XKEYBOARD on all servers and by avoiding the use of
+.I xmodmap
+on the backend or console X servers prior to starting
+.IR Xdmx .
+.PP
+If
+.I \-xkbmap
+is specified on the
+.I Xdmx
+command line, then that map will currently be used for all keyboards.
+.SH "MULTIPLE CORE KEYBOARDS"
+X was not designed to support multiple core keyboards.  However,
+.I Xdmx
+provides some support for multiple core keyboards.  Best results will be
+obtained if all of the keyboards are of the same type and are using the
+same keyboard map.  Because the X server passes raw key code information
+to the X client, key symbols for keyboards with different key maps would
+be different if the key code for each keyboard was sent without
+translation to the client.  Therefore,
+.I Xdmx
+will attempt to translate the key code from a core keyboard to the key
+code for the key with the same key symbol of the
+.B first
+core keyboard that was loaded.  If the key symbol appears in both maps,
+the results will be expected.  Otherwise, the second core keyboard will
+return a NoSymbol key symbol for some keys that would have been
+translated if it was the first core keyboard.
+.ig
+.SH ENVIRONMENT
+..
+.ig
+.SH FILES
+..
+.SH "SEE ALSO"
+.BR DMX "(3X), " X "(__miscmansuffix__), " Xserver "(1), " xdmxconfig "(1), "
+.BR vdltodmx "(1), " xfs "(1), " xkbcomp (1)
+.SH AUTHORS
+Kevin E. Martin
+.I <kem at redhat.com>,
+David H. Dawes
+.I <dawes at xfree86.org>,
+and
+Rickard E. (Rik) Faith
+.IR <faith at redhat.com> .
+.PP
+Portions of
+.I Xdmx
+are based on code from The XFree86 Project
+.RI ( http://www.xfree86.org )
+and X.Org
+.RI ( http://www.x.org ).
commit 9bd9d550a0d6fb4fe3daacb604658de92e69d99c
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:28:27 2011 -0500

    exa: build man pages using XORG_MANPAGE_SECTIONS
    
    Nothing requires the use of a C preprocessor
    Using standard file extensions (.man) means no need for .gitignore
    Use standard directory and makefile
    Fix trailing whitespaces
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index ffad0af..45756ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2213,6 +2213,7 @@ hw/xfree86/doc/sgml/Makefile
 hw/xfree86/dri/Makefile
 hw/xfree86/dri2/Makefile
 hw/xfree86/exa/Makefile
+hw/xfree86/exa/man/Makefile
 hw/xfree86/fbdevhw/Makefile
 hw/xfree86/fbdevhw/man/Makefile
 hw/xfree86/i2c/Makefile
diff --git a/hw/xfree86/exa/.gitignore b/hw/xfree86/exa/.gitignore
deleted file mode 100644
index d20a82f..0000000
--- a/hw/xfree86/exa/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-#		Add & Override for this directory and it's subdirectories
-exa.man
diff --git a/hw/xfree86/exa/Makefile.am b/hw/xfree86/exa/Makefile.am
index da9b720..39f7a90 100644
--- a/hw/xfree86/exa/Makefile.am
+++ b/hw/xfree86/exa/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = man
+
 module_LTLIBRARIES = libexa.la
 
 libexa_la_LDFLAGS = -avoid-version
@@ -14,15 +16,3 @@ libexa_la_SOURCES = \
 
 libexa_la_LIBADD = \
 	../../../exa/libexa.la
-
-include $(top_srcdir)/cpprules.in
-
-drivermandir = $(DRIVER_MAN_DIR)
-driverman_DATA = exa.$(DRIVER_MAN_SUFFIX)
-CLEANFILES = $(driverman_DATA) exa.man
-
-exa.$(DRIVER_MAN_SUFFIX): exa.man
-	-$(AM_V_at)rm -f exa.$(DRIVER_MAN_SUFFIX)
-	$(AM_V_at)$(LN_S) exa.man exa.$(DRIVER_MAN_SUFFIX)
-
-EXTRA_DIST = exa.man.pre
diff --git a/hw/xfree86/exa/exa.man.pre b/hw/xfree86/exa/exa.man.pre
deleted file mode 100644
index 5c953e2..0000000
--- a/hw/xfree86/exa/exa.man.pre
+++ /dev/null
@@ -1,42 +0,0 @@
-.\" shorthand for double quote that works everywhere.
-.ds q \N'34'
-.TH EXA __drivermansuffix__ __vendorversion__
-.SH NAME
-exa \- new 2D acceleration architecture for X.Org
-.SH DESCRIPTION
-.B EXA
-provides a simple API for video drivers to implement for 2D acceleration.  It
-is a module loaded by drivers, and is not intended to be loaded on its own.
-See your driver's manual page for how to enable 
-.BR EXA .
-.PP
-The
-.B EXA
-architecture is designed to make accelerating the Render extension simple and
-efficient, and results in various performance tradeoffs compared to XAA.  Some
-__xconfigfile__ options are available for debugging performance issues or
-driver rendering problems.  They are not intended for general use.
-.TP
-.BI "Option \*qEXANoComposite\*q \*q" boolean \*q
-Disables acceleration of the Composite operation, which is at the heart of
-the Render extension.  Not related to the Composite extension.  Default: No.
-.TP
-.BI "Option \*qEXANoUploadToScreen\*q \*q" boolean \*q
-Disables acceleration of uploading pixmap data to the framebuffer. Default: No.
-.TP
-.BI "Option \*qEXANoDownloadFromScreen\*q \*q" boolean \*q
-Disables acceleration of downloading of pixmap data from the framebuffer. 
-.B NOTE:
-Not usable with drivers which rely on DownloadFromScreen succeeding.
-Default: No.
-.TP
-.BI "Option \*qMigrationHeuristic\*q \*q" anystr \*q
-Chooses an alternate pixmap migration heuristic, for debugging purposes.  The
-default is intended to be the best performing one for general use, though others
-may help with specific use cases.  Available options include \*qalways\*q,
-\*qgreedy\*q, and \*qsmart\*q.  Default: always.
-.SH "SEE ALSO"
-.BR __xservername__ (__appmansuffix__),
-.BR __xconfigfile__(__filemansuffix__).
-.SH AUTHORS
-Authors include: Keith Packard, Eric Anholt, Zack Rusin, and Michel D\(:anzer
diff --git a/hw/xfree86/exa/man/Makefile.am b/hw/xfree86/exa/man/Makefile.am
new file mode 100644
index 0000000..db287db
--- /dev/null
+++ b/hw/xfree86/exa/man/Makefile.am
@@ -0,0 +1,11 @@
+drivermandir = $(DRIVER_MAN_DIR)
+driverman_PRE = exa.man
+driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX))
+
+EXTRA_DIST = $(driverman_PRE)
+CLEANFILES = $(driverman_DATA)
+SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+.man.$(DRIVER_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/xfree86/exa/man/exa.man b/hw/xfree86/exa/man/exa.man
new file mode 100644
index 0000000..30d0182
--- /dev/null
+++ b/hw/xfree86/exa/man/exa.man
@@ -0,0 +1,42 @@
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH EXA __drivermansuffix__ __vendorversion__
+.SH NAME
+exa \- new 2D acceleration architecture for X.Org
+.SH DESCRIPTION
+.B EXA
+provides a simple API for video drivers to implement for 2D acceleration.  It
+is a module loaded by drivers, and is not intended to be loaded on its own.
+See your driver's manual page for how to enable
+.BR EXA .
+.PP
+The
+.B EXA
+architecture is designed to make accelerating the Render extension simple and
+efficient, and results in various performance tradeoffs compared to XAA.  Some
+__xconfigfile__ options are available for debugging performance issues or
+driver rendering problems.  They are not intended for general use.
+.TP
+.BI "Option \*qEXANoComposite\*q \*q" boolean \*q
+Disables acceleration of the Composite operation, which is at the heart of
+the Render extension.  Not related to the Composite extension.  Default: No.
+.TP
+.BI "Option \*qEXANoUploadToScreen\*q \*q" boolean \*q
+Disables acceleration of uploading pixmap data to the framebuffer. Default: No.
+.TP
+.BI "Option \*qEXANoDownloadFromScreen\*q \*q" boolean \*q
+Disables acceleration of downloading of pixmap data from the framebuffer.
+.B NOTE:
+Not usable with drivers which rely on DownloadFromScreen succeeding.
+Default: No.
+.TP
+.BI "Option \*qMigrationHeuristic\*q \*q" anystr \*q
+Chooses an alternate pixmap migration heuristic, for debugging purposes.  The
+default is intended to be the best performing one for general use, though others
+may help with specific use cases.  Available options include \*qalways\*q,
+\*qgreedy\*q, and \*qsmart\*q.  Default: always.
+.SH "SEE ALSO"
+.BR __xservername__ (__appmansuffix__),
+.BR __xconfigfile__(__filemansuffix__).
+.SH AUTHORS
+Authors include: Keith Packard, Eric Anholt, Zack Rusin, and Michel D\(:anzer
commit d4b1fd3ff66d1a3e44a85aed34d9a01eee0d37fd
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:28:26 2011 -0500

    fbdevhw: build man pages using XORG_MANPAGE_SECTIONS
    
    Nothing requires the use of a C preprocessor
    Using standard file extensions (.man) means no need for .gitignore
    Use standard directory and makefile
    Fix trailing whitespaces
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 20aad23..ffad0af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2214,6 +2214,7 @@ hw/xfree86/dri/Makefile
 hw/xfree86/dri2/Makefile
 hw/xfree86/exa/Makefile
 hw/xfree86/fbdevhw/Makefile
+hw/xfree86/fbdevhw/man/Makefile
 hw/xfree86/i2c/Makefile
 hw/xfree86/int10/Makefile
 hw/xfree86/loader/Makefile
diff --git a/hw/xfree86/fbdevhw/.gitignore b/hw/xfree86/fbdevhw/.gitignore
deleted file mode 100644
index 88d61c6..0000000
--- a/hw/xfree86/fbdevhw/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-#		Add & Override for this directory and it's subdirectories
-fbdevhw.man
diff --git a/hw/xfree86/fbdevhw/Makefile.am b/hw/xfree86/fbdevhw/Makefile.am
index 76a69c1..2a03890 100644
--- a/hw/xfree86/fbdevhw/Makefile.am
+++ b/hw/xfree86/fbdevhw/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = man
+
 module_LTLIBRARIES = libfbdevhw.la
 
 libfbdevhw_la_LDFLAGS = -avoid-version
@@ -14,14 +16,4 @@ AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
 
 sdk_HEADERS = fbdevhw.h
 
-include $(top_srcdir)/cpprules.in
-
-drivermandir = $(DRIVER_MAN_DIR)
-driverman_DATA = fbdevhw.$(DRIVER_MAN_SUFFIX)
-CLEANFILES = $(driverman_DATA) fbdevhw.man
-
-fbdevhw.$(DRIVER_MAN_SUFFIX): fbdevhw.man
-	-$(AM_V_at)rm -f fbdevhw.$(DRIVER_MAN_SUFFIX)
-	$(AM_V_at)$(LN_S) fbdevhw.man fbdevhw.$(DRIVER_MAN_SUFFIX)
-
-EXTRA_DIST = fbpriv.h fbdevhw.man.pre README
+EXTRA_DIST = fbpriv.h README
diff --git a/hw/xfree86/fbdevhw/fbdevhw.man.pre b/hw/xfree86/fbdevhw/fbdevhw.man.pre
deleted file mode 100644
index deeced8..0000000
--- a/hw/xfree86/fbdevhw/fbdevhw.man.pre
+++ /dev/null
@@ -1,22 +0,0 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.man,v 1.1 2001/01/24 00:06:34 dawes Exp $ 
-.TH FBDEVHW __drivermansuffix__ __vendorversion__
-.SH NAME
-fbdevhw \- os-specific submodule for framebuffer device access
-.SH DESCRIPTION
-.B fbdevhw
-provides functions for talking to a framebuffer device.  It is
-os-specific.  It is a submodule used by other video drivers.
-A
-.B fbdevhw
-module is currently available for linux framebuffer devices.
-.PP
-fbdev(__drivermansuffix__) is a non-accelerated driver which runs on top of the
-fbdevhw module.  fbdevhw can be used by other drivers too, this
-is usually activated with `Option "UseFBDev"' in the device section.
-.SH "SEE ALSO"
-__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), 
-xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__),
-fbdev(__drivermansuffix__)
-.SH AUTHORS
-Authors include: Gerd Knorr, based on the XF68_FBDev Server code
-(Martin Schaller, Geert Uytterhoeven).
diff --git a/hw/xfree86/fbdevhw/man/Makefile.am b/hw/xfree86/fbdevhw/man/Makefile.am
new file mode 100644
index 0000000..5da5c55
--- /dev/null
+++ b/hw/xfree86/fbdevhw/man/Makefile.am
@@ -0,0 +1,11 @@
+drivermandir = $(DRIVER_MAN_DIR)
+driverman_PRE = fbdevhw.man
+driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX))
+
+EXTRA_DIST = $(driverman_PRE)
+CLEANFILES = $(driverman_DATA)
+SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+.man.$(DRIVER_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/xfree86/fbdevhw/man/fbdevhw.man b/hw/xfree86/fbdevhw/man/fbdevhw.man
new file mode 100644
index 0000000..fe5d1e1
--- /dev/null
+++ b/hw/xfree86/fbdevhw/man/fbdevhw.man
@@ -0,0 +1,22 @@
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.man,v 1.1 2001/01/24 00:06:34 dawes Exp $
+.TH FBDEVHW __drivermansuffix__ __vendorversion__
+.SH NAME
+fbdevhw \- os-specific submodule for framebuffer device access
+.SH DESCRIPTION
+.B fbdevhw
+provides functions for talking to a framebuffer device.  It is
+os-specific.  It is a submodule used by other video drivers.
+A
+.B fbdevhw
+module is currently available for linux framebuffer devices.
+.PP
+fbdev(__drivermansuffix__) is a non-accelerated driver which runs on top of the
+fbdevhw module.  fbdevhw can be used by other drivers too, this
+is usually activated with `Option "UseFBDev"' in the device section.
+.SH "SEE ALSO"
+__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__),
+xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__),
+fbdev(__drivermansuffix__)
+.SH AUTHORS
+Authors include: Gerd Knorr, based on the XF68_FBDev Server code
+(Martin Schaller, Geert Uytterhoeven).
commit b9276cb86b433bc740fe26c2e624d3d5399732f6
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:27:53 2011 -0500

    XFree86 utils: build utils man pages using XORG_MANPAGE_SECTIONS
    
    Nothing requires the use of a C preprocessor
    Using standard file extensions (.man) means no need for .gitignore
    Use standard directory and makefile
    Fix trailing whitespaces
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index a482a73..20aad23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2233,6 +2233,7 @@ hw/xfree86/vgahw/Makefile
 hw/xfree86/x86emu/Makefile
 hw/xfree86/xaa/Makefile
 hw/xfree86/utils/Makefile
+hw/xfree86/utils/man/Makefile
 hw/xfree86/utils/cvt/Makefile
 hw/xfree86/utils/gtf/Makefile
 hw/dmx/config/Makefile
diff --git a/hw/xfree86/utils/Makefile.am b/hw/xfree86/utils/Makefile.am
index d27861b..71f9790 100644
--- a/hw/xfree86/utils/Makefile.am
+++ b/hw/xfree86/utils/Makefile.am
@@ -1,3 +1,4 @@
 SUBDIRS = \
 	gtf \
-	cvt
+	cvt \
+	man
diff --git a/hw/xfree86/utils/cvt/.gitignore b/hw/xfree86/utils/cvt/.gitignore
index 7816fd7..a217c55 100644
--- a/hw/xfree86/utils/cvt/.gitignore
+++ b/hw/xfree86/utils/cvt/.gitignore
@@ -1,3 +1 @@
-#		Add & Override for this directory and it's subdirectories
 cvt
-cvt.man
diff --git a/hw/xfree86/utils/cvt/Makefile.am b/hw/xfree86/utils/cvt/Makefile.am
index ba02145..4ebcedf 100644
--- a/hw/xfree86/utils/cvt/Makefile.am
+++ b/hw/xfree86/utils/cvt/Makefile.am
@@ -32,11 +32,3 @@ cvt_SOURCES = cvt.c \
 	$(top_srcdir)/os/xprintf.c
 
 cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
-
-man1_MANS = cvt.man
-
-CLEANFILES = $(man1_MANS)
-
-include $(top_srcdir)/cpprules.in
-
-EXTRA_DIST = cvt.man.pre
diff --git a/hw/xfree86/utils/cvt/cvt.man.pre b/hw/xfree86/utils/cvt/cvt.man.pre
deleted file mode 100644
index 8a292ee..0000000
--- a/hw/xfree86/utils/cvt/cvt.man.pre
+++ /dev/null
@@ -1,42 +0,0 @@
-.\" $XFree86$
-.TH CVT 1 __vendorversion__
-.SH NAME
-cvt - calculate VESA CVT mode lines
-.SH SYNOPSIS
-.B cvt
-.RB [ \-v | \-\-verbose ]
-.RB [ \-r | \-\-reduced ]
-.I h-resolution
-.I v-resolution
-.RB [ refresh ]
-.SH DESCRIPTION
-.I Cvt
-is a utility for calculating VESA Coordinated Video Timing modes.  Given the
-desired horizontal and vertical resolutions, a modeline adhering to the CVT
-standard is printed. This modeline can be included in __xservername__ 
-.B __xconfigfile__(__filemansuffix__)
-.
-
-.SH OPTIONS
-.TP 8
-.BR refresh
-Provide a vertical refresh rate in kHz.  The CVT standard prefers either 50.0,
-60.0, 75.0 or 85.0kHz.  The default is 60.0kHz.
-.TP 8
-.BR \-v | \-\-verbose
-Warn verbosely when a given mode does not completely correspond with CVT
-standards.
-.TP 8
-.BR \-r | \-\-reduced
-Create a mode with reduced blanking.  This allows for higher frequency signals,
-with a lower or equal dotclock. Not for Cathode Ray Tube based displays though.
-
-.SH "SEE ALSO"
-__xconfigfile__(__filemansuffix__)
-.SH AUTHOR
-Luc Verhaegen.
-.PP
-This program is based on the Coordinated Video Timing sample
-implementation written by Graham Loveridge. This file is publicly
-available at <http://www.vesa.org/Public/CVT/CVTd6r1.xls>. CVT is a
-VESA trademark.
diff --git a/hw/xfree86/utils/gtf/.gitignore b/hw/xfree86/utils/gtf/.gitignore
index 9aebbbb..919c993 100644
--- a/hw/xfree86/utils/gtf/.gitignore
+++ b/hw/xfree86/utils/gtf/.gitignore
@@ -1,3 +1 @@
-#		Add & Override for this directory and it's subdirectories
 gtf
-gtf.man
diff --git a/hw/xfree86/utils/gtf/Makefile.am b/hw/xfree86/utils/gtf/Makefile.am
index ea1c5fb..f77bf60 100644
--- a/hw/xfree86/utils/gtf/Makefile.am
+++ b/hw/xfree86/utils/gtf/Makefile.am
@@ -25,20 +25,3 @@ bin_PROGRAMS = gtf
 gtf_SOURCES = gtf.c
 gtf_CFLAGS = $(XORG_CFLAGS)
 gtf_LDADD = -lm
-
-appmandir = $(APP_MAN_DIR)
-
-appman_PRE = gtf.man
-appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
-
-include $(top_srcdir)/cpprules.in
-
-EXTRA_DIST = gtf.man.pre
-BUILT_SOURCES = $(appman_PRE)
-CLEANFILES = $(appman_PRE) $(appman_DATA)
-
-SUFFIXES += .$(APP_MAN_SUFFIX) .man
-
-.man.$(APP_MAN_SUFFIX):
-	-$(AM_V_at)rm -f $@
-	$(AM_V_at)$(LN_S) $< $@
diff --git a/hw/xfree86/utils/gtf/gtf.man.pre b/hw/xfree86/utils/gtf/gtf.man.pre
deleted file mode 100644
index 74ade74..0000000
--- a/hw/xfree86/utils/gtf/gtf.man.pre
+++ /dev/null
@@ -1,45 +0,0 @@
-.\" $XFree86$
-.TH GTF 1 __vendorversion__
-.SH NAME
-gtf - calculate VESA GTF mode lines
-.SH SYNOPSIS
-.B gtf
-.I h-resolution
-.I v-resolution
-.I refresh
-.RB [ \-v | \-\-verbose ]
-.RB [ \-f | \-\-fbmode ]
-.RB [ \-x | \-\-xorgmode ]
-.SH DESCRIPTION
-.I Gtf
-is a utility for calculating VESA GTF modes.  Given the desired
-horizontal and vertical resolutions and refresh rate (in Hz), the parameters
-for a matching VESA GTF mode are printed out.  Two output formats are
-supported: mode lines suitable for the __xservername__
-.B __xconfigfile__(__filemansuffix__)
-file, and mode parameters suitable for the Linux
-.B fbset(8)
-utility.
-
-.SH OPTIONS
-.TP 8
-.BR \-v | \-\-verbose
-Enable verbose printouts  This shows a trace for each step of the
-computation.
-.TP 8
-.BR \-x | \-\-xorgmode
-Print the mode parameters as __xservername__-style mode lines.  This is the
-default format.
-.TP 8
-.BR \-f | \-\-fbset
-Print the mode parameters in a format suitable for
-.BR fbset(8) .
-.SH "SEE ALSO"
-__xconfigfile__(__filemansuffix__)
-.SH AUTHOR
-Andy Ritger.
-.PP
-This program is based on the Generalized Timing Formula (GTF(TM)) Standard
-Version: 1.0, Revision: 1.0.  The GTF Excel(TM) spreadsheet, a sample
-(and the definitive) implementation of the GTF Timing Standard is
-available at <ftp://ftp.vesa.org/pub/GTF/VTF_V1R1.xls>.
diff --git a/hw/xfree86/utils/man/Makefile.am b/hw/xfree86/utils/man/Makefile.am
new file mode 100644
index 0000000..fd2af8e
--- /dev/null
+++ b/hw/xfree86/utils/man/Makefile.am
@@ -0,0 +1,10 @@
+appmandir = $(APP_MAN_DIR)
+appman_PRE = cvt.man gtf.man
+appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
+
+EXTRA_DIST = $(appman_PRE)
+CLEANFILES = $(appman_DATA)
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/xfree86/utils/man/cvt.man b/hw/xfree86/utils/man/cvt.man
new file mode 100644
index 0000000..b380171
--- /dev/null
+++ b/hw/xfree86/utils/man/cvt.man
@@ -0,0 +1,42 @@
+.\" $XFree86$
+.TH CVT 1 __vendorversion__
+.SH NAME
+cvt - calculate VESA CVT mode lines
+.SH SYNOPSIS
+.B cvt
+.RB [ \-v | \-\-verbose ]
+.RB [ \-r | \-\-reduced ]
+.I h-resolution
+.I v-resolution
+.RB [ refresh ]
+.SH DESCRIPTION
+.I Cvt
+is a utility for calculating VESA Coordinated Video Timing modes.  Given the
+desired horizontal and vertical resolutions, a modeline adhering to the CVT
+standard is printed. This modeline can be included in __xservername__
+.B __xconfigfile__(__filemansuffix__)
+.
+
+.SH OPTIONS
+.TP 8
+.BR refresh
+Provide a vertical refresh rate in kHz.  The CVT standard prefers either 50.0,
+60.0, 75.0 or 85.0kHz.  The default is 60.0kHz.
+.TP 8
+.BR \-v | \-\-verbose
+Warn verbosely when a given mode does not completely correspond with CVT
+standards.
+.TP 8
+.BR \-r | \-\-reduced
+Create a mode with reduced blanking.  This allows for higher frequency signals,
+with a lower or equal dotclock. Not for Cathode Ray Tube based displays though.
+
+.SH "SEE ALSO"
+__xconfigfile__(__filemansuffix__)
+.SH AUTHOR
+Luc Verhaegen.
+.PP
+This program is based on the Coordinated Video Timing sample
+implementation written by Graham Loveridge. This file is publicly
+available at <http://www.vesa.org/Public/CVT/CVTd6r1.xls>. CVT is a
+VESA trademark.
diff --git a/hw/xfree86/utils/man/gtf.man b/hw/xfree86/utils/man/gtf.man
new file mode 100644
index 0000000..74ade74
--- /dev/null
+++ b/hw/xfree86/utils/man/gtf.man
@@ -0,0 +1,45 @@
+.\" $XFree86$
+.TH GTF 1 __vendorversion__
+.SH NAME
+gtf - calculate VESA GTF mode lines
+.SH SYNOPSIS
+.B gtf
+.I h-resolution
+.I v-resolution
+.I refresh
+.RB [ \-v | \-\-verbose ]
+.RB [ \-f | \-\-fbmode ]
+.RB [ \-x | \-\-xorgmode ]
+.SH DESCRIPTION
+.I Gtf
+is a utility for calculating VESA GTF modes.  Given the desired
+horizontal and vertical resolutions and refresh rate (in Hz), the parameters
+for a matching VESA GTF mode are printed out.  Two output formats are
+supported: mode lines suitable for the __xservername__
+.B __xconfigfile__(__filemansuffix__)
+file, and mode parameters suitable for the Linux
+.B fbset(8)
+utility.
+
+.SH OPTIONS
+.TP 8
+.BR \-v | \-\-verbose
+Enable verbose printouts  This shows a trace for each step of the
+computation.
+.TP 8
+.BR \-x | \-\-xorgmode
+Print the mode parameters as __xservername__-style mode lines.  This is the
+default format.
+.TP 8
+.BR \-f | \-\-fbset
+Print the mode parameters in a format suitable for
+.BR fbset(8) .
+.SH "SEE ALSO"
+__xconfigfile__(__filemansuffix__)
+.SH AUTHOR
+Andy Ritger.
+.PP
+This program is based on the Generalized Timing Formula (GTF(TM)) Standard
+Version: 1.0, Revision: 1.0.  The GTF Excel(TM) spreadsheet, a sample
+(and the definitive) implementation of the GTF Timing Standard is
+available at <ftp://ftp.vesa.org/pub/GTF/VTF_V1R1.xls>.
commit ac5ffef60e05eb05275913b133786709881e7e7e
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:27:52 2011 -0500

    Xephyr: build Xephyr man pages using XORG_MANPAGE_SECTIONS
    
    Nothing requires the use of a C preprocessor
    Using standard file extensions (.man) means no need for .gitignore
    Use standard directory and makefile
    Fix trailing whitespaces
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 32b7b54..a482a73 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2257,6 +2257,7 @@ hw/xquartz/pbproxy/Makefile
 hw/xquartz/xpr/Makefile
 hw/kdrive/Makefile
 hw/kdrive/ephyr/Makefile
+hw/kdrive/ephyr/man/Makefile
 hw/kdrive/fake/Makefile
 hw/kdrive/fbdev/Makefile
 hw/kdrive/linux/Makefile
diff --git a/hw/kdrive/ephyr/.gitignore b/hw/kdrive/ephyr/.gitignore
index bfe7e08..4962d1e 100644
--- a/hw/kdrive/ephyr/.gitignore
+++ b/hw/kdrive/ephyr/.gitignore
@@ -1,3 +1 @@
-#		Add & Override for this directory and it's subdirectories
 Xephyr
-Xephyr.man
diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index 8646703..9d9b64e 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = man
+
 INCLUDES = 			\
 	@KDRIVE_INCS@		\
 	@KDRIVE_CFLAGS@		\
@@ -83,20 +85,6 @@ Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
 relink:
 	$(AM_V_at)rm -f $(bin_PROGRAMS) && $(MAKE) $(bin_PROGRAMS)
 
-MAN_SRCS = Xephyr.man.pre
-
-appmandir = $(APP_MAN_DIR)
-appman_DATA = Xephyr.$(APP_MAN_SUFFIX)
-
-Xephyr.$(APP_MAN_SUFFIX): Xephyr.man
-	-$(AM_V_at)rm -f Xephyr.$(APP_MAN_SUFFIX)
-	$(AM_V_at)$(LN_S) Xephyr.man Xephyr.$(APP_MAN_SUFFIX)
-
-include $(top_srcdir)/cpprules.in
-
-CLEANFILES = $(appman_DATA) Xephyr.man
-
 EXTRA_DIST = \
 	$(HOSTVIDEO_SRCS) \
-	$(HOSTDRI_SRCS) \
-	$(MAN_SRCS)
+	$(HOSTDRI_SRCS)
diff --git a/hw/kdrive/ephyr/Xephyr.man.pre b/hw/kdrive/ephyr/Xephyr.man.pre
deleted file mode 100644
index eb80b96..0000000
--- a/hw/kdrive/ephyr/Xephyr.man.pre
+++ /dev/null
@@ -1,89 +0,0 @@
-."
-." Copyright (c) Matthieu Herrb <matthieu at herrb.eu>
-."
-." Permission to use, copy, modify, and distribute this software for any
-." purpose with or without fee is hereby granted, provided that the above
-." copyright notice and this permission notice appear in all copies.
-."
-." THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-." WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-." MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-." ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-." WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-." ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-." OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-."
-.TH Xephyr __appmansuffix__ __vendorversion__
-.SH NAME
-Xephyr - X server outputting to a window on a pre-existing X display
-.SH SYNOPSIS
-.B Xephyr
-.RI [\fB:\fP display ]
-.RI [ option
-.IR ... ]
-.SH DESCRIPTION
-.B Xephyr
-is a kdrive server that outputs to a window on a pre-existing "host"
-X display.
-Think
-.I Xnest
-but with support for modern extensions like composite, damage and randr.
-.PP
-Unlike
-.I Xnest
-which is an X proxy, i.e.  limited to the capabilities of the host X server,
-.B Xephyr
-is a real X server which
-uses the host X server window as "framebuffer" via fast SHM XImages.
-.PP
-It also has support for "visually" debugging what the server is
-painting.
-.SH OPTIONS
-.TP 8
-.BI -screen " width" x height
-sets the screen size.
-.TP 8
-.BI -parent " id"
-uses exiting window
-.I id .
-If a 
-.BI -screen 
-argument follows a 
-.BI -parent
-argument, this screen is embedded into the given window.
-.TP 8
-.B -host-cursor
-set 'cursor acceleration':
-The host's cursor is reused. This is only really there to aid
-debugging by avoiding server paints for the cursor. Performance
-improvement is negligible.
-.SH "SIGNALS"
-Send a SIGUSR1 to the server (e.g. pkill -USR1 Xephyr) to
-toggle the debugging mode.
-In this mode red rectangles are painted to
-screen areas getting painted before painting the actual content.
-The
-delay between this can be altered by setting a XEPHYR_PAUSE env var to
-a value in micro seconds.
-.SH CAVEATS
-.PP
-.IP \(bu 2
-Rotated displays are currently updated via full blits. This
-is slower than a normal orientated display. Debug mode will
-therefore not be of much use rotated.
-.IP \(bu 2
-The '-host-cursor' cursor is static in its appearance.
-.IP \(bu 2
-The build gets a warning about 'nanosleep'. I think the various '-D'
-build flags are causing this. I haven't figured as yet how to work
-round it. It doesn't appear to break anything however.
-.IP \(bu 2
-Keyboard handling is basic but works.
-.TP \(bu 2
-Mouse button 5 probably won't work.
-.SH "SEE ALSO"
-X(__miscmansuffix__), Xserver(__appmansuffix__)
-.SH AUTHOR
-Matthew Allum <mallum at o-hand.com> 2004
-
-
diff --git a/hw/kdrive/ephyr/man/Makefile.am b/hw/kdrive/ephyr/man/Makefile.am
new file mode 100644
index 0000000..58f1cbd
--- /dev/null
+++ b/hw/kdrive/ephyr/man/Makefile.am
@@ -0,0 +1,10 @@
+appmandir = $(APP_MAN_DIR)
+appman_PRE = Xephyr.man
+appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
+
+EXTRA_DIST = $(appman_PRE)
+CLEANFILES = $(appman_DATA)
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/kdrive/ephyr/man/Xephyr.man b/hw/kdrive/ephyr/man/Xephyr.man
new file mode 100644
index 0000000..8e7bfd5
--- /dev/null
+++ b/hw/kdrive/ephyr/man/Xephyr.man
@@ -0,0 +1,87 @@
+."
+." Copyright (c) Matthieu Herrb <matthieu at herrb.eu>
+."
+." Permission to use, copy, modify, and distribute this software for any
+." purpose with or without fee is hereby granted, provided that the above
+." copyright notice and this permission notice appear in all copies.
+."
+." THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+." WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+." MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+." ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+." WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+." ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+." OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+."
+.TH Xephyr __appmansuffix__ __vendorversion__
+.SH NAME
+Xephyr - X server outputting to a window on a pre-existing X display
+.SH SYNOPSIS
+.B Xephyr
+.RI [\fB:\fP display ]
+.RI [ option
+.IR ... ]
+.SH DESCRIPTION
+.B Xephyr
+is a kdrive server that outputs to a window on a pre-existing "host"
+X display.
+Think
+.I Xnest
+but with support for modern extensions like composite, damage and randr.
+.PP
+Unlike
+.I Xnest
+which is an X proxy, i.e.  limited to the capabilities of the host X server,
+.B Xephyr
+is a real X server which
+uses the host X server window as "framebuffer" via fast SHM XImages.
+.PP
+It also has support for "visually" debugging what the server is
+painting.
+.SH OPTIONS
+.TP 8
+.BI -screen " width" x height
+sets the screen size.
+.TP 8
+.BI -parent " id"
+uses exiting window
+.I id .
+If a
+.BI -screen
+argument follows a
+.BI -parent
+argument, this screen is embedded into the given window.
+.TP 8
+.B -host-cursor
+set 'cursor acceleration':
+The host's cursor is reused. This is only really there to aid
+debugging by avoiding server paints for the cursor. Performance
+improvement is negligible.
+.SH "SIGNALS"
+Send a SIGUSR1 to the server (e.g. pkill -USR1 Xephyr) to
+toggle the debugging mode.
+In this mode red rectangles are painted to
+screen areas getting painted before painting the actual content.
+The
+delay between this can be altered by setting a XEPHYR_PAUSE env var to
+a value in micro seconds.
+.SH CAVEATS
+.PP
+.IP \(bu 2
+Rotated displays are currently updated via full blits. This
+is slower than a normal orientated display. Debug mode will
+therefore not be of much use rotated.
+.IP \(bu 2
+The '-host-cursor' cursor is static in its appearance.
+.IP \(bu 2
+The build gets a warning about 'nanosleep'. I think the various '-D'
+build flags are causing this. I haven't figured as yet how to work
+round it. It doesn't appear to break anything however.
+.IP \(bu 2
+Keyboard handling is basic but works.
+.TP \(bu 2
+Mouse button 5 probably won't work.
+.SH "SEE ALSO"
+X(__miscmansuffix__), Xserver(__appmansuffix__)
+.SH AUTHOR
+Matthew Allum <mallum at o-hand.com> 2004
commit 9240cffd659b1c13d66162200c6e384ea1cdbc44
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:27:51 2011 -0500

    Xvfb: build Xvfb man pages using XORG_MANPAGE_SECTIONS
    
    Nothing requires the use of a C preprocessor
    Using standard file extensions (.man) means no need for .gitignore
    Use standard directory and makefile
    Fix trailing whitespaces
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 81e5a8e..32b7b54 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2242,6 +2242,7 @@ hw/dmx/input/Makefile
 hw/dmx/glxProxy/Makefile
 hw/dmx/Makefile
 hw/vfb/Makefile
+hw/vfb/man/Makefile
 hw/xnest/Makefile
 hw/xnest/man/Makefile
 hw/xwin/Makefile
diff --git a/hw/vfb/.gitignore b/hw/vfb/.gitignore
index 55076f0..c047541 100644
--- a/hw/vfb/.gitignore
+++ b/hw/vfb/.gitignore
@@ -1,3 +1 @@
-#		Add & Override for this directory and it's subdirectories
 Xvfb
-Xvfb.man
diff --git a/hw/vfb/Makefile.am b/hw/vfb/Makefile.am
index de5e1c5..ed46dbb 100644
--- a/hw/vfb/Makefile.am
+++ b/hw/vfb/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = man
+
 bin_PROGRAMS = Xvfb
 noinst_LIBRARIES = libfbcmap.a
 
@@ -28,24 +30,5 @@ Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS)
 Xvfb_DEPENDENCIES = $(XVFB_LIBS)
 Xvfb_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
 
-# Man page
-include $(top_srcdir)/cpprules.in
-
-appmandir = $(APP_MAN_DIR)
-
-appman_PRE = Xvfb.man
-appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
-
-BUILT_SOURCES = $(appman_PRE)
-CLEANFILES = $(appman_PRE) $(appman_DATA)
-
-SUFFIXES += .$(APP_MAN_SUFFIX) .man
-
-.man.$(APP_MAN_SUFFIX):
-	-$(AM_V_at)rm -f $@
-	$(AM_V_at)$(LN_S) $< $@
-
-EXTRA_DIST = Xvfb.man.pre
-
 relink:
 	$(AM_V_at)rm -f Xvfb$(EXEEXT) && $(MAKE) Xvfb$(EXEEXT)
diff --git a/hw/vfb/Xvfb.man.pre b/hw/vfb/Xvfb.man.pre
deleted file mode 100644
index 569afe1..0000000
--- a/hw/vfb/Xvfb.man.pre
+++ /dev/null
@@ -1,125 +0,0 @@
-.\" $XdotOrg: xc/programs/Xserver/hw/vfb/Xvfb.man,v 1.3 2005/03/23 20:49:52 gisburn Exp $
-.\" $Xorg: Xvfb.man,v 1.4 2001/02/09 02:04:45 xorgcvs Exp $
-.\" Copyright 1993, 1998  The Open Group
-.\" 
-.\" Permission to use, copy, modify, distribute, and sell this software and its
-.\" documentation for any purpose is hereby granted without fee, provided that
-.\" the above copyright notice appear in all copies and that both that
-.\" copyright notice and this permission notice appear in supporting
-.\" documentation.
-.\" 
-.\" The above copyright notice and this permission notice shall be included
-.\" in all copies or substantial portions of the Software.
-.\" 
-.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-.\" OTHER DEALINGS IN THE SOFTWARE.
-.\" 
-.\" Except as contained in this notice, the name of The Open Group shall
-.\" not be used in advertising or otherwise to promote the sale, use or
-.\" other dealings in this Software without prior written authorization
-.\" from The Open Group.
-.\"
-.\" $XFree86: xc/programs/Xserver/hw/vfb/Xvfb.man,v 1.9 2001/12/14 19:59:45 dawes Exp $
-.\"
-.TH XVFB 1 __xorgversion__
-.SH NAME
-Xvfb \- virtual framebuffer X server for X Version 11
-.SH SYNOPSIS
-.B Xvfb
-[ option ] ...
-.SH DESCRIPTION
-.I Xvfb
-is an X server that can run on machines with no display hardware
-and no physical input devices.  It emulates a dumb framebuffer using
-virtual memory.
-.PP
-The primary use of this server was intended to be server testing.  The
-fb code for any depth can be exercised with this server
-without the need for real hardware that supports the desired depths.
-The X community has found many other novel uses for \fIXvfb\fP,
-including testing clients against unusual depths and screen
-configurations, doing batch processing with \fIXvfb\fP as a background
-rendering engine, load testing, as an aid to porting the X server to a
-new platform, and providing an unobtrusive way to run applications
-that don't really need an X server but insist on having one anyway.
-.SH OPTIONS
-.PP
-In addition to the normal server options described in the \fIXserver(1)\fP
-manual page, \fIXvfb\fP accepts the following command line switches:
-.TP 4
-.B "\-screen \fIscreennum\fP \fIWxHxD\fP"
-This option creates screen \fIscreennum\fP and sets its width, height,
-and depth to W, H, and D respectively.  By default, only screen 0 exists
-and has the dimensions 1280x1024x8.
-.TP 4
-.B "\-pixdepths \fIlist-of-depths\fP"
-This option specifies a list of pixmap depths that the server should
-support in addition to the depths implied by the supported screens.
-\fIlist-of-depths\fP is a space-separated list of integers that can
-have values from 1 to 32.
-.TP 4
-.B "\-fbdir \fIframebuffer-directory\fP"
-This option specifies the directory in which the memory mapped files
-containing the framebuffer memory should be created.
-See FILES. 
-This option only exists on machines that have the mmap and msync system
-calls.
-.TP 4
-.B "\-shmem"
-This option specifies that the framebuffer should be put in shared memory.
-The shared memory ID for each screen will be printed by the server.
-The shared memory is in xwd format.
-This option only exists on machines that support the System V shared memory
-interface.
-.PP
-If neither \fB\-shmem\fP nor \fB\-fbdir\fP is specified,
-the framebuffer memory will be allocated with malloc().
-.TP 4
-.B "\-linebias \fIn\fP"
-This option specifies how to adjust the pixelization of thin lines.
-The value \fIn\fP is a bitmask of octants in which to prefer an axial
-step when the Bresenham error term is exactly zero.  See the file
-Xserver/mi/miline.h for more information.  This option is probably only useful
-to server developers to experiment with the range of line pixelization
-possible with the fb code.
-.TP 4
-.B "\-blackpixel \fIpixel-value\fP, \-whitepixel \fIpixel-value\fP"
-These options specify the black and white pixel values the server should use.
-.SH FILES
-The following files are created if the \-fbdir option is given.
-.TP 4
-\fIframebuffer-directory\fP/Xvfb_screen<n>
-Memory mapped file containing screen n's framebuffer memory, one file
-per screen.  The file is in xwd format.  Thus, taking a full-screen
-snapshot can be done with a file copy command, and the resulting
-snapshot will even contain the cursor image.
-.SH EXAMPLES
-.TP 8
-Xvfb :1 -screen 0 1600x1200x32
-The server will listen for connections as server number 1, and screen 0
-will be depth 32 1600x1200.
-.TP 8
-Xvfb :1 -screen 1 1600x1200x16
-The server will listen for connections as server number 1, will have the
-default screen configuration (one screen, 1280x1024x8), and screen 1
-will be depth 16 1600x1200.
-.TP 8
-Xvfb -pixdepths 3 27 -fbdir /var/tmp
-The server will listen for connections as server number 0, will have the
-default screen configuration (one screen, 1280x1024x8),
-will also support pixmap
-depths of 3 and 27, 
-and will use memory mapped files in /var/tmp for the framebuffer.
-.TP 8
-xwud -in /var/tmp/Xvfb_screen0
-Displays screen 0 of the server started by the preceding example.
-.SH "SEE ALSO"
-.PP
-X(__miscmansuffix__), Xserver(1), xwd(1), xwud(1), XWDFile.h
-.SH AUTHORS
-David P. Wiggins, The Open Group, Inc.
diff --git a/hw/vfb/man/Makefile.am b/hw/vfb/man/Makefile.am
new file mode 100644
index 0000000..5decadd
--- /dev/null
+++ b/hw/vfb/man/Makefile.am
@@ -0,0 +1,10 @@
+appmandir = $(APP_MAN_DIR)
+appman_PRE = Xvfb.man
+appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
+
+EXTRA_DIST = $(appman_PRE)
+CLEANFILES = $(appman_DATA)
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/vfb/man/Xvfb.man b/hw/vfb/man/Xvfb.man
new file mode 100644
index 0000000..95b4dd4
--- /dev/null
+++ b/hw/vfb/man/Xvfb.man
@@ -0,0 +1,125 @@
+.\" $XdotOrg: xc/programs/Xserver/hw/vfb/Xvfb.man,v 1.3 2005/03/23 20:49:52 gisburn Exp $
+.\" $Xorg: Xvfb.man,v 1.4 2001/02/09 02:04:45 xorgcvs Exp $
+.\" Copyright 1993, 1998  The Open Group
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and its
+.\" documentation for any purpose is hereby granted without fee, provided that
+.\" the above copyright notice appear in all copies and that both that
+.\" copyright notice and this permission notice appear in supporting
+.\" documentation.
+.\"
+.\" The above copyright notice and this permission notice shall be included
+.\" in all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+.\" OTHER DEALINGS IN THE SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of The Open Group shall
+.\" not be used in advertising or otherwise to promote the sale, use or
+.\" other dealings in this Software without prior written authorization
+.\" from The Open Group.
+.\"
+.\" $XFree86: xc/programs/Xserver/hw/vfb/Xvfb.man,v 1.9 2001/12/14 19:59:45 dawes Exp $
+.\"
+.TH XVFB 1 __xorgversion__
+.SH NAME
+Xvfb \- virtual framebuffer X server for X Version 11
+.SH SYNOPSIS
+.B Xvfb
+[ option ] ...
+.SH DESCRIPTION
+.I Xvfb
+is an X server that can run on machines with no display hardware
+and no physical input devices.  It emulates a dumb framebuffer using
+virtual memory.
+.PP
+The primary use of this server was intended to be server testing.  The
+fb code for any depth can be exercised with this server
+without the need for real hardware that supports the desired depths.
+The X community has found many other novel uses for \fIXvfb\fP,
+including testing clients against unusual depths and screen
+configurations, doing batch processing with \fIXvfb\fP as a background
+rendering engine, load testing, as an aid to porting the X server to a
+new platform, and providing an unobtrusive way to run applications
+that don't really need an X server but insist on having one anyway.
+.SH OPTIONS
+.PP
+In addition to the normal server options described in the \fIXserver(1)\fP
+manual page, \fIXvfb\fP accepts the following command line switches:
+.TP 4
+.B "\-screen \fIscreennum\fP \fIWxHxD\fP"
+This option creates screen \fIscreennum\fP and sets its width, height,
+and depth to W, H, and D respectively.  By default, only screen 0 exists
+and has the dimensions 1280x1024x8.
+.TP 4
+.B "\-pixdepths \fIlist-of-depths\fP"
+This option specifies a list of pixmap depths that the server should
+support in addition to the depths implied by the supported screens.
+\fIlist-of-depths\fP is a space-separated list of integers that can
+have values from 1 to 32.
+.TP 4
+.B "\-fbdir \fIframebuffer-directory\fP"
+This option specifies the directory in which the memory mapped files
+containing the framebuffer memory should be created.
+See FILES.
+This option only exists on machines that have the mmap and msync system
+calls.
+.TP 4
+.B "\-shmem"
+This option specifies that the framebuffer should be put in shared memory.
+The shared memory ID for each screen will be printed by the server.
+The shared memory is in xwd format.
+This option only exists on machines that support the System V shared memory
+interface.
+.PP
+If neither \fB\-shmem\fP nor \fB\-fbdir\fP is specified,
+the framebuffer memory will be allocated with malloc().
+.TP 4
+.B "\-linebias \fIn\fP"
+This option specifies how to adjust the pixelization of thin lines.
+The value \fIn\fP is a bitmask of octants in which to prefer an axial
+step when the Bresenham error term is exactly zero.  See the file
+Xserver/mi/miline.h for more information.  This option is probably only useful
+to server developers to experiment with the range of line pixelization
+possible with the fb code.
+.TP 4
+.B "\-blackpixel \fIpixel-value\fP, \-whitepixel \fIpixel-value\fP"
+These options specify the black and white pixel values the server should use.
+.SH FILES
+The following files are created if the \-fbdir option is given.
+.TP 4
+\fIframebuffer-directory\fP/Xvfb_screen<n>
+Memory mapped file containing screen n's framebuffer memory, one file
+per screen.  The file is in xwd format.  Thus, taking a full-screen
+snapshot can be done with a file copy command, and the resulting
+snapshot will even contain the cursor image.
+.SH EXAMPLES
+.TP 8
+Xvfb :1 -screen 0 1600x1200x32
+The server will listen for connections as server number 1, and screen 0
+will be depth 32 1600x1200.
+.TP 8
+Xvfb :1 -screen 1 1600x1200x16
+The server will listen for connections as server number 1, will have the
+default screen configuration (one screen, 1280x1024x8), and screen 1
+will be depth 16 1600x1200.
+.TP 8
+Xvfb -pixdepths 3 27 -fbdir /var/tmp
+The server will listen for connections as server number 0, will have the
+default screen configuration (one screen, 1280x1024x8),
+will also support pixmap
+depths of 3 and 27,
+and will use memory mapped files in /var/tmp for the framebuffer.
+.TP 8
+xwud -in /var/tmp/Xvfb_screen0
+Displays screen 0 of the server started by the preceding example.
+.SH "SEE ALSO"
+.PP
+X(__miscmansuffix__), Xserver(1), xwd(1), xwud(1), XWDFile.h
+.SH AUTHORS
+David P. Wiggins, The Open Group, Inc.
commit 3f4c71799b3164440624d09b7b631d3d3c0a29ef
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:27:50 2011 -0500

    XWin: build XWin man pages using XORG_MANPAGE_SECTIONS
    
    Nothing requires the use of a C preprocessor
    Using standard file extensions (.man) means no need for .gitignore
    Use standard directory and makefile
    Now can be built easily on any platform in the man directory
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index cab7fa7..81e5a8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2246,6 +2246,7 @@ hw/xnest/Makefile
 hw/xnest/man/Makefile
 hw/xwin/Makefile
 hw/xwin/glx/Makefile
+hw/xwin/man/Makefile
 hw/xquartz/Makefile
 hw/xquartz/GL/Makefile
 hw/xquartz/bundle/Makefile
diff --git a/hw/xwin/.gitignore b/hw/xwin/.gitignore
index a8c3a28..bc4986c 100644
--- a/hw/xwin/.gitignore
+++ b/hw/xwin/.gitignore
@@ -1,6 +1,3 @@
-#		Add & Override for this directory and it's subdirectories
 winprefslex.c
 winprefsyacc.c
 winprefsyacc.h
-XWin.man
-XWinrc.man
diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am
index 232d65e..f6a75df 100644
--- a/hw/xwin/Makefile.am
+++ b/hw/xwin/Makefile.am
@@ -156,7 +156,7 @@ winprefsyacc.h: winprefsyacc.c
 winprefslex.c: winprefslex.l winprefsyacc.c winprefsyacc.h
 
 BUILT_SOURCES = winprefsyacc.h winprefsyacc.c winprefslex.c
-CLEANFILES = $(BUILT_SOURCES) $(appman_DATA) $(fileman_DATA) XWin.man XWinrc.man
+CLEANFILES = $(BUILT_SOURCES)
 
 AM_YFLAGS = -d
 AM_LFLAGS = -i
@@ -165,34 +165,13 @@ AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \
             -I$(top_srcdir) \
             -Wno-bad-function-cast
 
-MAN_SRCS = XWin.man.pre XWinrc.man.pre
-
-appmandir = $(APP_MAN_DIR)
-appman_DATA = XWin.$(APP_MAN_SUFFIX)
-
-filemandir = $(FILE_MAN_DIR)
-fileman_DATA = XWinrc.$(FILE_MAN_SUFFIX)
-
-XWin.$(APP_MAN_SUFFIX): XWin.man
-	-$(AM_V_at)rm -f XWin.$(APP_MAN_SUFFIX)
-	$(AM_V_at)$(LN_S) XWin.man XWin.$(APP_MAN_SUFFIX)
-
-XWinrc.$(FILE_MAN_SUFFIX): XWinrc.man
-	-$(AM_V_at)rm -f XWinrc.$(FILE_MAN_SUFFIX)
-	$(AM_V_at)$(LN_S) XWinrc.man XWinrc.$(FILE_MAN_SUFFIX)
-
-EXTRAMANDEFS = -D__logdir__=$(logdir) -D__sysconfdir__=$(sysconfdir) -D__datadir__=$(datadir)
-
 xwinconfigdir = $(sysconfdir)/X11
 xwinconfig_DATA = system.XWinrc
 
-include $(top_srcdir)/cpprules.in
-
 install-exec-hook:
 	(cd $(DESTDIR)$(bindir) && rm -f X && $(LN_S) XWin$(EXEEXT) X)
 
 EXTRA_DIST = \
-	$(MAN_SRCS) \
 	$(xwinconfig_DATA) \
 	X.ico \
 	XWin.rc \
@@ -220,5 +199,5 @@ EXTRA_DIST = \
 relink:
 	$(AM_V_at)rm -f XWin$(EXEEXT) && $(MAKE) XWin$(EXEEXT)
 
-SUBDIRS = $(GLX_DIR) .
-DIST_SUBDIRS = glx .
+SUBDIRS = man $(GLX_DIR) .
+DIST_SUBDIRS = man glx .
diff --git a/hw/xwin/XWin.man.pre b/hw/xwin/XWin.man.pre
deleted file mode 100644
index 51268f6..0000000
--- a/hw/xwin/XWin.man.pre
+++ /dev/null
@@ -1,346 +0,0 @@
-.TH XWIN 1 __vendorversion__
-.SH NAME
-XWin \- X Server for the Cygwin environment on Microsoft Windows
-
-
-.SH SYNOPSIS
-.B XWin
-[ options ] ...
-
-
-.SH DESCRIPTION
-\fIXWin\fP is an X Server for the X Window System on the Cygwin environment
-running on Microsoft Windows.
-
-
-.SH MODES
-\fIXWin\fP can operate in 3 different modes:
-.br
-* \fISingle Window\fP: This is the default mode.  Each X screen
-appears as a single \fIWindows\fP window and all X windows are contained
-within this window.
-(In X terminology, the \fIWindows\fP window contains the root window for
-the screen)
-.br
-* \fIMulti-Window\fP: In this mode \fIXWin\fP uses its own integrated
-window manager in order to handle the top-level X windows, in such a
-way that they appear as normal \fIWindows\fP windows.
-.br
-* \fIRootless\fP: In this mode the X server works in a window
-containing the whole screen but this root window (traditionally covered with an X hatch
-pattern) is hidden from view, so only top-level X windows are seen.
-
-.SH OPTIONS
-In addition to the normal server options described in the \fIXserver(1)\fP
-manual page, \fIXWin\fP accepts the following command line switches,
-\fIall\fP of which are optional:
-
-.SH OPTIONS CONTROLLING WINDOWING MODE
-Only one of these options may be specified.
-.TP 8
-.B (default)
-Windowed or rooted mode.
-Each X screen appears as a single \fIWindows\fP window and all X windows are
-contained within those windows.
-.TP 8
-.B \-multiwindow
-Each top-level X window appears in its own \fIWindows\fP window.
-Also start the integrated \fIWindows\fP-based window manager.
-.TP 8
-.B \-rootless
-Run the server in rootless mode.
-The X server works on a window covering the whole screen but the root window
-is hidden from view.
-.TP 8
-.B \-mwextwm
-Experimental.
-The mode combines \fB\-rootless\fP mode drawing with native \fIWindows\fP
-window frames managed by the experimental external window manager \fIxwinwm\fP.
-.PP
-\fBNOTE:\fP \fI-multiwindow\fP mode uses its own internal window manager.
-All other modes require an external window manager in order to move, resize, and perform other
-operations on the individual X windows.
-
-.SH OPTIONS FOR SPECIFYING X SCREENS
-An X display may be composed of multiple screens.
-The default behaviour is to create a single screen 0 that is roughly the
-size of useful area of the primary monitor (allowing for any window
-decorations and the task-bar).
-
-Screen specific parameters, such as \fB\-fullscreen\fP, can be applied as a
-default to all screens by placing those screen specific parameters
-before any \fB\-screen\fP parameter.  Screen specific parameters placed after
-the first \fB\-screen\fP parameter will apply only to the immediately
-preceeding \fB\-screen\fP parameter.
-.TP 8
-.B \-[no]multimonitors or \-[no]multiplemonitors
-Create a screen 0 that covers all monitors [the primary monitor] on a system with
-multiple monitors.
-This option is currently enabled by default in \fB\-multiwindow\fP mode.
-.TP 8
-.B "\-screen \fIscreen_number\fP [\fIW\fP \fIH\fP [\fIX\fP \fIY\fP] | [[\fIW\fPx\fIH\fP[+\fIX\fP+\fIY\fP]][@\fIM\fP]] ] "
-Create screen number
-.I screen_number
-and optionally specify it's
-.I height,
-.I width
-and
-.I initial position.
-Additionally a
-.I
-monitor number
-(which count from 1) can be specified to place the screen on,
-at which point, all coordinates become relative to that monitor.
-Screen numbers must be contiguous starting from zero and cannot be duplicated.
-
-Examples:
-
-.I "  -screen 0 @1 ; on 1st monitor using its full resolution (the default)"
-
-.I "  -screen 0 800x600+100+100 at 2 ; on 2nd monitor offset 100,100 size 800x600"
-
-.I "  -screen 0 1024x768 at 3        ; on 3rd monitor size 1024x768"
-
-.SH OPTIONS CONTROLLING THE APPEARANCE OF THE X SCREEN WINDOWS
-These parameters only apply to windowed mode screens i.e. not
-in \fB-multwindow\fP or \fB-rootless\fP mode
-.TP 8
-.B "\-fullscreen"
-The X server window takes the full screen, covering completely the
-\fIWindows\fP desktop.
-.TP 8
-.B \-nodecoration
-Do not give the Cygwin/X window a \fIWindows\fP window border, title bar,
-etc.
-This parameter is ignored when the \fB\-fullscreen\fP parameter is specified.
-.TP 8
-.B \-scrollbars
-In windowed mode, allow screens bigger than the \fIWindows\fP desktop.
-Moreover, if the window has decorations, one can now resize it.
-This parameter is ignored when the \fB\-fullscreen\fP parameter is specified.
-
-
-.SH OPTIONS CONTROLLING WINDOWS INTEGRATION
-.TP 8
-.B \-[no]clipboard
-Enables [disables] the integration between the Cygwin/X clipboard and
-\fIWindows\fP clipboard.  The default is enabled.
-.TP 8
-.B "\-emulate3buttons [\fItimeout\fP]"
-Emulate a three button mouse; pressing both buttons within
-.I timeout
-milliseconds causes an emulated middle button press.  The default
-.I timeout
-is 50 milliseconds.  Note that most mice with scroll wheel have middle
-button functionality, usually you will need this option only if you have
-a two button mouse without scroll wheel.
-.TP 8
-.B \-[no]keyhook
-Enable [disable] a low-level keyboard hook for catching
-special keypresses like Menu and Alt+Tab and passing them to the X
-Server instead of letting \fIWindows\fP handle them.
-.TP 8
-.B \-lesspointer
-Normally the \fIWindows\fP mouse cursor is hidden when the mouse is
-over an active Cygwin/X window.  This option causes the mouse cursor
-also to be hidden when it is over an inactive Cygwin/X window.  This
-prevents the \fIWindows\fP mouse cursor from being drawn on top of the X
-cursor.
-This parameter has no effect unless \fB-swcursor\fP is also specified.
-.TP 8
-.B \-swcursor
-Disable the usage of the \fIWindows\fP cursor and use the X11 software cursor instead.
-.TP 8
-.B \-[no]trayicon
-Do not create a tray icon.  Default is to create one
-icon per screen.  You can globally disable tray icons with
-\fB\-notrayicon\fP, then enable it for specific screens with
-\fB\-trayicon\fP for those screens.
-.TP 8
-.B \-nounicodeclipboard
-Do not use Unicode clipboard even if on a NT-based platform.
-.TP 8
-.B \-[no]unixkill
-Enable or disable the \fICtrl-Alt-Backspace\fP key combination as a
-signal to exit the X Server.  The \fICtrl-Alt-Backspace\fP key combination
-is disabled by default.
-.TP 8
-.B \-[no]winkill
-Enable or disable the \fIAlt-F4\fP key combination as a signal to exit the
-X Server.
-The \fIAlt-F4\fP key combination is enabled by default.
-
-.SH DRAWING ENGINE OPTIONS
-.TP 8
-.B "\-clipupdates \fInum_boxes\fP"
-Specify an optional threshold, above which the regions in a shadow
-update operation will be collected into a GDI clipping region.  The
-clipping region is then used to do a single bit block transfer that is
-constrained to the updated area by the clipping region.  There is some
-overhead involved in creating, installing, destroying, and removing
-the clipping region, thus there may not be much benefit for a small
-number of boxes (less than 10).  It is even possible that this
-functionality does not provide a benefit at any number of boxes; we
-can only determine the usefulness of this feature through testing.
-This option probably has limited effect on current \fIWindows\fP versions
-as they already perform GDI batching.
-This parameter works in conjunction with engines 1, 2, and 4 (Shadow
-GDI, Shadow DirectDraw, and Shadow DirectDraw Non-Locking,
-respectively).
-.TP 8
-.B "\-engine \fIengine_type_id\fP"
-This option, which is intended for Cygwin/X developers,
-overrides the server's automatically selected engine type.  This
-parameter will be ignored if the specified engine type is not
-supported on the current system.  The supported engine type ids are 1
-- Shadow GDI, 2 - Shadow DirectDraw, and 4 - Shadow DirectDraw Non-Locking.
-Additionally, there are engines with type ids
-8 - Primary DirectDraw (obsolete) and 16 - Native GDI (experimental and barely functional).
-Default behavior is to determine the engine with optimum performance that
-supports the specified depth and window configuration.
-
-.SH FULLSCREEN OPTIONS
-.TP 8
-.B "\-depth \fIdepth\fP"
-Specify the color depth, in bits per pixel, to use when running in
-fullscreen with a DirectDraw engine.  This parameter is ignored if
-\fB\-fullscreen\fP is not specified.
-.TP 8
-.B "\-refresh \fIrate_in_Hz\fP"
-Specify an optional refresh rate to use when running in
-fullscreen with a DirectDraw engine.  This parameter is ignored if
-\fB\-fullscreen\fP is not specified.
-
-.SH MISCELLANEOUS OPTIONS
-See also the normal server options described in the \fIXserver(1)\fP
-manual page
-
-.TP 8
-.B \-help
-Write a help text listing supported command line options and their description to the console.
-.TP 8
-.B \-ignoreinput
-Ignore keyboard and mouse input.  This is usually only used for testing
-and debugging purposes.
-.TP 8
-.B "\-logfile \fIfilename\fP"
-Change the server log file from the default of \fI
-__logdir__/XWin.n.log\fP,
-where \fIn\fP is the display number of the XWin server, to \fIfilename\fP.
-.TP 8
-.B "\-logverbose \fIlevel\fP"
-Control the degree of verbosity of the log messages with the integer
-parameter \fIlevel\fP.  For \fIlevel\fP=0 only fatal errors are
-reported, for \fIlevel\fP=1 simple information about
-configuration is also given, for \fIlevel\fP=2 (default)
-additional runtime information is recorded
-and for \fIlevel\fP=3 detailed log
-information (including trace and debug output) is produced.  Bigger
-values will yield a still more detailed debug output.
-.TP 8
-.B \-silent-dup-error
-If another instance of \fIXWin\fP with the same display number is found running,
-exit silently and don't display any error message.
-.TP 8
-.B "\-xkblayout \fIlayout\fP"
-.TP 8
-.B "\-xkbmodel \fImodel\fP"
-.TP 8
-.B "\-xkboptions \fIoption\fP"
-.TP 8
-.B "\-xkbrules \fIrule\fP"
-.TP 8
-.B "\-xkbvariant \fIvariant\fp"
-These options configure the xkeyboard extension to load
-a particular keyboard map as the X server starts.  The behavior is similar
-to the \fIsetxkbmap\fP program.  The layout data is located at \fI
-__datadir__/X11/xkb/\fP.  Additional information is found in the
-README files therein and in the man page of \fIsetxkbmap\fP.  For example
-in order to load a German layout for a pc105 keyboard one uses
-the options:
-.br
-.I " \-xkblayout de \-xkbmodel pc105"
-
-Alternatively one may use the \fIsetxkbmap\fP program after \fIXWin\fP is
-running.
-
-The default is to select a configuration matching your current layout as
-reported by \fIWindows\fP, if known, or the default X server configuration
-if no matching keyboard configuration was found.
-
-.SH UNDOCUMENTED OPTIONS
-These options are undocumented.  Do not use them.
-
-.TP 8
-.B \-emulatepseudo
-Create a depth 8 PseudoColor visual when running in depths 15, 16, 24,
-or 32, collectively known as TrueColor depths.
-Color map manipulation is not supported, so the PseudoColor visual will
-not have the correct colors.
-This option is intended to allow applications which only work with a depth 8
-visual to operate in TrueColor modes.
-.TP 8
-.B \-internalwm
-Run the internal window manager.
-
-.SH LOG FILE
-As it runs \fIXWin\fP writes messages indicating the most relevant events
-to  the console
-from which it was called and to a log file that by default is located at \fI
-__logdir__/XWin.0.log\fP.  This file is mainly for debugging purposes.
-
-
-.SH PREFERENCES FILE
-On startup \fIXWin\fP looks for the file \fI$HOME/.XWinrc\fP or, if
-the previous file does not exist, \fI
-__sysconfdir__/X11/system.XWinrc\fP.  \fI.XWinrc\fP allows setting
-preferences for the following:
-.br
-* To include items into the menu associated with the \fIXWin\fP icon
-which is in the \fIWindows\fP system tray.  This functions in all
-modes that have a tray icon.
-.br
-* To include items in the system menu which is associated with the \fIWindows\fP
-window that \fIXWin -multiwindow\fP produces for each top-level X
-window, in both the generic case and for particular programs.
-.br
-* To change the icon that is associated to the \fIWindows\fP window that
-\fIXWin -multiwindow\fP produces for each top-level X-window.
-.br
-* To change the style that is associated to the \fIWindows\fP window that
-\fXWin I-multiwindow\fP produces for each top-level X window.
-.PP
-The format of the \fI.XWinrc\fP file is given in the man page XWinrc(5).
-
-.SH EXAMPLES
-Need some examples
-
-
-.SH "SEE ALSO"
-X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), XWinrc(__filemansuffix__), setxkbmap(1)
-
-
-.SH BUGS
-.I XWin
-and this man page still have many limitations.  Some of the more obvious
-ones are:
-.br
-- The display mode can not be changed once the X server has started.
-.br
-- The \fIXWin\fP software is continuously developing; it is therefore possible that
-this man page is not up to date.  It is always prudent to
-look also at the output of \fIXWin -help\fP in order to
-check the options that are operative.
-
-
-.SH AUTHORS
-This list is by no means complete, but direct contributors to the
-Cygwin/X project include (in alphabetical order by last name): Stuart
-Adamson, Michael Bax, Jehan Bing, Lev Bishop, Dr. Peter Busch, Biju G
-C, Robert Collins, Nick Crabtree, Early Ehlinger, Christopher Faylor,
-John Fortin, Brian Genisio, Fabrizio Gennari, Alexander Gottwald, Ralf
-Habacker, Colin Harrison, Matthieu Herrb, Alan Hourihane, Pierre A
-Humblet, Harold L Hunt II, Dakshinamurthy Karra, Joe Krahn,
-Paul Loewenstein, Kensuke Matsuzaki,
-Takuma Murakami, Earle F. Philhower III, Benjamin Riefenstahl, Yaakov Selkowitz,
-Suhaib Siddiqi, Jack Tanner, Jon Turney and Nicholas Wourms.
diff --git a/hw/xwin/XWinrc.man.pre b/hw/xwin/XWinrc.man.pre
deleted file mode 100644
index 5c1fb97..0000000
--- a/hw/xwin/XWinrc.man.pre
+++ /dev/null
@@ -1,253 +0,0 @@
-.TH XWIN 5 __vendorversion__
-
-
-.SH NAME
-XWinrc\- XWin Server Resource Configuration File.
-
-
-.SH DESCRIPTION
-The X Server for the X Window System on the Cygwin/X environment
-running on Microsoft Windows, \fIXWin\fP can be optionally configured
-with the \fIXWinrc\fP file.  A system-wide configuration file should
-be placed in \fI
-__sysconfdir__/X11/system.XWinrc\fP, a per-user file
-should be put at \fI$HOME/.XWinrc\fP.  The \fIsystem.XWinrc\fP file is
-read only if no \fI$HOME/.XWinrc\fP exist.
-.PP
-With the \fI.XWinrc\fP configuration file it is possible to do the
-following:
-.PP
-1- To include items into the menu associated with the \fIXWin\fP icon
-which is in the \fIWindows\fP system tray.  This feature functions in
-all XWin modes that have such tray icon.
-.PP
-2- To include items into the menu which is associated with the
-\fIWindows\fP window that \fIXWin -multiwindow\fP produces for each
-top-level X-window.  That can be done both for the generic case and
-for particular programs.
-.PP
-3- To change the icon that is associated to the \fIWindows\fP window
-that \fIXWin -multiwindow\fP produces for each top-level X-window.
-Again, that can be done both for the generic case and for particular
-programs.  The new icons associated should be \fIWindows\fP format
-icons \fI.ico\fP.
-.PP
-4- To change the style that is associated to the \fIWindows\fP window
-that \fI-multiwindow\fP produces for  each  top-level  X window.   Again,
-that can be done both for the generic case and for particular programs.
-
-
-.SH FILE FORMAT
-.B Keywords
-are case insensitive, but in this document they will be written
-completely capitalized.
-.PP
-.B Comments
-are legal pretty much anywhere you can have an end-of-line; they
-begin with "#" or "//" and go to the end-of-line.
-.PP
-Quote marks in strings are optional unless the string has included spaces,
-or could be parsed, ambiguously, as a misplaced keyword.
-.PP
-There are four kinds of instructions: miscellaneous, menu, icon and style.
-
-
-.SH Miscellaneous instruction
-.TP 8
-.B DEBUG \fIString\fP
-The \fIString\fP is printed to the XWin log file.
-
-.TP 8
-.B TRAYICON \fIicon-specifier\fB
-The \fBTRAYICON\fP keyword changes the icon \fIXWin\fP displays in the
-system tray area.
-
-.TP 8
-.B SILENTEXIT
-The \fBSILENTEXIT\fP keyword, which takes no parameters, disables the
-exit confirmation dialog if no clients are connected.
-
-.TP 8
-.B FORCEEXIT
-The \fBFORCEEXIT\fP keyword, which takes no parameters, disables the
-exit confirmation dialog always.  Unsaved client work may be lost but
-this may be useful if you want no dialogs.
-
-.SH Menu instructions
-.TP 8
-.B MENU \fIMenu_Name\fP {
-.br
-.B       \fIMenu_Item_Line\fP
-.br
-.B       \fIMenu_Item_Line\fP
-.br
-.B        \fI...\fP
-.br
-.B }
-.br
-This instruction defines a menu and asigns a \fIMenu_Name\fP to it.
-\fIMenu_Item_Line\fP are lines  of any of the following types:
-.TP 8
-.B \t SEPARATOR
-.TP 8
-.B  \t \fIItem_Label\fP  EXEC \fICommand\fP
-.TP 8
-.B \t \fIItem_Label\fP  MENU \fIpreviously-defined-menu-name\fP
-.TP 8
-.B \t \fIItem_Label\fP  ALWAYSONTOP
-.TP 8
-.B \t \fIItem_Label\fP  RELOAD
-.br
-The \fIItem_Label\fP is the string that is written in the menu item.
-.br
-\fICommand\fP is a string with the command that will be executed by /bin/sh.
-Here paths should be \fICYGWIN\fP style (e.g. /usr/local/bin/myprogram).
-A string "%display%" appearing in the \fICommand\fP will be replaced
-with the proper display variable (i.e. 127.0.0.1:<display>.0).
-.br
-\fBALWAYSONTOP\fP sets the window to which the menu is associated to
-display above all others.
-.br
-\fBRELOAD\fP causes the XWinrc file to be reloaded and icons and menus
-regenerated.
-.TP 8
-.B ROOTMENU \fIpreviously-defined-menu-name\fP
-Includes the items in the indicated menu into the menu associated with
-\fIXWin\fP that appears in the system tray.
-.TP 8
-.B DEFAULTSYSMENU \fIpreviously-defined-menu-name\fP ATSTART|ATEND
-Includes the items in the indicated menu into the menu associated with
-generic top-level X-Windows in the \fIXWin\fP \fImultiwindow\fP mode.  The
-keywords \fBATSTART\fP and \fBATEND\fP indicate if such items should be
-included at the start or at the end of the menu.
-.TP 8
-.B SYSMENU {
-  \fIclass-or-name-of-window\fP \fIdefined-menu-name\fP \fBATSTART|ATEND\fP
-.br
-  \fI...\fP
-.br
-  \fB}\fP
-.br
-Associates a specific menu to a specified window class or name
-in \fI-multiwindow\fP mode. The keywords ATSTART or ATEND indicate if
-such items should be included at the start or at the end of the menu.
-
-
-.SH Icon Instructions
-When specifying an \fIicon-file\fP in the following commands several different formats are allowed:
-.br
-\fB"NAME.ICO"\fP\fI of an .ico format file\fP
-.br
-\t \t ("cygwin.ico", "apple.ico")
-.br
-\fB"NAME.DLL,nn"\fP\fI of a .DLL and icon index\fP
-.br
-\t \t ("c:\\windows\\system32\\shell32.dll,4" is the default folder icon)
-.br
-\fB",nnn"\fP\fI index into XWin.EXE internal ICON resources\fP
-.br
-\t \t (",101" is the 1st icon inside \fIXWin.EXE\fP)
-.TP 8
-.B ICONDIRECTORY \fIWindows-path-to-icon-directory\fP
-Defines the default directory to search for \ficon-file\fP files.
-It should be a \fIWindows\fP style path (e.g. C:\\cygwin\\usr\\local\\icons).
-.TP 8
-.B DEFAULTICON \fIicon-file\fP
-Defines a replacement for the standard X icon for applications without
-specified icons.
-.TP 8
-.B ICONS {
-.br
- \fIclass-or-name-of-window\fP \fIicon-file\fP
-.br
-  \fI...\fP
-.br
-  \fB}\fP
-.br
-Defines icon replacements windows matching the specified window class or names.
-If multiple name or class matches occur for a window, only the first one
-will be used.
-
-.SH Style Instructions
-.TP 8
-.B STYLES {
-\fIclass-or-name-of-window\fP \fIstyle-keyword-1\fP \fIstyle-keyword-2\fP
-.br
-  \fI...\fP
-.br
-\fB}\fP
-
-Associates specific styles to a specified window class or name
-in \fI-multiwindow\fP mode.  If multiple class or name matches occur,
-for a window, only the first one will be used.
-
-The style keywords indicate the following:
-
-\fIstyle-keyword-1\fP
-
-\fBTOPMOST\fP
-.br
-Open the class or name above all NOTOPMOST Microsoft Windows
-.br
-\fBMAXIMIZE\fP
-.br
-Start the class or name fullscreen.
-.br
-\fBMINIMIZE\fP
-.br
-Start the class or name iconic.
-.br
-\fBBOTTOM\fP
-.br
-Open the class or name below all Windows windows.
-.br
-
-\fIstyle-keyword-2\fP
-
-\fBNOTITLE\fP
-.br
-No Windows title bar, for the class or name.
-.br
-\fBOUTLINE\fP
-.br
-No Windows title bar and just a thin-line border, for the class or name.
-.br
-\fBNOFRAME\fP
-.br
-No Windows title bar or border, for the class or name.
-
-One keyword in \fIstyle-keyword-1\fP can be used with one keyword in \fIstyle-keyword-2\fP,
-or any keyword can be used singly.
-
-
-.SH EXAMPLE
-.TP 8
-This example adds an Xterm menu item to the system tray icon
-\fBMENU systray {
-.br
-\t xterm  EXEC "xterm -display %display% -sb -sl 999"
-.br
-\t SEPARATOR
-.br
-}
-.br
-ROOTMENU systray
-\fP
-
-.TP 8
-This example makes an oclock window frameless in \fI-multiwindow\fP mode
-\fBSTYLES {
-.br
-\t oclock NOFRAME
-.br
-}
-
-
-
-.SH "SEE ALSO"
- XWin(1)
-
-
-.SH AUTHOR
-The XWinrc feature of XWin was written primarily by Earle F. Philhower
-III.  Extended for style configuration by Colin Harrison.
diff --git a/hw/xwin/man/Makefile.am b/hw/xwin/man/Makefile.am
new file mode 100644
index 0000000..98a89a5
--- /dev/null
+++ b/hw/xwin/man/Makefile.am
@@ -0,0 +1,21 @@
+appmandir = $(APP_MAN_DIR)
+appman_PRE = XWin.man
+appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
+
+filemandir = $(FILE_MAN_DIR)
+fileman_PRE = XWinrc.man
+fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX))
+
+EXTRA_DIST = $(appman_PRE) $(fileman_PRE)
+CLEANFILES = $(appman_DATA) $(fileman_DATA)
+SUFFIXES = .$(APP_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man
+
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+MAN_SUBSTS += 	-e 's|__logdir__|$(logdir)|g' \
+		-e 's|__datadir__|$(datadir)|g' \
+		-e 's|__sysconfdir__|$(sysconfdir)|g'
+
+.man.$(APP_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+.man.$(FILE_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man
new file mode 100644
index 0000000..51268f6
--- /dev/null
+++ b/hw/xwin/man/XWin.man
@@ -0,0 +1,346 @@
+.TH XWIN 1 __vendorversion__
+.SH NAME
+XWin \- X Server for the Cygwin environment on Microsoft Windows
+
+
+.SH SYNOPSIS
+.B XWin
+[ options ] ...
+
+
+.SH DESCRIPTION
+\fIXWin\fP is an X Server for the X Window System on the Cygwin environment
+running on Microsoft Windows.
+
+
+.SH MODES
+\fIXWin\fP can operate in 3 different modes:
+.br
+* \fISingle Window\fP: This is the default mode.  Each X screen
+appears as a single \fIWindows\fP window and all X windows are contained
+within this window.
+(In X terminology, the \fIWindows\fP window contains the root window for
+the screen)
+.br
+* \fIMulti-Window\fP: In this mode \fIXWin\fP uses its own integrated
+window manager in order to handle the top-level X windows, in such a
+way that they appear as normal \fIWindows\fP windows.
+.br
+* \fIRootless\fP: In this mode the X server works in a window
+containing the whole screen but this root window (traditionally covered with an X hatch
+pattern) is hidden from view, so only top-level X windows are seen.
+
+.SH OPTIONS
+In addition to the normal server options described in the \fIXserver(1)\fP
+manual page, \fIXWin\fP accepts the following command line switches,
+\fIall\fP of which are optional:
+
+.SH OPTIONS CONTROLLING WINDOWING MODE
+Only one of these options may be specified.
+.TP 8
+.B (default)
+Windowed or rooted mode.
+Each X screen appears as a single \fIWindows\fP window and all X windows are
+contained within those windows.
+.TP 8
+.B \-multiwindow
+Each top-level X window appears in its own \fIWindows\fP window.
+Also start the integrated \fIWindows\fP-based window manager.
+.TP 8
+.B \-rootless
+Run the server in rootless mode.
+The X server works on a window covering the whole screen but the root window
+is hidden from view.
+.TP 8
+.B \-mwextwm
+Experimental.
+The mode combines \fB\-rootless\fP mode drawing with native \fIWindows\fP
+window frames managed by the experimental external window manager \fIxwinwm\fP.
+.PP
+\fBNOTE:\fP \fI-multiwindow\fP mode uses its own internal window manager.
+All other modes require an external window manager in order to move, resize, and perform other
+operations on the individual X windows.
+
+.SH OPTIONS FOR SPECIFYING X SCREENS
+An X display may be composed of multiple screens.
+The default behaviour is to create a single screen 0 that is roughly the
+size of useful area of the primary monitor (allowing for any window
+decorations and the task-bar).
+
+Screen specific parameters, such as \fB\-fullscreen\fP, can be applied as a
+default to all screens by placing those screen specific parameters
+before any \fB\-screen\fP parameter.  Screen specific parameters placed after
+the first \fB\-screen\fP parameter will apply only to the immediately
+preceeding \fB\-screen\fP parameter.
+.TP 8
+.B \-[no]multimonitors or \-[no]multiplemonitors
+Create a screen 0 that covers all monitors [the primary monitor] on a system with
+multiple monitors.
+This option is currently enabled by default in \fB\-multiwindow\fP mode.
+.TP 8
+.B "\-screen \fIscreen_number\fP [\fIW\fP \fIH\fP [\fIX\fP \fIY\fP] | [[\fIW\fPx\fIH\fP[+\fIX\fP+\fIY\fP]][@\fIM\fP]] ] "
+Create screen number
+.I screen_number
+and optionally specify it's
+.I height,
+.I width
+and
+.I initial position.
+Additionally a
+.I
+monitor number
+(which count from 1) can be specified to place the screen on,
+at which point, all coordinates become relative to that monitor.
+Screen numbers must be contiguous starting from zero and cannot be duplicated.
+
+Examples:
+
+.I "  -screen 0 @1 ; on 1st monitor using its full resolution (the default)"
+
+.I "  -screen 0 800x600+100+100 at 2 ; on 2nd monitor offset 100,100 size 800x600"
+
+.I "  -screen 0 1024x768 at 3        ; on 3rd monitor size 1024x768"
+
+.SH OPTIONS CONTROLLING THE APPEARANCE OF THE X SCREEN WINDOWS
+These parameters only apply to windowed mode screens i.e. not
+in \fB-multwindow\fP or \fB-rootless\fP mode
+.TP 8
+.B "\-fullscreen"
+The X server window takes the full screen, covering completely the
+\fIWindows\fP desktop.
+.TP 8
+.B \-nodecoration
+Do not give the Cygwin/X window a \fIWindows\fP window border, title bar,
+etc.
+This parameter is ignored when the \fB\-fullscreen\fP parameter is specified.
+.TP 8
+.B \-scrollbars
+In windowed mode, allow screens bigger than the \fIWindows\fP desktop.
+Moreover, if the window has decorations, one can now resize it.
+This parameter is ignored when the \fB\-fullscreen\fP parameter is specified.
+
+
+.SH OPTIONS CONTROLLING WINDOWS INTEGRATION
+.TP 8
+.B \-[no]clipboard
+Enables [disables] the integration between the Cygwin/X clipboard and
+\fIWindows\fP clipboard.  The default is enabled.
+.TP 8
+.B "\-emulate3buttons [\fItimeout\fP]"
+Emulate a three button mouse; pressing both buttons within
+.I timeout
+milliseconds causes an emulated middle button press.  The default
+.I timeout
+is 50 milliseconds.  Note that most mice with scroll wheel have middle
+button functionality, usually you will need this option only if you have
+a two button mouse without scroll wheel.
+.TP 8
+.B \-[no]keyhook
+Enable [disable] a low-level keyboard hook for catching
+special keypresses like Menu and Alt+Tab and passing them to the X
+Server instead of letting \fIWindows\fP handle them.
+.TP 8
+.B \-lesspointer
+Normally the \fIWindows\fP mouse cursor is hidden when the mouse is
+over an active Cygwin/X window.  This option causes the mouse cursor
+also to be hidden when it is over an inactive Cygwin/X window.  This
+prevents the \fIWindows\fP mouse cursor from being drawn on top of the X
+cursor.
+This parameter has no effect unless \fB-swcursor\fP is also specified.
+.TP 8
+.B \-swcursor
+Disable the usage of the \fIWindows\fP cursor and use the X11 software cursor instead.
+.TP 8
+.B \-[no]trayicon
+Do not create a tray icon.  Default is to create one
+icon per screen.  You can globally disable tray icons with
+\fB\-notrayicon\fP, then enable it for specific screens with
+\fB\-trayicon\fP for those screens.
+.TP 8
+.B \-nounicodeclipboard
+Do not use Unicode clipboard even if on a NT-based platform.
+.TP 8
+.B \-[no]unixkill
+Enable or disable the \fICtrl-Alt-Backspace\fP key combination as a
+signal to exit the X Server.  The \fICtrl-Alt-Backspace\fP key combination
+is disabled by default.
+.TP 8
+.B \-[no]winkill
+Enable or disable the \fIAlt-F4\fP key combination as a signal to exit the
+X Server.
+The \fIAlt-F4\fP key combination is enabled by default.
+
+.SH DRAWING ENGINE OPTIONS
+.TP 8
+.B "\-clipupdates \fInum_boxes\fP"
+Specify an optional threshold, above which the regions in a shadow
+update operation will be collected into a GDI clipping region.  The
+clipping region is then used to do a single bit block transfer that is
+constrained to the updated area by the clipping region.  There is some
+overhead involved in creating, installing, destroying, and removing
+the clipping region, thus there may not be much benefit for a small
+number of boxes (less than 10).  It is even possible that this
+functionality does not provide a benefit at any number of boxes; we
+can only determine the usefulness of this feature through testing.
+This option probably has limited effect on current \fIWindows\fP versions
+as they already perform GDI batching.
+This parameter works in conjunction with engines 1, 2, and 4 (Shadow
+GDI, Shadow DirectDraw, and Shadow DirectDraw Non-Locking,
+respectively).
+.TP 8
+.B "\-engine \fIengine_type_id\fP"
+This option, which is intended for Cygwin/X developers,
+overrides the server's automatically selected engine type.  This
+parameter will be ignored if the specified engine type is not
+supported on the current system.  The supported engine type ids are 1
+- Shadow GDI, 2 - Shadow DirectDraw, and 4 - Shadow DirectDraw Non-Locking.
+Additionally, there are engines with type ids
+8 - Primary DirectDraw (obsolete) and 16 - Native GDI (experimental and barely functional).
+Default behavior is to determine the engine with optimum performance that
+supports the specified depth and window configuration.
+
+.SH FULLSCREEN OPTIONS
+.TP 8
+.B "\-depth \fIdepth\fP"
+Specify the color depth, in bits per pixel, to use when running in
+fullscreen with a DirectDraw engine.  This parameter is ignored if
+\fB\-fullscreen\fP is not specified.
+.TP 8
+.B "\-refresh \fIrate_in_Hz\fP"
+Specify an optional refresh rate to use when running in
+fullscreen with a DirectDraw engine.  This parameter is ignored if
+\fB\-fullscreen\fP is not specified.
+
+.SH MISCELLANEOUS OPTIONS
+See also the normal server options described in the \fIXserver(1)\fP
+manual page
+
+.TP 8
+.B \-help
+Write a help text listing supported command line options and their description to the console.
+.TP 8
+.B \-ignoreinput
+Ignore keyboard and mouse input.  This is usually only used for testing
+and debugging purposes.
+.TP 8
+.B "\-logfile \fIfilename\fP"
+Change the server log file from the default of \fI
+__logdir__/XWin.n.log\fP,
+where \fIn\fP is the display number of the XWin server, to \fIfilename\fP.
+.TP 8
+.B "\-logverbose \fIlevel\fP"
+Control the degree of verbosity of the log messages with the integer
+parameter \fIlevel\fP.  For \fIlevel\fP=0 only fatal errors are
+reported, for \fIlevel\fP=1 simple information about
+configuration is also given, for \fIlevel\fP=2 (default)
+additional runtime information is recorded
+and for \fIlevel\fP=3 detailed log
+information (including trace and debug output) is produced.  Bigger
+values will yield a still more detailed debug output.
+.TP 8
+.B \-silent-dup-error
+If another instance of \fIXWin\fP with the same display number is found running,
+exit silently and don't display any error message.
+.TP 8
+.B "\-xkblayout \fIlayout\fP"
+.TP 8
+.B "\-xkbmodel \fImodel\fP"
+.TP 8
+.B "\-xkboptions \fIoption\fP"
+.TP 8
+.B "\-xkbrules \fIrule\fP"
+.TP 8
+.B "\-xkbvariant \fIvariant\fp"
+These options configure the xkeyboard extension to load
+a particular keyboard map as the X server starts.  The behavior is similar
+to the \fIsetxkbmap\fP program.  The layout data is located at \fI
+__datadir__/X11/xkb/\fP.  Additional information is found in the
+README files therein and in the man page of \fIsetxkbmap\fP.  For example
+in order to load a German layout for a pc105 keyboard one uses
+the options:
+.br
+.I " \-xkblayout de \-xkbmodel pc105"
+
+Alternatively one may use the \fIsetxkbmap\fP program after \fIXWin\fP is
+running.
+
+The default is to select a configuration matching your current layout as
+reported by \fIWindows\fP, if known, or the default X server configuration
+if no matching keyboard configuration was found.
+
+.SH UNDOCUMENTED OPTIONS
+These options are undocumented.  Do not use them.
+
+.TP 8
+.B \-emulatepseudo
+Create a depth 8 PseudoColor visual when running in depths 15, 16, 24,
+or 32, collectively known as TrueColor depths.
+Color map manipulation is not supported, so the PseudoColor visual will
+not have the correct colors.
+This option is intended to allow applications which only work with a depth 8
+visual to operate in TrueColor modes.
+.TP 8
+.B \-internalwm
+Run the internal window manager.
+
+.SH LOG FILE
+As it runs \fIXWin\fP writes messages indicating the most relevant events
+to  the console
+from which it was called and to a log file that by default is located at \fI
+__logdir__/XWin.0.log\fP.  This file is mainly for debugging purposes.
+
+
+.SH PREFERENCES FILE
+On startup \fIXWin\fP looks for the file \fI$HOME/.XWinrc\fP or, if
+the previous file does not exist, \fI
+__sysconfdir__/X11/system.XWinrc\fP.  \fI.XWinrc\fP allows setting
+preferences for the following:
+.br
+* To include items into the menu associated with the \fIXWin\fP icon
+which is in the \fIWindows\fP system tray.  This functions in all
+modes that have a tray icon.
+.br
+* To include items in the system menu which is associated with the \fIWindows\fP
+window that \fIXWin -multiwindow\fP produces for each top-level X
+window, in both the generic case and for particular programs.
+.br
+* To change the icon that is associated to the \fIWindows\fP window that
+\fIXWin -multiwindow\fP produces for each top-level X-window.
+.br
+* To change the style that is associated to the \fIWindows\fP window that
+\fXWin I-multiwindow\fP produces for each top-level X window.
+.PP
+The format of the \fI.XWinrc\fP file is given in the man page XWinrc(5).
+
+.SH EXAMPLES
+Need some examples
+
+
+.SH "SEE ALSO"
+X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), XWinrc(__filemansuffix__), setxkbmap(1)
+
+
+.SH BUGS
+.I XWin
+and this man page still have many limitations.  Some of the more obvious
+ones are:
+.br
+- The display mode can not be changed once the X server has started.
+.br
+- The \fIXWin\fP software is continuously developing; it is therefore possible that
+this man page is not up to date.  It is always prudent to
+look also at the output of \fIXWin -help\fP in order to
+check the options that are operative.
+
+
+.SH AUTHORS
+This list is by no means complete, but direct contributors to the
+Cygwin/X project include (in alphabetical order by last name): Stuart
+Adamson, Michael Bax, Jehan Bing, Lev Bishop, Dr. Peter Busch, Biju G
+C, Robert Collins, Nick Crabtree, Early Ehlinger, Christopher Faylor,
+John Fortin, Brian Genisio, Fabrizio Gennari, Alexander Gottwald, Ralf
+Habacker, Colin Harrison, Matthieu Herrb, Alan Hourihane, Pierre A
+Humblet, Harold L Hunt II, Dakshinamurthy Karra, Joe Krahn,
+Paul Loewenstein, Kensuke Matsuzaki,
+Takuma Murakami, Earle F. Philhower III, Benjamin Riefenstahl, Yaakov Selkowitz,
+Suhaib Siddiqi, Jack Tanner, Jon Turney and Nicholas Wourms.
diff --git a/hw/xwin/man/XWinrc.man b/hw/xwin/man/XWinrc.man
new file mode 100644
index 0000000..5c1fb97
--- /dev/null
+++ b/hw/xwin/man/XWinrc.man
@@ -0,0 +1,253 @@
+.TH XWIN 5 __vendorversion__
+
+
+.SH NAME
+XWinrc\- XWin Server Resource Configuration File.
+
+
+.SH DESCRIPTION
+The X Server for the X Window System on the Cygwin/X environment
+running on Microsoft Windows, \fIXWin\fP can be optionally configured
+with the \fIXWinrc\fP file.  A system-wide configuration file should
+be placed in \fI
+__sysconfdir__/X11/system.XWinrc\fP, a per-user file
+should be put at \fI$HOME/.XWinrc\fP.  The \fIsystem.XWinrc\fP file is
+read only if no \fI$HOME/.XWinrc\fP exist.
+.PP
+With the \fI.XWinrc\fP configuration file it is possible to do the
+following:
+.PP
+1- To include items into the menu associated with the \fIXWin\fP icon
+which is in the \fIWindows\fP system tray.  This feature functions in
+all XWin modes that have such tray icon.
+.PP
+2- To include items into the menu which is associated with the
+\fIWindows\fP window that \fIXWin -multiwindow\fP produces for each
+top-level X-window.  That can be done both for the generic case and
+for particular programs.
+.PP
+3- To change the icon that is associated to the \fIWindows\fP window
+that \fIXWin -multiwindow\fP produces for each top-level X-window.
+Again, that can be done both for the generic case and for particular
+programs.  The new icons associated should be \fIWindows\fP format
+icons \fI.ico\fP.
+.PP
+4- To change the style that is associated to the \fIWindows\fP window
+that \fI-multiwindow\fP produces for  each  top-level  X window.   Again,
+that can be done both for the generic case and for particular programs.
+
+
+.SH FILE FORMAT
+.B Keywords
+are case insensitive, but in this document they will be written
+completely capitalized.
+.PP
+.B Comments
+are legal pretty much anywhere you can have an end-of-line; they
+begin with "#" or "//" and go to the end-of-line.
+.PP
+Quote marks in strings are optional unless the string has included spaces,
+or could be parsed, ambiguously, as a misplaced keyword.
+.PP
+There are four kinds of instructions: miscellaneous, menu, icon and style.
+
+
+.SH Miscellaneous instruction
+.TP 8
+.B DEBUG \fIString\fP
+The \fIString\fP is printed to the XWin log file.
+
+.TP 8
+.B TRAYICON \fIicon-specifier\fB
+The \fBTRAYICON\fP keyword changes the icon \fIXWin\fP displays in the
+system tray area.
+
+.TP 8
+.B SILENTEXIT
+The \fBSILENTEXIT\fP keyword, which takes no parameters, disables the
+exit confirmation dialog if no clients are connected.
+
+.TP 8
+.B FORCEEXIT
+The \fBFORCEEXIT\fP keyword, which takes no parameters, disables the
+exit confirmation dialog always.  Unsaved client work may be lost but
+this may be useful if you want no dialogs.
+
+.SH Menu instructions
+.TP 8
+.B MENU \fIMenu_Name\fP {
+.br
+.B       \fIMenu_Item_Line\fP
+.br
+.B       \fIMenu_Item_Line\fP
+.br
+.B        \fI...\fP
+.br
+.B }
+.br
+This instruction defines a menu and asigns a \fIMenu_Name\fP to it.
+\fIMenu_Item_Line\fP are lines  of any of the following types:
+.TP 8
+.B \t SEPARATOR
+.TP 8
+.B  \t \fIItem_Label\fP  EXEC \fICommand\fP
+.TP 8
+.B \t \fIItem_Label\fP  MENU \fIpreviously-defined-menu-name\fP
+.TP 8
+.B \t \fIItem_Label\fP  ALWAYSONTOP
+.TP 8
+.B \t \fIItem_Label\fP  RELOAD
+.br
+The \fIItem_Label\fP is the string that is written in the menu item.
+.br
+\fICommand\fP is a string with the command that will be executed by /bin/sh.
+Here paths should be \fICYGWIN\fP style (e.g. /usr/local/bin/myprogram).
+A string "%display%" appearing in the \fICommand\fP will be replaced
+with the proper display variable (i.e. 127.0.0.1:<display>.0).
+.br
+\fBALWAYSONTOP\fP sets the window to which the menu is associated to
+display above all others.
+.br
+\fBRELOAD\fP causes the XWinrc file to be reloaded and icons and menus
+regenerated.
+.TP 8
+.B ROOTMENU \fIpreviously-defined-menu-name\fP
+Includes the items in the indicated menu into the menu associated with
+\fIXWin\fP that appears in the system tray.
+.TP 8
+.B DEFAULTSYSMENU \fIpreviously-defined-menu-name\fP ATSTART|ATEND
+Includes the items in the indicated menu into the menu associated with
+generic top-level X-Windows in the \fIXWin\fP \fImultiwindow\fP mode.  The
+keywords \fBATSTART\fP and \fBATEND\fP indicate if such items should be
+included at the start or at the end of the menu.
+.TP 8
+.B SYSMENU {
+  \fIclass-or-name-of-window\fP \fIdefined-menu-name\fP \fBATSTART|ATEND\fP
+.br
+  \fI...\fP
+.br
+  \fB}\fP
+.br
+Associates a specific menu to a specified window class or name
+in \fI-multiwindow\fP mode. The keywords ATSTART or ATEND indicate if
+such items should be included at the start or at the end of the menu.
+
+
+.SH Icon Instructions
+When specifying an \fIicon-file\fP in the following commands several different formats are allowed:
+.br
+\fB"NAME.ICO"\fP\fI of an .ico format file\fP
+.br
+\t \t ("cygwin.ico", "apple.ico")
+.br
+\fB"NAME.DLL,nn"\fP\fI of a .DLL and icon index\fP
+.br
+\t \t ("c:\\windows\\system32\\shell32.dll,4" is the default folder icon)
+.br
+\fB",nnn"\fP\fI index into XWin.EXE internal ICON resources\fP
+.br
+\t \t (",101" is the 1st icon inside \fIXWin.EXE\fP)
+.TP 8
+.B ICONDIRECTORY \fIWindows-path-to-icon-directory\fP
+Defines the default directory to search for \ficon-file\fP files.
+It should be a \fIWindows\fP style path (e.g. C:\\cygwin\\usr\\local\\icons).
+.TP 8
+.B DEFAULTICON \fIicon-file\fP
+Defines a replacement for the standard X icon for applications without
+specified icons.
+.TP 8
+.B ICONS {
+.br
+ \fIclass-or-name-of-window\fP \fIicon-file\fP
+.br
+  \fI...\fP
+.br
+  \fB}\fP
+.br
+Defines icon replacements windows matching the specified window class or names.
+If multiple name or class matches occur for a window, only the first one
+will be used.
+
+.SH Style Instructions
+.TP 8
+.B STYLES {
+\fIclass-or-name-of-window\fP \fIstyle-keyword-1\fP \fIstyle-keyword-2\fP
+.br
+  \fI...\fP
+.br
+\fB}\fP
+
+Associates specific styles to a specified window class or name
+in \fI-multiwindow\fP mode.  If multiple class or name matches occur,
+for a window, only the first one will be used.
+
+The style keywords indicate the following:
+
+\fIstyle-keyword-1\fP
+
+\fBTOPMOST\fP
+.br
+Open the class or name above all NOTOPMOST Microsoft Windows
+.br
+\fBMAXIMIZE\fP
+.br
+Start the class or name fullscreen.
+.br
+\fBMINIMIZE\fP
+.br
+Start the class or name iconic.
+.br
+\fBBOTTOM\fP
+.br
+Open the class or name below all Windows windows.
+.br
+
+\fIstyle-keyword-2\fP
+
+\fBNOTITLE\fP
+.br
+No Windows title bar, for the class or name.
+.br
+\fBOUTLINE\fP
+.br
+No Windows title bar and just a thin-line border, for the class or name.
+.br
+\fBNOFRAME\fP
+.br
+No Windows title bar or border, for the class or name.
+
+One keyword in \fIstyle-keyword-1\fP can be used with one keyword in \fIstyle-keyword-2\fP,
+or any keyword can be used singly.
+
+
+.SH EXAMPLE
+.TP 8
+This example adds an Xterm menu item to the system tray icon
+\fBMENU systray {
+.br
+\t xterm  EXEC "xterm -display %display% -sb -sl 999"
+.br
+\t SEPARATOR
+.br
+}
+.br
+ROOTMENU systray
+\fP
+
+.TP 8
+This example makes an oclock window frameless in \fI-multiwindow\fP mode
+\fBSTYLES {
+.br
+\t oclock NOFRAME
+.br
+}
+
+
+
+.SH "SEE ALSO"
+ XWin(1)
+
+
+.SH AUTHOR
+The XWinrc feature of XWin was written primarily by Earle F. Philhower
+III.  Extended for style configuration by Colin Harrison.
commit b8492e18a7e5322c4a492f6cf6cfeb5b0221d994
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:27:49 2011 -0500

    Xnest: build Xnest man pages using XORG_MANPAGE_SECTIONS
    
    Nothing requires the use of a C preprocessor
    Using standard file extensions (.man) means no need for .gitignore
    Use standard directory and makefile
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 1ceffe7..cab7fa7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2243,6 +2243,7 @@ hw/dmx/glxProxy/Makefile
 hw/dmx/Makefile
 hw/vfb/Makefile
 hw/xnest/Makefile
+hw/xnest/man/Makefile
 hw/xwin/Makefile
 hw/xwin/glx/Makefile
 hw/xquartz/Makefile
diff --git a/hw/xnest/.gitignore b/hw/xnest/.gitignore
index 16db15e..b76c5a2 100644
--- a/hw/xnest/.gitignore
+++ b/hw/xnest/.gitignore
@@ -1,3 +1 @@
-#		Add & Override for this directory and it's subdirectories
 Xnest
-Xnest.man
diff --git a/hw/xnest/Makefile.am b/hw/xnest/Makefile.am
index 666a0f0..c395b4d 100644
--- a/hw/xnest/Makefile.am
+++ b/hw/xnest/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = man
+
 bin_PROGRAMS = Xnest
 noinst_LIBRARIES = libfbcmap.a
 
@@ -59,34 +61,12 @@ Xnest_LDADD = $(XNEST_LIBS) $(XNEST_SYS_LIBS) $(XSERVER_SYS_LIBS)
 Xnest_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
 
 EXTRA_DIST = icon \
-             screensaver \
-	     Xnest.man.pre
+             screensaver
 
 # -UDPMSExtension for miinitext? can't put into 
 # OS_DEFINES???
 # EXT_DEFINES???
 # ICONFIGFILES -- SpecialCObjectRule
 
-# Man page
-include $(top_srcdir)/cpprules.in
-
-appmandir = $(APP_MAN_DIR)
-
-appman_PRE = Xnest.man
-appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
-
-EXTRAMANDEFS = \
-	-D__XCONFIGFILE__=$(__XCONFIGFILE__) \
-	-D__XSERVERNAME__=$(XSERVERNAME)
-
-BUILT_SOURCES = $(appman_PRE)
-CLEANFILES = $(appman_PRE) $(appman_DATA)
-
-SUFFIXES += .$(APP_MAN_SUFFIX) .man
-
-.man.$(APP_MAN_SUFFIX):
-	-$(AM_V_at)rm -f $@
-	$(AM_V_at)$(LN_S) $< $@
-
 relink:
 	$(AM_V_at)rm -f Xnest$(EXEEXT) && $(MAKE) Xnest$(EXEEXT)
diff --git a/hw/xnest/Xnest.man.pre b/hw/xnest/Xnest.man.pre
deleted file mode 100644
index 024d88e..0000000
--- a/hw/xnest/Xnest.man.pre
+++ /dev/null
@@ -1,428 +0,0 @@
-.\" $Xorg: Xnest.man,v 1.3 2000/08/17 19:53:28 cpqbld Exp $
-.\" Copyright (c) 1993, 1994  X Consortium
-.\"
-.\" Permission is hereby granted, free of charge, to any person obtaining
-.\" a copy of this software and associated documentation files (the
-.\" "Software"), to deal in the Software without restriction, including
-.\" without limitation the rights to use, copy, modify, merge, publish,
-.\" distribute, sublicense, and/or sell copies of the Software, and to
-.\" permit persons to whom the Software is furnished to do so, subject to
-.\" the following conditions:
-.\"
-.\" The above copyright notice and this permission notice shall be included
-.\" in all copies or substantial portions of the Software.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
-.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-.\" OTHER DEALINGS IN THE SOFTWARE.
-.\"
-.\" Except as contained in this notice, the name of the X Consortium shall
-.\" not be used in advertising or otherwise to promote the sale, use or
-.\" other dealings in this Software without prior written authorization
-.\" from the X Consortium.
-.\"
-.\" $XFree86: xc/programs/Xserver/hw/xnest/Xnest.man,v 1.6 2001/01/27 18:21:00 dawes Exp $
-.\"
-.TH Xnest __appmansuffix__ __xorgversion__
-.SH NAME
-Xnest \- a nested X server
-.SH SYNOPSIS
-.B Xnest
-[
-.I options
-]
-.SH DESCRIPTION
-.B Xnest
-is both an X client and an X server.
-.B Xnest
-is a client of the real server which manages windows and graphics requests on
-its behalf.
-.B Xnest
-is a server to its own clients.
-.B Xnest
-manages windows and graphics requests on their behalf.
-To these clients,
-.B Xnest
-appears to be a conventional server.
-.SH OPTIONS
-.B Xnest
-supports all standard options of the sample server implementation.
-For more details, please see
-.BR Xserver (__appmansuffix__).
-The following additional arguments are supported as well.
-.TP
-.BI "\-display " string
-This option specifies the display name of the real server that
-.B Xnest
-should try to connect to.
-If it is not provided on the command line,
-.B Xnest
-will read the
-.I DISPLAY
-environment variable in order to find out this information.
-.TP
-.B \-sync
-This option tells
-.B Xnest
-to synchronize its window and graphics operations with the real server.
-This is a useful option for debugging, but it will slow down
-.BR Xnest 's
-performance considerably.
-It should not be used unless absolutely necessary.
-.TP
-.B \-full
-This option tells
-.B Xnest
-to utilize full regeneration of real server objects and reopen a new connection
-to the real server each time the nested server regenerates.
-The sample server implementation regenerates all objects in the server when the
-last client of this server terminates.
-When this happens,
-.B Xnest
-by default maintains the same top-level window and the same real server
-connection in each new generation.
-If the user selects full regeneration, even the top-level window and the
-connection to the real server will be regenerated for each server generation.
-.TP
-.BI "\-class " string
-This option specifies the default visual class of the nested server.
-It is similar to the
-.B \-cc
-option from the set of standard options except that it will accept a string
-rather than a number for the visual class specification.
-The
-.I string
-must be one of the following six values:
-.BR StaticGray ,
-.BR GrayScale ,
-.BR StaticColor ,
-.BR PseudoColor ,
-.BR TrueColor ,
-or
-.BR DirectColor .
-If both the
-.B \-class
-and
-.B \-cc
-options are specified, the last instance of either option takes precedence.
-The class of the default visual of the nested server need not be the same as the
-class of the default visual of the real server, but it must be supported by the
-real server.
-Use
-.BR xdpyinfo (__appmansuffix__)
-to obtain a list of supported visual classes on the real server before starting
-.BR Xnest .
-If the user chooses a static class, all the colors in the default color map will
-be preallocated.
-If the user chooses a dynamic class, colors in the default color map will be
-available to individual clients for allocation.
-.TP
-.BI "\-depth " int
-This option specifies the default visual depth of the nested server.
-The depth of the default visual of the nested server need not be the same as the
-depth of the default visual of the real server, but it must be supported by the
-real server.
-Use
-.BR xdpyinfo (__appmansuffix__)
-to obtain a list of supported visual depths on the real server before starting
-.BR Xnest .
-.TP
-.B \-sss
-This option tells
-.B Xnest
-to use the software screen saver.
-By default,
-.B Xnest
-will use the screen saver that corresponds to the hardware screen saver in the
-real server.
-Of course, even this screen saver is software-generated since
-.B Xnest
-does not control any actual hardware.
-However, it is treated as a hardware screen saver within the sample server code.
-.TP
-.B \-geometry \fIW\fBx\fIH\fB+\fIX\fB+\fIY\fP
-This option specifies the geometry parameters for the top-level
-.B Xnest
-window.
-See \(lqGEOMETRY SPECIFICATIONS\(rq in
-.BR X (__miscmansuffix__)
-for a discusson of this option's syntax.
-This window corresponds to the root window of the nested server.
-The width
-.I W
-and height
-.I H
-specified with this option will be the maximum width and height of each
-top-level
-.B Xnest
-window.
-.B Xnest
-will allow the user to make any top-level window smaller, but it will not
-actually change the size of the nested server root window.
-.B Xnest
-does not yet support the RANDR extension for resizing, rotation, and reflection
-of the root window.
-If this option is not specified,
-.B Xnest
-will choose
-.I W
-and
-.I H
-to be 3/4ths the dimensions of the root window of the real server.
-.TP
-.BI "\-bw " int
-This option specifies the border width of the top-level
-.B Xnest
-window.
-The integer parameter
-.I int
-must be positive.
-The default border width is 1.
-.TP
-.BI "\-name " string
-This option specifies the name of the top-level
-.B Xnest
-window as
-.IR string .
-The default value is the program name.
-.TP
-.BI "\-scrns " int
-This option specifies the number of screens to create in the nested server.
-For each screen,
-.B Xnest
-will create a separate top-level window.
-Each screen is referenced by the number after the dot in the client display name
-specification.
-For example,
-.B xterm \-display :1.1
-will open an
-.BR xterm (__appmansuffix__)
-client in the nested server with the display number
-.B :1
-on the second screen.
-The number of screens is limited by the hard-coded constant in the server sample
-code, which is usually 3.
-.TP
-.B \-install
-This option tells
-.B Xnest
-to do its own color map installation by bypassing the real window manager.
-For it to work properly, the user will probably have to temporarily quit the
-real window manager.
-By default,
-.B Xnest
-will keep the nested client window whose color map should be installed in the
-real server in the
-.I WM_COLORMAP_WINDOWS
-property of the top-level
-.B Xnest
-window.
-If this color map is of the same visual type as the root window of the nested
-server,
-.B Xnest
-will associate this color map with the top-level
-.B Xnest
-window as well.
-Since this does not have to be the case, window managers should look primarily
-at the
-.I WM_COLORMAP_WINDOWS
-property rather than the color map associated with the top-level
-.B Xnest
-window.
-.\" Is the following still true?  This sentence is several years old.
-Unfortunately, window managers are not very good at doing that yet so this
-option might come in handy.
-.TP
-.BI "\-parent " window_id
-This option tells
-.B Xnest
-to use
-.I window_id
-as the root window instead of creating a window.
-.\" XRX is dead, dead, dead.
-.\" This option is used by the xrx xnestplugin.
-.SH "EXTENDED DESCRIPTION"
-Starting up
-.B Xnest
-is just as simple as starting up
-.BR xclock (__appmansuffix__)
-from a terminal emulator.
-If a user wishes to run
-.B Xnest
-on the same
-workstation as the real server, it is important that the nested server is given
-its own listening socket address.
-Therefore, if there is a server already running on the user's workstation,
-.B Xnest
-will have to be started up with a new display number.
-Since there is usually no more than one server running on a workstation,
-specifying
-.RB \(oq "Xnest :1" \(cq
-on the command line will be sufficient for most users.
-For each server running on the workstation, the display number needs to be
-incremented by one.
-Thus, if you wish to start another
-.BR Xnest ,
-you will need to type
-.RB \(oq "Xnest :2" \(cq
-on the command line.
-.PP
-To run clients in the nested server, each client needs to be given the same
-display number as the nested server.
-For example,
-.RB \(oq "xterm \-display :1" \(cq
-will start up an
-.B xterm
-process in the first nested server
-and
-.RB \(oq "xterm \-display :2" \(cq
-will start an
-.B xterm
-in the second nested server from the example above.
-Additional clients can be started from these
-.BR xterm s
-in each nested server.
-.SS "Xnest as a client"
-.B Xnest
-behaves and looks to the real server and other real clients as another real
-client.
-It is a rather demanding client, however, since almost any window or graphics
-request from a nested client will result in a window or graphics request from
-.B Xnest
-to the real server.
-Therefore, it is desirable that
-.B Xnest
-and the real server are on a local network, or even better, on the same machine.
-.B Xnest
-assumes that the real server supports the SHAPE extension.
-There is no way to turn off this assumption dynamically.
-.B Xnest
-can be compiled without the SHAPE extension built in, in which case the real
-server need not support it.
-Dynamic SHAPE extension selection support may be considered in further
-development of
-.BR Xnest .
-.PP
-Since
-.B Xnest
-need not use the same default visual as the the real server, the top-level
-window of the
-.B Xnest
-client always has its own color map.
-This implies that other windows' colors will not be displayed properly while the
-keyboard or pointer focus is in the
-.B Xnest
-window, unless the real server has support for more than one installed color map
-at any time.
-The color map associated with the top window of the
-.B Xnest
-client need not be the appropriate color map that the nested server wants
-installed in the real server.
-In the case that a nested client attempts to install a color map of a different
-visual from the default visual of the nested server,
-.B Xnest
-will put the top window of this nested client and all other top windows of the
-nested clients that use the same color map into the
-.I WM_COLORMAP_WINDOWS
-property of the top-level
-.B Xnest
-window on the real server.
-Thus, it is important that the real window manager that manages the
-.B Xnest
-top-level window looks at the
-.I WM_COLORMAP_WINDOWS
-property rather than the color map associated with the top-level
-.B Xnest
-window.
-Since most window managers don't yet appear to implement this convention
-properly,
-.B Xnest
-can optionally do direct installation of color maps into the real server
-bypassing the real window manager.
-If the user chooses this option, it is usually necessary to temporarily disable
-the real window manager since it will interfere with the
-.B Xnest
-scheme of color map installation.
-.PP
-Keyboard and pointer control procedures of the nested server change the keyboard
-and pointer control parameters of the real server.
-Therefore, after
-.B Xnest
-is started up, it will change the keyboard and pointer controls of the real
-server to its own internal defaults.
-.SS "Xnest as a server"
-.B Xnest
-as a server looks exactly like a real server to its own clients.
-For the clients, there is no way of telling if they are running on a real or a
-nested server.
-.PP
-As already mentioned,
-.B Xnest
-is a very user-friendly server when it comes to customization.
-.B Xnest
-will pick up a number of command-line arguments that can configure its default
-visual class and depth, number of screens, etc.
-.PP
-The only apparent intricacy from the users' perspective about using
-.B Xnest
-as a server is the selection of fonts.
-.B Xnest
-manages fonts by loading them locally and then passing the font name to the real
-server and asking it to load that font remotely.
-This approach avoids the overload of sending the glyph bits across the network
-for every text operation, although it is really a bug.
-The consequence of this approach is that the user will have to worry about two
-different font paths \(em a local one for the nested server and a remote one for
-the real server \(em since
-.B Xnest
-does not propagate its font path to the real server.
-The reason for this is because real and nested servers need not run on the same
-file system which makes the two font paths mutually incompatible.
-Thus, if there is a font in the local font path of the nested server, there is
-no guarantee that this font exists in the remote font path of the real server.
-The
-.BR xlsfonts (__appmansuffix__)
-client, if run on the nested server, will list fonts in the local font path and,
-if run on the real server, will list fonts in the remote font path.
-Before a font can be successfully opened by the nested server, it has to exist
-in local and remote font paths.
-It is the users' responsibility to make sure that this is the case.
-.SH "FUTURE DIRECTIONS"
-Make dynamic the requirement for the SHAPE extension in the real server, rather
-than having to recompile
-.B Xnest
-to turn this requirement on and off.
-.PP
-Perhaps there should be a command-line option to tell
-.B Xnest
-to inherit the keyboard and pointer control parameters from the real server
-rather than imposing its own.
-.PP
-.B Xnest
-should read a customization input file to provide even greater freedom and
-simplicity in selecting the desired layout.
-.PP
-There is no support for backing store and save unders, but this should also be
-considered.
-.PP
-.\" Is the following still true now that client-side font rendering is
-.\" considered the way to go?
-The proper implementation of fonts should be moved into the
-.I os
-layer.
-.SH BUGS
-Doesn't run well on servers supporting different visual depths.
-.PP
-Still crashes randomly.
-.PP
-Probably has some memory leaks.
-.SH AUTHOR
-Davor Matic, MIT X Consortium
-.SH "SEE ALSO"
-.BR Xserver (__appmansuffix__),
-.BR xdpyinfo (__appmansuffix__),
-.BR X (__miscmansuffix__)
diff --git a/hw/xnest/man/Makefile.am b/hw/xnest/man/Makefile.am
new file mode 100644
index 0000000..ff3468f
--- /dev/null
+++ b/hw/xnest/man/Makefile.am
@@ -0,0 +1,10 @@
+appmandir = $(APP_MAN_DIR)
+appman_PRE = Xnest.man
+appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
+
+EXTRA_DIST = $(appman_PRE)
+CLEANFILES = $(appman_DATA)
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/xnest/man/Xnest.man b/hw/xnest/man/Xnest.man
new file mode 100644
index 0000000..024d88e
--- /dev/null
+++ b/hw/xnest/man/Xnest.man
@@ -0,0 +1,428 @@
+.\" $Xorg: Xnest.man,v 1.3 2000/08/17 19:53:28 cpqbld Exp $
+.\" Copyright (c) 1993, 1994  X Consortium
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining
+.\" a copy of this software and associated documentation files (the
+.\" "Software"), to deal in the Software without restriction, including
+.\" without limitation the rights to use, copy, modify, merge, publish,
+.\" distribute, sublicense, and/or sell copies of the Software, and to
+.\" permit persons to whom the Software is furnished to do so, subject to
+.\" the following conditions:
+.\"
+.\" The above copyright notice and this permission notice shall be included
+.\" in all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
+.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+.\" OTHER DEALINGS IN THE SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of the X Consortium shall
+.\" not be used in advertising or otherwise to promote the sale, use or
+.\" other dealings in this Software without prior written authorization
+.\" from the X Consortium.
+.\"
+.\" $XFree86: xc/programs/Xserver/hw/xnest/Xnest.man,v 1.6 2001/01/27 18:21:00 dawes Exp $
+.\"
+.TH Xnest __appmansuffix__ __xorgversion__
+.SH NAME
+Xnest \- a nested X server
+.SH SYNOPSIS
+.B Xnest
+[
+.I options
+]
+.SH DESCRIPTION
+.B Xnest
+is both an X client and an X server.
+.B Xnest
+is a client of the real server which manages windows and graphics requests on
+its behalf.
+.B Xnest
+is a server to its own clients.
+.B Xnest
+manages windows and graphics requests on their behalf.
+To these clients,
+.B Xnest
+appears to be a conventional server.
+.SH OPTIONS
+.B Xnest
+supports all standard options of the sample server implementation.
+For more details, please see
+.BR Xserver (__appmansuffix__).
+The following additional arguments are supported as well.
+.TP
+.BI "\-display " string
+This option specifies the display name of the real server that
+.B Xnest
+should try to connect to.
+If it is not provided on the command line,
+.B Xnest
+will read the
+.I DISPLAY
+environment variable in order to find out this information.
+.TP
+.B \-sync
+This option tells
+.B Xnest
+to synchronize its window and graphics operations with the real server.
+This is a useful option for debugging, but it will slow down
+.BR Xnest 's
+performance considerably.
+It should not be used unless absolutely necessary.
+.TP
+.B \-full
+This option tells
+.B Xnest
+to utilize full regeneration of real server objects and reopen a new connection
+to the real server each time the nested server regenerates.
+The sample server implementation regenerates all objects in the server when the
+last client of this server terminates.
+When this happens,
+.B Xnest
+by default maintains the same top-level window and the same real server
+connection in each new generation.
+If the user selects full regeneration, even the top-level window and the
+connection to the real server will be regenerated for each server generation.
+.TP
+.BI "\-class " string
+This option specifies the default visual class of the nested server.
+It is similar to the
+.B \-cc
+option from the set of standard options except that it will accept a string
+rather than a number for the visual class specification.
+The
+.I string
+must be one of the following six values:
+.BR StaticGray ,
+.BR GrayScale ,
+.BR StaticColor ,
+.BR PseudoColor ,
+.BR TrueColor ,
+or
+.BR DirectColor .
+If both the
+.B \-class
+and
+.B \-cc
+options are specified, the last instance of either option takes precedence.
+The class of the default visual of the nested server need not be the same as the
+class of the default visual of the real server, but it must be supported by the
+real server.
+Use
+.BR xdpyinfo (__appmansuffix__)
+to obtain a list of supported visual classes on the real server before starting
+.BR Xnest .
+If the user chooses a static class, all the colors in the default color map will
+be preallocated.
+If the user chooses a dynamic class, colors in the default color map will be
+available to individual clients for allocation.
+.TP
+.BI "\-depth " int
+This option specifies the default visual depth of the nested server.
+The depth of the default visual of the nested server need not be the same as the
+depth of the default visual of the real server, but it must be supported by the
+real server.
+Use
+.BR xdpyinfo (__appmansuffix__)
+to obtain a list of supported visual depths on the real server before starting
+.BR Xnest .
+.TP
+.B \-sss
+This option tells
+.B Xnest
+to use the software screen saver.
+By default,
+.B Xnest
+will use the screen saver that corresponds to the hardware screen saver in the
+real server.
+Of course, even this screen saver is software-generated since
+.B Xnest
+does not control any actual hardware.
+However, it is treated as a hardware screen saver within the sample server code.
+.TP
+.B \-geometry \fIW\fBx\fIH\fB+\fIX\fB+\fIY\fP
+This option specifies the geometry parameters for the top-level
+.B Xnest
+window.
+See \(lqGEOMETRY SPECIFICATIONS\(rq in
+.BR X (__miscmansuffix__)
+for a discusson of this option's syntax.
+This window corresponds to the root window of the nested server.
+The width
+.I W
+and height
+.I H
+specified with this option will be the maximum width and height of each
+top-level
+.B Xnest
+window.
+.B Xnest
+will allow the user to make any top-level window smaller, but it will not
+actually change the size of the nested server root window.
+.B Xnest
+does not yet support the RANDR extension for resizing, rotation, and reflection
+of the root window.
+If this option is not specified,
+.B Xnest
+will choose
+.I W
+and
+.I H
+to be 3/4ths the dimensions of the root window of the real server.
+.TP
+.BI "\-bw " int
+This option specifies the border width of the top-level
+.B Xnest
+window.
+The integer parameter
+.I int
+must be positive.
+The default border width is 1.
+.TP
+.BI "\-name " string
+This option specifies the name of the top-level
+.B Xnest
+window as
+.IR string .
+The default value is the program name.
+.TP
+.BI "\-scrns " int
+This option specifies the number of screens to create in the nested server.
+For each screen,
+.B Xnest
+will create a separate top-level window.
+Each screen is referenced by the number after the dot in the client display name
+specification.
+For example,
+.B xterm \-display :1.1
+will open an
+.BR xterm (__appmansuffix__)
+client in the nested server with the display number
+.B :1
+on the second screen.
+The number of screens is limited by the hard-coded constant in the server sample
+code, which is usually 3.
+.TP
+.B \-install
+This option tells
+.B Xnest
+to do its own color map installation by bypassing the real window manager.
+For it to work properly, the user will probably have to temporarily quit the
+real window manager.
+By default,
+.B Xnest
+will keep the nested client window whose color map should be installed in the
+real server in the
+.I WM_COLORMAP_WINDOWS
+property of the top-level
+.B Xnest
+window.
+If this color map is of the same visual type as the root window of the nested
+server,
+.B Xnest
+will associate this color map with the top-level
+.B Xnest
+window as well.
+Since this does not have to be the case, window managers should look primarily
+at the
+.I WM_COLORMAP_WINDOWS
+property rather than the color map associated with the top-level
+.B Xnest
+window.
+.\" Is the following still true?  This sentence is several years old.
+Unfortunately, window managers are not very good at doing that yet so this
+option might come in handy.
+.TP
+.BI "\-parent " window_id
+This option tells
+.B Xnest
+to use
+.I window_id
+as the root window instead of creating a window.
+.\" XRX is dead, dead, dead.
+.\" This option is used by the xrx xnestplugin.
+.SH "EXTENDED DESCRIPTION"
+Starting up
+.B Xnest
+is just as simple as starting up
+.BR xclock (__appmansuffix__)
+from a terminal emulator.
+If a user wishes to run
+.B Xnest
+on the same
+workstation as the real server, it is important that the nested server is given
+its own listening socket address.
+Therefore, if there is a server already running on the user's workstation,
+.B Xnest
+will have to be started up with a new display number.
+Since there is usually no more than one server running on a workstation,
+specifying
+.RB \(oq "Xnest :1" \(cq
+on the command line will be sufficient for most users.
+For each server running on the workstation, the display number needs to be
+incremented by one.
+Thus, if you wish to start another
+.BR Xnest ,
+you will need to type
+.RB \(oq "Xnest :2" \(cq
+on the command line.
+.PP
+To run clients in the nested server, each client needs to be given the same
+display number as the nested server.
+For example,
+.RB \(oq "xterm \-display :1" \(cq
+will start up an
+.B xterm
+process in the first nested server
+and
+.RB \(oq "xterm \-display :2" \(cq
+will start an
+.B xterm
+in the second nested server from the example above.
+Additional clients can be started from these
+.BR xterm s
+in each nested server.
+.SS "Xnest as a client"
+.B Xnest
+behaves and looks to the real server and other real clients as another real
+client.
+It is a rather demanding client, however, since almost any window or graphics
+request from a nested client will result in a window or graphics request from
+.B Xnest
+to the real server.
+Therefore, it is desirable that
+.B Xnest
+and the real server are on a local network, or even better, on the same machine.
+.B Xnest
+assumes that the real server supports the SHAPE extension.
+There is no way to turn off this assumption dynamically.
+.B Xnest
+can be compiled without the SHAPE extension built in, in which case the real
+server need not support it.
+Dynamic SHAPE extension selection support may be considered in further
+development of
+.BR Xnest .
+.PP
+Since
+.B Xnest
+need not use the same default visual as the the real server, the top-level
+window of the
+.B Xnest
+client always has its own color map.
+This implies that other windows' colors will not be displayed properly while the
+keyboard or pointer focus is in the
+.B Xnest
+window, unless the real server has support for more than one installed color map
+at any time.
+The color map associated with the top window of the
+.B Xnest
+client need not be the appropriate color map that the nested server wants
+installed in the real server.
+In the case that a nested client attempts to install a color map of a different
+visual from the default visual of the nested server,
+.B Xnest
+will put the top window of this nested client and all other top windows of the
+nested clients that use the same color map into the
+.I WM_COLORMAP_WINDOWS
+property of the top-level
+.B Xnest
+window on the real server.
+Thus, it is important that the real window manager that manages the
+.B Xnest
+top-level window looks at the
+.I WM_COLORMAP_WINDOWS
+property rather than the color map associated with the top-level
+.B Xnest
+window.
+Since most window managers don't yet appear to implement this convention
+properly,
+.B Xnest
+can optionally do direct installation of color maps into the real server
+bypassing the real window manager.
+If the user chooses this option, it is usually necessary to temporarily disable
+the real window manager since it will interfere with the
+.B Xnest
+scheme of color map installation.
+.PP
+Keyboard and pointer control procedures of the nested server change the keyboard
+and pointer control parameters of the real server.
+Therefore, after
+.B Xnest
+is started up, it will change the keyboard and pointer controls of the real
+server to its own internal defaults.
+.SS "Xnest as a server"
+.B Xnest
+as a server looks exactly like a real server to its own clients.
+For the clients, there is no way of telling if they are running on a real or a
+nested server.
+.PP
+As already mentioned,
+.B Xnest
+is a very user-friendly server when it comes to customization.
+.B Xnest
+will pick up a number of command-line arguments that can configure its default
+visual class and depth, number of screens, etc.
+.PP
+The only apparent intricacy from the users' perspective about using
+.B Xnest
+as a server is the selection of fonts.
+.B Xnest
+manages fonts by loading them locally and then passing the font name to the real
+server and asking it to load that font remotely.
+This approach avoids the overload of sending the glyph bits across the network
+for every text operation, although it is really a bug.
+The consequence of this approach is that the user will have to worry about two
+different font paths \(em a local one for the nested server and a remote one for
+the real server \(em since
+.B Xnest
+does not propagate its font path to the real server.
+The reason for this is because real and nested servers need not run on the same
+file system which makes the two font paths mutually incompatible.
+Thus, if there is a font in the local font path of the nested server, there is
+no guarantee that this font exists in the remote font path of the real server.
+The
+.BR xlsfonts (__appmansuffix__)
+client, if run on the nested server, will list fonts in the local font path and,
+if run on the real server, will list fonts in the remote font path.
+Before a font can be successfully opened by the nested server, it has to exist
+in local and remote font paths.
+It is the users' responsibility to make sure that this is the case.
+.SH "FUTURE DIRECTIONS"
+Make dynamic the requirement for the SHAPE extension in the real server, rather
+than having to recompile
+.B Xnest
+to turn this requirement on and off.
+.PP
+Perhaps there should be a command-line option to tell
+.B Xnest
+to inherit the keyboard and pointer control parameters from the real server
+rather than imposing its own.
+.PP
+.B Xnest
+should read a customization input file to provide even greater freedom and
+simplicity in selecting the desired layout.
+.PP
+There is no support for backing store and save unders, but this should also be
+considered.
+.PP
+.\" Is the following still true now that client-side font rendering is
+.\" considered the way to go?
+The proper implementation of fonts should be moved into the
+.I os
+layer.
+.SH BUGS
+Doesn't run well on servers supporting different visual depths.
+.PP
+Still crashes randomly.
+.PP
+Probably has some memory leaks.
+.SH AUTHOR
+Davor Matic, MIT X Consortium
+.SH "SEE ALSO"
+.BR Xserver (__appmansuffix__),
+.BR xdpyinfo (__appmansuffix__),
+.BR X (__miscmansuffix__)
commit 57ca20d26614a0787cdd0db91a2eb8cdb301f2dc
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:27:48 2011 -0500

    Xquartz: strip the man page code from cpprules.in
    
    This is dead code which will not be used in the future.
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xquartz/bundle/cpprules.in b/hw/xquartz/bundle/cpprules.in
index f32eafc..92a987d 100644
--- a/hw/xquartz/bundle/cpprules.in
+++ b/hw/xquartz/bundle/cpprules.in
@@ -13,25 +13,7 @@ CPP_SED_MAGIC = $(SED) -e '/^\#  *[0-9][0-9]*  *.*$$/d' \
                        -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \
                        -e '/\@\@$$/s/\@\@$$/\\/'
 
-# Strings to replace in man pages
-XORGRELSTRING = @PACKAGE_STRING@
-  XORGMANNAME = X Version 11
-
-MANDEFS =  \
-	-D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
-	-D__appmansuffix__=$(APP_MAN_SUFFIX) \
-	-D__filemansuffix__=$(FILE_MAN_SUFFIX) \
-	-D__libmansuffix__=$(LIB_MAN_SUFFIX) \
-	-D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
-	-D__XSERVERNAME__=Xorg -D__XCONFIGFILE__=xorg.conf \
-	-D__xinitdir__=$(XINITDIR) \
-	-D__bindir__=$(bindir) \
-	-DSHELL_CMD=$(SHELL_CMD) $(ARCHMANDEFS)
-
-SUFFIXES = .$(APP_MAN_SUFFIX) .man .cpp
+SUFFIXES = .cpp
 
 .cpp:
-	$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
-
-.man.$(APP_MAN_SUFFIX):
-	$(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+	$(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
commit c06c46acdc2ead20a6030118fad6092b3da6709f
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:27:47 2011 -0500

    Xquartz: build Xquartz man pages using XORG_MANPAGE_SECTIONS
    
    Nothing requires the use of a C preprocessor
    Using standard file extensions (.man)
    Use standard directory and makefile
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xquartz/doc/Makefile.am b/hw/xquartz/doc/Makefile.am
index 6c68c84..287dc7a 100644
--- a/hw/xquartz/doc/Makefile.am
+++ b/hw/xquartz/doc/Makefile.am
@@ -1,16 +1,13 @@
 appmandir = $(APP_MAN_DIR)
-appman_PRE = Xquartz.man.pre
-appman_PROCESSED = $(appman_PRE:man.pre=man)
-appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@)
+appman_PRE = Xquartz.man
+appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
 
-CLEANFILES = $(appman_PROCESSED) $(appman_DATA)
+EXTRA_DIST = $(appman_PRE)
+CLEANFILES = $(appman_DATA)
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
 
-include $(top_srcdir)/cpprules.in
-
-MANDEFS += -D__laucnd_id_prefix__=$(LAUNCHD_ID_PREFIX)
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+MAN_SUBSTS += 	-e 's|__laucnd_id_prefix__|$(LAUNCHD_ID_PREFIX)|g'
 
 .man.$(APP_MAN_SUFFIX):
-	$(AM_V_at)cp $< $@
-
-EXTRA_DIST = \
-	Xquartz.man.pre
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/xquartz/doc/Xquartz.man b/hw/xquartz/doc/Xquartz.man
new file mode 100644
index 0000000..4471947
--- /dev/null
+++ b/hw/xquartz/doc/Xquartz.man
@@ -0,0 +1,162 @@
+.TH XQUARTZ 1 __vendorversion__
+.SH NAME
+Xquartz \- X window system server for Mac OSX
+.SH SYNOPSIS
+.B Xquartz
+[ options ] ...
+.SH DESCRIPTION
+.I Xquartz
+is the X window server for Mac OS X provided by Apple.
+.I Xquartz
+runs in parallel with Aqua in rootless mode. In rootless mode, the X
+window system and Mac OS X share your display.  The root window of the
+X11 display is the size of the screen and contains all the other
+windows. The X11 root window is not displayed in rootless mode as Mac
+OS X handles the desktop background.
+.SH CUSTOMIZATION
+\fIXquartz\fP can be customized using the defaults(1) command. The available options are:
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 enable_fake_buttons -boolean true
+Emulates a 3 button mouse using modifier keys. By default, the Command modifier
+is used to emulate button 2 and Option is used for button 3. Thus, clicking the
+first mouse button while holding down Command will act like clicking
+button 2. Holding down Option will simulate button 3.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 fake_button2 \fImodifiers\fP
+Change the modifier keys used to emulate the second mouse button. By default,
+Command is used to emulate the second button. Any combination of the following
+modifier names may be used: {l,r,}shift, {l,r,}option, {l,r,}control, {l,r,}command, fn
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 fake_button3 \fImodifiers\fP
+Change the modifier keys used to emulate the second mouse button. By default,
+Command is used to emulate the second button. Any combination of the following
+modifier names may be used: {l,r,}shift, {l,r,}option, {l,r,}control, {l,r,}command, fn
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 fullscreen_hotkeys -boolean true
+Enable OSX hotkeys while in fullscreen
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 fullscreen_menu -boolean true
+Show the OSX menu while in fullscreen
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 no_quit_alert -boolean true
+Disables the alert dialog displayed when attempting to quit X11.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 no_auth -boolean true
+Stops the X server requiring that clients authenticate themselves when
+connecting.  See Xsecurity(__miscmansuffix__).
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 nolisten_tcp -boolean false
+This will tell the server to listen and accept TCP connections.  Doing this without enabling
+xauth is a possible security concern.  See Xsecurity(__miscmansuffix__).
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 enable_system_beep -boolean false
+Don't use the standard system beep effect for X11 alerts.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 enable_key_equivalents -boolean false
+Disable menu keyboard equivalents while X11 windows are focused.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 depth \fIdepth\fP
+Specifies the color bit depth to use. Currently only 15, and 24 color
+bits per pixel are supported. If not specified, or a value of -1 is specified,
+defaults to the depth of the main display.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 sync_keymap -boolean true
+Keep the X11 keymap up to date with the OSX system keymap.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 option_sends_alt -boolean true
+The Option key will send Alt_L and Alt_R instead of Mode_switch.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard -boolean true
+Enable syncing between the OSX pasteboard and clipboard/primary selection buffers in X11.  This option needs to be true for any of the other pasteboard sync options to have an effect.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard_to_clipboard -boolean true
+Update the X11 CLIPBOARD when the OSX NSPasteboard is updated.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard_to_primary -boolean true
+Update the the X11 PRIMARY buffer when the OSX NSPasteboard is updated.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 sync_clipboard_to_pasteboard -boolean true
+Update the the OSX NSPasteboard when the X11 CLIPBOARD is updated.  Note that enabling this option causes the clipboard synchronization to act as a clipboard manager in X11.  This makes it impossible to use xclipboard, klipper, or any other such clipboard managers.  If you want to use any of these programs, you must disable this option.
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 sync_primary_on_select -boolean true
+This option defaults to false and is provided only "for experts."  It updates the NSPasteboard whenever a new X11 selection is made (rather than requiring you to hit cmd-c to copy the selection to the NSPasteboard).  Since the X11 protocol does not require applications to send notification when they change selection, this might not work in all cases (if you run into this problem, try selecting text in another application first, then selecting the text you want).
+.TP 8
+.B defaults write __laucnd_id_prefix__.X11 enable_test_extensions -boolean true
+This option defaults to false and is only accessible through the command line.  Enable this option to turn on the DEC-XTRAP, RECORD, and XTEST extensions in the server.
+.SH OPTIONS
+.PP
+In addition to the normal server options described in the \fIXserver(1)\fP
+manual page, \fIXquartz\fP accepts the following command line switches:
+.TP 8
+.B \-fakebuttons
+Same as enable_fake_buttons above with value true.
+.TP 8
+.B \-nofakebuttons
+Same as enable_fake_buttons above with value false.
+.TP 8
+.B "\-fakemouse2 \fImodifiers\fP"
+Same as fake_button2 above.
+.TP 8
+.B "\-fakemouse3 \fImodifiers\fP"
+Same as fake_button3 above.
+.TP 8
+.B "\-depth \fIdepth\fP"
+Same as depth above.
+.SH "SEE ALSO"
+.PP
+X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1)
+.PP
+http://xquartz.macosforge.org
+.PP
+.SH AUTHORS / HISTORY
+X11 was originally ported to Mac OS X Server by John Carmack.  Dave
+Zarzycki used this as the basis of his port of XFree86 4.0 to Darwin 1.0.
+Torrey T. Lyons improved and integrated this code into the XFree86
+Project's mainline for the 4.0.2 release.
+.PP
+The following members of the XonX Team contributed to the following
+releases (in alphabetical order):
+.TP 4
+XFree86 4.1.0:
+.br
+Rob Braun - Darwin x86 support
+.br
+Torrey T. Lyons - Project Lead
+.br
+Andreas Monitzer - Cocoa version of XDarwin front end
+.br
+Gregory Robert Parker - Original Quartz implementation
+.br
+Christoph Pfisterer - Dynamic shared X libraries
+.br
+Toshimitsu Tanaka - Japanese localization
+.TP 4
+XFree86 4.2.0:
+.br
+Rob Braun - Darwin x86 support
+.br
+Pablo Di Noto - Spanish localization
+.br
+Paul Edens - Dutch localization
+.br
+Kyunghwan Kim - Korean localization
+.br
+Mario Klebsch - Non-US keyboard support
+.br
+Torrey T. Lyons - Project Lead
+.br
+Andreas Monitzer - German localization
+.br
+Patrik Montgomery - Swedish localization
+.br
+Greg Parker - Rootless support
+.br
+Toshimitsu Tanaka - Japanese localization
+.br
+Olivier Verdier - French localization
+.PP
+Code from Apple's X11.app (which was based on XFree86 4.1) was integrated into X.org's XDarwin DDX by Ben Byer for xorg-server-1.2.
+The XDarwin DDX was renamed Xquartz to more accurately reflect its state (the pure-darwin backend was removed).
+Jeremy Huddleston took over as project lead and brought the project up to the X.org 1.4 server branch.
+.PP
+Jeremy Huddleston <jeremyhu at apple.com> is the current maintainer.
diff --git a/hw/xquartz/doc/Xquartz.man.pre b/hw/xquartz/doc/Xquartz.man.pre
deleted file mode 100644
index 4471947..0000000
--- a/hw/xquartz/doc/Xquartz.man.pre
+++ /dev/null
@@ -1,162 +0,0 @@
-.TH XQUARTZ 1 __vendorversion__
-.SH NAME
-Xquartz \- X window system server for Mac OSX
-.SH SYNOPSIS
-.B Xquartz
-[ options ] ...
-.SH DESCRIPTION
-.I Xquartz
-is the X window server for Mac OS X provided by Apple.
-.I Xquartz
-runs in parallel with Aqua in rootless mode. In rootless mode, the X
-window system and Mac OS X share your display.  The root window of the
-X11 display is the size of the screen and contains all the other
-windows. The X11 root window is not displayed in rootless mode as Mac
-OS X handles the desktop background.
-.SH CUSTOMIZATION
-\fIXquartz\fP can be customized using the defaults(1) command. The available options are:
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 enable_fake_buttons -boolean true
-Emulates a 3 button mouse using modifier keys. By default, the Command modifier
-is used to emulate button 2 and Option is used for button 3. Thus, clicking the
-first mouse button while holding down Command will act like clicking
-button 2. Holding down Option will simulate button 3.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 fake_button2 \fImodifiers\fP
-Change the modifier keys used to emulate the second mouse button. By default,
-Command is used to emulate the second button. Any combination of the following
-modifier names may be used: {l,r,}shift, {l,r,}option, {l,r,}control, {l,r,}command, fn
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 fake_button3 \fImodifiers\fP
-Change the modifier keys used to emulate the second mouse button. By default,
-Command is used to emulate the second button. Any combination of the following
-modifier names may be used: {l,r,}shift, {l,r,}option, {l,r,}control, {l,r,}command, fn
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 fullscreen_hotkeys -boolean true
-Enable OSX hotkeys while in fullscreen
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 fullscreen_menu -boolean true
-Show the OSX menu while in fullscreen
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 no_quit_alert -boolean true
-Disables the alert dialog displayed when attempting to quit X11.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 no_auth -boolean true
-Stops the X server requiring that clients authenticate themselves when
-connecting.  See Xsecurity(__miscmansuffix__).
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 nolisten_tcp -boolean false
-This will tell the server to listen and accept TCP connections.  Doing this without enabling
-xauth is a possible security concern.  See Xsecurity(__miscmansuffix__).
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 enable_system_beep -boolean false
-Don't use the standard system beep effect for X11 alerts.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 enable_key_equivalents -boolean false
-Disable menu keyboard equivalents while X11 windows are focused.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 depth \fIdepth\fP
-Specifies the color bit depth to use. Currently only 15, and 24 color
-bits per pixel are supported. If not specified, or a value of -1 is specified,
-defaults to the depth of the main display.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 sync_keymap -boolean true
-Keep the X11 keymap up to date with the OSX system keymap.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 option_sends_alt -boolean true
-The Option key will send Alt_L and Alt_R instead of Mode_switch.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard -boolean true
-Enable syncing between the OSX pasteboard and clipboard/primary selection buffers in X11.  This option needs to be true for any of the other pasteboard sync options to have an effect.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard_to_clipboard -boolean true
-Update the X11 CLIPBOARD when the OSX NSPasteboard is updated.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard_to_primary -boolean true
-Update the the X11 PRIMARY buffer when the OSX NSPasteboard is updated.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 sync_clipboard_to_pasteboard -boolean true
-Update the the OSX NSPasteboard when the X11 CLIPBOARD is updated.  Note that enabling this option causes the clipboard synchronization to act as a clipboard manager in X11.  This makes it impossible to use xclipboard, klipper, or any other such clipboard managers.  If you want to use any of these programs, you must disable this option.
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 sync_primary_on_select -boolean true
-This option defaults to false and is provided only "for experts."  It updates the NSPasteboard whenever a new X11 selection is made (rather than requiring you to hit cmd-c to copy the selection to the NSPasteboard).  Since the X11 protocol does not require applications to send notification when they change selection, this might not work in all cases (if you run into this problem, try selecting text in another application first, then selecting the text you want).
-.TP 8
-.B defaults write __laucnd_id_prefix__.X11 enable_test_extensions -boolean true
-This option defaults to false and is only accessible through the command line.  Enable this option to turn on the DEC-XTRAP, RECORD, and XTEST extensions in the server.
-.SH OPTIONS
-.PP
-In addition to the normal server options described in the \fIXserver(1)\fP
-manual page, \fIXquartz\fP accepts the following command line switches:
-.TP 8
-.B \-fakebuttons
-Same as enable_fake_buttons above with value true.
-.TP 8
-.B \-nofakebuttons
-Same as enable_fake_buttons above with value false.
-.TP 8
-.B "\-fakemouse2 \fImodifiers\fP"
-Same as fake_button2 above.
-.TP 8
-.B "\-fakemouse3 \fImodifiers\fP"
-Same as fake_button3 above.
-.TP 8
-.B "\-depth \fIdepth\fP"
-Same as depth above.
-.SH "SEE ALSO"
-.PP
-X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1)
-.PP
-http://xquartz.macosforge.org
-.PP
-.SH AUTHORS / HISTORY
-X11 was originally ported to Mac OS X Server by John Carmack.  Dave
-Zarzycki used this as the basis of his port of XFree86 4.0 to Darwin 1.0.
-Torrey T. Lyons improved and integrated this code into the XFree86
-Project's mainline for the 4.0.2 release.
-.PP
-The following members of the XonX Team contributed to the following
-releases (in alphabetical order):
-.TP 4
-XFree86 4.1.0:
-.br
-Rob Braun - Darwin x86 support
-.br
-Torrey T. Lyons - Project Lead
-.br
-Andreas Monitzer - Cocoa version of XDarwin front end
-.br
-Gregory Robert Parker - Original Quartz implementation
-.br
-Christoph Pfisterer - Dynamic shared X libraries
-.br
-Toshimitsu Tanaka - Japanese localization
-.TP 4
-XFree86 4.2.0:
-.br
-Rob Braun - Darwin x86 support
-.br
-Pablo Di Noto - Spanish localization
-.br
-Paul Edens - Dutch localization
-.br
-Kyunghwan Kim - Korean localization
-.br
-Mario Klebsch - Non-US keyboard support
-.br
-Torrey T. Lyons - Project Lead
-.br
-Andreas Monitzer - German localization
-.br
-Patrik Montgomery - Swedish localization
-.br
-Greg Parker - Rootless support
-.br
-Toshimitsu Tanaka - Japanese localization
-.br
-Olivier Verdier - French localization
-.PP
-Code from Apple's X11.app (which was based on XFree86 4.1) was integrated into X.org's XDarwin DDX by Ben Byer for xorg-server-1.2.
-The XDarwin DDX was renamed Xquartz to more accurately reflect its state (the pure-darwin backend was removed).
-Jeremy Huddleston took over as project lead and brought the project up to the X.org 1.4 server branch.
-.PP
-Jeremy Huddleston <jeremyhu at apple.com> is the current maintainer.
commit a9e85013b1045c7e02891a019bfa8042a219b7f1
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:27:46 2011 -0500

    man: build Xorg and xorg.conf man pages using XORG_MANPAGE_SECTIONS
    
    Nothing requires the use of a C preprocessor
    Using standard file extensions (.man) means no need for .gitignore
    Use standard directory and makefile
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/doc/man/.gitignore b/hw/xfree86/doc/man/.gitignore
deleted file mode 100644
index 7a16e4a..0000000
--- a/hw/xfree86/doc/man/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-#		Add & Override for this directory and it's subdirectories
-Xorg
-Xorg.man
-xorg.conf.man
diff --git a/hw/xfree86/doc/man/Makefile.am b/hw/xfree86/doc/man/Makefile.am
index 737166b..4fbc878 100644
--- a/hw/xfree86/doc/man/Makefile.am
+++ b/hw/xfree86/doc/man/Makefile.am
@@ -1,24 +1,25 @@
-# Xserver.man covers options generic to all X servers built in this tree
-MAN_SRCS = Xorg.man.pre xorg.conf.man.pre
-
 appmandir = $(APP_MAN_DIR)
-appman_DATA = Xorg.$(APP_MAN_SUFFIX)
+appman_PRE = Xorg.man
+appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
 
 filemandir = $(FILE_MAN_DIR)
-fileman_DATA = xorg.conf.$(FILE_MAN_SUFFIX)
-
-Xorg.$(APP_MAN_SUFFIX): Xorg.man
-	-$(AM_V_at)rm -f Xorg.$(APP_MAN_SUFFIX)
-	$(AM_V_at)$(LN_S) Xorg.man Xorg.$(APP_MAN_SUFFIX)
-
-xorg.conf.$(FILE_MAN_SUFFIX): xorg.conf.man
-	-$(AM_V_at)rm -f xorg.conf.$(FILE_MAN_SUFFIX)
-	$(AM_V_at)$(LN_S) xorg.conf.man xorg.conf.$(FILE_MAN_SUFFIX)
-
-include $(top_srcdir)/cpprules.in
-
-EXTRAMANDEFS = -D__logdir__=$(logdir)
-
-CLEANFILES = $(appman_DATA) $(fileman_DATA) xorg.conf.man Xorg.man
-
-EXTRA_DIST = $(MAN_SRCS)
+fileman_PRE = xorg.conf.man
+fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX))
+
+EXTRA_DIST = $(appman_PRE) $(fileman_PRE)
+CLEANFILES = $(appman_DATA) $(fileman_DATA)
+SUFFIXES = .$(APP_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man
+
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+MAN_SUBSTS += 	-e 's|__logdir__|$(logdir)|g' \
+		-e 's|__datadir__|$(datadir)|g' \
+		-e 's|__mandir__|$(mandir)|g' \
+		-e 's|__sysconfdir__|$(sysconfdir)|g' \
+		-e 's|__xconfigdir__|$(__XCONFIGDIR__)|g' \
+		-e 's|__xkbdir__|$(XKB_BASE_DIRECTORY)|g' \
+		-e 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g'
+
+.man.$(APP_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+.man.$(FILE_MAN_SUFFIX):
+	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/hw/xfree86/doc/man/Xorg.man b/hw/xfree86/doc/man/Xorg.man
new file mode 100644
index 0000000..6fa334c
--- /dev/null
+++ b/hw/xfree86/doc/man/Xorg.man
@@ -0,0 +1,689 @@
+.\" $XdotOrg: xserver/xorg/hw/xfree86/doc/man/Xorg.man.pre,v 1.3 2005/07/04 18:41:01 ajax Exp $
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH __xservername__ __appmansuffix__ __vendorversion__
+.SH NAME
+__xservername__ - X11R7 X server
+.SH SYNOPSIS
+.B __xservername__
+.RI [\fB:\fP display ]
+.RI [ option
+.IR ... ]
+.SH DESCRIPTION
+.B __xservername__
+is a full featured X server that was originally designed for UNIX and
+UNIX-like operating systems running on Intel x86 hardware.  It now runs
+on a wider range of hardware and OS platforms.
+.PP
+This work was derived by the X.Org Foundation from the XFree86 Project's
+.I "XFree86\ 4.4rc2"
+release.
+The XFree86 release was originally derived from
+.I "X386\ 1.2"
+by Thomas Roell which was contributed to X11R5 by Snitily Graphics
+Consulting Service.
+.SH PLATFORMS
+.PP
+.B __xservername__
+operates under a wide range of operating systems and hardware platforms.
+The Intel x86 (IA32) architecture is the most widely supported hardware
+platform.  Other hardware platforms include Compaq Alpha, Intel IA64, AMD64,
+SPARC and PowerPC.  The most widely supported operating systems are the
+free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD,
+OpenBSD, and Solaris.  Commercial UNIX operating systems such as
+UnixWare are also supported.  Other supported operating systems include
+GNU Hurd.  Mac OS X is supported with the
+Xquartz(__appmansuffix__) X server.  Win32/Cygwin is supported with the
+XWin(__appmansuffix__) X server.
+.PP
+.SH "NETWORK CONNECTIONS"
+.B __xservername__
+supports connections made using the following reliable
+byte-streams:
+.TP 4
+.I "Local"
+On most platforms, the "Local" connection type is a UNIX-domain socket.
+On some System V platforms, the "local" connection types also include
+STREAMS pipes, named pipes, and some other mechanisms.
+.TP 4
+.I TCP\/IP
+.B __xservername__
+listens on port
+.RI 6000+ n ,
+where
+.I n
+is the display number.  This connection type can be disabled with the
+.B \-nolisten
+option (see the Xserver(1) man page for details).
+.SH "ENVIRONMENT VARIABLES"
+For operating systems that support local connections other than Unix
+Domain sockets (SVR3 and SVR4), there is a compiled-in list specifying
+the order in which local connections should be attempted.  This list
+can be overridden by the
+.I XLOCAL
+environment variable described below.  If the display name indicates a
+best-choice connection should be made (e.g.
+.BR :0.0 ),
+each connection mechanism is tried until a connection succeeds or no
+more mechanisms are available.  Note: for these OSs, the Unix Domain
+socket connection is treated differently from the other local connection
+types.  To use it the connection must be made to
+.BR unix:0.0 .
+.PP
+The
+.I XLOCAL
+environment variable should contain a list of one more
+more of the following:
+.PP
+.RS 8
+.nf
+NAMED
+PTS
+SCO
+ISC
+.fi
+.RE
+.PP
+which represent SVR4 Named Streams pipe, Old-style USL Streams pipe,
+SCO XSight Streams pipe, and ISC Streams pipe, respectively.  You can
+select a single mechanism (e.g.
+.IR XLOCAL=NAMED ),
+or an ordered list (e.g. \fIXLOCAL="NAMED:PTS:SCO"\fP).
+his variable overrides the compiled-in defaults.  For SVR4 it is
+recommended that
+.I NAMED
+be the first preference connection.  The default setting is
+.IR PTS:NAMED:ISC:SCO .
+.PP
+To globally override the compiled-in defaults, you should define (and
+export if using
+.B sh
+or
+.BR ksh )
+.I XLOCAL
+globally.  If you use startx(1) or xinit(1), the definition should be
+at the top of your
+.I .xinitrc
+file.  If you use xdm(1), the definitions should be early on in the
+.I __projectroot__/lib/X11/xdm/Xsession
+script.
+.SH OPTIONS
+.B __xservername__
+supports several mechanisms for supplying/obtaining configuration and
+run-time parameters: command line options, environment variables, the
+__xconfigfile__(__filemansuffix__) configuration files, auto-detection, and
+fallback defaults.  When the same information is supplied in more than
+one way, the highest precedence mechanism is used.  The list of mechanisms
+is ordered from highest precedence to lowest.  Note that not all parameters
+can be supplied via all methods.  The available command line options
+and environment variables (and some defaults) are described here and in
+the Xserver(__appmansuffix__) manual page.  Most configuration file
+parameters, with their defaults, are described in the
+__xconfigfile__(__filemansuffix__) manual page.  Driver and module specific
+configuration parameters are described in the relevant driver or module
+manual page.
+.PP
+In addition to the normal server options described in the
+Xserver(__appmansuffix__) manual page,
+.B __xservername__
+accepts the following command line switches:
+.TP 8
+.BI vt XX
+.I XX
+specifies the Virtual Terminal device number which
+.B __xservername__
+will use.  Without this option,
+.B __xservername__
+will pick the first available Virtual Terminal that it can locate.  This
+option applies only to platforms that have virtual terminal support, such
+as Linux, BSD, OpenSolaris, SVR3, and SVR4.
+.TP
+.B \-allowMouseOpenFail
+Allow the server to start up even if the mouse device can't be opened
+or initialised.  This is equivalent to the
+.B AllowMouseOpenFail
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.B \-allowNonLocalXvidtune
+Make the VidMode extension available to remote clients.  This allows
+the xvidtune client to connect from another host.  This is equivalent
+to the
+.B AllowNonLocalXvidtune
+__xconfigfile__(__filemansuffix__) file option.  By default non-local
+connections are not allowed.
+.TP 8
+.BI \-bgamma " value"
+Set the blue gamma correction.
+.I value
+must be between 0.1 and 10.
+The default is 1.0.  Not all drivers support this.  See also the
+.BR \-gamma ,
+.BR \-rgamma ,
+and
+.B \-ggamma
+options.
+.TP 8
+.BI \-bpp " n"
+No longer supported.  Use
+.B \-depth
+to set the color depth, and use
+.B \-fbbpp
+if you really need to force a non-default framebuffer (hardware) pixel
+format.
+.TP 8
+.BI \-config " file"
+Read the server configuration from
+.IR file .
+This option will work for any file when the server is run as root (i.e,
+with real-uid 0), or for files relative to a directory in the config
+search path for all other users.
+.TP 8
+.BI \-configdir " directory"
+Read the server configuration files from
+.IR directory .
+This option will work for any directory when the server is run as root
+(i.e, with real-uid 0), or for directories relative to a directory in the
+config directory search path for all other users.
+.TP 8
+.B \-configure
+When this option is specified, the
+.B __xservername__
+server loads all video driver modules, probes for available hardware,
+and writes out an initial __xconfigfile__(__filemansuffix__) file based on
+what was detected.  This option currently has some problems on some
+platforms, but in most cases it is a good way to bootstrap the
+configuration process.  This option is only available when the server
+is run as root (i.e, with real-uid 0).
+.TP 8
+.BI "\-crt /dev/tty" XX
+SCO only.  This is the same as the
+.B vt
+option, and is provided for compatibility with the native SCO X server.
+.TP 8
+.BI \-depth " n"
+Sets the default color depth.  Legal values are 1, 4, 8, 15, 16, and
+24.  Not all drivers support all values.
+.TP 8
+.B \-disableVidMode
+Disable the parts of the VidMode extension (used by the xvidtune
+client) that can be used to change the video modes.  This is equivalent
+to the
+.B DisableVidModeExtension
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.B \-fbbpp \fIn\fP
+Sets the number of framebuffer bits per pixel.  You should only set this
+if you're sure it's necessary; normally the server can deduce the correct
+value from
+.B \-depth
+above.  Useful if you want to run a depth 24 configuration with a 24
+bpp framebuffer rather than the (possibly default) 32 bpp framebuffer
+(or vice versa).  Legal values are 1, 8, 16, 24, 32.  Not all drivers
+support all values.
+.TP 8
+.B \-flipPixels
+Swap the default values for the black and white pixels.
+.TP 8
+.BI \-gamma " value"
+Set the gamma correction.
+.I value
+must be between 0.1 and 10.  The default is 1.0.  This value is applied
+equally to the R, G and B values.  Those values can be set independently
+with the
+.BR \-rgamma ,
+.BR \-bgamma ,
+and
+.B \-ggamma
+options.  Not all drivers support this.
+.TP 8
+.BI \-ggamma " value"
+Set the green gamma correction.
+.I value
+must be between 0.1 and 10.  The default is 1.0.  Not all drivers support
+this.  See also the
+.BR \-gamma ,
+.BR \-rgamma ,
+and
+.B \-bgamma
+options.
+.TP 8
+.B \-ignoreABI
+The
+.B __xservername__
+server checks the ABI revision levels of each module that it loads.  It
+will normally refuse to load modules with ABI revisions that are newer
+than the server's.  This is because such modules might use interfaces
+that the server does not have.  When this option is specified, mismatches
+like this are downgraded from fatal errors to warnings.  This option
+should be used with care.
+.TP 8
+.B \-isolateDevice \fIbus\-id\fP
+Restrict device resets to the device at
+.IR bus\-id .
+The
+.I bus\-id
+string has the form
+.IB bustype : bus : device : function
+(e.g., \(oqPCI:1:0:0\(cq).
+At present, only isolation of PCI devices is supported; i.e., this option
+is ignored if
+.I bustype
+is anything other than \(oqPCI\(cq.
+.TP 8
+.B \-keeptty
+Prevent the server from detaching its initial controlling terminal.
+This option is only useful when debugging the server.  Not all platforms
+support (or can use) this option.
+.TP 8
+.BI \-keyboard " keyboard-name"
+Use the __xconfigfile__(__filemansuffix__) file
+.B InputDevice
+section called
+.I keyboard-name
+as the core keyboard.  This option is ignored when the
+.B Layout
+section specifies a core keyboard.  In the absence of both a Layout
+section and this option, the first relevant
+.B InputDevice
+section is used for the core keyboard.
+.TP 8
+.BI \-layout " layout-name"
+Use the __xconfigfile__(__filemansuffix__) file
+.B Layout
+section called
+.IR layout-name .
+By default the first
+.B Layout
+section is used.
+.TP 8
+.BI \-logfile " filename"
+Use the file called
+.I filename
+as the
+.B __xservername__
+server log file.  The default log file is
+.BI __logdir__/__xservername__. n .log
+on most platforms, where
+.I n
+is the display number of the
+.B __xservername__
+server.  The default may be in a different directory on some platforms.
+This option is only available when the server is run as root (i.e, with
+real-uid 0).
+.TP 8
+.BR \-logverbose " [\fIn\fP]"
+Sets the verbosity level for information printed to the
+.B __xservername__
+server log file.  If the
+.I n
+value isn't supplied, each occurrence of this option increments the log
+file verbosity level.  When the
+.I n
+value is supplied, the log file verbosity level is set to that value.
+The default log file verbosity level is 3.
+.TP 8
+.BI \-modulepath " searchpath"
+Set the module search path to
+.IR searchpath .
+.I searchpath
+is a comma separated list of directories to search for
+.B __xservername__
+server modules.  This option is only available when the server is run
+as root (i.e, with real-uid 0).
+.TP 8
+.B \-nosilk
+Disable Silken Mouse support.
+.TP 8
+.B \-pixmap24
+Set the internal pixmap format for depth 24 pixmaps to 24 bits per pixel.
+The default is usually 32 bits per pixel.  There is normally little
+reason to use this option.  Some client applications don't like this
+pixmap format, even though it is a perfectly legal format.  This is
+equivalent to the
+.B Pixmap
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.B \-pixmap32
+Set the internal pixmap format for depth 24 pixmaps to 32 bits per pixel.
+This is usually the default.  This is equivalent to the
+.B Pixmap
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.BI \-pointer " pointer-name"
+Use the __xconfigfile__(__filemansuffix__) file
+.B InputDevice
+section called
+.I pointer-name
+as the core pointer.  This option is ignored when the
+.B Layout
+section specifies a core pointer.  In the absence of both a Layout
+section and this option, the first relevant
+.B InputDevice
+section is used for the core pointer.
+.TP 8
+.B \-quiet
+Suppress most informational messages at startup.  The verbosity level
+is set to zero.
+.TP 8
+.BI \-rgamma " value"
+Set the red gamma correction.
+.I value
+must be between 0.1 and 10.  The default is 1.0.  Not all drivers support
+this.  See also the
+.BR \-gamma ,
+.BR \-bgamma ,
+and
+.B \-ggamma
+options.
+.TP 8
+.BI \-screen " screen-name"
+Use the __xconfigfile__(__filemansuffix__) file
+.B Screen
+section called
+.IR screen-name .
+By default the screens referenced by the default
+.B Layout
+section are used, or the first
+.B Screen
+section when there are no
+.B Layout
+sections.
+.TP 8
+.B \-showconfig
+This is the same as the
+.B \-version
+option, and is included for compatibility reasons.  It may be removed
+in a future release, so the
+.B \-version
+option should be used instead.
+.TP 8
+.B \-showDefaultModulePath
+Print out the default module path the server was compiled with.
+.TP 8
+.B \-showDefaultLibPath
+Print out the path libraries should be installed to.
+.TP 8
+.B \-showopts
+For each driver module installed, print out the list of options and their
+argument types.
+.TP 8
+.BI \-weight " nnn"
+Set RGB weighting at 16 bpp.  The default is 565.  This applies only to
+those drivers which support 16 bpp.
+.TP 8
+.BR \-verbose " [\fIn\fP]"
+Sets the verbosity level for information printed on stderr.  If the
+.I n
+value isn't supplied, each occurrence of this option increments the
+verbosity level.  When the
+.I n
+value is supplied, the verbosity level is set to that value.  The default
+verbosity level is 0.
+.TP 8
+.B \-version
+Print out the server version, patchlevel, release date, the operating
+system/platform it was built on, and whether it includes module loader
+support.
+.SH "KEYBOARD"
+.PP
+The
+.B __xservername__
+server is normally configured to recognize various special combinations
+of key presses that instruct the server to perform some action, rather
+than just sending the key press event to a client application. These actions
+depend on the XKB keymap loaded by a particular keyboard device and may or
+may not be available on a given configuration.
+.PP
+The following key combinations are commonly part of the default XKEYBOARD
+keymap.
+.TP 8
+.B Ctrl+Alt+Backspace
+Immediately kills the server -- no questions asked. It can be disabled by
+setting the
+.B DontZap
+__xconfigfile__(__filemansuffix__) file option to a TRUE value.
+.PP
+.RS 8
+It should be noted that zapping is triggered by the
+.B Terminate_Server
+action in the keyboard map. This action is not part of the default keymaps
+but can be enabled with the XKB option
+.B \*qterminate:ctrl_alt_bksp\*q.
+.RE
+.TP 8
+.B Ctrl+Alt+Keypad-Plus
+Change video mode to next one specified in the configuration file.
+This can be disabled with the
+.B DontZoom
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.B Ctrl+Alt+Keypad-Minus
+Change video mode to previous one specified in the configuration file.
+This can be disabled with the
+.B DontZoom
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.B Ctrl+Alt+F1...F12
+For systems with virtual terminal support, these keystroke
+combinations are used to switch to virtual terminals 1 through 12,
+respectively.  This can be disabled with the
+.B DontVTSwitch
+__xconfigfile__(__filemansuffix__) file option.
+.SH CONFIGURATION
+.B __xservername__
+typically uses a configuration file called
+.B __xconfigfile__
+and configuration files with the suffix
+.I .conf
+in a directory called
+.B __xconfigdir__
+for its initial setup.
+Refer to the __xconfigfile__(__filemansuffix__) manual page for information
+about the format of this file.
+.PP
+.B __xservername__
+has a mechanism for automatically generating a built-in configuration
+at run-time when no
+.B __xconfigfile__
+file or
+.B __xconfigdir__
+files are present.  The current version of this automatic configuration
+mechanism works in two ways.
+.PP
+The first is via enhancements that have made many components of the
+.B __xconfigfile__
+file optional.  This means that information that can be probed or
+reasonably deduced doesn't need to be specified explicitly, greatly
+reducing the amount of built-in configuration information that needs to
+be generated at run-time.
+.PP
+The second is to have "safe" fallbacks for most configuration information.
+This maximises the likelihood that the
+.B __xservername__
+server will start up in some usable configuration even when information
+about the specific hardware is not available.
+.PP
+The automatic configuration support for __xservername__ is work in progress.
+It is currently aimed at the most popular hardware and software platforms
+supported by __xservername__.  Enhancements are planned for future releases.
+.SH FILES
+The
+.B __xservername__
+server config files can be found in a range of locations.  These are
+documented fully in the __xconfigfile__(__filemansuffix__) manual page.  The
+most commonly used locations are shown here.
+.TP 30
+.B /etc/X11/__xconfigfile__
+Server configuration file.
+.TP 30
+.B /etc/X11/__xconfigfile__-4
+Server configuration file.
+.TP 30
+.B /etc/__xconfigfile__
+Server configuration file.
+.TP 30
+.B __projectroot__/etc/__xconfigfile__
+Server configuration file.
+.TP 30
+.B __projectroot__/lib/X11/__xconfigfile__
+Server configuration file.
+.TP 30
+.B /etc/X11/__xconfigdir__
+Server configuration directory.
+.TP 30
+.B /etc/X11/__xconfigdir__-4
+Server configuration directory.
+.TP 30
+.B /etc/__xconfigdir__
+Server configuration directory.
+.TP 30
+.B __projectroot__/etc/__xconfigdir__
+Server configuration directory.
+.TP 30
+.B __projectroot__/lib/X11/__xconfigdir__
+Server configuration directory.
+.TP 30
+.BI __logdir__/__xservername__. n .log
+Server log file for display
+.IR n .
+.TP 30
+.B __projectroot__/bin/\(**
+Client binaries.
+.TP 30
+.B __projectroot__/include/\(**
+Header files.
+.TP 30
+.B __projectroot__/lib/\(**
+Libraries.
+.TP 30
+.B __datadir__/fonts/X11/\(**
+Fonts.
+.TP 30
+.B __projectroot__/share/X11/XErrorDB
+Client error message database.
+.TP 30
+.B __projectroot__/lib/X11/app-defaults/\(**
+Client resource specifications.
+.TP 30
+.B __mandir__/man?/\(**
+Manual pages.
+.TP 30
+.BI /etc/X n .hosts
+Initial access control list for display
+.IR n .
+.SH "SEE ALSO"
+X(__miscmansuffix__), Xserver(__appmansuffix__), xdm(__appmansuffix__), xinit(__appmansuffix__),
+__xconfigfile__(__filemansuffix__), xvidtune(__appmansuffix__),
+apm(__drivermansuffix__),
+ati(__drivermansuffix__),
+chips(__drivermansuffix__),
+cirrus(__drivermansuffix__),
+cyrix(__drivermansuffix__),
+fbdev(__drivermansuffix__),
+glide(__drivermansuffix__),
+glint(__drivermansuffix__),
+i128(__drivermansuffix__),
+i740(__drivermansuffix__),
+imstt(__drivermansuffix__),
+intel(__drivermansuffix__),
+mga(__drivermansuffix__),
+neomagic(__drivermansuffix__),
+nsc(__drivermansuffix__),
+nv(__drivermansuffix__),
+openchrome (__drivermansuffix__),
+r128(__drivermansuffix__),
+rendition(__drivermansuffix__),
+s3virge(__drivermansuffix__),
+siliconmotion(__drivermansuffix__),
+sis(__drivermansuffix__),
+sunbw2(__drivermansuffix__),
+suncg14(__drivermansuffix__),
+suncg3(__drivermansuffix__),
+suncg6(__drivermansuffix__),
+sunffb(__drivermansuffix__),
+sunleo(__drivermansuffix__),
+suntcx(__drivermansuffix__),
+tdfx(__drivermansuffix__),
+tga(__drivermansuffix__),
+trident(__drivermansuffix__),
+tseng(__drivermansuffix__),
+v4l(__drivermansuffix__),
+vesa(__drivermansuffix__),
+vmware(__drivermansuffix__),
+.br
+Web site
+.IR <http://www.x.org> .
+
+.SH AUTHORS
+__xservername__ has many contributors world wide.  The names of most of them
+can be found in the documentation, ChangeLog files in the source tree,
+and in the actual source code.
+.PP
+__xservername__ was originally based on XFree86 4.4rc2.
+That was originally based on \fIX386 1.2\fP by Thomas Roell, which
+was contributed to the then X Consortium's X11R5 distribution by SGCS.
+.PP
+__xservername__ is released by the X.Org Foundation.
+.PP
+The project that became XFree86 was originally founded in 1992 by
+David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat.
+.PP
+XFree86 was later integrated in the then X Consortium's X11R6 release
+by a group of dedicated XFree86 developers, including the following:
+.PP
+.RS 4
+.nf
+Stuart Anderson    \fIanderson at metrolink.com\fP
+Doug Anson         \fIdanson at lgc.com\fP
+Gertjan Akkerman   \fIakkerman at dutiba.twi.tudelft.nl\fP
+Mike Bernson       \fImike at mbsun.mlb.org\fP
+Robin Cutshaw      \fIrobin at XFree86.org\fP
+David Dawes        \fIdawes at XFree86.org\fP
+Marc Evans         \fImarc at XFree86.org\fP
+Pascal Haible      \fIhaible at izfm.uni-stuttgart.de\fP
+Matthieu Herrb     \fIMatthieu.Herrb at laas.fr\fP
+Dirk Hohndel       \fIhohndel at XFree86.org\fP
+David Holland      \fIdavidh at use.com\fP
+Alan Hourihane     \fIalanh at fairlite.demon.co.uk\fP
+Jeffrey Hsu        \fIhsu at soda.berkeley.edu\fP
+Glenn Lai          \fIglenn at cs.utexas.edu\fP
+Ted Lemon          \fImellon at ncd.com\fP
+Rich Murphey       \fIrich at XFree86.org\fP
+Hans Nasten        \fInasten at everyware.se\fP
+Mark Snitily       \fImark at sgcs.com\fP
+Randy Terbush      \fIrandyt at cse.unl.edu\fP
+Jon Tombs          \fItombs at XFree86.org\fP
+Kees Verstoep      \fIversto at cs.vu.nl\fP
+Paul Vixie         \fIpaul at vix.com\fP
+Mark Weaver        \fIMark_Weaver at brown.edu\fP
+David Wexelblat    \fIdwex at XFree86.org\fP
+Philip Wheatley    \fIPhilip.Wheatley at ColumbiaSC.NCR.COM\fP
+Thomas Wolfram     \fIwolf at prz.tu-berlin.de\fP
+Orest Zborowski    \fIorestz at eskimo.com\fP
+.fi
+.RE
+.PP
+__xservername__ source is available from the FTP server
+\fI<ftp://ftp.x.org/>\fP, and from the X.Org
+server \fI<http://gitweb.freedesktop.org/>\fP.  Documentation and other
+information can be found from the X.Org web site
+\fI<http://www.x.org/>\fP.
+
+.SH LEGAL
+.PP
+.B __xservername__
+is copyright software, provided under licenses that permit modification
+and redistribution in source and binary form without fee.
+.B __xservername__ is copyright by numerous authors and
+contributors from around the world.  Licensing information can be found
+at
+.IR <http://www.x.org> .
+Refer to the source code for specific copyright notices.
+.PP
+.B XFree86(TM)
+is a trademark of The XFree86 Project, Inc.
+.PP
+.B X11(TM)
+and
+.B X Window System(TM)
+are trademarks of The Open Group.
diff --git a/hw/xfree86/doc/man/Xorg.man.pre b/hw/xfree86/doc/man/Xorg.man.pre
deleted file mode 100644
index 6fa334c..0000000
--- a/hw/xfree86/doc/man/Xorg.man.pre
+++ /dev/null
@@ -1,689 +0,0 @@
-.\" $XdotOrg: xserver/xorg/hw/xfree86/doc/man/Xorg.man.pre,v 1.3 2005/07/04 18:41:01 ajax Exp $
-.\" shorthand for double quote that works everywhere.
-.ds q \N'34'
-.TH __xservername__ __appmansuffix__ __vendorversion__
-.SH NAME
-__xservername__ - X11R7 X server
-.SH SYNOPSIS
-.B __xservername__
-.RI [\fB:\fP display ]
-.RI [ option
-.IR ... ]
-.SH DESCRIPTION
-.B __xservername__
-is a full featured X server that was originally designed for UNIX and
-UNIX-like operating systems running on Intel x86 hardware.  It now runs
-on a wider range of hardware and OS platforms.
-.PP
-This work was derived by the X.Org Foundation from the XFree86 Project's
-.I "XFree86\ 4.4rc2"
-release.
-The XFree86 release was originally derived from
-.I "X386\ 1.2"
-by Thomas Roell which was contributed to X11R5 by Snitily Graphics
-Consulting Service.
-.SH PLATFORMS
-.PP
-.B __xservername__
-operates under a wide range of operating systems and hardware platforms.
-The Intel x86 (IA32) architecture is the most widely supported hardware
-platform.  Other hardware platforms include Compaq Alpha, Intel IA64, AMD64,
-SPARC and PowerPC.  The most widely supported operating systems are the
-free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD,
-OpenBSD, and Solaris.  Commercial UNIX operating systems such as
-UnixWare are also supported.  Other supported operating systems include
-GNU Hurd.  Mac OS X is supported with the
-Xquartz(__appmansuffix__) X server.  Win32/Cygwin is supported with the
-XWin(__appmansuffix__) X server.
-.PP
-.SH "NETWORK CONNECTIONS"
-.B __xservername__
-supports connections made using the following reliable
-byte-streams:
-.TP 4
-.I "Local"
-On most platforms, the "Local" connection type is a UNIX-domain socket.
-On some System V platforms, the "local" connection types also include
-STREAMS pipes, named pipes, and some other mechanisms.
-.TP 4
-.I TCP\/IP
-.B __xservername__
-listens on port
-.RI 6000+ n ,
-where
-.I n
-is the display number.  This connection type can be disabled with the
-.B \-nolisten
-option (see the Xserver(1) man page for details).
-.SH "ENVIRONMENT VARIABLES"
-For operating systems that support local connections other than Unix
-Domain sockets (SVR3 and SVR4), there is a compiled-in list specifying
-the order in which local connections should be attempted.  This list
-can be overridden by the
-.I XLOCAL
-environment variable described below.  If the display name indicates a
-best-choice connection should be made (e.g.
-.BR :0.0 ),
-each connection mechanism is tried until a connection succeeds or no
-more mechanisms are available.  Note: for these OSs, the Unix Domain
-socket connection is treated differently from the other local connection
-types.  To use it the connection must be made to
-.BR unix:0.0 .
-.PP
-The
-.I XLOCAL
-environment variable should contain a list of one more
-more of the following:
-.PP
-.RS 8
-.nf
-NAMED
-PTS
-SCO
-ISC
-.fi
-.RE
-.PP
-which represent SVR4 Named Streams pipe, Old-style USL Streams pipe,
-SCO XSight Streams pipe, and ISC Streams pipe, respectively.  You can
-select a single mechanism (e.g.
-.IR XLOCAL=NAMED ),
-or an ordered list (e.g. \fIXLOCAL="NAMED:PTS:SCO"\fP).
-his variable overrides the compiled-in defaults.  For SVR4 it is
-recommended that
-.I NAMED
-be the first preference connection.  The default setting is
-.IR PTS:NAMED:ISC:SCO .
-.PP
-To globally override the compiled-in defaults, you should define (and
-export if using
-.B sh
-or
-.BR ksh )
-.I XLOCAL
-globally.  If you use startx(1) or xinit(1), the definition should be
-at the top of your
-.I .xinitrc
-file.  If you use xdm(1), the definitions should be early on in the
-.I __projectroot__/lib/X11/xdm/Xsession
-script.
-.SH OPTIONS
-.B __xservername__
-supports several mechanisms for supplying/obtaining configuration and
-run-time parameters: command line options, environment variables, the
-__xconfigfile__(__filemansuffix__) configuration files, auto-detection, and
-fallback defaults.  When the same information is supplied in more than
-one way, the highest precedence mechanism is used.  The list of mechanisms
-is ordered from highest precedence to lowest.  Note that not all parameters
-can be supplied via all methods.  The available command line options
-and environment variables (and some defaults) are described here and in
-the Xserver(__appmansuffix__) manual page.  Most configuration file
-parameters, with their defaults, are described in the
-__xconfigfile__(__filemansuffix__) manual page.  Driver and module specific
-configuration parameters are described in the relevant driver or module
-manual page.
-.PP
-In addition to the normal server options described in the
-Xserver(__appmansuffix__) manual page,
-.B __xservername__
-accepts the following command line switches:
-.TP 8
-.BI vt XX
-.I XX
-specifies the Virtual Terminal device number which
-.B __xservername__
-will use.  Without this option,
-.B __xservername__
-will pick the first available Virtual Terminal that it can locate.  This
-option applies only to platforms that have virtual terminal support, such
-as Linux, BSD, OpenSolaris, SVR3, and SVR4.
-.TP
-.B \-allowMouseOpenFail
-Allow the server to start up even if the mouse device can't be opened
-or initialised.  This is equivalent to the
-.B AllowMouseOpenFail
-__xconfigfile__(__filemansuffix__) file option.
-.TP 8
-.B \-allowNonLocalXvidtune
-Make the VidMode extension available to remote clients.  This allows
-the xvidtune client to connect from another host.  This is equivalent
-to the
-.B AllowNonLocalXvidtune
-__xconfigfile__(__filemansuffix__) file option.  By default non-local
-connections are not allowed.
-.TP 8
-.BI \-bgamma " value"
-Set the blue gamma correction.
-.I value
-must be between 0.1 and 10.
-The default is 1.0.  Not all drivers support this.  See also the
-.BR \-gamma ,
-.BR \-rgamma ,
-and
-.B \-ggamma
-options.
-.TP 8
-.BI \-bpp " n"
-No longer supported.  Use
-.B \-depth
-to set the color depth, and use
-.B \-fbbpp
-if you really need to force a non-default framebuffer (hardware) pixel
-format.
-.TP 8
-.BI \-config " file"
-Read the server configuration from
-.IR file .
-This option will work for any file when the server is run as root (i.e,
-with real-uid 0), or for files relative to a directory in the config
-search path for all other users.
-.TP 8
-.BI \-configdir " directory"
-Read the server configuration files from
-.IR directory .
-This option will work for any directory when the server is run as root
-(i.e, with real-uid 0), or for directories relative to a directory in the
-config directory search path for all other users.
-.TP 8
-.B \-configure
-When this option is specified, the
-.B __xservername__
-server loads all video driver modules, probes for available hardware,
-and writes out an initial __xconfigfile__(__filemansuffix__) file based on
-what was detected.  This option currently has some problems on some
-platforms, but in most cases it is a good way to bootstrap the
-configuration process.  This option is only available when the server
-is run as root (i.e, with real-uid 0).
-.TP 8
-.BI "\-crt /dev/tty" XX
-SCO only.  This is the same as the
-.B vt
-option, and is provided for compatibility with the native SCO X server.
-.TP 8
-.BI \-depth " n"
-Sets the default color depth.  Legal values are 1, 4, 8, 15, 16, and
-24.  Not all drivers support all values.
-.TP 8
-.B \-disableVidMode
-Disable the parts of the VidMode extension (used by the xvidtune
-client) that can be used to change the video modes.  This is equivalent
-to the
-.B DisableVidModeExtension
-__xconfigfile__(__filemansuffix__) file option.
-.TP 8
-.B \-fbbpp \fIn\fP
-Sets the number of framebuffer bits per pixel.  You should only set this
-if you're sure it's necessary; normally the server can deduce the correct
-value from
-.B \-depth
-above.  Useful if you want to run a depth 24 configuration with a 24
-bpp framebuffer rather than the (possibly default) 32 bpp framebuffer
-(or vice versa).  Legal values are 1, 8, 16, 24, 32.  Not all drivers
-support all values.
-.TP 8
-.B \-flipPixels
-Swap the default values for the black and white pixels.
-.TP 8
-.BI \-gamma " value"
-Set the gamma correction.
-.I value
-must be between 0.1 and 10.  The default is 1.0.  This value is applied
-equally to the R, G and B values.  Those values can be set independently
-with the
-.BR \-rgamma ,
-.BR \-bgamma ,
-and
-.B \-ggamma
-options.  Not all drivers support this.
-.TP 8
-.BI \-ggamma " value"
-Set the green gamma correction.
-.I value
-must be between 0.1 and 10.  The default is 1.0.  Not all drivers support
-this.  See also the
-.BR \-gamma ,
-.BR \-rgamma ,
-and
-.B \-bgamma
-options.
-.TP 8
-.B \-ignoreABI
-The
-.B __xservername__
-server checks the ABI revision levels of each module that it loads.  It
-will normally refuse to load modules with ABI revisions that are newer
-than the server's.  This is because such modules might use interfaces
-that the server does not have.  When this option is specified, mismatches
-like this are downgraded from fatal errors to warnings.  This option
-should be used with care.
-.TP 8
-.B \-isolateDevice \fIbus\-id\fP
-Restrict device resets to the device at
-.IR bus\-id .
-The
-.I bus\-id
-string has the form
-.IB bustype : bus : device : function
-(e.g., \(oqPCI:1:0:0\(cq).
-At present, only isolation of PCI devices is supported; i.e., this option
-is ignored if
-.I bustype
-is anything other than \(oqPCI\(cq.
-.TP 8
-.B \-keeptty
-Prevent the server from detaching its initial controlling terminal.
-This option is only useful when debugging the server.  Not all platforms
-support (or can use) this option.
-.TP 8
-.BI \-keyboard " keyboard-name"
-Use the __xconfigfile__(__filemansuffix__) file
-.B InputDevice
-section called
-.I keyboard-name
-as the core keyboard.  This option is ignored when the
-.B Layout
-section specifies a core keyboard.  In the absence of both a Layout
-section and this option, the first relevant
-.B InputDevice
-section is used for the core keyboard.
-.TP 8
-.BI \-layout " layout-name"
-Use the __xconfigfile__(__filemansuffix__) file
-.B Layout
-section called
-.IR layout-name .
-By default the first
-.B Layout
-section is used.
-.TP 8
-.BI \-logfile " filename"
-Use the file called
-.I filename
-as the
-.B __xservername__
-server log file.  The default log file is
-.BI __logdir__/__xservername__. n .log
-on most platforms, where
-.I n
-is the display number of the
-.B __xservername__
-server.  The default may be in a different directory on some platforms.
-This option is only available when the server is run as root (i.e, with
-real-uid 0).
-.TP 8
-.BR \-logverbose " [\fIn\fP]"
-Sets the verbosity level for information printed to the
-.B __xservername__
-server log file.  If the
-.I n
-value isn't supplied, each occurrence of this option increments the log
-file verbosity level.  When the
-.I n
-value is supplied, the log file verbosity level is set to that value.
-The default log file verbosity level is 3.
-.TP 8
-.BI \-modulepath " searchpath"
-Set the module search path to
-.IR searchpath .
-.I searchpath
-is a comma separated list of directories to search for
-.B __xservername__
-server modules.  This option is only available when the server is run
-as root (i.e, with real-uid 0).
-.TP 8
-.B \-nosilk
-Disable Silken Mouse support.
-.TP 8
-.B \-pixmap24
-Set the internal pixmap format for depth 24 pixmaps to 24 bits per pixel.
-The default is usually 32 bits per pixel.  There is normally little
-reason to use this option.  Some client applications don't like this
-pixmap format, even though it is a perfectly legal format.  This is
-equivalent to the
-.B Pixmap
-__xconfigfile__(__filemansuffix__) file option.
-.TP 8
-.B \-pixmap32
-Set the internal pixmap format for depth 24 pixmaps to 32 bits per pixel.
-This is usually the default.  This is equivalent to the
-.B Pixmap
-__xconfigfile__(__filemansuffix__) file option.
-.TP 8
-.BI \-pointer " pointer-name"
-Use the __xconfigfile__(__filemansuffix__) file
-.B InputDevice
-section called
-.I pointer-name
-as the core pointer.  This option is ignored when the
-.B Layout
-section specifies a core pointer.  In the absence of both a Layout
-section and this option, the first relevant
-.B InputDevice
-section is used for the core pointer.
-.TP 8
-.B \-quiet
-Suppress most informational messages at startup.  The verbosity level
-is set to zero.
-.TP 8
-.BI \-rgamma " value"
-Set the red gamma correction.
-.I value
-must be between 0.1 and 10.  The default is 1.0.  Not all drivers support
-this.  See also the
-.BR \-gamma ,
-.BR \-bgamma ,
-and
-.B \-ggamma
-options.
-.TP 8
-.BI \-screen " screen-name"
-Use the __xconfigfile__(__filemansuffix__) file
-.B Screen
-section called
-.IR screen-name .
-By default the screens referenced by the default
-.B Layout
-section are used, or the first
-.B Screen
-section when there are no
-.B Layout
-sections.
-.TP 8
-.B \-showconfig
-This is the same as the
-.B \-version
-option, and is included for compatibility reasons.  It may be removed
-in a future release, so the
-.B \-version
-option should be used instead.
-.TP 8
-.B \-showDefaultModulePath
-Print out the default module path the server was compiled with.
-.TP 8
-.B \-showDefaultLibPath
-Print out the path libraries should be installed to.
-.TP 8
-.B \-showopts
-For each driver module installed, print out the list of options and their
-argument types.
-.TP 8
-.BI \-weight " nnn"
-Set RGB weighting at 16 bpp.  The default is 565.  This applies only to
-those drivers which support 16 bpp.
-.TP 8
-.BR \-verbose " [\fIn\fP]"
-Sets the verbosity level for information printed on stderr.  If the
-.I n
-value isn't supplied, each occurrence of this option increments the
-verbosity level.  When the
-.I n
-value is supplied, the verbosity level is set to that value.  The default
-verbosity level is 0.
-.TP 8
-.B \-version
-Print out the server version, patchlevel, release date, the operating
-system/platform it was built on, and whether it includes module loader
-support.
-.SH "KEYBOARD"
-.PP
-The
-.B __xservername__
-server is normally configured to recognize various special combinations
-of key presses that instruct the server to perform some action, rather
-than just sending the key press event to a client application. These actions
-depend on the XKB keymap loaded by a particular keyboard device and may or
-may not be available on a given configuration.
-.PP
-The following key combinations are commonly part of the default XKEYBOARD
-keymap.
-.TP 8
-.B Ctrl+Alt+Backspace
-Immediately kills the server -- no questions asked. It can be disabled by
-setting the
-.B DontZap
-__xconfigfile__(__filemansuffix__) file option to a TRUE value.
-.PP
-.RS 8
-It should be noted that zapping is triggered by the
-.B Terminate_Server
-action in the keyboard map. This action is not part of the default keymaps
-but can be enabled with the XKB option
-.B \*qterminate:ctrl_alt_bksp\*q.
-.RE
-.TP 8
-.B Ctrl+Alt+Keypad-Plus
-Change video mode to next one specified in the configuration file.
-This can be disabled with the
-.B DontZoom
-__xconfigfile__(__filemansuffix__) file option.
-.TP 8
-.B Ctrl+Alt+Keypad-Minus
-Change video mode to previous one specified in the configuration file.
-This can be disabled with the
-.B DontZoom
-__xconfigfile__(__filemansuffix__) file option.
-.TP 8
-.B Ctrl+Alt+F1...F12
-For systems with virtual terminal support, these keystroke
-combinations are used to switch to virtual terminals 1 through 12,
-respectively.  This can be disabled with the
-.B DontVTSwitch
-__xconfigfile__(__filemansuffix__) file option.
-.SH CONFIGURATION
-.B __xservername__
-typically uses a configuration file called
-.B __xconfigfile__
-and configuration files with the suffix
-.I .conf
-in a directory called
-.B __xconfigdir__
-for its initial setup.
-Refer to the __xconfigfile__(__filemansuffix__) manual page for information
-about the format of this file.
-.PP
-.B __xservername__
-has a mechanism for automatically generating a built-in configuration
-at run-time when no
-.B __xconfigfile__
-file or
-.B __xconfigdir__
-files are present.  The current version of this automatic configuration
-mechanism works in two ways.
-.PP
-The first is via enhancements that have made many components of the
-.B __xconfigfile__
-file optional.  This means that information that can be probed or
-reasonably deduced doesn't need to be specified explicitly, greatly
-reducing the amount of built-in configuration information that needs to
-be generated at run-time.
-.PP
-The second is to have "safe" fallbacks for most configuration information.
-This maximises the likelihood that the
-.B __xservername__
-server will start up in some usable configuration even when information
-about the specific hardware is not available.
-.PP
-The automatic configuration support for __xservername__ is work in progress.
-It is currently aimed at the most popular hardware and software platforms
-supported by __xservername__.  Enhancements are planned for future releases.
-.SH FILES
-The
-.B __xservername__
-server config files can be found in a range of locations.  These are
-documented fully in the __xconfigfile__(__filemansuffix__) manual page.  The
-most commonly used locations are shown here.
-.TP 30
-.B /etc/X11/__xconfigfile__
-Server configuration file.
-.TP 30
-.B /etc/X11/__xconfigfile__-4
-Server configuration file.
-.TP 30
-.B /etc/__xconfigfile__
-Server configuration file.
-.TP 30
-.B __projectroot__/etc/__xconfigfile__
-Server configuration file.
-.TP 30
-.B __projectroot__/lib/X11/__xconfigfile__
-Server configuration file.
-.TP 30
-.B /etc/X11/__xconfigdir__
-Server configuration directory.
-.TP 30
-.B /etc/X11/__xconfigdir__-4
-Server configuration directory.
-.TP 30
-.B /etc/__xconfigdir__
-Server configuration directory.
-.TP 30
-.B __projectroot__/etc/__xconfigdir__
-Server configuration directory.
-.TP 30
-.B __projectroot__/lib/X11/__xconfigdir__
-Server configuration directory.
-.TP 30
-.BI __logdir__/__xservername__. n .log
-Server log file for display
-.IR n .
-.TP 30
-.B __projectroot__/bin/\(**
-Client binaries.
-.TP 30
-.B __projectroot__/include/\(**
-Header files.
-.TP 30
-.B __projectroot__/lib/\(**
-Libraries.
-.TP 30
-.B __datadir__/fonts/X11/\(**
-Fonts.
-.TP 30
-.B __projectroot__/share/X11/XErrorDB
-Client error message database.
-.TP 30
-.B __projectroot__/lib/X11/app-defaults/\(**
-Client resource specifications.
-.TP 30
-.B __mandir__/man?/\(**
-Manual pages.
-.TP 30
-.BI /etc/X n .hosts
-Initial access control list for display
-.IR n .
-.SH "SEE ALSO"
-X(__miscmansuffix__), Xserver(__appmansuffix__), xdm(__appmansuffix__), xinit(__appmansuffix__),
-__xconfigfile__(__filemansuffix__), xvidtune(__appmansuffix__),
-apm(__drivermansuffix__),
-ati(__drivermansuffix__),
-chips(__drivermansuffix__),
-cirrus(__drivermansuffix__),
-cyrix(__drivermansuffix__),
-fbdev(__drivermansuffix__),
-glide(__drivermansuffix__),
-glint(__drivermansuffix__),
-i128(__drivermansuffix__),
-i740(__drivermansuffix__),
-imstt(__drivermansuffix__),
-intel(__drivermansuffix__),
-mga(__drivermansuffix__),
-neomagic(__drivermansuffix__),
-nsc(__drivermansuffix__),
-nv(__drivermansuffix__),
-openchrome (__drivermansuffix__),
-r128(__drivermansuffix__),
-rendition(__drivermansuffix__),
-s3virge(__drivermansuffix__),
-siliconmotion(__drivermansuffix__),
-sis(__drivermansuffix__),
-sunbw2(__drivermansuffix__),
-suncg14(__drivermansuffix__),
-suncg3(__drivermansuffix__),
-suncg6(__drivermansuffix__),
-sunffb(__drivermansuffix__),
-sunleo(__drivermansuffix__),
-suntcx(__drivermansuffix__),
-tdfx(__drivermansuffix__),
-tga(__drivermansuffix__),
-trident(__drivermansuffix__),
-tseng(__drivermansuffix__),
-v4l(__drivermansuffix__),
-vesa(__drivermansuffix__),
-vmware(__drivermansuffix__),
-.br
-Web site
-.IR <http://www.x.org> .
-
-.SH AUTHORS
-__xservername__ has many contributors world wide.  The names of most of them
-can be found in the documentation, ChangeLog files in the source tree,
-and in the actual source code.
-.PP
-__xservername__ was originally based on XFree86 4.4rc2.
-That was originally based on \fIX386 1.2\fP by Thomas Roell, which
-was contributed to the then X Consortium's X11R5 distribution by SGCS.
-.PP
-__xservername__ is released by the X.Org Foundation.
-.PP
-The project that became XFree86 was originally founded in 1992 by
-David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat.
-.PP
-XFree86 was later integrated in the then X Consortium's X11R6 release
-by a group of dedicated XFree86 developers, including the following:
-.PP
-.RS 4
-.nf
-Stuart Anderson    \fIanderson at metrolink.com\fP
-Doug Anson         \fIdanson at lgc.com\fP
-Gertjan Akkerman   \fIakkerman at dutiba.twi.tudelft.nl\fP
-Mike Bernson       \fImike at mbsun.mlb.org\fP
-Robin Cutshaw      \fIrobin at XFree86.org\fP
-David Dawes        \fIdawes at XFree86.org\fP
-Marc Evans         \fImarc at XFree86.org\fP
-Pascal Haible      \fIhaible at izfm.uni-stuttgart.de\fP
-Matthieu Herrb     \fIMatthieu.Herrb at laas.fr\fP
-Dirk Hohndel       \fIhohndel at XFree86.org\fP
-David Holland      \fIdavidh at use.com\fP
-Alan Hourihane     \fIalanh at fairlite.demon.co.uk\fP
-Jeffrey Hsu        \fIhsu at soda.berkeley.edu\fP
-Glenn Lai          \fIglenn at cs.utexas.edu\fP
-Ted Lemon          \fImellon at ncd.com\fP
-Rich Murphey       \fIrich at XFree86.org\fP
-Hans Nasten        \fInasten at everyware.se\fP
-Mark Snitily       \fImark at sgcs.com\fP
-Randy Terbush      \fIrandyt at cse.unl.edu\fP
-Jon Tombs          \fItombs at XFree86.org\fP
-Kees Verstoep      \fIversto at cs.vu.nl\fP
-Paul Vixie         \fIpaul at vix.com\fP
-Mark Weaver        \fIMark_Weaver at brown.edu\fP
-David Wexelblat    \fIdwex at XFree86.org\fP
-Philip Wheatley    \fIPhilip.Wheatley at ColumbiaSC.NCR.COM\fP
-Thomas Wolfram     \fIwolf at prz.tu-berlin.de\fP
-Orest Zborowski    \fIorestz at eskimo.com\fP
-.fi
-.RE
-.PP
-__xservername__ source is available from the FTP server
-\fI<ftp://ftp.x.org/>\fP, and from the X.Org
-server \fI<http://gitweb.freedesktop.org/>\fP.  Documentation and other
-information can be found from the X.Org web site
-\fI<http://www.x.org/>\fP.
-
-.SH LEGAL
-.PP
-.B __xservername__
-is copyright software, provided under licenses that permit modification
-and redistribution in source and binary form without fee.
-.B __xservername__ is copyright by numerous authors and
-contributors from around the world.  Licensing information can be found
-at
-.IR <http://www.x.org> .
-Refer to the source code for specific copyright notices.
-.PP
-.B XFree86(TM)
-is a trademark of The XFree86 Project, Inc.
-.PP
-.B X11(TM)
-and
-.B X Window System(TM)
-are trademarks of The Open Group.
diff --git a/hw/xfree86/doc/man/xorg.conf.man b/hw/xfree86/doc/man/xorg.conf.man
new file mode 100644
index 0000000..e3fd0ea
--- /dev/null
+++ b/hw/xfree86/doc/man/xorg.conf.man
@@ -0,0 +1,2478 @@
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH __xconfigfile__ __filemansuffix__ __vendorversion__
+.SH NAME
+__xconfigfile__ and __xconfigdir__ \- configuration files for
+__xservername__ X server
+.SH INTRODUCTION
+.B __xservername__
+supports several mechanisms for supplying/obtaining configuration and
+run-time parameters: command line options, environment variables, the
+__xconfigfile__ and __xconfigdir__ configuration files, auto-detection,
+and fallback defaults. When the same information is supplied in more
+than one way, the highest precedence mechanism is used. The list of
+mechanisms is ordered from highest precedence to lowest. Note that not
+all parameters can be supplied via all methods. The available command
+line options and environment variables (and some defaults) are
+described in the Xserver(__appmansuffix__) and
+__xservername__(__appmansuffix__) manual pages. Most configuration file
+parameters, with their defaults, are described below. Driver and module
+specific configuration parameters are described in the relevant driver
+or module manual page.
+.SH DESCRIPTION
+.B __xservername__
+uses a configuration file called
+.I __xconfigfile__
+and files ending in the suffix
+.I .conf
+from the directory
+.I __xconfigdir__
+for its initial setup.
+The
+.I __xconfigfile__
+configuration file is searched for in the following places when the
+server is started as a normal user:
+.PP
+.RS 4
+.nf
+.IR /etc/X11/ <cmdline>
+.IR __projectroot__/etc/X11/ <cmdline>
+.IB /etc/X11/ $XORGCONFIG
+.IB __projectroot__/etc/X11/ $XORGCONFIG
+.I /etc/X11/__xconfigfile__
+.I /etc/__xconfigfile__
+.IR __projectroot__/etc/X11/__xconfigfile__. <hostname>
+.I __projectroot__/etc/X11/__xconfigfile__
+.IR __projectroot__/lib/X11/__xconfigfile__. <hostname>
+.I __projectroot__/lib/X11/__xconfigfile__
+.fi
+.RE
+.PP
+where
+.I <cmdline>
+is a relative path (with no \(lq..\(rq components) specified with the
+.B \-config
+command line option,
+.B $XORGCONFIG
+is the relative path (with no \(lq..\(rq components) specified by that
+environment variable, and
+.I <hostname>
+is the machine's hostname as reported by
+.BR gethostname (__libmansuffix__).
+.PP
+When the __xservername__ server is started by the \(lqroot\(rq user, the config file
+search locations are as follows:
+.PP
+.RS 4
+.nf
+<cmdline>
+.IR /etc/X11/ <cmdline>
+.IR __projectroot__/etc/X11/ <cmdline>
+.B $XORGCONFIG
+.IB /etc/X11/ $XORGCONFIG
+.IB __projectroot__/etc/X11/ $XORGCONFIG
+.I /etc/X11/__xconfigfile__
+.I /etc/__xconfigfile__
+.IR __projectroot__/etc/X11/__xconfigfile__. <hostname>
+.I __projectroot__/etc/X11/__xconfigfile__
+.IR __projectroot__/lib/X11/__xconfigfile__. <hostname>
+.I __projectroot__/lib/X11/__xconfigfile__
+.fi
+.RE
+.PP
+where
+.I <cmdline>
+is the path specified with the
+.B \-config
+command line option (which may be absolute or relative),
+.B $XORGCONFIG
+is the path specified by that
+environment variable (absolute or relative),
+.B $HOME
+is the path specified by that environment variable (usually the home
+directory), and
+.I <hostname>
+is the machine's hostname as reported by
+.BR gethostname (__libmansuffix__).
+.PP
+Additional configuration files are searched for in the following
+directories when the server is started as a normal user:
+.PP
+.RS 4
+.nf
+.IR /etc/X11/ <cmdline>
+.IR __sysconfdir__/X11/ <cmdline>
+.I /etc/X11/__xconfigdir__
+.I __sysconfdir__/X11/__xconfigdir__
+.fi
+.RE
+.PP
+where
+.I <cmdline>
+is a relative path (with no \(lq..\(rq components) specified with the
+.B \-configdir
+command line option.
+.PP
+When the __xservername__ server is started by the \(lqroot\(rq user, the
+config directory search locations are as follows:
+.PP
+.RS 4
+.nf
+<cmdline>
+.IR /etc/X11/ <cmdline>
+.IR __sysconfdir__/X11/ <cmdline>
+.I /etc/X11/__xconfigdir__
+.I __sysconfdir__/X11/__xconfigdir__
+.fi
+.RE
+.PP
+where
+.I <cmdline>
+is the path specified with the
+.B \-configdir
+command line option (which may be absolute or relative).
+.PP
+Finally, configuration files will also be searched for in directories
+reserved for system use. These are to separate configuration files from
+the vendor or 3rd party packages from those of local administration.
+These files are found in the following directories:
+.PP
+.RS 4
+.nf
+.I /usr/share/X11/__xconfigdir__
+.I __datadir__/X11/__xconfigdir__
+.fi
+.RE
+.PP
+The
+.I __xconfigfile__
+and
+.I __xconfigdir__
+files are composed of a number of sections which may be present in any order,
+or omitted to use default configuration values.
+Each section has the form:
+.PP
+.RS 4
+.nf
+.BI "Section  \*q" SectionName \*q
+.RI "    " SectionEntry
+    ...
+.B EndSection
+.fi
+.RE
+.PP
+The section names are:
+.PP
+.RS 4
+.nf
+.BR "Files          " "File pathnames"
+.BR "ServerFlags    " "Server flags"
+.BR "Module         " "Dynamic module loading"
+.BR "Extensions     " "Extension enabling"
+.BR "InputDevice    " "Input device description"
+.BR "InputClass     " "Input class description"
+.BR "Device         " "Graphics device description"
+.BR "VideoAdaptor   " "Xv video adaptor description"
+.BR "Monitor        " "Monitor description"
+.BR "Modes          " "Video modes descriptions"
+.BR "Screen         " "Screen configuration"
+.BR "ServerLayout   " "Overall layout"
+.BR "DRI            " "DRI\-specific configuration"
+.BR "Vendor         " "Vendor\-specific configuration"
+.fi
+.RE
+.PP
+The following obsolete section names are still recognised for compatibility
+purposes.
+In new config files, the
+.B InputDevice
+section should be used instead.
+.PP
+.RS 4
+.nf
+.BR "Keyboard       " "Keyboard configuration"
+.BR "Pointer        " "Pointer/mouse configuration"
+.fi
+.RE
+.PP
+The old
+.B XInput
+section is no longer recognised.
+.PP
+The
+.B ServerLayout
+sections are at the highest level.
+They bind together the input and output devices that will be used in a session.
+The input devices are described in the
+.B InputDevice
+sections.
+Output devices usually consist of multiple independent components (e.g.,
+a graphics board and a monitor).
+These multiple components are bound together in the
+.B Screen
+sections, and it is these that are referenced by the
+.B ServerLayout
+section.
+Each
+.B Screen
+section binds together a graphics board and a monitor.
+The graphics boards are described in the
+.B Device
+sections, and the monitors are described in the
+.B Monitor
+sections.
+.PP
+Config file keywords are case\-insensitive, and \(lq_\(rq characters are
+ignored.
+Most strings (including
+.B Option
+names) are also case-insensitive, and insensitive to white space and
+\(lq_\(rq characters.
+.PP
+Each config file entry usually takes up a single line in the file.  They
+consist of a keyword, which is possibly followed by one or more arguments,
+with the number and types of the arguments depending on the keyword.
+The argument types are:
+.PP
+.RS 4
+.nf
+.BR "Integer     " "an integer number in decimal, hex or octal"
+.BR "Real        " "a floating point number"
+.BR "String      " "a string enclosed in double quote marks (\*q)"
+.fi
+.RE
+.PP
+Note: hex integer values must be prefixed with \(lq0x\(rq, and octal values
+with \(lq0\(rq.
+.PP
+A special keyword called
+.B Option
+may be used to provide free\-form data to various components of the server.
+The
+.B Option
+keyword takes either one or two string arguments.
+The first is the option name, and the optional second argument is the
+option value.
+Some commonly used option value types include:
+.PP
+.RS 4
+.nf
+.BR "Integer     " "an integer number in decimal, hex or octal"
+.BR "Real        " "a floating point number"
+.BR "String      " "a sequence of characters"
+.BR "Boolean     " "a boolean value (see below)"
+.BR "Frequency   " "a frequency value (see below)"
+.fi
+.RE
+.PP
+Note that
+.I all
+.B Option
+values, not just strings, must be enclosed in quotes.
+.PP
+Boolean options may optionally have a value specified.
+When no value is specified, the option's value is
+.BR TRUE .
+The following boolean option values are recognised as
+.BR TRUE :
+.PP
+.RS 4
+.BR 1 ,
+.BR on ,
+.BR true ,
+.B yes
+.RE
+.PP
+and the following boolean option values are recognised as
+.BR FALSE :
+.PP
+.RS 4
+.BR 0 ,
+.BR off ,
+.BR false ,
+.B no
+.RE
+.PP
+If an option name is prefixed with
+.RB \*q No \*q,
+then the option value is negated.
+.PP
+Example: the following option entries are equivalent:
+.PP
+.RS 4
+.nf
+.B "Option \*qAccel\*q   \*qOff\*q"
+.B "Option \*qNoAccel\*q"
+.B "Option \*qNoAccel\*q \*qOn\*q"
+.B "Option \*qAccel\*q   \*qfalse\*q"
+.B "Option \*qAccel\*q   \*qno\*q"
+.fi
+.RE
+.PP
+Frequency option values consist of a real number that is optionally
+followed by one of the following frequency units:
+.PP
+.RS 4
+.BR Hz ,
+.BR k ,
+.BR kHz ,
+.BR M ,
+.B MHz
+.RE
+.PP
+When the unit name is omitted, the correct units will be determined from
+the value and the expectations of the appropriate range of the value.
+It is recommended that the units always be specified when using frequency
+option values to avoid any errors in determining the value.
+.SH "FILES SECTION"
+The
+.B Files
+section is used to specify some path names required by the server.
+Some of these paths can also be set from the command line (see
+.BR Xserver (__appmansuffix__)
+and
+.BR __xservername__ (__appmansuffix__)).
+The command line settings override the values specified in the config
+file.
+The
+.B Files
+section is optional, as are all of the entries that may appear in it.
+.PP
+The entries that can appear in this section are:
+.TP 7
+.BI "FontPath \*q" path \*q
+sets the search path for fonts.
+This path is a comma separated list of font path elements which the __xservername__
+server searches for font databases.
+Multiple
+.B FontPath
+entries may be specified, and they will be concatenated to build up the
+fontpath used by the server.  Font path elements can be absolute
+directory paths, catalogue directories or a font server identifier. The
+formats of the later two are explained below:
+.PP
+.RS 7
+Catalogue directories:
+.PP
+.RS 4
+Catalogue directories can be specified using the prefix \fBcatalogue:\fR
+before the directory name. The directory can then be populated with
+symlinks pointing to the real font directories, using the following
+syntax in the symlink name:
+.PP
+.RS 4
+.IR <identifier> : [attribute]: pri= <priority>
+.RE
+.PP
+where
+.I <identifier>
+is an alphanumeric identifier,
+.I [attribute]
+is an attribute which will be passed to the underlying FPE and
+.I <priority>
+is a number used to order the fontfile FPEs. Examples:
+.PP
+.RS 4
+.nf
+.I 75dpi:unscaled:pri=20  -> /usr/share/X11/fonts/75dpi
+.I gscript:pri=60 -> /usr/share/fonts/default/ghostscript
+.I misc:unscaled:pri=10 \-> /usr/share/X11/fonts/misc
+.fi
+.PP
+.RE .RE .RE
+.PP
+.RS 7
+Font server identifiers:
+.PP
+.RS 4
+Font server identifiers have the form:
+.RS 4
+.PP
+.IR <trans> / <hostname> : <port\-number>
+.RE
+.PP
+where
+.I <trans>
+is the transport type to use to connect to the font server (e.g.,
+.B unix
+for UNIX\-domain sockets or
+.B tcp
+for a TCP/IP connection),
+.I <hostname>
+is the hostname of the machine running the font server, and
+.I <port\-number>
+is the port number that the font server is listening on (usually 7100).
+.RE
+.PP
+When this entry is not specified in the config file, the server falls back
+to the compiled\-in default font path, which contains the following
+font path elements (which can be set inside a catalogue directory):
+.PP
+.RS 4
+.nf
+.I __datadir__/fonts/X11/misc/
+.I __datadir__/fonts/X11/TTF/
+.I __datadir__/fonts/X11/OTF/
+.I __datadir__/fonts/X11/Type1/
+.I __datadir__/fonts/X11/100dpi/
+.I __datadir__/fonts/X11/75dpi/
+.fi
+.RE
+.PP
+Font path elements that are found to be invalid are removed from the
+font path when the server starts up.
+.RE
+.TP 7
+.BI "ModulePath \*q" path \*q
+sets the search path for loadable __xservername__ server modules.
+This path is a comma separated list of directories which the __xservername__ server
+searches for loadable modules loading in the order specified.
+Multiple
+.B ModulePath
+entries may be specified, and they will be concatenated to build the
+module search path used by the server.  The default module path is
+.PP
+.RS 11
+__modulepath__
+.RE
+.\" The LogFile keyword is not currently implemented
+.ig
+.TP 7
+.BI "LogFile \*q" path \*q
+sets the name of the __xservername__ server log file.
+The default log file name is
+.PP
+.RS 11
+.RI __logdir__/__xservername__. <n> .log
+.RE
+.PP
+.RS 7
+where
+.I <n>
+is the display number for the __xservername__ server.
+..
+.TP 7
+.BI "XkbDir \*q" path \*q
+sets the base directory for keyboard layout files.  The
+.B \-xkbdir
+command line option can be used to override this.  The default directory is
+.PP
+.RS 11
+__xkbdir__
+.RE
+.SH "SERVERFLAGS SECTION"
+In addition to options specific to this section (described below), the
+.B ServerFlags
+section is used to specify some global
+__xservername__ server options.
+All of the entries in this section are
+.BR Options ,
+although for compatibility purposes some of the old style entries are
+still recognised.
+Those old style entries are not documented here, and using them is
+discouraged.
+The
+.B ServerFlags
+section is optional, as are the entries that may be specified in it.
+.PP
+.B Options
+specified in this section (with the exception of the
+.B \*qDefaultServerLayout\*q
+.BR Option )
+may be overridden by
+.B Options
+specified in the active
+.B ServerLayout
+section.
+Options with command line equivalents are overridden when their command
+line equivalent is used.
+The options recognised by this section are:
+.TP 7
+.BI "Option \*qDefaultServerLayout\*q  \*q" layout\-id \*q
+This specifies the default
+.B ServerLayout
+section to use in the absence of the
+.B \-layout
+command line option.
+.TP 7
+.BI "Option \*qNoTrapSignals\*q  \*q" boolean \*q
+This prevents the __xservername__ server from trapping a range of unexpected fatal
+signals and exiting cleanly.
+Instead, the __xservername__ server will die and drop core where the fault occurred.
+The default behaviour is for the __xservername__ server to exit cleanly, but still drop a
+core file.
+In general you never want to use this option unless you are debugging an __xservername__
+server problem and know how to deal with the consequences.
+.TP 7
+.BI "Option \*qUseSIGIO\*q  \*q" boolean \*q
+This controls whether the __xservername__ server requests that events from
+input devices be reported via a SIGIO signal handler (also known as SIGPOLL
+on some platforms), or only reported via the standard select(3) loop.
+The default behaviour is platform specific.   In general you do not want to
+use this option unless you are debugging the __xservername__ server, or
+working around a specific bug until it is fixed, and understand the
+consequences.
+.TP 7
+.BI "Option \*qDontVTSwitch\*q  \*q" boolean \*q
+This disallows the use of the
+.BI Ctrl+Alt+F n
+sequence (where
+.RI F n
+refers to one of the numbered function keys).
+That sequence is normally used to switch to another \*qvirtual terminal\*q
+on operating systems that have this feature.
+When this option is enabled, that key sequence has no special meaning and
+is passed to clients.
+Default: off.
+.TP 7
+.BI "Option \*qDontZap\*q  \*q" boolean \*q
+This disallows the use of the
+.B Terminate_Server
+XKB action (usually on Ctrl+Alt+Backspace, depending on XKB options).
+This action is normally used to terminate the __xservername__ server.
+When this option is enabled, the action has no effect.
+Default: off.
+.TP 7
+.BI "Option \*qDontZoom\*q  \*q" boolean \*q
+This disallows the use of the
+.B Ctrl+Alt+Keypad\-Plus
+and
+.B Ctrl+Alt+Keypad\-Minus
+sequences.
+These sequences allows you to switch between video modes.
+When this option is enabled, those key sequences have no special meaning
+and are passed to clients.
+Default: off.
+.TP 7
+.BI "Option \*qDisableVidModeExtension\*q  \*q" boolean \*q
+This disables the parts of the VidMode extension used by the xvidtune client
+that can be used to change the video modes.
+Default: the VidMode extension is enabled.
+.TP 7
+.BI "Option \*qAllowNonLocalXvidtune\*q  \*q" boolean \*q
+This allows the xvidtune client (and other clients that use the VidMode
+extension) to connect from another host.
+Default: off.
+.TP 7
+.BI "Option \*qAllowMouseOpenFail\*q  \*q" boolean \*q
+This tells the mousedrv(__drivermansuffix__) and vmmouse(__drivermansuffix__)
+drivers to not report failure if the mouse device can't be opened/initialised.
+It has no effect on the evdev(__drivermansuffix__) or other drivers.
+Default: false.
+.TP 7
+.BI "Option \*qVTSysReq\*q  \*q" boolean \*q
+enables the SYSV\-style VT switch sequence for non\-SYSV systems
+which support VT switching.
+This sequence is
+.B Alt\-SysRq
+followed by a function key
+.RB ( Fn ).
+This prevents the __xservername__ server trapping the
+keys used for the default VT switch sequence, which means that clients can
+access them.
+Default: off.
+.TP 7
+.BI "Option \*qBlankTime\*q  \*q" time \*q
+sets the inactivity timeout for the
+.B blank
+phase of the screensaver.
+.I time
+is in minutes.
+This is equivalent to the __xservername__ server's
+.B \-s
+flag, and the value can be changed at run\-time with
+.BR xset(__appmansuffix__).
+Default: 10 minutes.
+.TP 7
+.BI "Option \*qStandbyTime\*q  \*q" time \*q
+sets the inactivity timeout for the
+.B standby
+phase of DPMS mode.
+.I time
+is in minutes, and the value can be changed at run\-time with
+.BR xset(__appmansuffix__).
+Default: 10 minutes.
+This is only suitable for VESA DPMS compatible monitors, and may not be
+supported by all video drivers.
+It is only enabled for screens that have the
+.B \*qDPMS\*q
+option set (see the MONITOR section below).
+.TP 7
+.BI "Option \*qSuspendTime\*q  \*q" time \*q
+sets the inactivity timeout for the
+.B suspend
+phase of DPMS mode.
+.I time
+is in minutes, and the value can be changed at run\-time with
+.BR xset(__appmansuffix__).
+Default: 10 minutes.
+This is only suitable for VESA DPMS compatible monitors, and may not be
+supported by all video drivers.
+It is only enabled for screens that have the
+.B \*qDPMS\*q
+option set (see the MONITOR section below).
+.TP 7
+.BI "Option \*qOffTime\*q  \*q" time \*q
+sets the inactivity timeout for the
+.B off
+phase of DPMS mode.
+.I time
+is in minutes, and the value can be changed at run\-time with
+.BR xset(__appmansuffix__).
+Default: 10 minutes.
+This is only suitable for VESA DPMS compatible monitors, and may not be
+supported by all video drivers.
+It is only enabled for screens that have the
+.B \*qDPMS\*q
+option set (see the MONITOR section below).
+.TP 7
+.BI "Option \*qPixmap\*q  \*q" bpp \*q
+This sets the pixmap format to use for depth 24.
+Allowed values for
+.I bpp
+are 24 and 32.
+Default: 32 unless driver constraints don't allow this (which is rare).
+Note: some clients don't behave well when this value is set to 24.
+.TP 7
+.BI "Option \*qPC98\*q  \*q" boolean \*q
+Specify that the machine is a Japanese PC\-98 machine.
+This should not be enabled for anything other than the Japanese\-specific
+PC\-98 architecture.
+Default: auto\-detected.
+.TP 7
+.BI "Option \*qNoPM\*q  \*q" boolean \*q
+Disables something to do with power management events.
+Default: PM enabled on platforms that support it.
+.TP 7
+.BI "Option \*qXinerama\*q  \*q" boolean \*q
+enable or disable XINERAMA extension.
+Default is disabled.
+.TP 7
+.BI "Option \*qAIGLX\*q \*q" boolean \*q
+enable or disable AIGLX. AIGLX is enabled by default.
+.TP 7
+.BI "Option \*qDRI2\*q \*q" boolean \*q
+enable or disable DRI2. DRI2 is disabled by default.
+.TP 7
+.BI "Option \*qGlxVisuals\*q \*q" string \*q
+This option controls how many GLX visuals the GLX modules sets up.
+The default value is
+.BR "typical" ,
+which will setup up a typical subset of
+the GLXFBConfigs provided by the driver as GLX visuals.  Other options are
+.BR "minimal" ,
+which will set up the minimal set allowed by the GLX specification and
+.BR "all"
+which will setup GLX visuals for all GLXFBConfigs.
+.TP 7
+.BI "Option \*qUseDefaultFontPath\*q \*q" boolean \*q
+Include the default font path even if other paths are specified in
+xorg.conf. If enabled, other font paths are included as well. Enabled by
+default.
+.TP 7
+.BI "Option \*qIgnoreABI\*q \*q" boolean \*q
+Allow modules built for a different, potentially incompatible version of
+the X server to load. Disabled by default.
+.TP 7
+.BI "Option \*qAutoAddDevices\*q \*q" boolean \*q
+If this option is disabled, then no devices will be added from HAL events.
+Enabled by default.
+.TP 7
+.BI "Option \*qAutoEnableDevices\*q \*q" boolean \*q
+If this option is disabled, then the devices will be added (and the
+DevicePresenceNotify event sent), but not enabled, thus leaving policy up
+to the client.
+Enabled by default.
+.TP 7
+.BI "Option \*qLog\*q \*q" string \*q
+This option controls whether the log is flushed and/or synced to disk after
+each message.
+Possible values are
+.B flush
+or
+.BR sync .
+Unset by default.
+.SH "MODULE SECTION"
+The
+.B Module
+section is used to specify which __xservername__ server modules should be loaded.
+This section is ignored when the __xservername__ server is built in static form.
+The type of modules normally loaded in this section are __xservername__ server
+extension modules.
+Most other module types are loaded automatically when they are needed via
+other mechanisms.
+The
+.B Module
+section is optional, as are all of the entries that may be specified in
+it.
+.PP
+Entries in this section may be in two forms.
+The first and most commonly used form is an entry that uses the
+.B Load
+keyword, as described here:
+.TP 7
+.BI "Load  \*q" modulename \*q
+This instructs the server to load the module called
+.IR modulename .
+The module name given should be the module's standard name, not the
+module file name.
+The standard name is case\-sensitive, and does not include the \(lqlib\(rq
+prefix, or the \(lq.a\(rq, \(lq.o\(rq, or \(lq.so\(rq suffixes.
+.PP
+.RS 7
+Example: the DRI extension module can be loaded with the following entry:
+.PP
+.RS 4
+.B "Load \*qdri\*q"
+.RE
+.RE
+.TP 7
+.BI "Disable  \*q" modulename \*q
+This instructs the server to not load the module called
+.IR modulename .
+Some modules are loaded by default in the server, and this overrides that
+default. If a
+.B Load
+instruction is given for the same module, it overrides the
+.B Disable
+instruction and the module is loaded. The module name given should be the
+module's standard name, not the module file name. As with the
+.B Load
+instruction, the standard name is case-sensitive, and does not include the
+"lib" prefix, or the ".a", ".o", or ".so" suffixes.
+.PP
+The second form of entry is a
+.BR SubSection,
+with the subsection name being the module name, and the contents of the
+.B SubSection
+being
+.B Options
+that are passed to the module when it is loaded.
+.PP
+Example: the extmod module (which contains a miscellaneous group of
+server extensions) can be loaded, with the XFree86\-DGA extension
+disabled by using the following entry:
+.PP
+.RS 4
+.nf
+.B "SubSection \*qextmod\*q"
+.B "   Option  \*qomit XFree86\-DGA\*q"
+.B EndSubSection
+.fi
+.RE
+.PP
+Modules are searched for in each directory specified in the
+.B ModulePath
+search path, and in the drivers, extensions, input, internal, and
+multimedia subdirectories of each of those directories.
+In addition to this, operating system specific subdirectories of all
+the above are searched first if they exist.
+.PP
+To see what extension modules are available, check the extensions
+subdirectory under:
+.PP
+.RS 4
+.nf
+__modulepath__
+.fi
+.RE
+.PP
+The \(lqextmod\(rq, \(lqdbe\(rq, \(lqdri\(rq, \(lqdri2\(rq, \(lqglx\(rq,
+and \(lqrecord\(rq extension modules are loaded automatically, if they
+are present, unless disabled with \*qDisable\*q entries.
+It is recommended
+that at very least the \(lqextmod\(rq extension module be loaded.
+If it isn't, some commonly used server extensions (like the SHAPE
+extension) will not be available.
+.SH "EXTENSIONS SECTION"
+The
+.B Extensions
+section is used to specify which X11 protocol extensions should be enabled
+or disabled.
+The
+.B Extensions
+section is optional, as are all of the entries that may be specified in
+it.
+.PP
+Entries in this section are listed as Option statements with the name of
+the extension as the first argument, and a boolean value as the second.
+The extension name is case\-sensitive, and matches the form shown in the output
+of \*qXorg -extension ?\*q.
+.PP
+.RS 7
+Example: the MIT-SHM extension can be disabled with the following entry:
+.PP
+.RS 4
+.nf
+.B "Section \*qExtensions\*q"
+.B "    Option \*qMIT-SHM\*q \*qDisable\*q"
+.B "EndSection"
+.fi
+.RE
+.RE
+.SH "INPUTDEVICE SECTION"
+The config file may have multiple
+.B InputDevice
+sections.
+Recent X servers employ input hotplugging to add input devices, with the HAL
+backend being the default backend for X servers since 1.4. It is usually not
+necessary to provide
+.B InputDevice
+sections in the xorg.conf if hotplugging is enabled.
+.PP
+If hotplugging is disabled, there will normally
+be at least two: one for the core (primary) keyboard
+and one for the core pointer.
+If either of these two is missing, a default configuration for the missing
+ones will be used. In the absence of an explicitly specified core input
+device, the first
+.B InputDevice
+marked as
+.B CorePointer
+(or
+.BR CoreKeyboard )
+is used.
+If there is no match there, the first
+.B InputDevice
+that uses the \(lqmouse\(rq (or \(lqkbd\(rq) driver is used.
+The final fallback is to use built\-in default configurations.
+Currently the default configuration may not work as expected on all platforms.
+.PP
+.B InputDevice
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B  "Section \*qInputDevice\*q"
+.BI "    Identifier \*q" name \*q
+.BI "    Driver     \*q" inputdriver \*q
+.I  "    options"
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+and
+.B Driver
+entries are required in all
+.B InputDevice
+sections.
+All other entries are optional.
+.PP
+The
+.B Identifier
+entry specifies the unique name for this input device.
+The
+.B Driver
+entry specifies the name of the driver to use for this input device.
+When using the loadable server, the input driver module
+.RI \*q inputdriver \*q
+will be loaded for each active
+.B InputDevice
+section.
+An
+.B InputDevice
+section is considered active if it is referenced by an active
+.B ServerLayout
+section, if it is referenced by the
+.B \-keyboard
+or
+.B \-pointer
+command line options, or if it is selected implicitly as the core pointer
+or keyboard device in the absence of such explicit references.
+The most commonly used input drivers are
+.BR evdev (__drivermansuffix__)
+on Linux systems, and
+.BR kbd (__drivermansuffix__)
+and
+.BR mousedrv (__drivermansuffix__)
+on other platforms.
+.PP
+.PP
+.B InputDevice
+sections recognise some driver\-independent
+.BR Options ,
+which are described here.
+See the individual input driver manual pages for a description of the
+device\-specific options.
+.TP 7
+.BI "Option \*qAutoServerLayout\*q  \*q" boolean \*q
+Always add the device to the ServerLayout section used by this instance of
+the server. This affects implied layouts as well as explicit layouts
+specified in the configuration and/or on the command line.
+.TP 7
+.BI "Option \*qCorePointer\*q"
+Deprecated, see
+.B Floating
+.TP 7
+.BI "Option \*qCoreKeyboard\*q"
+Deprecated, see
+.B Floating
+.TP 7
+.BI "Option \*qAlwaysCore\*q  \*q" boolean \*q
+Deprecated, see
+.B Floating
+.TP 7
+.BI "Option \*qSendCoreEvents\*q  \*q" boolean \*q
+Deprecated, see
+.B Floating
+
+.TP 7
+.BI "Option \*qFloating\*q  \*q" boolean \*q
+When enabled, the input device is set up floating and does not
+report events through any master device or control a cursor. The device is
+only available to clients using the X Input Extension API. This option is
+disabled by default.
+The options
+.B CorePointer,
+.B CoreKeyboard,
+.B AlwaysCore,
+and
+.B SendCoreEvents,
+are the inverse of option
+.B Floating
+(i.e.
+.B SendCoreEvents \*qon\*q
+is equivalent to
+.B Floating \*qoff\*q
+).
+
+This option controls the startup behavior only, a device
+may be reattached or set floating at runtime.
+.PP
+For pointing devices, the following options control how the pointer
+is accelerated or decelerated with respect to physical device motion. Most of
+these can be adjusted at runtime, see the xinput(1) man page for details. Only
+the most important acceleration options are discussed here.
+.TP 7
+.BI "Option \*qAccelerationProfile\*q  \*q" integer \*q
+Select the profile. In layman's terms, the profile constitutes the "feeling" of
+the acceleration. More formally, it defines how the transfer function (actual
+acceleration as a function of current device velocity and acceleration controls)
+is constructed. This is mainly a matter of personal preference.
+.PP
+.RS 6
+.nf
+.B  " 0      classic (mostly compatible)"
+.B  "-1      none (only constant deceleration is applied)"
+.B  " 1      device-dependent"
+.B  " 2      polynomial (polynomial function)"
+.B  " 3      smooth linear (soft knee, then linear)"
+.B  " 4      simple (normal when slow, otherwise accelerated)"
+.B  " 5      power (power function)"
+.B  " 6      linear (more speed, more acceleration)"
+.B  " 7      limited (like linear, but maxes out at threshold)"
+.fi
+.RE
+.TP 7
+.BI "Option \*qConstantDeceleration\*q  \*q" real \*q
+Makes the pointer go
+.B deceleration
+times slower than normal. Most useful for high-resolution devices.
+.TP 7
+.BI "Option \*qAdaptiveDeceleration\*q  \*q" real \*q
+Allows to actually decelerate the pointer when going slow. At most, it will be
+.B adaptive deceleration
+times slower. Enables precise pointer placement without sacrificing speed.
+.TP 7
+.BI "Option \*qAccelerationScheme\*q  \*q" string \*q
+Selects the scheme, which is the underlying algorithm.
+.PP
+.RS 7
+.nf
+.B  "predictable   default algorithm (behaving more predictable)"
+.B  "lightweight   old acceleration code (as specified in the X protocol spec)"
+.B  "none          no acceleration or deceleration"
+.fi
+.RE
+.TP 7
+.BI "Option \*qAccelerationNumerator\*q  \*q" integer \*q
+.TP 7
+.BI "Option \*qAccelerationDenominator\*q  \*q" integer \*q
+Set numerator and denominator of the acceleration factor. The acceleration
+factor is a rational which, together with threshold, can be used to tweak
+profiles to suit the users needs. The
+.B simple
+and
+.B limited
+profiles use it directly (i.e. they accelerate by the factor), for other
+profiles it should hold that a higher acceleration factor leads to a faster
+pointer. Typically, 1 is unaccelerated and values up to 5 are sensible.
+.TP 7
+.BI "Option \*qAccelerationThreshold\*q  \*q" integer \*q
+Set the threshold, which is roughly the velocity (usually device units per 10
+ms) required for acceleration to become effective. The precise effect varies
+with the profile however.
+
+.SH "INPUTCLASS SECTION"
+The config file may have multiple
+.B InputClass
+sections.
+These sections are optional and are used to provide configuration for a
+class of input devices as they are automatically added. An input device can
+match more than one
+.B InputClass
+section. Each class can override settings from a previous class, so it is
+best to arrange the sections with the most generic matches first.
+.PP
+.B InputClass
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B  "Section \*qInputClass\*q"
+.BI "    Identifier  \*q" name \*q
+.I  "    entries"
+.I  "    ..."
+.I  "    options"
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+entry is required in all
+.B InputClass
+sections.
+All other entries are optional.
+.PP
+The
+.B Identifier
+entry specifies the unique name for this input class.
+The
+.B Driver
+entry specifies the name of the driver to use for this input device.
+After all classes have been examined, the
+.RI \*q inputdriver \*q
+module from the first
+.B Driver
+entry will be enabled when using the loadable server.
+.PP
+When an input device is automatically added, its characteristics are
+checked against all
+.B InputClass
+sections. Each section can contain optional entries to narrow the match
+of the class. If none of the optional entries appear, the
+.B InputClass
+section is generic and will match any input device. If more than one of
+these entries appear, they all must match for the configuration to apply.
+.PP
+There are two types of match entries used in
+.B InputClass
+sections. The first allows various tokens to be matched against attributes
+of the device. An entry can be constructed to match attributes from different
+devices by separating arguments with a '|' character. Multiple entries of the
+same type may be supplied to add multiple matching conditions on the same
+attribute. For example:
+.PP
+.RS 4
+.nf
+.B  "Section \*qInputClass\*q"
+.B  "    Identifier   \*qMy Class\*q"
+.B  "    # product string must contain example and
+.B  "    # either gizmo or gadget
+.B  "    MatchProduct \*qexample\*q
+.B  "    MatchProduct \*qgizmo|gadget\*q
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.TP 7
+.BI "MatchProduct  \*q" matchproduct \*q
+This entry can be used to check if the substring
+.RI \*q matchproduct \*q
+occurs in the device's product name.
+.TP 7
+.BI "MatchVendor  \*q" matchvendor \*q
+This entry can be used to check if the substring
+.RI \*q matchvendor \*q
+occurs in the device's vendor name.
+.TP 7
+.BI "MatchDevicePath \*q" matchdevice \*q
+This entry can be used to check if the device file matches the
+.RI \*q matchdevice \*q
+pathname pattern.
+.TP 7
+.BI "MatchOS \*q" matchos \*q
+This entry can be used to check if the operating system matches the
+case-insensitive
+.RI \*q matchos \*q
+string. This entry is only supported on platforms providing the
+.BR uname (2)
+system call.
+.TP 7
+.BI "MatchPnPID \*q" matchpnp \*q
+The device's Plug and Play (PnP) ID can be checked against the
+.RI \*q matchpnp \*q
+shell wildcard pattern.
+.TP 7
+.BI "MatchUSBID \*q" matchusb \*q
+The device's USB ID can be checked against the
+.RI \*q matchusb \*q
+shell wildcard pattern. The ID is constructed as lowercase hexadecimal numbers
+separated by a ':'. This is the same format as the
+.BR lsusb (8)
+program.
+.TP 7
+.BI "MatchDriver \*q" matchdriver \*q
+Check the case-sensitive string
+.RI \*q matchdriver \*q
+against the currently configured driver of the device. Ordering of sections
+using this entry is important since it will not match unless the driver has
+been set by the config backend or a previous
+.B InputClass
+section.
+.TP 7
+.BI "MatchTag \*q" matchtag \*q
+This entry can be used to check if tags assigned by the config backend
+matches the
+.RI \*q matchtag \*q
+pattern. A match is found if at least one of the tags given in
+.RI \*q matchtag \*q
+matches at least one of the tags assigned by the backend.
+.PP
+The second type of entry is used to match device types. These entries take a
+boolean argument similar to
+.B Option
+entries.
+.TP 7
+.BI "MatchIsKeyboard     \*q" bool \*q
+.TP 7
+.BI "MatchIsPointer      \*q" bool \*q
+.TP 7
+.BI "MatchIsJoystick     \*q" bool \*q
+.TP 7
+.BI "MatchIsTablet       \*q" bool \*q
+.TP 7
+.BI "MatchIsTouchpad     \*q" bool \*q
+.TP 7
+.BI "MatchIsTouchscreen  \*q" bool \*q
+.PP
+When an input device has been matched to the
+.B InputClass
+section, any
+.B Option
+entries are applied to the device. One
+.B InputClass
+specific
+.B Option
+is recognized. See the
+.B InputDevice
+section above for a description of the remaining
+.B Option
+entries.
+.TP 7
+.BI "Option \*qIgnore\*q \*q" boolean \*q
+This optional entry specifies that the device should be ignored entirely,
+and not added to the server. This can be useful when the device is handled
+by another program and no X events should be generated.
+.SH "DEVICE SECTION"
+The config file may have multiple
+.B Device
+sections.
+There must be at least one, for the video card being used.
+.PP
+.B Device
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B  "Section \*qDevice\*q"
+.BI "    Identifier \*q" name \*q
+.BI "    Driver     \*q" driver \*q
+.I  "    entries"
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+and
+.B Driver
+entries are required in all
+.B Device
+sections.  All other entries are optional.
+.PP
+The
+.B Identifier
+entry specifies the unique name for this graphics device.
+The
+.B Driver
+entry specifies the name of the driver to use for this graphics device.
+When using the loadable server, the driver module
+.RI \*q driver \*q
+will be loaded for each active
+.B Device
+section.
+A
+.B Device
+section is considered active if it is referenced by an active
+.B Screen
+section.
+.PP
+.B Device
+sections recognise some driver\-independent entries and
+.BR Options ,
+which are described here.
+Not all drivers make use of these
+driver\-independent entries, and many of those that do don't require them
+to be specified because the information is auto\-detected.
+See the individual graphics driver manual pages for further information
+about this, and for a description of the device\-specific options.
+Note that most of the
+.B Options
+listed here (but not the other entries) may be specified in the
+.B Screen
+section instead of here in the
+.B Device
+section.
+.TP 7
+.BI "BusID  \*q" bus\-id \*q
+This specifies the bus location of the graphics card.
+For PCI/AGP cards,
+the
+.I bus\-id
+string has the form
+.BI PCI: bus : device : function
+(e.g., \(lqPCI:1:0:0\(rq might be appropriate for an AGP card).
+This field is usually optional in single-head configurations when using
+the primary graphics card.
+In multi-head configurations, or when using a secondary graphics card in a
+single-head configuration, this entry is mandatory.
+Its main purpose is to make an unambiguous connection between the device
+section and the hardware it is representing.
+This information can usually be found by running the pciaccess tool
+scanpci.
+.TP 7
+.BI "Screen  " number
+This option is mandatory for cards where a single PCI entity can drive more
+than one display (i.e., multiple CRTCs sharing a single graphics accelerator
+and video memory).
+One
+.B Device
+section is required for each head, and this
+parameter determines which head each of the
+.B Device
+sections applies to.
+The legal values of
+.I number
+range from 0 to one less than the total number of heads per entity.
+Most drivers require that the primary screen (0) be present.
+.TP 7
+.BI "Chipset  \*q" chipset \*q
+This usually optional entry specifies the chipset used on the graphics
+board.
+In most cases this entry is not required because the drivers will probe the
+hardware to determine the chipset type.
+Don't specify it unless the driver-specific documentation recommends that you
+do.
+.TP 7
+.BI "Ramdac  \*q" ramdac\-type \*q
+This optional entry specifies the type of RAMDAC used on the graphics
+board.
+This is only used by a few of the drivers, and in most cases it is not
+required because the drivers will probe the hardware to determine the
+RAMDAC type where possible.
+Don't specify it unless the driver-specific documentation recommends that you
+do.
+.TP 7
+.BI "DacSpeed  " speed
+.TP 7
+.BI "DacSpeed  " "speed\-8 speed\-16 speed\-24 speed\-32"
+This optional entry specifies the RAMDAC speed rating (which is usually
+printed on the RAMDAC chip).
+The speed is in MHz.
+When one value is given, it applies to all framebuffer pixel sizes.
+When multiple values are given, they apply to the framebuffer pixel sizes
+8, 16, 24 and 32 respectively.
+This is not used by many drivers, and only needs to be specified when the
+speed rating of the RAMDAC is different from the defaults built in to
+driver, or when the driver can't auto-detect the correct defaults.
+Don't specify it unless the driver-specific documentation recommends that you
+do.
+.TP 7
+.BI "Clocks  " "clock ..."
+specifies the pixel that are on your graphics board.
+The clocks are in MHz, and may be specified as a floating point number.
+The value is stored internally to the nearest kHz.
+The ordering of the clocks is important.
+It must match the order in which they are selected on the graphics board.
+Multiple
+.B Clocks
+lines may be specified, and each is concatenated to form the list.
+Most drivers do not use this entry, and it is only required for some older
+boards with non-programmable clocks.
+Don't specify this entry unless the driver-specific documentation explicitly
+recommends that you do.
+.TP
+.BI "ClockChip  \*q" clockchip\-type \*q
+This optional entry is used to specify the clock chip type on graphics
+boards which have a programmable clock generator.
+Only a few __xservername__ drivers support programmable clock chips.
+For details, see the appropriate driver manual page.
+.TP 7
+.BI "VideoRam  " "mem"
+This optional entry specifies the amount of video ram that is installed
+on the graphics board.
+This is measured in kBytes.
+In most cases this is not required because the __xservername__ server probes
+the graphics board to determine this quantity.
+The driver-specific documentation should indicate when it might be needed.
+.TP 7
+.BI "BiosBase  " "baseaddress"
+This optional entry specifies the base address of the video BIOS for
+the VGA board.
+This address is normally auto-detected, and should only be specified if the
+driver-specific documentation recommends it.
+.TP 7
+.BI "MemBase  " "baseaddress"
+This optional entry specifies the memory base address of a graphics
+board's linear frame buffer.
+This entry is not used by many drivers, and it should only be specified if
+the driver-specific documentation recommends it.
+.TP 7
+.BI "IOBase  " "baseaddress"
+This optional entry specifies the IO base address.
+This entry is not used by many drivers, and it should only be specified if
+the driver-specific documentation recommends it.
+.TP 7
+.BI "ChipID  " "id"
+This optional entry specifies a numerical ID representing the chip type.
+For PCI cards, it is usually the device ID.
+This can be used to override the auto-detection, but that should only be done
+when the driver-specific documentation recommends it.
+.TP 7
+.BI "ChipRev  " "rev"
+This optional entry specifies the chip revision number.
+This can be used to override the auto-detection, but that should only be done
+when the driver-specific documentation recommends it.
+.TP 7
+.BI "TextClockFreq  " "freq"
+This optional entry specifies the pixel clock frequency that is used
+for the regular text mode.
+The frequency is specified in MHz.
+This is rarely used.
+.TP 7
+.BI "Option \*qModeDebug\*q \*q" boolean \*q
+Enable printing of additional debugging information about modesetting to
+the server log.
+.ig
+.TP 7
+This optional entry allows an IRQ number to be specified.
+..
+.TP 7
+.B Options
+Option flags may be specified in the
+.B Device
+sections.
+These include driver\-specific options and driver\-independent options.
+The former are described in the driver\-specific documentation.
+Some of the latter are described below in the section about the
+.B Screen
+section, and they may also be included here.
+
+.SH "VIDEOADAPTOR SECTION"
+Nobody wants to say how this works.
+Maybe nobody knows ...
+
+.SH "MONITOR SECTION"
+The config file may have multiple
+.B Monitor
+sections.
+There should normally be at least one, for the monitor being used,
+but a default configuration will be created when one isn't specified.
+.PP
+.B Monitor
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B  "Section \*qMonitor\*q"
+.BI "    Identifier \*q" name \*q
+.I  "    entries"
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.PP
+The only mandatory entry in a
+.B Monitor
+section is the
+.B Identifier
+entry.
+.PP
+The
+.B Identifier
+entry specifies the unique name for this monitor.
+The
+.B Monitor
+section may be used to provide information about the specifications of the
+monitor, monitor-specific
+.BR Options ,
+and information about the video modes to use with the monitor.
+.PP
+With RandR 1.2-enabled drivers, monitor sections may be tied to specific
+outputs of the video card.  Using the name of the output defined by the video
+driver plus the identifier of a monitor section, one associates a monitor
+section with an output by adding an option to the Device section in the
+following format:
+
+.B Option \*qMonitor-outputname\*q \*qmonitorsection\*q
+
+(for example,
+.B Option \*qMonitor-VGA\*q \*qVGA monitor\*q
+for a VGA output)
+.PP
+In the absence of specific association of monitor sections to outputs, if a
+monitor section is present the server will associate it with an output to
+preserve compatibility for previous single-head configurations.
+.PP
+Specifying video modes is optional because the server will use the DDC or other
+information provided by the monitor to automatically configure the list of
+modes available.
+When modes are specified explicitly in the
+.B Monitor
+section (with the
+.BR Modes ,
+.BR ModeLine ,
+or
+.B UseModes
+keywords), built-in modes with the same names are not included.
+Built-in modes with different names are, however, still implicitly included,
+when they meet the requirements of the monitor.
+.PP
+The entries that may be used in
+.B Monitor
+sections are described below.
+.TP 7
+.BI "VendorName  \*q" vendor \*q
+This optional entry specifies the monitor's manufacturer.
+.TP 7
+.BI "ModelName  \*q" model \*q
+This optional entry specifies the monitor's model.
+.TP 7
+.BI "HorizSync  " "horizsync\-range"
+gives the range(s) of horizontal sync frequencies supported by the
+monitor.
+.I horizsync\-range
+may be a comma separated list of either discrete values or ranges of
+values.
+A range of values is two values separated by a dash.
+By default the values are in units of kHz.
+They may be specified in MHz or Hz
+if
+.B MHz
+or
+.B Hz
+is added to the end of the line.
+The data given here is used by the __xservername__ server to determine if video
+modes are within the specifications of the monitor.
+This information should be available in the monitor's handbook.
+If this entry is omitted, a default range of 28\-33kHz is used.
+.TP 7
+.BI "VertRefresh  " "vertrefresh\-range"
+gives the range(s) of vertical refresh frequencies supported by the
+monitor.
+.I vertrefresh\-range
+may be a comma separated list of either discrete values or ranges of
+values.
+A range of values is two values separated by a dash.
+By default the values are in units of Hz.
+They may be specified in MHz or kHz
+if
+.B MHz
+or
+.B kHz
+is added to the end of the line.
+The data given here is used by the __xservername__ server to determine if video
+modes are within the specifications of the monitor.
+This information should be available in the monitor's handbook.
+If this entry is omitted, a default range of 43\-72Hz is used.
+.TP 7
+.BI "DisplaySize  " "width height"
+This optional entry gives the width and height, in millimetres, of the
+picture area of the monitor.
+If given this is used to calculate the horizontal and vertical pitch (DPI) of
+the screen.
+.TP 7
+.BI "Gamma  " "gamma\-value"
+.TP 7
+.BI "Gamma  " "red\-gamma green\-gamma blue\-gamma"
+This is an optional entry that can be used to specify the gamma correction
+for the monitor.
+It may be specified as either a single value or as three separate RGB values.
+The values should be in the range 0.1 to 10.0, and the default is 1.0.
+Not all drivers are capable of using this information.
+.TP 7
+.BI "UseModes  \*q" modesection\-id \*q
+Include the set of modes listed in the
+.B Modes
+section called
+.IR modesection\-id.
+This makes all of the modes defined in that section available for use by
+this monitor.
+.TP 7
+.BI "Mode  \*q" name \*q
+This is an optional multi-line entry that can be used to provide
+definitions for video modes for the monitor.
+In most cases this isn't necessary because the built-in set of VESA standard
+modes will be sufficient.
+The
+.B Mode
+keyword indicates the start of a multi-line video mode description.
+The mode description is terminated with the
+.B EndMode
+keyword.
+The mode description consists of the following entries:
+.RS 7
+.TP 4
+.BI "DotClock  " clock
+is the dot (pixel) clock rate to be used for the mode.
+.TP 4
+.BI "HTimings  " "hdisp hsyncstart hsyncend htotal"
+specifies the horizontal timings for the mode.
+.TP 4
+.BI "VTimings  " "vdisp vsyncstart vsyncend vtotal"
+specifies the vertical timings for the mode.
+.TP 4
+.BI "Flags  \*q" flag \*q " ..."
+specifies an optional set of mode flags, each of which is a separate
+string in double quotes.
+.B \*qInterlace\*q
+indicates that the mode is interlaced.
+.B \*qDoubleScan\*q
+indicates a mode where each scanline is doubled.
+.B \*q+HSync\*q
+and
+.B \*q\-HSync\*q
+can be used to select the polarity of the HSync signal.
+.B \*q+VSync\*q
+and
+.B \*q\-VSync\*q
+can be used to select the polarity of the VSync signal.
+.B \*qComposite\*q
+can be used to specify composite sync on hardware where this is supported.
+Additionally, on some hardware,
+.B \*q+CSync\*q
+and
+.B \*q\-CSync\*q
+may be used to select the composite sync polarity.
+.TP 4
+.BI "HSkew  " hskew
+specifies the number of pixels (towards the right edge of the screen) by
+which the display enable signal is to be skewed.
+Not all drivers use this information.
+This option might become necessary to override the default value supplied
+by the server (if any).
+\(lqRoving\(rq horizontal lines indicate this value needs to be increased.
+If the last few pixels on a scan line appear on the left of the screen,
+this value should be decreased.
+.TP 4
+.BI "VScan  " vscan
+specifies the number of times each scanline is painted on the screen.
+Not all drivers use this information.
+Values less than 1 are treated as 1, which is the default.
+Generally, the
+.B \*qDoubleScan\*q
+.B Flag
+mentioned above doubles this value.
+.RE
+.TP 7
+.BI "ModeLine  \*q" name \*q " mode\-description"
+This entry is a more compact version of the
+.B Mode
+entry, and it also can be used to specify video modes for the monitor.
+is a single line format for specifying video modes.
+In most cases this isn't necessary because the built\-in set of VESA
+standard modes will be sufficient.
+.PP
+.RS 7
+The
+.I mode\-description
+is in four sections, the first three of which are mandatory.
+The first is the dot (pixel) clock.
+This is a single number specifying the pixel clock rate for the mode in
+MHz.
+The second section is a list of four numbers specifying the horizontal
+timings.
+These numbers are the
+.IR hdisp ,
+.IR hsyncstart ,
+.IR hsyncend ,
+and
+.I htotal
+values.
+The third section is a list of four numbers specifying the vertical
+timings.
+These numbers are the
+.IR vdisp ,
+.IR vsyncstart ,
+.IR vsyncend ,
+and
+.I vtotal
+values.
+The final section is a list of flags specifying other characteristics of
+the mode.
+.B Interlace
+indicates that the mode is interlaced.
+.B DoubleScan
+indicates a mode where each scanline is doubled.
+.B +HSync
+and
+.B \-HSync
+can be used to select the polarity of the HSync signal.
+.B +VSync
+and
+.B \-VSync
+can be used to select the polarity of the VSync signal.
+.B Composite
+can be used to specify composite sync on hardware where this is supported.
+Additionally, on some hardware,
+.B +CSync
+and
+.B \-CSync
+may be used to select the composite sync polarity.
+The
+.B HSkew
+and
+.B VScan
+options mentioned above in the
+.B Modes
+entry description can also be used here.
+.RE
+.TP 7
+.BI "Option " "\*qDPMS\*q  " \*qbool\*q
+This option controls whether the server should enable the DPMS extension
+for power management for this screen.  The default is to enable the
+extension.
+.TP 7
+.BI "Option " "\*qSyncOnGreen\*q  " \*qbool\*q
+This option controls whether the video card should drive the sync signal
+on the green color pin.  Not all cards support this option, and most
+monitors do not require it.  The default is off.
+.TP 7
+.BI "Option " "\*qPrimary\*q  " \*qbool\*q
+This optional entry specifies that the monitor should be treated as the primary
+monitor. (RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qPreferredMode\*q  " \*qstring\*q
+This optional entry specifies a mode to be marked as the preferred initial mode
+of the monitor.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qPosition\*q  " "\*qx y\*q"
+This optional entry specifies the position of the monitor within the X
+screen.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qLeftOf\*q  " \*qoutput\*q
+This optional entry specifies that the monitor should be positioned to the
+left of the output (not monitor) of the given name.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qRightOf\*q  " \*qoutput\*q
+This optional entry specifies that the monitor should be positioned to the
+right of the output (not monitor) of the given name.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qAbove\*q  " \*qoutput\*q
+This optional entry specifies that the monitor should be positioned above the
+output (not monitor) of the given name.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qBelow\*q  " \*qoutput\*q
+This optional entry specifies that the monitor should be positioned below the
+output (not monitor) of the given name.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qEnable\*q  " \*qbool\*q
+This optional entry specifies whether the monitor should be turned on
+at startup.  By default, the server will attempt to enable all connected
+monitors.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qDefaultModes\*q  " \*qbool\*q
+This optional entry specifies whether the server should add supported default
+modes to the list of modes offered on this monitor. By default, the server
+will add default modes; you should only disable this if you can guarantee
+that EDID will be available at all times, or if you have added custom modelines
+which the server can use.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qMinClock\*q  " \*qfrequency\*q
+This optional entry specifies the minimum dot clock, in kHz, that is supported
+by the monitor.
+.TP 7
+.BI "Option " "\*qMaxClock\*q  " \*qfrequency\*q
+This optional entry specifies the maximum dot clock, in kHz, that is supported
+by the monitor.
+.TP 7
+.BI "Option " "\*qIgnore\*q  " \*qbool\*q
+This optional entry specifies that the monitor should be ignored entirely,
+and not reported through RandR.  This is useful if the hardware reports the
+presence of outputs that don't exist.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qRotate\*q  " \*qrotation\*q
+This optional entry specifies the initial rotation of the given monitor.
+Valid values for rotation are \*qnormal\*q, \*qleft\*q, \*qright\*q, and
+\*qinverted\*q.
+(RandR 1.2-supporting drivers only)
+
+.SH "MODES SECTION"
+The config file may have multiple
+.B Modes
+sections, or none.
+These sections provide a way of defining sets of video modes independently
+of the
+.B Monitor
+sections.
+.B Monitor
+sections may include the definitions provided in these sections by
+using the
+.B UseModes
+keyword.
+In most cases the
+.B Modes
+sections are not necessary because the built\-in set of VESA standard modes
+will be sufficient.
+.PP
+.B Modes
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B  "Section \*qModes\*q"
+.BI "    Identifier \*q" name \*q
+.I  "    entries"
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+entry specifies the unique name for this set of mode descriptions.
+The other entries permitted in
+.B Modes
+sections are the
+.B Mode
+and
+.B ModeLine
+entries that are described above in the
+.B Monitor
+section.
+.SH "SCREEN SECTION"
+The config file may have multiple
+.B Screen
+sections.
+There must be at least one, for the \(lqscreen\(rq being used.
+A \(lqscreen\(rq represents the binding of a graphics device
+.RB ( Device
+section) and a monitor
+.RB ( Monitor
+section).
+A
+.B Screen
+section is considered \(lqactive\(rq if it is referenced by an active
+.B ServerLayout
+section or by the
+.B \-screen
+command line option.
+If neither of those is present, the first
+.B Screen
+section found in the config file is considered the active one.
+.PP
+.B Screen
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B  "Section \*qScreen\*q"
+.BI "    Identifier \*q" name \*q
+.BI "    Device     \*q" devid \*q
+.BI "    Monitor    \*q" monid \*q
+.I  "    entries"
+.I  "    ..."
+.BI "    SubSection \*qDisplay\*q"
+.I  "       entries"
+.I  "       ...
+.B  "    EndSubSection"
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+and
+.B Device
+entries are mandatory.
+All others are optional.
+.PP
+The
+.B Identifier
+entry specifies the unique name for this screen.
+The
+.B Screen
+section provides information specific to the whole screen, including
+screen\-specific
+.BR Options .
+In multi\-head configurations, there will be multiple active
+.B Screen
+sections, one for each head.
+The entries available
+for this section are:
+.TP 7
+.BI "Device  \*q" device\-id \*q
+This mandatory entry specifies the
+.B Device
+section to be used for this screen.
+This is what ties a specific graphics card to a screen.
+The
+.I device\-id
+must match the
+.B Identifier
+of a
+.B Device
+section in the config file.
+.TP 7
+.BI "Monitor  \*q" monitor\-id \*q
+specifies which monitor description is to be used for this screen.
+If a
+.B Monitor
+name is not specified, a default configuration is used.
+Currently the default configuration may not function as expected on all
+platforms.
+.TP 7
+.BI "VideoAdaptor  \*q" xv\-id \*q
+specifies an optional Xv video adaptor description to be used with this
+screen.
+.TP 7
+.BI "DefaultDepth  " depth
+specifies which color depth the server should use by default.
+The
+.B \-depth
+command line option can be used to override this.
+If neither is specified, the default depth is driver\-specific, but in most
+cases is 8.
+.TP 7
+.BI "DefaultFbBpp  " bpp
+specifies which framebuffer layout to use by default.
+The
+.B \-fbbpp
+command line option can be used to override this.
+In most cases the driver will chose the best default value for this.
+The only case where there is even a choice in this value is for depth 24,
+where some hardware supports both a packed 24 bit framebuffer layout and a
+sparse 32 bit framebuffer layout.
+.TP 7
+.B Options
+Various
+.B Option
+flags may be specified in the
+.B Screen
+section.
+Some are driver\-specific and are described in the driver documentation.
+Others are driver\-independent, and will eventually be described here.
+.\" XXX These should really be in an xaa man page.
+.TP 7
+.BI "Option \*qAccel\*q"
+Enables XAA (X Acceleration Architecture), a mechanism that makes video cards'
+2D hardware acceleration available to the  __xservername__ server.
+This option is on by default, but it may be necessary to turn it off if
+there are bugs in the driver.
+There are many options to disable specific accelerated operations, listed
+below.
+Note that disabling an operation will have no effect if the operation is
+not accelerated (whether due to lack of support in the hardware or in the
+driver).
+.TP 7
+.BI "Option \*qInitPrimary\*q \*q" boolean \*q
+Use the Int10 module to initialize the primary graphics card.
+Normally, only secondary cards are soft-booted using the Int10 module, as the
+primary card has already been initialized by the BIOS at boot time.
+Default: false.
+.TP 7
+.BI "Option \*qNoInt10\*q \*q" boolean \*q
+Disables the Int10 module, a module that uses the int10 call to the BIOS
+of the graphics card to initialize it.
+Default: false.
+.TP 7
+.BI "Option \*qNoMTRR\*q"
+Disables MTRR (Memory Type Range Register) support, a feature of modern
+processors which can improve video performance by a factor of up to 2.5.
+Some hardware has buggy MTRR support, and some video drivers have been
+known to exhibit problems when MTRR's are used.
+.TP 7
+.BI "Option \*qXaaNoCPUToScreenColorExpandFill\*q"
+Disables accelerated rectangular expansion blits from source patterns
+stored in system memory (using a memory\-mapped aperture).
+.TP 7
+.BI "Option \*qXaaNoColor8x8PatternFillRect\*q"
+Disables accelerated fills of a rectangular region with a full\-color
+pattern.
+.TP 7
+.BI "Option \*qXaaNoColor8x8PatternFillTrap\*q"
+Disables accelerated fills of a trapezoidal region with a full\-color
+pattern.
+.TP 7
+.BI "Option \*qXaaNoDashedBresenhamLine\*q"
+Disables accelerated dashed Bresenham line draws.
+.TP 7
+.BI "Option \*qXaaNoDashedTwoPointLine\*q"
+Disables accelerated dashed line draws between two arbitrary points.
+.TP 7
+.BI "Option \*qXaaNoImageWriteRect\*q"
+Disables accelerated transfers of full\-color rectangular patterns from
+system memory to video memory (using a memory\-mapped aperture).
+.TP 7
+.BI "Option \*qXaaNoMono8x8PatternFillRect\*q"
+Disables accelerated fills of a rectangular region with a monochrome
+pattern.
+.TP 7
+.BI "Option \*qXaaNoMono8x8PatternFillTrap\*q"
+Disables accelerated fills of a trapezoidal region with a monochrome
+pattern.
+.TP 7
+.BI "Option \*qXaaNoOffscreenPixmaps\*q"
+Disables accelerated draws into pixmaps stored in offscreen video memory.
+.TP 7
+.BI "Option \*qXaaNoPixmapCache\*q"
+Disables caching of patterns in offscreen video memory.
+.TP 7
+.BI "Option \*qXaaNoScanlineCPUToScreenColorExpandFill\*q"
+Disables accelerated rectangular expansion blits from source patterns
+stored in system memory (one scan line at a time).
+.TP 7
+.BI "Option \*qXaaNoScanlineImageWriteRect\*q"
+Disables accelerated transfers of full\-color rectangular patterns from
+system memory to video memory (one scan line at a time).
+.TP 7
+.BI "Option \*qXaaNoScreenToScreenColorExpandFill\*q"
+Disables accelerated rectangular expansion blits from source patterns
+stored in offscreen video memory.
+.TP 7
+.BI "Option \*qXaaNoScreenToScreenCopy\*q"
+Disables accelerated copies of rectangular regions from one part of
+video memory to another part of video memory.
+.TP 7
+.BI "Option \*qXaaNoSolidBresenhamLine\*q"
+Disables accelerated solid Bresenham line draws.
+.TP 7
+.BI "Option \*qXaaNoSolidFillRect\*q"
+Disables accelerated solid\-color fills of rectangles.
+.TP 7
+.BI "Option \*qXaaNoSolidFillTrap\*q"
+Disables accelerated solid\-color fills of Bresenham trapezoids.
+.TP 7
+.BI "Option \*qXaaNoSolidHorVertLine\*q"
+Disables accelerated solid horizontal and vertical line draws.
+.TP 7
+.BI "Option \*qXaaNoSolidTwoPointLine\*q"
+Disables accelerated solid line draws between two arbitrary points.
+.PP
+Each
+.B Screen
+section may optionally contain one or more
+.B Display
+subsections.
+Those subsections provide depth/fbbpp specific configuration information,
+and the one chosen depends on the depth and/or fbbpp that is being used for
+the screen.
+The
+.B Display
+subsection format is described in the section below.
+
+.SH "DISPLAY SUBSECTION"
+Each
+.B Screen
+section may have multiple
+.B Display
+subsections.
+The \(lqactive\(rq
+.B Display
+subsection is the first that matches the depth and/or fbbpp values being
+used, or failing that, the first that has neither a depth or fbbpp value
+specified.
+The
+.B Display
+subsections are optional.
+When there isn't one that matches the depth and/or fbbpp values being used,
+all the parameters that can be specified here fall back to their defaults.
+.PP
+.B Display
+subsections have the following format:
+.PP
+.RS 4
+.nf
+.B  "    SubSection \*qDisplay\*q"
+.BI "        Depth  " depth
+.I  "        entries"
+.I  "        ..."
+.B  "    EndSubSection"
+.fi
+.RE
+.TP 7
+.BI "Depth  " depth
+This entry specifies what colour depth the
+.B Display
+subsection is to be used for.
+This entry is usually specified, but it may be omitted to create a match\-all
+.B Display
+subsection or when wishing to match only against the
+.B FbBpp
+parameter.
+The range of
+.I depth
+values that are allowed depends on the driver.
+Most drivers support 8, 15, 16 and 24.
+Some also support 1 and/or 4, and some may support other values (like 30).
+Note:
+.I depth
+means the number of bits in a pixel that are actually used to determine
+the pixel colour.
+32 is not a valid
+.I depth
+value.
+Most hardware that uses 32 bits per pixel only uses 24 of them to hold the
+colour information, which means that the colour depth is 24, not 32.
+.TP 7
+.BI "FbBpp  " bpp
+This entry specifies the framebuffer format this
+.B Display
+subsection is to be used for.
+This entry is only needed when providing depth 24 configurations that allow
+a choice between a 24 bpp packed framebuffer format and a 32bpp sparse
+framebuffer format.
+In most cases this entry should not be used.
+.TP 7
+.BI "Weight  " "red\-weight green\-weight blue\-weight"
+This optional entry specifies the relative RGB weighting to be used
+for a screen is being used at depth 16 for drivers that allow multiple
+formats.
+This may also be specified from the command line with the
+.B \-weight
+option (see
+.BR __xservername__(__appmansuffix__)).
+.TP 7
+.BI "Virtual  " "xdim ydim"
+This optional entry specifies the virtual screen resolution to be used.
+.I xdim
+must be a multiple of either 8 or 16 for most drivers, and a multiple
+of 32 when running in monochrome mode.
+The given value will be rounded down if this is not the case.
+Video modes which are too large for the specified virtual size will be
+rejected.
+If this entry is not present, the virtual screen resolution will be set to
+accommodate all the valid video modes given in the
+.B Modes
+entry.
+Some drivers/hardware combinations do not support virtual screens.
+Refer to the appropriate driver\-specific documentation for details.
+.TP 7
+.BI "ViewPort  " "x0 y0"
+This optional entry sets the upper left corner of the initial display.
+This is only relevant when the virtual screen resolution is different
+from the resolution of the initial video mode.
+If this entry is not given, then the initial display will be centered in
+the virtual display area.
+.TP 7
+.BI "Modes  \*q" mode\-name \*q " ..."
+This optional entry specifies the list of video modes to use.
+Each
+.I mode\-name
+specified must be in double quotes.
+They must correspond to those specified or referenced in the appropriate
+.B Monitor
+section (including implicitly referenced built\-in VESA standard modes).
+The server will delete modes from this list which don't satisfy various
+requirements.
+The first valid mode in this list will be the default display mode for
+startup.
+The list of valid modes is converted internally into a circular list.
+It is possible to switch to the next mode with
+.B Ctrl+Alt+Keypad\-Plus
+and to the previous mode with
+.BR Ctrl+Alt+Keypad\-Minus .
+When this entry is omitted, the valid modes referenced by the appropriate
+.B Monitor
+section will be used.  If the
+.B Monitor
+section contains no modes, then the selection will be taken from the
+built-in VESA standard modes.
+.TP 7
+.BI "Visual  \*q" visual\-name \*q
+This optional entry sets the default root visual type.
+This may also be specified from the command line (see the
+.BR Xserver(__appmansuffix__)
+man page).
+The visual types available for depth 8 are (default is
+.BR PseudoColor ):
+.PP
+.RS 11
+.nf
+.B StaticGray
+.B GrayScale
+.B StaticColor
+.B PseudoColor
+.B TrueColor
+.B DirectColor
+.fi
+.RE
+.PP
+.RS 7
+The visual type available for the depths 15, 16 and 24 are (default is
+.BR TrueColor ):
+.PP
+.RS 4
+.nf
+.B TrueColor
+.B DirectColor
+.fi
+.RE
+.PP
+Not all drivers support
+.B DirectColor
+at these depths.
+.PP
+The visual types available for the depth 4 are (default is
+.BR StaticColor ):
+.PP
+.RS 4
+.nf
+.B StaticGray
+.B GrayScale
+.B StaticColor
+.B PseudoColor
+.fi
+.RE
+.PP
+The visual type available for the depth 1 (monochrome) is
+.BR StaticGray .
+.RE
+.TP 7
+.BI "Black  " "red green blue"
+This optional entry allows the \(lqblack\(rq colour to be specified.
+This is only supported at depth 1.
+The default is black.
+.TP 7
+.BI "White  " "red green blue"
+This optional entry allows the \(lqwhite\(rq colour to be specified.
+This is only supported at depth 1.
+The default is white.
+.TP 7
+.B Options
+Option flags may be specified in the
+.B Display
+subsections.
+These may include driver\-specific options and driver\-independent options.
+The former are described in the driver\-specific documentation.
+Some of the latter are described above in the section about the
+.B Screen
+section, and they may also be included here.
+.SH "SERVERLAYOUT SECTION"
+The config file may have multiple
+.B ServerLayout
+sections.
+A \(lqserver layout\(rq represents the binding of one or more screens
+.RB ( Screen
+sections) and one or more input devices
+.RB ( InputDevice
+sections) to form a complete configuration.
+In multi\-head configurations, it also specifies the relative layout of the
+heads.
+A
+.B ServerLayout
+section is considered \(lqactive\(rq if it is referenced by the
+.B \-layout
+command line option or by an
+.B "Option \*qDefaultServerLayout\*q"
+entry in the
+.B ServerFlags
+section (the former takes precedence over the latter).
+If those options are not used, the first
+.B ServerLayout
+section found in the config file is considered the active one.
+If no
+.B ServerLayout
+sections are present, the single active screen and two active (core)
+input devices are selected as described in the relevant sections above.
+.PP
+.B ServerLayout
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B  "Section \*qServerLayout\*q"
+.BI "    Identifier   \*q" name \*q
+.BI "    Screen       \*q" screen\-id \*q
+.I  "    ..."
+.BI "    InputDevice  \*q" idev\-id \*q
+.I  "    ..."
+.I  "    options"
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.PP
+Each
+.B ServerLayout
+section must have an
+.B Identifier
+entry and at least one
+.B Screen
+entry.
+.PP
+The
+.B Identifier
+entry specifies the unique name for this server layout.
+The
+.B ServerLayout
+section provides information specific to the whole session, including
+session\-specific
+.BR Options .
+The
+.B ServerFlags
+options (described above) may be specified here, and ones given here
+override those given in the
+.B ServerFlags
+section.
+.PP
+The entries that may be used in this section are described here.
+.TP 7
+.BI "Screen  " "screen\-num" " \*qscreen\-id\*q " "position\-information"
+One of these entries must be given for each screen being used in
+a session.
+The
+.I screen\-id
+field is mandatory, and specifies the
+.B Screen
+section being referenced.
+The
+.I screen\-num
+field is optional, and may be used to specify the screen number
+in multi\-head configurations.
+When this field is omitted, the screens will be numbered in the order that
+they are listed in.
+The numbering starts from 0, and must be consecutive.
+The
+.I position\-information
+field describes the way multiple screens are positioned.
+There are a number of different ways that this information can be provided:
+.RS 7
+.TP 4
+.I  "x y"
+.TP 4
+.BI "Absolute  " "x y"
+These both specify that the upper left corner's coordinates are
+.RI ( x , y ).
+The
+.B Absolute
+keyword is optional.
+Some older versions of XFree86 (4.2 and earlier) don't recognise the
+.B Absolute
+keyword, so it's safest to just specify the coordinates without it.
+.TP 4
+.BI "RightOf   \*q" screen\-id \*q
+.TP 4
+.BI "LeftOf    \*q" screen\-id \*q
+.TP 4
+.BI "Above     \*q" screen\-id \*q
+.TP 4
+.BI "Below     \*q" screen\-id \*q
+.TP 4
+.BI "Relative  \*q" screen\-id \*q " x y"
+These give the screen's location relative to another screen.
+The first four position the screen immediately to the right, left, above or
+below the other screen.
+When positioning to the right or left, the top edges are aligned.
+When positioning above or below, the left edges are aligned.
+The
+.B Relative
+form specifies the offset of the screen's origin (upper left corner)
+relative to the origin of another screen.
+.RE
+.TP 7
+.BI "InputDevice  \*q" idev\-id "\*q \*q" option \*q " ..."
+One of these entries should be given for each input device being used in
+a session.
+Normally at least two are required, one each for the core pointer and
+keyboard devices.
+If either of those is missing, suitable
+.B InputDevice
+entries are searched for using the method described above in the
+.B INPUTDEVICE
+section.  The
+.I idev\-id
+field is mandatory, and specifies the name of the
+.B InputDevice
+section being referenced.
+Multiple
+.I option
+fields may be specified, each in double quotes.
+The options permitted here are any that may also be given in the
+.B InputDevice
+sections.
+Normally only session\-specific input device options would be used here.
+The most commonly used options are:
+.PP
+.RS 11
+.nf
+.B \*qCorePointer\*q
+.B \*qCoreKeyboard\*q
+.B \*qSendCoreEvents\*q
+.fi
+.RE
+.PP
+.RS 7
+and the first two should normally be used to indicate the core pointer
+and core keyboard devices respectively.
+.RE
+.TP 7
+.B Options
+In addition to the following, any option permitted in the
+.B ServerFlags
+section may also be specified here.
+When the same option appears in both places, the value given here overrides
+the one given in the
+.B ServerFlags
+section.
+.TP 7
+.BI "Option \*qIsolateDevice\*q  \*q" bus\-id \*q
+Restrict device resets to the specified
+.IR bus\-id .
+See the
+.B BusID
+option (described in
+.BR "DEVICE SECTION" ,
+above) for the format of the
+.I bus\-id
+parameter.
+This option overrides
+.BR SingleCard ,
+if specified.
+At present, only PCI devices can be isolated in this manner.
+.TP 7
+.BI "Option \*qSingleCard\*q  \*q" boolean \*q
+As
+.BR IsolateDevice ,
+except that the bus ID of the first device in the layout is used.
+.PP
+Here is an example of a
+.B ServerLayout
+section for a dual headed configuration with two mice:
+.PP
+.RS 4
+.nf
+.B "Section \*qServerLayout\*q"
+.B "    Identifier  \*qLayout 1\*q"
+.B "    Screen      \*qMGA 1\*q"
+.B "    Screen      \*qMGA 2\*q RightOf \*qMGA 1\*q"
+.B "    InputDevice \*qKeyboard 1\*q \*qCoreKeyboard\*q"
+.B "    InputDevice \*qMouse 1\*q    \*qCorePointer\*q"
+.B "    InputDevice \*qMouse 2\*q    \*qSendCoreEvents\*q"
+.B "    Option      \*qBlankTime\*q  \*q5\*q"
+.B "EndSection"
+.fi
+.RE
+.SH "DRI SECTION"
+This optional section is used to provide some information for the
+Direct Rendering Infrastructure.
+Details about the format of this section can be found on-line at
+.IR <http://dri.freedesktop.org/> .
+.SH "VENDOR SECTION"
+The optional
+.B Vendor
+section may be used to provide vendor\-specific configuration information.
+Multiple
+.B Vendor
+sections may be present, and they may contain an
+.B Identifier
+entry and multiple
+.B Option
+flags.
+The data therein is not used in this release.
+.PP
+.SH "SEE ALSO"
+General:
+.BR X (__miscmansuffix__),
+.BR Xserver (__appmansuffix__),
+.BR __xservername__ (__appmansuffix__),
+.BR cvt (__appmansuffix__),
+.BR gtf (__appmansuffix__).
+.PP
+.B "Not all modules or interfaces are available on all platforms."
+.PP
+Display drivers:
+.BR apm (__drivermansuffix__),
+.BR ati (__drivermansuffix__),
+.BR chips (__drivermansuffix__),
+.BR cirrus (__drivermansuffix__),
+.BR cyrix (__drivermansuffix__),
+.BR fbdev (__drivermansuffix__),
+.BR glide (__drivermansuffix__),
+.BR glint (__drivermansuffix__),
+.BR i128 (__drivermansuffix__),
+.BR i740 (__drivermansuffix__),
+.BR imstt (__drivermansuffix__),
+.BR intel (__drivermansuffix__),
+.BR mga (__drivermansuffix__),
+.BR neomagic (__drivermansuffix__),
+.BR nv (__drivermansuffix__),
+.BR openchrome (__drivermansuffix__),
+.BR r128 (__drivermansuffix__),
+.BR radeon (__drivermansuffix__),
+.BR rendition (__drivermansuffix__),
+.BR savage (__drivermansuffix__),
+.BR s3virge (__drivermansuffix__),
+.BR siliconmotion (__drivermansuffix__),
+.BR sis (__drivermansuffix__),
+.BR sisusb (__drivermansuffix__),
+.BR sunbw2 (__drivermansuffix__),
+.BR suncg14 (__drivermansuffix__),
+.BR suncg3 (__drivermansuffix__),
+.BR suncg6 (__drivermansuffix__),
+.BR sunffb (__drivermansuffix__),
+.BR sunleo (__drivermansuffix__),
+.BR suntcx (__drivermansuffix__),
+.BR tdfx (__drivermansuffix__),
+.\" .BR tga (__drivermansuffix__),
+.BR trident (__drivermansuffix__),
+.BR tseng (__drivermansuffix__),
+.BR vesa (__drivermansuffix__),
+.BR vmware (__drivermansuffix__),
+.BR voodoo (__drivermansuffix__),
+.BR wsfb (__drivermansuffix__),
+.BR xgi (__drivermansuffix__),
+.BR xgixp (__drivermansuffix__).
+.PP
+Input drivers:
+.BR acecad (__drivermansuffix__),
+.BR citron (__drivermansuffix__),
+.BR elographics (__drivermansuffix__),
+.BR evdev (__drivermansuffix__),
+.BR fpit (__drivermansuffix__),
+.BR joystick (__drivermansuffix__),
+.BR kbd (__drivermansuffix__),
+.BR mousedrv (__drivermansuffix__),
+.BR mutouch (__drivermansuffix__),
+.BR penmount (__drivermansuffix__),
+.BR synaptics (__drivermansuffix__),
+.BR vmmouse (__drivermansuffix__),
+.BR void (__drivermansuffix__),
+.BR wacom (__drivermansuffix__).
+.PP
+Other modules and interfaces:
+.BR exa (__drivermansuffix__),
+.BR fbdevhw (__drivermansuffix__),
+.\" .BR shadowfb (__drivermansuffix__),
+.BR v4l (__drivermansuffix__).
+.br
+.SH AUTHORS
+This manual page was largely rewritten by David Dawes
+.IR <dawes at xfree86.org> .
diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
deleted file mode 100644
index e3fd0ea..0000000
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ /dev/null
@@ -1,2478 +0,0 @@
-.\" shorthand for double quote that works everywhere.
-.ds q \N'34'
-.TH __xconfigfile__ __filemansuffix__ __vendorversion__
-.SH NAME
-__xconfigfile__ and __xconfigdir__ \- configuration files for
-__xservername__ X server
-.SH INTRODUCTION
-.B __xservername__
-supports several mechanisms for supplying/obtaining configuration and
-run-time parameters: command line options, environment variables, the
-__xconfigfile__ and __xconfigdir__ configuration files, auto-detection,
-and fallback defaults. When the same information is supplied in more
-than one way, the highest precedence mechanism is used. The list of
-mechanisms is ordered from highest precedence to lowest. Note that not
-all parameters can be supplied via all methods. The available command
-line options and environment variables (and some defaults) are
-described in the Xserver(__appmansuffix__) and
-__xservername__(__appmansuffix__) manual pages. Most configuration file
-parameters, with their defaults, are described below. Driver and module
-specific configuration parameters are described in the relevant driver
-or module manual page.
-.SH DESCRIPTION
-.B __xservername__
-uses a configuration file called
-.I __xconfigfile__
-and files ending in the suffix
-.I .conf
-from the directory
-.I __xconfigdir__
-for its initial setup.
-The
-.I __xconfigfile__
-configuration file is searched for in the following places when the
-server is started as a normal user:
-.PP
-.RS 4
-.nf
-.IR /etc/X11/ <cmdline>
-.IR __projectroot__/etc/X11/ <cmdline>
-.IB /etc/X11/ $XORGCONFIG
-.IB __projectroot__/etc/X11/ $XORGCONFIG
-.I /etc/X11/__xconfigfile__
-.I /etc/__xconfigfile__
-.IR __projectroot__/etc/X11/__xconfigfile__. <hostname>
-.I __projectroot__/etc/X11/__xconfigfile__
-.IR __projectroot__/lib/X11/__xconfigfile__. <hostname>
-.I __projectroot__/lib/X11/__xconfigfile__
-.fi
-.RE
-.PP
-where
-.I <cmdline>
-is a relative path (with no \(lq..\(rq components) specified with the
-.B \-config
-command line option,
-.B $XORGCONFIG
-is the relative path (with no \(lq..\(rq components) specified by that
-environment variable, and
-.I <hostname>
-is the machine's hostname as reported by
-.BR gethostname (__libmansuffix__).
-.PP
-When the __xservername__ server is started by the \(lqroot\(rq user, the config file
-search locations are as follows:
-.PP
-.RS 4
-.nf
-<cmdline>
-.IR /etc/X11/ <cmdline>
-.IR __projectroot__/etc/X11/ <cmdline>
-.B $XORGCONFIG
-.IB /etc/X11/ $XORGCONFIG
-.IB __projectroot__/etc/X11/ $XORGCONFIG
-.I /etc/X11/__xconfigfile__
-.I /etc/__xconfigfile__
-.IR __projectroot__/etc/X11/__xconfigfile__. <hostname>
-.I __projectroot__/etc/X11/__xconfigfile__
-.IR __projectroot__/lib/X11/__xconfigfile__. <hostname>
-.I __projectroot__/lib/X11/__xconfigfile__
-.fi
-.RE
-.PP
-where
-.I <cmdline>
-is the path specified with the
-.B \-config
-command line option (which may be absolute or relative),
-.B $XORGCONFIG
-is the path specified by that
-environment variable (absolute or relative),
-.B $HOME
-is the path specified by that environment variable (usually the home
-directory), and
-.I <hostname>
-is the machine's hostname as reported by
-.BR gethostname (__libmansuffix__).
-.PP
-Additional configuration files are searched for in the following
-directories when the server is started as a normal user:
-.PP
-.RS 4
-.nf
-.IR /etc/X11/ <cmdline>
-.IR __sysconfdir__/X11/ <cmdline>
-.I /etc/X11/__xconfigdir__
-.I __sysconfdir__/X11/__xconfigdir__
-.fi
-.RE
-.PP
-where
-.I <cmdline>
-is a relative path (with no \(lq..\(rq components) specified with the
-.B \-configdir
-command line option.
-.PP
-When the __xservername__ server is started by the \(lqroot\(rq user, the
-config directory search locations are as follows:
-.PP
-.RS 4
-.nf
-<cmdline>
-.IR /etc/X11/ <cmdline>
-.IR __sysconfdir__/X11/ <cmdline>
-.I /etc/X11/__xconfigdir__
-.I __sysconfdir__/X11/__xconfigdir__
-.fi
-.RE
-.PP
-where
-.I <cmdline>
-is the path specified with the
-.B \-configdir
-command line option (which may be absolute or relative).
-.PP
-Finally, configuration files will also be searched for in directories
-reserved for system use. These are to separate configuration files from
-the vendor or 3rd party packages from those of local administration.
-These files are found in the following directories:
-.PP
-.RS 4
-.nf
-.I /usr/share/X11/__xconfigdir__
-.I __datadir__/X11/__xconfigdir__
-.fi
-.RE
-.PP
-The
-.I __xconfigfile__
-and
-.I __xconfigdir__
-files are composed of a number of sections which may be present in any order,
-or omitted to use default configuration values.
-Each section has the form:
-.PP
-.RS 4
-.nf
-.BI "Section  \*q" SectionName \*q
-.RI "    " SectionEntry
-    ...
-.B EndSection
-.fi
-.RE
-.PP
-The section names are:
-.PP
-.RS 4
-.nf
-.BR "Files          " "File pathnames"
-.BR "ServerFlags    " "Server flags"
-.BR "Module         " "Dynamic module loading"
-.BR "Extensions     " "Extension enabling"
-.BR "InputDevice    " "Input device description"
-.BR "InputClass     " "Input class description"
-.BR "Device         " "Graphics device description"
-.BR "VideoAdaptor   " "Xv video adaptor description"
-.BR "Monitor        " "Monitor description"
-.BR "Modes          " "Video modes descriptions"
-.BR "Screen         " "Screen configuration"
-.BR "ServerLayout   " "Overall layout"
-.BR "DRI            " "DRI\-specific configuration"
-.BR "Vendor         " "Vendor\-specific configuration"
-.fi
-.RE
-.PP
-The following obsolete section names are still recognised for compatibility
-purposes.
-In new config files, the
-.B InputDevice
-section should be used instead.
-.PP
-.RS 4
-.nf
-.BR "Keyboard       " "Keyboard configuration"
-.BR "Pointer        " "Pointer/mouse configuration"
-.fi
-.RE
-.PP
-The old
-.B XInput
-section is no longer recognised.
-.PP
-The
-.B ServerLayout
-sections are at the highest level.
-They bind together the input and output devices that will be used in a session.
-The input devices are described in the
-.B InputDevice
-sections.
-Output devices usually consist of multiple independent components (e.g.,
-a graphics board and a monitor).
-These multiple components are bound together in the
-.B Screen
-sections, and it is these that are referenced by the
-.B ServerLayout
-section.
-Each
-.B Screen
-section binds together a graphics board and a monitor.
-The graphics boards are described in the
-.B Device
-sections, and the monitors are described in the
-.B Monitor
-sections.
-.PP
-Config file keywords are case\-insensitive, and \(lq_\(rq characters are
-ignored.
-Most strings (including
-.B Option
-names) are also case-insensitive, and insensitive to white space and
-\(lq_\(rq characters.
-.PP
-Each config file entry usually takes up a single line in the file.  They
-consist of a keyword, which is possibly followed by one or more arguments,
-with the number and types of the arguments depending on the keyword.
-The argument types are:
-.PP
-.RS 4
-.nf
-.BR "Integer     " "an integer number in decimal, hex or octal"
-.BR "Real        " "a floating point number"
-.BR "String      " "a string enclosed in double quote marks (\*q)"
-.fi
-.RE
-.PP
-Note: hex integer values must be prefixed with \(lq0x\(rq, and octal values
-with \(lq0\(rq.
-.PP
-A special keyword called
-.B Option
-may be used to provide free\-form data to various components of the server.
-The
-.B Option
-keyword takes either one or two string arguments.
-The first is the option name, and the optional second argument is the
-option value.
-Some commonly used option value types include:
-.PP
-.RS 4
-.nf
-.BR "Integer     " "an integer number in decimal, hex or octal"
-.BR "Real        " "a floating point number"
-.BR "String      " "a sequence of characters"
-.BR "Boolean     " "a boolean value (see below)"
-.BR "Frequency   " "a frequency value (see below)"
-.fi
-.RE
-.PP
-Note that
-.I all
-.B Option
-values, not just strings, must be enclosed in quotes.
-.PP
-Boolean options may optionally have a value specified.
-When no value is specified, the option's value is
-.BR TRUE .
-The following boolean option values are recognised as
-.BR TRUE :
-.PP
-.RS 4
-.BR 1 ,
-.BR on ,
-.BR true ,
-.B yes
-.RE
-.PP
-and the following boolean option values are recognised as
-.BR FALSE :
-.PP
-.RS 4
-.BR 0 ,
-.BR off ,
-.BR false ,
-.B no
-.RE
-.PP
-If an option name is prefixed with
-.RB \*q No \*q,
-then the option value is negated.
-.PP
-Example: the following option entries are equivalent:
-.PP
-.RS 4
-.nf
-.B "Option \*qAccel\*q   \*qOff\*q"
-.B "Option \*qNoAccel\*q"
-.B "Option \*qNoAccel\*q \*qOn\*q"
-.B "Option \*qAccel\*q   \*qfalse\*q"
-.B "Option \*qAccel\*q   \*qno\*q"
-.fi
-.RE
-.PP
-Frequency option values consist of a real number that is optionally
-followed by one of the following frequency units:
-.PP
-.RS 4
-.BR Hz ,
-.BR k ,
-.BR kHz ,
-.BR M ,
-.B MHz
-.RE
-.PP
-When the unit name is omitted, the correct units will be determined from
-the value and the expectations of the appropriate range of the value.
-It is recommended that the units always be specified when using frequency
-option values to avoid any errors in determining the value.
-.SH "FILES SECTION"
-The
-.B Files
-section is used to specify some path names required by the server.
-Some of these paths can also be set from the command line (see
-.BR Xserver (__appmansuffix__)
-and
-.BR __xservername__ (__appmansuffix__)).
-The command line settings override the values specified in the config
-file.
-The
-.B Files
-section is optional, as are all of the entries that may appear in it.
-.PP
-The entries that can appear in this section are:
-.TP 7
-.BI "FontPath \*q" path \*q
-sets the search path for fonts.
-This path is a comma separated list of font path elements which the __xservername__
-server searches for font databases.
-Multiple
-.B FontPath
-entries may be specified, and they will be concatenated to build up the
-fontpath used by the server.  Font path elements can be absolute
-directory paths, catalogue directories or a font server identifier. The
-formats of the later two are explained below:
-.PP
-.RS 7
-Catalogue directories:
-.PP
-.RS 4
-Catalogue directories can be specified using the prefix \fBcatalogue:\fR
-before the directory name. The directory can then be populated with
-symlinks pointing to the real font directories, using the following
-syntax in the symlink name:
-.PP
-.RS 4
-.IR <identifier> : [attribute]: pri= <priority>
-.RE
-.PP
-where
-.I <identifier>
-is an alphanumeric identifier,
-.I [attribute]
-is an attribute which will be passed to the underlying FPE and
-.I <priority>
-is a number used to order the fontfile FPEs. Examples:
-.PP
-.RS 4
-.nf
-.I 75dpi:unscaled:pri=20  -> /usr/share/X11/fonts/75dpi
-.I gscript:pri=60 -> /usr/share/fonts/default/ghostscript
-.I misc:unscaled:pri=10 \-> /usr/share/X11/fonts/misc
-.fi
-.PP
-.RE .RE .RE
-.PP
-.RS 7
-Font server identifiers:
-.PP
-.RS 4
-Font server identifiers have the form:
-.RS 4
-.PP
-.IR <trans> / <hostname> : <port\-number>
-.RE
-.PP
-where
-.I <trans>
-is the transport type to use to connect to the font server (e.g.,
-.B unix
-for UNIX\-domain sockets or
-.B tcp
-for a TCP/IP connection),
-.I <hostname>
-is the hostname of the machine running the font server, and
-.I <port\-number>
-is the port number that the font server is listening on (usually 7100).
-.RE
-.PP
-When this entry is not specified in the config file, the server falls back
-to the compiled\-in default font path, which contains the following
-font path elements (which can be set inside a catalogue directory):
-.PP
-.RS 4
-.nf
-.I __datadir__/fonts/X11/misc/
-.I __datadir__/fonts/X11/TTF/
-.I __datadir__/fonts/X11/OTF/
-.I __datadir__/fonts/X11/Type1/
-.I __datadir__/fonts/X11/100dpi/
-.I __datadir__/fonts/X11/75dpi/
-.fi
-.RE
-.PP
-Font path elements that are found to be invalid are removed from the
-font path when the server starts up.
-.RE
-.TP 7
-.BI "ModulePath \*q" path \*q
-sets the search path for loadable __xservername__ server modules.
-This path is a comma separated list of directories which the __xservername__ server
-searches for loadable modules loading in the order specified.
-Multiple
-.B ModulePath
-entries may be specified, and they will be concatenated to build the
-module search path used by the server.  The default module path is
-.PP
-.RS 11
-__modulepath__
-.RE
-.\" The LogFile keyword is not currently implemented
-.ig
-.TP 7
-.BI "LogFile \*q" path \*q
-sets the name of the __xservername__ server log file.
-The default log file name is
-.PP
-.RS 11
-.RI __logdir__/__xservername__. <n> .log
-.RE
-.PP
-.RS 7
-where
-.I <n>
-is the display number for the __xservername__ server.
-..
-.TP 7
-.BI "XkbDir \*q" path \*q
-sets the base directory for keyboard layout files.  The
-.B \-xkbdir
-command line option can be used to override this.  The default directory is
-.PP
-.RS 11
-__xkbdir__
-.RE
-.SH "SERVERFLAGS SECTION"
-In addition to options specific to this section (described below), the
-.B ServerFlags
-section is used to specify some global
-__xservername__ server options.
-All of the entries in this section are
-.BR Options ,
-although for compatibility purposes some of the old style entries are
-still recognised.
-Those old style entries are not documented here, and using them is
-discouraged.
-The
-.B ServerFlags
-section is optional, as are the entries that may be specified in it.
-.PP
-.B Options
-specified in this section (with the exception of the
-.B \*qDefaultServerLayout\*q
-.BR Option )
-may be overridden by
-.B Options
-specified in the active
-.B ServerLayout
-section.
-Options with command line equivalents are overridden when their command
-line equivalent is used.
-The options recognised by this section are:
-.TP 7
-.BI "Option \*qDefaultServerLayout\*q  \*q" layout\-id \*q
-This specifies the default
-.B ServerLayout
-section to use in the absence of the
-.B \-layout
-command line option.
-.TP 7
-.BI "Option \*qNoTrapSignals\*q  \*q" boolean \*q
-This prevents the __xservername__ server from trapping a range of unexpected fatal
-signals and exiting cleanly.
-Instead, the __xservername__ server will die and drop core where the fault occurred.
-The default behaviour is for the __xservername__ server to exit cleanly, but still drop a
-core file.
-In general you never want to use this option unless you are debugging an __xservername__
-server problem and know how to deal with the consequences.
-.TP 7
-.BI "Option \*qUseSIGIO\*q  \*q" boolean \*q
-This controls whether the __xservername__ server requests that events from
-input devices be reported via a SIGIO signal handler (also known as SIGPOLL
-on some platforms), or only reported via the standard select(3) loop.
-The default behaviour is platform specific.   In general you do not want to
-use this option unless you are debugging the __xservername__ server, or
-working around a specific bug until it is fixed, and understand the
-consequences.
-.TP 7
-.BI "Option \*qDontVTSwitch\*q  \*q" boolean \*q
-This disallows the use of the
-.BI Ctrl+Alt+F n
-sequence (where
-.RI F n
-refers to one of the numbered function keys).
-That sequence is normally used to switch to another \*qvirtual terminal\*q
-on operating systems that have this feature.
-When this option is enabled, that key sequence has no special meaning and
-is passed to clients.
-Default: off.
-.TP 7
-.BI "Option \*qDontZap\*q  \*q" boolean \*q
-This disallows the use of the
-.B Terminate_Server
-XKB action (usually on Ctrl+Alt+Backspace, depending on XKB options).
-This action is normally used to terminate the __xservername__ server.
-When this option is enabled, the action has no effect.
-Default: off.
-.TP 7
-.BI "Option \*qDontZoom\*q  \*q" boolean \*q
-This disallows the use of the
-.B Ctrl+Alt+Keypad\-Plus
-and
-.B Ctrl+Alt+Keypad\-Minus
-sequences.
-These sequences allows you to switch between video modes.
-When this option is enabled, those key sequences have no special meaning
-and are passed to clients.
-Default: off.
-.TP 7
-.BI "Option \*qDisableVidModeExtension\*q  \*q" boolean \*q
-This disables the parts of the VidMode extension used by the xvidtune client
-that can be used to change the video modes.
-Default: the VidMode extension is enabled.
-.TP 7
-.BI "Option \*qAllowNonLocalXvidtune\*q  \*q" boolean \*q
-This allows the xvidtune client (and other clients that use the VidMode
-extension) to connect from another host.
-Default: off.
-.TP 7
-.BI "Option \*qAllowMouseOpenFail\*q  \*q" boolean \*q
-This tells the mousedrv(__drivermansuffix__) and vmmouse(__drivermansuffix__)
-drivers to not report failure if the mouse device can't be opened/initialised.
-It has no effect on the evdev(__drivermansuffix__) or other drivers.
-Default: false.
-.TP 7
-.BI "Option \*qVTSysReq\*q  \*q" boolean \*q
-enables the SYSV\-style VT switch sequence for non\-SYSV systems
-which support VT switching.
-This sequence is
-.B Alt\-SysRq
-followed by a function key
-.RB ( Fn ).
-This prevents the __xservername__ server trapping the
-keys used for the default VT switch sequence, which means that clients can
-access them.
-Default: off.
-.TP 7
-.BI "Option \*qBlankTime\*q  \*q" time \*q
-sets the inactivity timeout for the
-.B blank
-phase of the screensaver.
-.I time
-is in minutes.
-This is equivalent to the __xservername__ server's
-.B \-s
-flag, and the value can be changed at run\-time with
-.BR xset(__appmansuffix__).
-Default: 10 minutes.
-.TP 7
-.BI "Option \*qStandbyTime\*q  \*q" time \*q
-sets the inactivity timeout for the
-.B standby
-phase of DPMS mode.
-.I time
-is in minutes, and the value can be changed at run\-time with
-.BR xset(__appmansuffix__).
-Default: 10 minutes.
-This is only suitable for VESA DPMS compatible monitors, and may not be
-supported by all video drivers.
-It is only enabled for screens that have the
-.B \*qDPMS\*q
-option set (see the MONITOR section below).
-.TP 7
-.BI "Option \*qSuspendTime\*q  \*q" time \*q
-sets the inactivity timeout for the
-.B suspend
-phase of DPMS mode.
-.I time
-is in minutes, and the value can be changed at run\-time with
-.BR xset(__appmansuffix__).
-Default: 10 minutes.
-This is only suitable for VESA DPMS compatible monitors, and may not be
-supported by all video drivers.
-It is only enabled for screens that have the
-.B \*qDPMS\*q
-option set (see the MONITOR section below).
-.TP 7
-.BI "Option \*qOffTime\*q  \*q" time \*q
-sets the inactivity timeout for the
-.B off
-phase of DPMS mode.
-.I time
-is in minutes, and the value can be changed at run\-time with
-.BR xset(__appmansuffix__).
-Default: 10 minutes.
-This is only suitable for VESA DPMS compatible monitors, and may not be
-supported by all video drivers.
-It is only enabled for screens that have the
-.B \*qDPMS\*q
-option set (see the MONITOR section below).
-.TP 7
-.BI "Option \*qPixmap\*q  \*q" bpp \*q
-This sets the pixmap format to use for depth 24.
-Allowed values for
-.I bpp
-are 24 and 32.
-Default: 32 unless driver constraints don't allow this (which is rare).
-Note: some clients don't behave well when this value is set to 24.
-.TP 7
-.BI "Option \*qPC98\*q  \*q" boolean \*q
-Specify that the machine is a Japanese PC\-98 machine.
-This should not be enabled for anything other than the Japanese\-specific
-PC\-98 architecture.
-Default: auto\-detected.
-.TP 7
-.BI "Option \*qNoPM\*q  \*q" boolean \*q
-Disables something to do with power management events.
-Default: PM enabled on platforms that support it.
-.TP 7
-.BI "Option \*qXinerama\*q  \*q" boolean \*q
-enable or disable XINERAMA extension.
-Default is disabled.
-.TP 7
-.BI "Option \*qAIGLX\*q \*q" boolean \*q
-enable or disable AIGLX. AIGLX is enabled by default.
-.TP 7
-.BI "Option \*qDRI2\*q \*q" boolean \*q
-enable or disable DRI2. DRI2 is disabled by default.
-.TP 7
-.BI "Option \*qGlxVisuals\*q \*q" string \*q
-This option controls how many GLX visuals the GLX modules sets up.
-The default value is
-.BR "typical" ,
-which will setup up a typical subset of
-the GLXFBConfigs provided by the driver as GLX visuals.  Other options are
-.BR "minimal" ,
-which will set up the minimal set allowed by the GLX specification and
-.BR "all"
-which will setup GLX visuals for all GLXFBConfigs.
-.TP 7
-.BI "Option \*qUseDefaultFontPath\*q \*q" boolean \*q
-Include the default font path even if other paths are specified in
-xorg.conf. If enabled, other font paths are included as well. Enabled by
-default.
-.TP 7
-.BI "Option \*qIgnoreABI\*q \*q" boolean \*q
-Allow modules built for a different, potentially incompatible version of
-the X server to load. Disabled by default.
-.TP 7
-.BI "Option \*qAutoAddDevices\*q \*q" boolean \*q
-If this option is disabled, then no devices will be added from HAL events.
-Enabled by default.
-.TP 7
-.BI "Option \*qAutoEnableDevices\*q \*q" boolean \*q
-If this option is disabled, then the devices will be added (and the
-DevicePresenceNotify event sent), but not enabled, thus leaving policy up
-to the client.
-Enabled by default.
-.TP 7
-.BI "Option \*qLog\*q \*q" string \*q
-This option controls whether the log is flushed and/or synced to disk after
-each message.
-Possible values are
-.B flush
-or
-.BR sync .
-Unset by default.
-.SH "MODULE SECTION"
-The
-.B Module
-section is used to specify which __xservername__ server modules should be loaded.
-This section is ignored when the __xservername__ server is built in static form.
-The type of modules normally loaded in this section are __xservername__ server
-extension modules.
-Most other module types are loaded automatically when they are needed via
-other mechanisms.
-The
-.B Module
-section is optional, as are all of the entries that may be specified in
-it.
-.PP
-Entries in this section may be in two forms.
-The first and most commonly used form is an entry that uses the
-.B Load
-keyword, as described here:
-.TP 7
-.BI "Load  \*q" modulename \*q
-This instructs the server to load the module called
-.IR modulename .
-The module name given should be the module's standard name, not the
-module file name.
-The standard name is case\-sensitive, and does not include the \(lqlib\(rq
-prefix, or the \(lq.a\(rq, \(lq.o\(rq, or \(lq.so\(rq suffixes.
-.PP
-.RS 7
-Example: the DRI extension module can be loaded with the following entry:
-.PP
-.RS 4
-.B "Load \*qdri\*q"
-.RE
-.RE
-.TP 7
-.BI "Disable  \*q" modulename \*q
-This instructs the server to not load the module called
-.IR modulename .
-Some modules are loaded by default in the server, and this overrides that
-default. If a
-.B Load
-instruction is given for the same module, it overrides the
-.B Disable
-instruction and the module is loaded. The module name given should be the
-module's standard name, not the module file name. As with the
-.B Load
-instruction, the standard name is case-sensitive, and does not include the
-"lib" prefix, or the ".a", ".o", or ".so" suffixes.
-.PP
-The second form of entry is a
-.BR SubSection,
-with the subsection name being the module name, and the contents of the
-.B SubSection
-being
-.B Options
-that are passed to the module when it is loaded.
-.PP
-Example: the extmod module (which contains a miscellaneous group of
-server extensions) can be loaded, with the XFree86\-DGA extension
-disabled by using the following entry:
-.PP
-.RS 4
-.nf
-.B "SubSection \*qextmod\*q"
-.B "   Option  \*qomit XFree86\-DGA\*q"
-.B EndSubSection
-.fi
-.RE
-.PP
-Modules are searched for in each directory specified in the
-.B ModulePath
-search path, and in the drivers, extensions, input, internal, and
-multimedia subdirectories of each of those directories.
-In addition to this, operating system specific subdirectories of all
-the above are searched first if they exist.
-.PP
-To see what extension modules are available, check the extensions
-subdirectory under:
-.PP
-.RS 4
-.nf
-__modulepath__
-.fi
-.RE
-.PP
-The \(lqextmod\(rq, \(lqdbe\(rq, \(lqdri\(rq, \(lqdri2\(rq, \(lqglx\(rq,
-and \(lqrecord\(rq extension modules are loaded automatically, if they
-are present, unless disabled with \*qDisable\*q entries.
-It is recommended
-that at very least the \(lqextmod\(rq extension module be loaded.
-If it isn't, some commonly used server extensions (like the SHAPE
-extension) will not be available.
-.SH "EXTENSIONS SECTION"
-The
-.B Extensions
-section is used to specify which X11 protocol extensions should be enabled
-or disabled.
-The
-.B Extensions
-section is optional, as are all of the entries that may be specified in
-it.
-.PP
-Entries in this section are listed as Option statements with the name of
-the extension as the first argument, and a boolean value as the second.
-The extension name is case\-sensitive, and matches the form shown in the output
-of \*qXorg -extension ?\*q.
-.PP
-.RS 7
-Example: the MIT-SHM extension can be disabled with the following entry:
-.PP
-.RS 4
-.nf
-.B "Section \*qExtensions\*q"
-.B "    Option \*qMIT-SHM\*q \*qDisable\*q"
-.B "EndSection"
-.fi
-.RE
-.RE
-.SH "INPUTDEVICE SECTION"
-The config file may have multiple
-.B InputDevice
-sections.
-Recent X servers employ input hotplugging to add input devices, with the HAL
-backend being the default backend for X servers since 1.4. It is usually not
-necessary to provide
-.B InputDevice
-sections in the xorg.conf if hotplugging is enabled.
-.PP
-If hotplugging is disabled, there will normally
-be at least two: one for the core (primary) keyboard
-and one for the core pointer.
-If either of these two is missing, a default configuration for the missing
-ones will be used. In the absence of an explicitly specified core input
-device, the first
-.B InputDevice
-marked as
-.B CorePointer
-(or
-.BR CoreKeyboard )
-is used.
-If there is no match there, the first
-.B InputDevice
-that uses the \(lqmouse\(rq (or \(lqkbd\(rq) driver is used.
-The final fallback is to use built\-in default configurations.
-Currently the default configuration may not work as expected on all platforms.
-.PP
-.B InputDevice
-sections have the following format:
-.PP
-.RS 4
-.nf
-.B  "Section \*qInputDevice\*q"
-.BI "    Identifier \*q" name \*q
-.BI "    Driver     \*q" inputdriver \*q
-.I  "    options"
-.I  "    ..."
-.B  "EndSection"
-.fi
-.RE
-.PP
-The
-.B Identifier
-and
-.B Driver
-entries are required in all
-.B InputDevice
-sections.
-All other entries are optional.
-.PP
-The
-.B Identifier
-entry specifies the unique name for this input device.
-The
-.B Driver
-entry specifies the name of the driver to use for this input device.
-When using the loadable server, the input driver module
-.RI \*q inputdriver \*q
-will be loaded for each active
-.B InputDevice
-section.
-An
-.B InputDevice
-section is considered active if it is referenced by an active
-.B ServerLayout
-section, if it is referenced by the
-.B \-keyboard
-or
-.B \-pointer
-command line options, or if it is selected implicitly as the core pointer
-or keyboard device in the absence of such explicit references.
-The most commonly used input drivers are
-.BR evdev (__drivermansuffix__)
-on Linux systems, and
-.BR kbd (__drivermansuffix__)
-and
-.BR mousedrv (__drivermansuffix__)
-on other platforms.
-.PP
-.PP
-.B InputDevice
-sections recognise some driver\-independent
-.BR Options ,
-which are described here.
-See the individual input driver manual pages for a description of the
-device\-specific options.
-.TP 7
-.BI "Option \*qAutoServerLayout\*q  \*q" boolean \*q
-Always add the device to the ServerLayout section used by this instance of
-the server. This affects implied layouts as well as explicit layouts
-specified in the configuration and/or on the command line.
-.TP 7
-.BI "Option \*qCorePointer\*q"
-Deprecated, see
-.B Floating
-.TP 7
-.BI "Option \*qCoreKeyboard\*q"
-Deprecated, see
-.B Floating
-.TP 7
-.BI "Option \*qAlwaysCore\*q  \*q" boolean \*q
-Deprecated, see
-.B Floating
-.TP 7
-.BI "Option \*qSendCoreEvents\*q  \*q" boolean \*q
-Deprecated, see
-.B Floating
-
-.TP 7
-.BI "Option \*qFloating\*q  \*q" boolean \*q
-When enabled, the input device is set up floating and does not
-report events through any master device or control a cursor. The device is
-only available to clients using the X Input Extension API. This option is
-disabled by default.
-The options
-.B CorePointer,
-.B CoreKeyboard,
-.B AlwaysCore,
-and
-.B SendCoreEvents,
-are the inverse of option
-.B Floating
-(i.e.
-.B SendCoreEvents \*qon\*q
-is equivalent to
-.B Floating \*qoff\*q
-).
-
-This option controls the startup behavior only, a device
-may be reattached or set floating at runtime.
-.PP
-For pointing devices, the following options control how the pointer
-is accelerated or decelerated with respect to physical device motion. Most of
-these can be adjusted at runtime, see the xinput(1) man page for details. Only
-the most important acceleration options are discussed here.
-.TP 7
-.BI "Option \*qAccelerationProfile\*q  \*q" integer \*q
-Select the profile. In layman's terms, the profile constitutes the "feeling" of
-the acceleration. More formally, it defines how the transfer function (actual
-acceleration as a function of current device velocity and acceleration controls)
-is constructed. This is mainly a matter of personal preference.
-.PP
-.RS 6
-.nf
-.B  " 0      classic (mostly compatible)"
-.B  "-1      none (only constant deceleration is applied)"
-.B  " 1      device-dependent"
-.B  " 2      polynomial (polynomial function)"
-.B  " 3      smooth linear (soft knee, then linear)"
-.B  " 4      simple (normal when slow, otherwise accelerated)"
-.B  " 5      power (power function)"
-.B  " 6      linear (more speed, more acceleration)"
-.B  " 7      limited (like linear, but maxes out at threshold)"
-.fi
-.RE
-.TP 7
-.BI "Option \*qConstantDeceleration\*q  \*q" real \*q
-Makes the pointer go
-.B deceleration
-times slower than normal. Most useful for high-resolution devices.
-.TP 7
-.BI "Option \*qAdaptiveDeceleration\*q  \*q" real \*q
-Allows to actually decelerate the pointer when going slow. At most, it will be
-.B adaptive deceleration
-times slower. Enables precise pointer placement without sacrificing speed.
-.TP 7
-.BI "Option \*qAccelerationScheme\*q  \*q" string \*q
-Selects the scheme, which is the underlying algorithm.
-.PP
-.RS 7
-.nf
-.B  "predictable   default algorithm (behaving more predictable)"
-.B  "lightweight   old acceleration code (as specified in the X protocol spec)"
-.B  "none          no acceleration or deceleration"
-.fi
-.RE
-.TP 7
-.BI "Option \*qAccelerationNumerator\*q  \*q" integer \*q
-.TP 7
-.BI "Option \*qAccelerationDenominator\*q  \*q" integer \*q
-Set numerator and denominator of the acceleration factor. The acceleration
-factor is a rational which, together with threshold, can be used to tweak
-profiles to suit the users needs. The
-.B simple
-and
-.B limited
-profiles use it directly (i.e. they accelerate by the factor), for other
-profiles it should hold that a higher acceleration factor leads to a faster
-pointer. Typically, 1 is unaccelerated and values up to 5 are sensible.
-.TP 7
-.BI "Option \*qAccelerationThreshold\*q  \*q" integer \*q
-Set the threshold, which is roughly the velocity (usually device units per 10
-ms) required for acceleration to become effective. The precise effect varies
-with the profile however.
-
-.SH "INPUTCLASS SECTION"
-The config file may have multiple
-.B InputClass
-sections.
-These sections are optional and are used to provide configuration for a
-class of input devices as they are automatically added. An input device can
-match more than one
-.B InputClass
-section. Each class can override settings from a previous class, so it is
-best to arrange the sections with the most generic matches first.
-.PP
-.B InputClass
-sections have the following format:
-.PP
-.RS 4
-.nf
-.B  "Section \*qInputClass\*q"
-.BI "    Identifier  \*q" name \*q
-.I  "    entries"
-.I  "    ..."
-.I  "    options"
-.I  "    ..."
-.B  "EndSection"
-.fi
-.RE
-.PP
-The
-.B Identifier
-entry is required in all
-.B InputClass
-sections.
-All other entries are optional.
-.PP
-The
-.B Identifier
-entry specifies the unique name for this input class.
-The
-.B Driver
-entry specifies the name of the driver to use for this input device.
-After all classes have been examined, the
-.RI \*q inputdriver \*q
-module from the first
-.B Driver
-entry will be enabled when using the loadable server.
-.PP
-When an input device is automatically added, its characteristics are
-checked against all
-.B InputClass
-sections. Each section can contain optional entries to narrow the match
-of the class. If none of the optional entries appear, the
-.B InputClass
-section is generic and will match any input device. If more than one of
-these entries appear, they all must match for the configuration to apply.
-.PP
-There are two types of match entries used in
-.B InputClass
-sections. The first allows various tokens to be matched against attributes
-of the device. An entry can be constructed to match attributes from different
-devices by separating arguments with a '|' character. Multiple entries of the
-same type may be supplied to add multiple matching conditions on the same
-attribute. For example:
-.PP
-.RS 4
-.nf
-.B  "Section \*qInputClass\*q"
-.B  "    Identifier   \*qMy Class\*q"
-.B  "    # product string must contain example and
-.B  "    # either gizmo or gadget
-.B  "    MatchProduct \*qexample\*q
-.B  "    MatchProduct \*qgizmo|gadget\*q
-.I  "    ..."
-.B  "EndSection"
-.fi
-.RE
-.TP 7
-.BI "MatchProduct  \*q" matchproduct \*q
-This entry can be used to check if the substring
-.RI \*q matchproduct \*q
-occurs in the device's product name.
-.TP 7
-.BI "MatchVendor  \*q" matchvendor \*q
-This entry can be used to check if the substring
-.RI \*q matchvendor \*q
-occurs in the device's vendor name.
-.TP 7
-.BI "MatchDevicePath \*q" matchdevice \*q
-This entry can be used to check if the device file matches the
-.RI \*q matchdevice \*q
-pathname pattern.
-.TP 7
-.BI "MatchOS \*q" matchos \*q
-This entry can be used to check if the operating system matches the
-case-insensitive
-.RI \*q matchos \*q
-string. This entry is only supported on platforms providing the
-.BR uname (2)
-system call.
-.TP 7
-.BI "MatchPnPID \*q" matchpnp \*q
-The device's Plug and Play (PnP) ID can be checked against the
-.RI \*q matchpnp \*q
-shell wildcard pattern.
-.TP 7
-.BI "MatchUSBID \*q" matchusb \*q
-The device's USB ID can be checked against the
-.RI \*q matchusb \*q
-shell wildcard pattern. The ID is constructed as lowercase hexadecimal numbers
-separated by a ':'. This is the same format as the
-.BR lsusb (8)
-program.
-.TP 7
-.BI "MatchDriver \*q" matchdriver \*q
-Check the case-sensitive string
-.RI \*q matchdriver \*q
-against the currently configured driver of the device. Ordering of sections
-using this entry is important since it will not match unless the driver has
-been set by the config backend or a previous
-.B InputClass
-section.
-.TP 7
-.BI "MatchTag \*q" matchtag \*q
-This entry can be used to check if tags assigned by the config backend
-matches the
-.RI \*q matchtag \*q
-pattern. A match is found if at least one of the tags given in
-.RI \*q matchtag \*q
-matches at least one of the tags assigned by the backend.
-.PP
-The second type of entry is used to match device types. These entries take a
-boolean argument similar to
-.B Option
-entries.
-.TP 7
-.BI "MatchIsKeyboard     \*q" bool \*q
-.TP 7
-.BI "MatchIsPointer      \*q" bool \*q
-.TP 7
-.BI "MatchIsJoystick     \*q" bool \*q
-.TP 7
-.BI "MatchIsTablet       \*q" bool \*q
-.TP 7
-.BI "MatchIsTouchpad     \*q" bool \*q
-.TP 7
-.BI "MatchIsTouchscreen  \*q" bool \*q
-.PP
-When an input device has been matched to the
-.B InputClass
-section, any
-.B Option
-entries are applied to the device. One
-.B InputClass
-specific
-.B Option
-is recognized. See the
-.B InputDevice
-section above for a description of the remaining
-.B Option
-entries.
-.TP 7
-.BI "Option \*qIgnore\*q \*q" boolean \*q
-This optional entry specifies that the device should be ignored entirely,
-and not added to the server. This can be useful when the device is handled
-by another program and no X events should be generated.
-.SH "DEVICE SECTION"
-The config file may have multiple
-.B Device
-sections.
-There must be at least one, for the video card being used.
-.PP
-.B Device
-sections have the following format:
-.PP
-.RS 4
-.nf
-.B  "Section \*qDevice\*q"
-.BI "    Identifier \*q" name \*q
-.BI "    Driver     \*q" driver \*q
-.I  "    entries"
-.I  "    ..."
-.B  "EndSection"
-.fi
-.RE
-.PP
-The
-.B Identifier
-and
-.B Driver
-entries are required in all
-.B Device
-sections.  All other entries are optional.
-.PP
-The
-.B Identifier
-entry specifies the unique name for this graphics device.
-The
-.B Driver
-entry specifies the name of the driver to use for this graphics device.
-When using the loadable server, the driver module
-.RI \*q driver \*q
-will be loaded for each active
-.B Device
-section.
-A
-.B Device
-section is considered active if it is referenced by an active
-.B Screen
-section.
-.PP
-.B Device
-sections recognise some driver\-independent entries and
-.BR Options ,
-which are described here.
-Not all drivers make use of these
-driver\-independent entries, and many of those that do don't require them
-to be specified because the information is auto\-detected.
-See the individual graphics driver manual pages for further information
-about this, and for a description of the device\-specific options.
-Note that most of the
-.B Options
-listed here (but not the other entries) may be specified in the
-.B Screen
-section instead of here in the
-.B Device
-section.
-.TP 7
-.BI "BusID  \*q" bus\-id \*q
-This specifies the bus location of the graphics card.
-For PCI/AGP cards,
-the
-.I bus\-id
-string has the form
-.BI PCI: bus : device : function
-(e.g., \(lqPCI:1:0:0\(rq might be appropriate for an AGP card).
-This field is usually optional in single-head configurations when using
-the primary graphics card.
-In multi-head configurations, or when using a secondary graphics card in a
-single-head configuration, this entry is mandatory.
-Its main purpose is to make an unambiguous connection between the device
-section and the hardware it is representing.
-This information can usually be found by running the pciaccess tool
-scanpci.
-.TP 7
-.BI "Screen  " number
-This option is mandatory for cards where a single PCI entity can drive more
-than one display (i.e., multiple CRTCs sharing a single graphics accelerator
-and video memory).
-One
-.B Device
-section is required for each head, and this
-parameter determines which head each of the
-.B Device
-sections applies to.
-The legal values of
-.I number
-range from 0 to one less than the total number of heads per entity.
-Most drivers require that the primary screen (0) be present.
-.TP 7
-.BI "Chipset  \*q" chipset \*q
-This usually optional entry specifies the chipset used on the graphics
-board.
-In most cases this entry is not required because the drivers will probe the
-hardware to determine the chipset type.
-Don't specify it unless the driver-specific documentation recommends that you
-do.
-.TP 7
-.BI "Ramdac  \*q" ramdac\-type \*q
-This optional entry specifies the type of RAMDAC used on the graphics
-board.
-This is only used by a few of the drivers, and in most cases it is not
-required because the drivers will probe the hardware to determine the
-RAMDAC type where possible.
-Don't specify it unless the driver-specific documentation recommends that you
-do.
-.TP 7
-.BI "DacSpeed  " speed
-.TP 7
-.BI "DacSpeed  " "speed\-8 speed\-16 speed\-24 speed\-32"
-This optional entry specifies the RAMDAC speed rating (which is usually
-printed on the RAMDAC chip).
-The speed is in MHz.
-When one value is given, it applies to all framebuffer pixel sizes.
-When multiple values are given, they apply to the framebuffer pixel sizes
-8, 16, 24 and 32 respectively.
-This is not used by many drivers, and only needs to be specified when the
-speed rating of the RAMDAC is different from the defaults built in to
-driver, or when the driver can't auto-detect the correct defaults.
-Don't specify it unless the driver-specific documentation recommends that you
-do.
-.TP 7
-.BI "Clocks  " "clock ..."
-specifies the pixel that are on your graphics board.
-The clocks are in MHz, and may be specified as a floating point number.
-The value is stored internally to the nearest kHz.
-The ordering of the clocks is important.
-It must match the order in which they are selected on the graphics board.
-Multiple
-.B Clocks
-lines may be specified, and each is concatenated to form the list.
-Most drivers do not use this entry, and it is only required for some older
-boards with non-programmable clocks.
-Don't specify this entry unless the driver-specific documentation explicitly
-recommends that you do.
-.TP
-.BI "ClockChip  \*q" clockchip\-type \*q
-This optional entry is used to specify the clock chip type on graphics
-boards which have a programmable clock generator.
-Only a few __xservername__ drivers support programmable clock chips.
-For details, see the appropriate driver manual page.
-.TP 7
-.BI "VideoRam  " "mem"
-This optional entry specifies the amount of video ram that is installed
-on the graphics board.
-This is measured in kBytes.
-In most cases this is not required because the __xservername__ server probes
-the graphics board to determine this quantity.
-The driver-specific documentation should indicate when it might be needed.
-.TP 7
-.BI "BiosBase  " "baseaddress"
-This optional entry specifies the base address of the video BIOS for
-the VGA board.
-This address is normally auto-detected, and should only be specified if the
-driver-specific documentation recommends it.
-.TP 7
-.BI "MemBase  " "baseaddress"
-This optional entry specifies the memory base address of a graphics
-board's linear frame buffer.
-This entry is not used by many drivers, and it should only be specified if
-the driver-specific documentation recommends it.
-.TP 7
-.BI "IOBase  " "baseaddress"
-This optional entry specifies the IO base address.
-This entry is not used by many drivers, and it should only be specified if
-the driver-specific documentation recommends it.
-.TP 7
-.BI "ChipID  " "id"
-This optional entry specifies a numerical ID representing the chip type.
-For PCI cards, it is usually the device ID.
-This can be used to override the auto-detection, but that should only be done
-when the driver-specific documentation recommends it.
-.TP 7
-.BI "ChipRev  " "rev"
-This optional entry specifies the chip revision number.
-This can be used to override the auto-detection, but that should only be done
-when the driver-specific documentation recommends it.
-.TP 7
-.BI "TextClockFreq  " "freq"
-This optional entry specifies the pixel clock frequency that is used
-for the regular text mode.
-The frequency is specified in MHz.
-This is rarely used.
-.TP 7
-.BI "Option \*qModeDebug\*q \*q" boolean \*q
-Enable printing of additional debugging information about modesetting to
-the server log.
-.ig
-.TP 7
-This optional entry allows an IRQ number to be specified.
-..
-.TP 7
-.B Options
-Option flags may be specified in the
-.B Device
-sections.
-These include driver\-specific options and driver\-independent options.
-The former are described in the driver\-specific documentation.
-Some of the latter are described below in the section about the
-.B Screen
-section, and they may also be included here.
-
-.SH "VIDEOADAPTOR SECTION"
-Nobody wants to say how this works.
-Maybe nobody knows ...
-
-.SH "MONITOR SECTION"
-The config file may have multiple
-.B Monitor
-sections.
-There should normally be at least one, for the monitor being used,
-but a default configuration will be created when one isn't specified.
-.PP
-.B Monitor
-sections have the following format:
-.PP
-.RS 4
-.nf
-.B  "Section \*qMonitor\*q"
-.BI "    Identifier \*q" name \*q
-.I  "    entries"
-.I  "    ..."
-.B  "EndSection"
-.fi
-.RE
-.PP
-The only mandatory entry in a
-.B Monitor
-section is the
-.B Identifier
-entry.
-.PP
-The
-.B Identifier
-entry specifies the unique name for this monitor.
-The
-.B Monitor
-section may be used to provide information about the specifications of the
-monitor, monitor-specific
-.BR Options ,
-and information about the video modes to use with the monitor.
-.PP
-With RandR 1.2-enabled drivers, monitor sections may be tied to specific
-outputs of the video card.  Using the name of the output defined by the video
-driver plus the identifier of a monitor section, one associates a monitor
-section with an output by adding an option to the Device section in the
-following format:
-
-.B Option \*qMonitor-outputname\*q \*qmonitorsection\*q
-
-(for example,
-.B Option \*qMonitor-VGA\*q \*qVGA monitor\*q
-for a VGA output)
-.PP
-In the absence of specific association of monitor sections to outputs, if a
-monitor section is present the server will associate it with an output to
-preserve compatibility for previous single-head configurations.
-.PP
-Specifying video modes is optional because the server will use the DDC or other
-information provided by the monitor to automatically configure the list of
-modes available.
-When modes are specified explicitly in the
-.B Monitor
-section (with the
-.BR Modes ,
-.BR ModeLine ,
-or
-.B UseModes
-keywords), built-in modes with the same names are not included.
-Built-in modes with different names are, however, still implicitly included,
-when they meet the requirements of the monitor.
-.PP
-The entries that may be used in
-.B Monitor
-sections are described below.
-.TP 7
-.BI "VendorName  \*q" vendor \*q
-This optional entry specifies the monitor's manufacturer.
-.TP 7
-.BI "ModelName  \*q" model \*q
-This optional entry specifies the monitor's model.
-.TP 7
-.BI "HorizSync  " "horizsync\-range"
-gives the range(s) of horizontal sync frequencies supported by the
-monitor.
-.I horizsync\-range
-may be a comma separated list of either discrete values or ranges of
-values.
-A range of values is two values separated by a dash.
-By default the values are in units of kHz.
-They may be specified in MHz or Hz
-if
-.B MHz
-or
-.B Hz
-is added to the end of the line.
-The data given here is used by the __xservername__ server to determine if video
-modes are within the specifications of the monitor.
-This information should be available in the monitor's handbook.
-If this entry is omitted, a default range of 28\-33kHz is used.
-.TP 7
-.BI "VertRefresh  " "vertrefresh\-range"
-gives the range(s) of vertical refresh frequencies supported by the
-monitor.
-.I vertrefresh\-range
-may be a comma separated list of either discrete values or ranges of
-values.
-A range of values is two values separated by a dash.
-By default the values are in units of Hz.
-They may be specified in MHz or kHz
-if
-.B MHz
-or
-.B kHz
-is added to the end of the line.
-The data given here is used by the __xservername__ server to determine if video
-modes are within the specifications of the monitor.
-This information should be available in the monitor's handbook.
-If this entry is omitted, a default range of 43\-72Hz is used.
-.TP 7
-.BI "DisplaySize  " "width height"
-This optional entry gives the width and height, in millimetres, of the
-picture area of the monitor.
-If given this is used to calculate the horizontal and vertical pitch (DPI) of
-the screen.
-.TP 7
-.BI "Gamma  " "gamma\-value"
-.TP 7
-.BI "Gamma  " "red\-gamma green\-gamma blue\-gamma"
-This is an optional entry that can be used to specify the gamma correction
-for the monitor.
-It may be specified as either a single value or as three separate RGB values.
-The values should be in the range 0.1 to 10.0, and the default is 1.0.
-Not all drivers are capable of using this information.
-.TP 7
-.BI "UseModes  \*q" modesection\-id \*q
-Include the set of modes listed in the
-.B Modes
-section called
-.IR modesection\-id.
-This makes all of the modes defined in that section available for use by
-this monitor.
-.TP 7
-.BI "Mode  \*q" name \*q
-This is an optional multi-line entry that can be used to provide
-definitions for video modes for the monitor.
-In most cases this isn't necessary because the built-in set of VESA standard
-modes will be sufficient.
-The
-.B Mode
-keyword indicates the start of a multi-line video mode description.
-The mode description is terminated with the
-.B EndMode
-keyword.
-The mode description consists of the following entries:
-.RS 7
-.TP 4
-.BI "DotClock  " clock
-is the dot (pixel) clock rate to be used for the mode.
-.TP 4
-.BI "HTimings  " "hdisp hsyncstart hsyncend htotal"
-specifies the horizontal timings for the mode.
-.TP 4
-.BI "VTimings  " "vdisp vsyncstart vsyncend vtotal"
-specifies the vertical timings for the mode.
-.TP 4
-.BI "Flags  \*q" flag \*q " ..."
-specifies an optional set of mode flags, each of which is a separate
-string in double quotes.
-.B \*qInterlace\*q
-indicates that the mode is interlaced.
-.B \*qDoubleScan\*q
-indicates a mode where each scanline is doubled.
-.B \*q+HSync\*q
-and
-.B \*q\-HSync\*q
-can be used to select the polarity of the HSync signal.
-.B \*q+VSync\*q
-and
-.B \*q\-VSync\*q
-can be used to select the polarity of the VSync signal.
-.B \*qComposite\*q
-can be used to specify composite sync on hardware where this is supported.
-Additionally, on some hardware,
-.B \*q+CSync\*q
-and
-.B \*q\-CSync\*q
-may be used to select the composite sync polarity.
-.TP 4
-.BI "HSkew  " hskew
-specifies the number of pixels (towards the right edge of the screen) by
-which the display enable signal is to be skewed.
-Not all drivers use this information.
-This option might become necessary to override the default value supplied
-by the server (if any).
-\(lqRoving\(rq horizontal lines indicate this value needs to be increased.
-If the last few pixels on a scan line appear on the left of the screen,
-this value should be decreased.
-.TP 4
-.BI "VScan  " vscan
-specifies the number of times each scanline is painted on the screen.
-Not all drivers use this information.
-Values less than 1 are treated as 1, which is the default.
-Generally, the
-.B \*qDoubleScan\*q
-.B Flag
-mentioned above doubles this value.
-.RE
-.TP 7
-.BI "ModeLine  \*q" name \*q " mode\-description"
-This entry is a more compact version of the
-.B Mode
-entry, and it also can be used to specify video modes for the monitor.
-is a single line format for specifying video modes.
-In most cases this isn't necessary because the built\-in set of VESA
-standard modes will be sufficient.
-.PP
-.RS 7
-The
-.I mode\-description
-is in four sections, the first three of which are mandatory.
-The first is the dot (pixel) clock.
-This is a single number specifying the pixel clock rate for the mode in
-MHz.
-The second section is a list of four numbers specifying the horizontal
-timings.
-These numbers are the
-.IR hdisp ,
-.IR hsyncstart ,
-.IR hsyncend ,
-and
-.I htotal
-values.
-The third section is a list of four numbers specifying the vertical
-timings.
-These numbers are the
-.IR vdisp ,
-.IR vsyncstart ,
-.IR vsyncend ,
-and
-.I vtotal
-values.
-The final section is a list of flags specifying other characteristics of
-the mode.
-.B Interlace
-indicates that the mode is interlaced.
-.B DoubleScan
-indicates a mode where each scanline is doubled.
-.B +HSync
-and
-.B \-HSync
-can be used to select the polarity of the HSync signal.
-.B +VSync
-and
-.B \-VSync
-can be used to select the polarity of the VSync signal.
-.B Composite
-can be used to specify composite sync on hardware where this is supported.
-Additionally, on some hardware,
-.B +CSync
-and
-.B \-CSync
-may be used to select the composite sync polarity.
-The
-.B HSkew
-and
-.B VScan
-options mentioned above in the
-.B Modes
-entry description can also be used here.
-.RE
-.TP 7
-.BI "Option " "\*qDPMS\*q  " \*qbool\*q
-This option controls whether the server should enable the DPMS extension
-for power management for this screen.  The default is to enable the
-extension.
-.TP 7
-.BI "Option " "\*qSyncOnGreen\*q  " \*qbool\*q
-This option controls whether the video card should drive the sync signal
-on the green color pin.  Not all cards support this option, and most
-monitors do not require it.  The default is off.
-.TP 7
-.BI "Option " "\*qPrimary\*q  " \*qbool\*q
-This optional entry specifies that the monitor should be treated as the primary
-monitor. (RandR 1.2-supporting drivers only)
-.TP 7
-.BI "Option " "\*qPreferredMode\*q  " \*qstring\*q
-This optional entry specifies a mode to be marked as the preferred initial mode
-of the monitor.
-(RandR 1.2-supporting drivers only)
-.TP 7
-.BI "Option " "\*qPosition\*q  " "\*qx y\*q"
-This optional entry specifies the position of the monitor within the X
-screen.
-(RandR 1.2-supporting drivers only)
-.TP 7
-.BI "Option " "\*qLeftOf\*q  " \*qoutput\*q
-This optional entry specifies that the monitor should be positioned to the
-left of the output (not monitor) of the given name.
-(RandR 1.2-supporting drivers only)
-.TP 7
-.BI "Option " "\*qRightOf\*q  " \*qoutput\*q
-This optional entry specifies that the monitor should be positioned to the
-right of the output (not monitor) of the given name.
-(RandR 1.2-supporting drivers only)
-.TP 7
-.BI "Option " "\*qAbove\*q  " \*qoutput\*q
-This optional entry specifies that the monitor should be positioned above the
-output (not monitor) of the given name.
-(RandR 1.2-supporting drivers only)
-.TP 7
-.BI "Option " "\*qBelow\*q  " \*qoutput\*q
-This optional entry specifies that the monitor should be positioned below the
-output (not monitor) of the given name.
-(RandR 1.2-supporting drivers only)
-.TP 7
-.BI "Option " "\*qEnable\*q  " \*qbool\*q
-This optional entry specifies whether the monitor should be turned on
-at startup.  By default, the server will attempt to enable all connected
-monitors.
-(RandR 1.2-supporting drivers only)
-.TP 7
-.BI "Option " "\*qDefaultModes\*q  " \*qbool\*q
-This optional entry specifies whether the server should add supported default
-modes to the list of modes offered on this monitor. By default, the server
-will add default modes; you should only disable this if you can guarantee
-that EDID will be available at all times, or if you have added custom modelines
-which the server can use.
-(RandR 1.2-supporting drivers only)
-.TP 7
-.BI "Option " "\*qMinClock\*q  " \*qfrequency\*q
-This optional entry specifies the minimum dot clock, in kHz, that is supported
-by the monitor.
-.TP 7
-.BI "Option " "\*qMaxClock\*q  " \*qfrequency\*q
-This optional entry specifies the maximum dot clock, in kHz, that is supported
-by the monitor.
-.TP 7
-.BI "Option " "\*qIgnore\*q  " \*qbool\*q
-This optional entry specifies that the monitor should be ignored entirely,
-and not reported through RandR.  This is useful if the hardware reports the
-presence of outputs that don't exist.
-(RandR 1.2-supporting drivers only)
-.TP 7
-.BI "Option " "\*qRotate\*q  " \*qrotation\*q
-This optional entry specifies the initial rotation of the given monitor.
-Valid values for rotation are \*qnormal\*q, \*qleft\*q, \*qright\*q, and
-\*qinverted\*q.
-(RandR 1.2-supporting drivers only)
-
-.SH "MODES SECTION"
-The config file may have multiple
-.B Modes
-sections, or none.
-These sections provide a way of defining sets of video modes independently
-of the
-.B Monitor
-sections.
-.B Monitor
-sections may include the definitions provided in these sections by
-using the
-.B UseModes
-keyword.
-In most cases the
-.B Modes
-sections are not necessary because the built\-in set of VESA standard modes
-will be sufficient.
-.PP
-.B Modes
-sections have the following format:
-.PP
-.RS 4
-.nf
-.B  "Section \*qModes\*q"
-.BI "    Identifier \*q" name \*q
-.I  "    entries"
-.I  "    ..."
-.B  "EndSection"
-.fi
-.RE
-.PP
-The
-.B Identifier
-entry specifies the unique name for this set of mode descriptions.
-The other entries permitted in
-.B Modes
-sections are the
-.B Mode
-and
-.B ModeLine
-entries that are described above in the
-.B Monitor
-section.
-.SH "SCREEN SECTION"
-The config file may have multiple
-.B Screen
-sections.
-There must be at least one, for the \(lqscreen\(rq being used.
-A \(lqscreen\(rq represents the binding of a graphics device
-.RB ( Device
-section) and a monitor
-.RB ( Monitor
-section).
-A
-.B Screen
-section is considered \(lqactive\(rq if it is referenced by an active
-.B ServerLayout
-section or by the
-.B \-screen
-command line option.
-If neither of those is present, the first
-.B Screen
-section found in the config file is considered the active one.
-.PP
-.B Screen
-sections have the following format:
-.PP
-.RS 4
-.nf
-.B  "Section \*qScreen\*q"
-.BI "    Identifier \*q" name \*q
-.BI "    Device     \*q" devid \*q
-.BI "    Monitor    \*q" monid \*q
-.I  "    entries"
-.I  "    ..."
-.BI "    SubSection \*qDisplay\*q"
-.I  "       entries"
-.I  "       ...
-.B  "    EndSubSection"
-.I  "    ..."
-.B  "EndSection"
-.fi
-.RE
-.PP
-The
-.B Identifier
-and
-.B Device
-entries are mandatory.
-All others are optional.
-.PP
-The
-.B Identifier
-entry specifies the unique name for this screen.
-The
-.B Screen
-section provides information specific to the whole screen, including
-screen\-specific
-.BR Options .
-In multi\-head configurations, there will be multiple active
-.B Screen
-sections, one for each head.
-The entries available
-for this section are:
-.TP 7
-.BI "Device  \*q" device\-id \*q
-This mandatory entry specifies the
-.B Device
-section to be used for this screen.
-This is what ties a specific graphics card to a screen.
-The
-.I device\-id
-must match the
-.B Identifier
-of a
-.B Device
-section in the config file.
-.TP 7
-.BI "Monitor  \*q" monitor\-id \*q
-specifies which monitor description is to be used for this screen.
-If a
-.B Monitor
-name is not specified, a default configuration is used.
-Currently the default configuration may not function as expected on all
-platforms.
-.TP 7
-.BI "VideoAdaptor  \*q" xv\-id \*q
-specifies an optional Xv video adaptor description to be used with this
-screen.
-.TP 7
-.BI "DefaultDepth  " depth
-specifies which color depth the server should use by default.
-The
-.B \-depth
-command line option can be used to override this.
-If neither is specified, the default depth is driver\-specific, but in most
-cases is 8.
-.TP 7
-.BI "DefaultFbBpp  " bpp
-specifies which framebuffer layout to use by default.
-The
-.B \-fbbpp
-command line option can be used to override this.
-In most cases the driver will chose the best default value for this.
-The only case where there is even a choice in this value is for depth 24,
-where some hardware supports both a packed 24 bit framebuffer layout and a
-sparse 32 bit framebuffer layout.
-.TP 7
-.B Options
-Various
-.B Option
-flags may be specified in the
-.B Screen
-section.
-Some are driver\-specific and are described in the driver documentation.
-Others are driver\-independent, and will eventually be described here.
-.\" XXX These should really be in an xaa man page.
-.TP 7
-.BI "Option \*qAccel\*q"
-Enables XAA (X Acceleration Architecture), a mechanism that makes video cards'
-2D hardware acceleration available to the  __xservername__ server.
-This option is on by default, but it may be necessary to turn it off if
-there are bugs in the driver.
-There are many options to disable specific accelerated operations, listed
-below.
-Note that disabling an operation will have no effect if the operation is
-not accelerated (whether due to lack of support in the hardware or in the
-driver).
-.TP 7
-.BI "Option \*qInitPrimary\*q \*q" boolean \*q
-Use the Int10 module to initialize the primary graphics card.
-Normally, only secondary cards are soft-booted using the Int10 module, as the
-primary card has already been initialized by the BIOS at boot time.
-Default: false.
-.TP 7
-.BI "Option \*qNoInt10\*q \*q" boolean \*q
-Disables the Int10 module, a module that uses the int10 call to the BIOS
-of the graphics card to initialize it.
-Default: false.
-.TP 7
-.BI "Option \*qNoMTRR\*q"
-Disables MTRR (Memory Type Range Register) support, a feature of modern
-processors which can improve video performance by a factor of up to 2.5.
-Some hardware has buggy MTRR support, and some video drivers have been
-known to exhibit problems when MTRR's are used.
-.TP 7
-.BI "Option \*qXaaNoCPUToScreenColorExpandFill\*q"
-Disables accelerated rectangular expansion blits from source patterns
-stored in system memory (using a memory\-mapped aperture).
-.TP 7
-.BI "Option \*qXaaNoColor8x8PatternFillRect\*q"
-Disables accelerated fills of a rectangular region with a full\-color
-pattern.
-.TP 7
-.BI "Option \*qXaaNoColor8x8PatternFillTrap\*q"
-Disables accelerated fills of a trapezoidal region with a full\-color
-pattern.
-.TP 7
-.BI "Option \*qXaaNoDashedBresenhamLine\*q"
-Disables accelerated dashed Bresenham line draws.
-.TP 7
-.BI "Option \*qXaaNoDashedTwoPointLine\*q"
-Disables accelerated dashed line draws between two arbitrary points.
-.TP 7
-.BI "Option \*qXaaNoImageWriteRect\*q"
-Disables accelerated transfers of full\-color rectangular patterns from
-system memory to video memory (using a memory\-mapped aperture).
-.TP 7
-.BI "Option \*qXaaNoMono8x8PatternFillRect\*q"
-Disables accelerated fills of a rectangular region with a monochrome
-pattern.
-.TP 7
-.BI "Option \*qXaaNoMono8x8PatternFillTrap\*q"
-Disables accelerated fills of a trapezoidal region with a monochrome
-pattern.
-.TP 7
-.BI "Option \*qXaaNoOffscreenPixmaps\*q"
-Disables accelerated draws into pixmaps stored in offscreen video memory.
-.TP 7
-.BI "Option \*qXaaNoPixmapCache\*q"
-Disables caching of patterns in offscreen video memory.
-.TP 7
-.BI "Option \*qXaaNoScanlineCPUToScreenColorExpandFill\*q"
-Disables accelerated rectangular expansion blits from source patterns
-stored in system memory (one scan line at a time).
-.TP 7
-.BI "Option \*qXaaNoScanlineImageWriteRect\*q"
-Disables accelerated transfers of full\-color rectangular patterns from
-system memory to video memory (one scan line at a time).
-.TP 7
-.BI "Option \*qXaaNoScreenToScreenColorExpandFill\*q"
-Disables accelerated rectangular expansion blits from source patterns
-stored in offscreen video memory.
-.TP 7
-.BI "Option \*qXaaNoScreenToScreenCopy\*q"
-Disables accelerated copies of rectangular regions from one part of
-video memory to another part of video memory.
-.TP 7
-.BI "Option \*qXaaNoSolidBresenhamLine\*q"
-Disables accelerated solid Bresenham line draws.
-.TP 7
-.BI "Option \*qXaaNoSolidFillRect\*q"
-Disables accelerated solid\-color fills of rectangles.
-.TP 7
-.BI "Option \*qXaaNoSolidFillTrap\*q"
-Disables accelerated solid\-color fills of Bresenham trapezoids.
-.TP 7
-.BI "Option \*qXaaNoSolidHorVertLine\*q"
-Disables accelerated solid horizontal and vertical line draws.
-.TP 7
-.BI "Option \*qXaaNoSolidTwoPointLine\*q"
-Disables accelerated solid line draws between two arbitrary points.
-.PP
-Each
-.B Screen
-section may optionally contain one or more
-.B Display
-subsections.
-Those subsections provide depth/fbbpp specific configuration information,
-and the one chosen depends on the depth and/or fbbpp that is being used for
-the screen.
-The
-.B Display
-subsection format is described in the section below.
-
-.SH "DISPLAY SUBSECTION"
-Each
-.B Screen
-section may have multiple
-.B Display
-subsections.
-The \(lqactive\(rq
-.B Display
-subsection is the first that matches the depth and/or fbbpp values being
-used, or failing that, the first that has neither a depth or fbbpp value
-specified.
-The
-.B Display
-subsections are optional.
-When there isn't one that matches the depth and/or fbbpp values being used,
-all the parameters that can be specified here fall back to their defaults.
-.PP
-.B Display
-subsections have the following format:
-.PP
-.RS 4
-.nf
-.B  "    SubSection \*qDisplay\*q"
-.BI "        Depth  " depth
-.I  "        entries"
-.I  "        ..."
-.B  "    EndSubSection"
-.fi
-.RE
-.TP 7
-.BI "Depth  " depth
-This entry specifies what colour depth the
-.B Display
-subsection is to be used for.
-This entry is usually specified, but it may be omitted to create a match\-all
-.B Display
-subsection or when wishing to match only against the
-.B FbBpp
-parameter.
-The range of
-.I depth
-values that are allowed depends on the driver.
-Most drivers support 8, 15, 16 and 24.
-Some also support 1 and/or 4, and some may support other values (like 30).
-Note:
-.I depth
-means the number of bits in a pixel that are actually used to determine
-the pixel colour.
-32 is not a valid
-.I depth
-value.
-Most hardware that uses 32 bits per pixel only uses 24 of them to hold the
-colour information, which means that the colour depth is 24, not 32.
-.TP 7
-.BI "FbBpp  " bpp
-This entry specifies the framebuffer format this
-.B Display
-subsection is to be used for.
-This entry is only needed when providing depth 24 configurations that allow
-a choice between a 24 bpp packed framebuffer format and a 32bpp sparse
-framebuffer format.
-In most cases this entry should not be used.
-.TP 7
-.BI "Weight  " "red\-weight green\-weight blue\-weight"
-This optional entry specifies the relative RGB weighting to be used
-for a screen is being used at depth 16 for drivers that allow multiple
-formats.
-This may also be specified from the command line with the
-.B \-weight
-option (see
-.BR __xservername__(__appmansuffix__)).
-.TP 7
-.BI "Virtual  " "xdim ydim"
-This optional entry specifies the virtual screen resolution to be used.
-.I xdim
-must be a multiple of either 8 or 16 for most drivers, and a multiple
-of 32 when running in monochrome mode.
-The given value will be rounded down if this is not the case.
-Video modes which are too large for the specified virtual size will be
-rejected.
-If this entry is not present, the virtual screen resolution will be set to
-accommodate all the valid video modes given in the
-.B Modes
-entry.
-Some drivers/hardware combinations do not support virtual screens.
-Refer to the appropriate driver\-specific documentation for details.
-.TP 7
-.BI "ViewPort  " "x0 y0"
-This optional entry sets the upper left corner of the initial display.
-This is only relevant when the virtual screen resolution is different
-from the resolution of the initial video mode.
-If this entry is not given, then the initial display will be centered in
-the virtual display area.
-.TP 7
-.BI "Modes  \*q" mode\-name \*q " ..."
-This optional entry specifies the list of video modes to use.
-Each
-.I mode\-name
-specified must be in double quotes.
-They must correspond to those specified or referenced in the appropriate
-.B Monitor
-section (including implicitly referenced built\-in VESA standard modes).
-The server will delete modes from this list which don't satisfy various
-requirements.
-The first valid mode in this list will be the default display mode for
-startup.
-The list of valid modes is converted internally into a circular list.
-It is possible to switch to the next mode with
-.B Ctrl+Alt+Keypad\-Plus
-and to the previous mode with
-.BR Ctrl+Alt+Keypad\-Minus .
-When this entry is omitted, the valid modes referenced by the appropriate
-.B Monitor
-section will be used.  If the
-.B Monitor
-section contains no modes, then the selection will be taken from the
-built-in VESA standard modes.
-.TP 7
-.BI "Visual  \*q" visual\-name \*q
-This optional entry sets the default root visual type.
-This may also be specified from the command line (see the
-.BR Xserver(__appmansuffix__)
-man page).
-The visual types available for depth 8 are (default is
-.BR PseudoColor ):
-.PP
-.RS 11
-.nf
-.B StaticGray
-.B GrayScale
-.B StaticColor
-.B PseudoColor
-.B TrueColor
-.B DirectColor
-.fi
-.RE
-.PP
-.RS 7
-The visual type available for the depths 15, 16 and 24 are (default is
-.BR TrueColor ):
-.PP
-.RS 4
-.nf
-.B TrueColor
-.B DirectColor
-.fi
-.RE
-.PP
-Not all drivers support
-.B DirectColor
-at these depths.
-.PP
-The visual types available for the depth 4 are (default is
-.BR StaticColor ):
-.PP
-.RS 4
-.nf
-.B StaticGray
-.B GrayScale
-.B StaticColor
-.B PseudoColor
-.fi
-.RE
-.PP
-The visual type available for the depth 1 (monochrome) is
-.BR StaticGray .
-.RE
-.TP 7
-.BI "Black  " "red green blue"
-This optional entry allows the \(lqblack\(rq colour to be specified.
-This is only supported at depth 1.
-The default is black.
-.TP 7
-.BI "White  " "red green blue"
-This optional entry allows the \(lqwhite\(rq colour to be specified.
-This is only supported at depth 1.
-The default is white.
-.TP 7
-.B Options
-Option flags may be specified in the
-.B Display
-subsections.
-These may include driver\-specific options and driver\-independent options.
-The former are described in the driver\-specific documentation.
-Some of the latter are described above in the section about the
-.B Screen
-section, and they may also be included here.
-.SH "SERVERLAYOUT SECTION"
-The config file may have multiple
-.B ServerLayout
-sections.
-A \(lqserver layout\(rq represents the binding of one or more screens
-.RB ( Screen
-sections) and one or more input devices
-.RB ( InputDevice
-sections) to form a complete configuration.
-In multi\-head configurations, it also specifies the relative layout of the
-heads.
-A
-.B ServerLayout
-section is considered \(lqactive\(rq if it is referenced by the
-.B \-layout
-command line option or by an
-.B "Option \*qDefaultServerLayout\*q"
-entry in the
-.B ServerFlags
-section (the former takes precedence over the latter).
-If those options are not used, the first
-.B ServerLayout
-section found in the config file is considered the active one.
-If no
-.B ServerLayout
-sections are present, the single active screen and two active (core)
-input devices are selected as described in the relevant sections above.
-.PP
-.B ServerLayout
-sections have the following format:
-.PP
-.RS 4
-.nf
-.B  "Section \*qServerLayout\*q"
-.BI "    Identifier   \*q" name \*q
-.BI "    Screen       \*q" screen\-id \*q
-.I  "    ..."
-.BI "    InputDevice  \*q" idev\-id \*q
-.I  "    ..."
-.I  "    options"
-.I  "    ..."
-.B  "EndSection"
-.fi
-.RE
-.PP
-Each
-.B ServerLayout
-section must have an
-.B Identifier
-entry and at least one
-.B Screen
-entry.
-.PP
-The
-.B Identifier
-entry specifies the unique name for this server layout.
-The
-.B ServerLayout
-section provides information specific to the whole session, including
-session\-specific
-.BR Options .
-The
-.B ServerFlags
-options (described above) may be specified here, and ones given here
-override those given in the
-.B ServerFlags
-section.
-.PP
-The entries that may be used in this section are described here.
-.TP 7
-.BI "Screen  " "screen\-num" " \*qscreen\-id\*q " "position\-information"
-One of these entries must be given for each screen being used in
-a session.
-The
-.I screen\-id
-field is mandatory, and specifies the
-.B Screen
-section being referenced.
-The
-.I screen\-num
-field is optional, and may be used to specify the screen number
-in multi\-head configurations.
-When this field is omitted, the screens will be numbered in the order that
-they are listed in.
-The numbering starts from 0, and must be consecutive.
-The
-.I position\-information
-field describes the way multiple screens are positioned.
-There are a number of different ways that this information can be provided:
-.RS 7
-.TP 4
-.I  "x y"
-.TP 4
-.BI "Absolute  " "x y"
-These both specify that the upper left corner's coordinates are
-.RI ( x , y ).
-The
-.B Absolute
-keyword is optional.
-Some older versions of XFree86 (4.2 and earlier) don't recognise the
-.B Absolute
-keyword, so it's safest to just specify the coordinates without it.
-.TP 4
-.BI "RightOf   \*q" screen\-id \*q
-.TP 4
-.BI "LeftOf    \*q" screen\-id \*q
-.TP 4
-.BI "Above     \*q" screen\-id \*q
-.TP 4
-.BI "Below     \*q" screen\-id \*q
-.TP 4
-.BI "Relative  \*q" screen\-id \*q " x y"
-These give the screen's location relative to another screen.
-The first four position the screen immediately to the right, left, above or
-below the other screen.
-When positioning to the right or left, the top edges are aligned.
-When positioning above or below, the left edges are aligned.
-The
-.B Relative
-form specifies the offset of the screen's origin (upper left corner)
-relative to the origin of another screen.
-.RE
-.TP 7
-.BI "InputDevice  \*q" idev\-id "\*q \*q" option \*q " ..."
-One of these entries should be given for each input device being used in
-a session.
-Normally at least two are required, one each for the core pointer and
-keyboard devices.
-If either of those is missing, suitable
-.B InputDevice
-entries are searched for using the method described above in the
-.B INPUTDEVICE
-section.  The
-.I idev\-id
-field is mandatory, and specifies the name of the
-.B InputDevice
-section being referenced.
-Multiple
-.I option
-fields may be specified, each in double quotes.
-The options permitted here are any that may also be given in the
-.B InputDevice
-sections.
-Normally only session\-specific input device options would be used here.
-The most commonly used options are:
-.PP
-.RS 11
-.nf
-.B \*qCorePointer\*q
-.B \*qCoreKeyboard\*q
-.B \*qSendCoreEvents\*q
-.fi
-.RE
-.PP
-.RS 7
-and the first two should normally be used to indicate the core pointer
-and core keyboard devices respectively.
-.RE
-.TP 7
-.B Options
-In addition to the following, any option permitted in the
-.B ServerFlags
-section may also be specified here.
-When the same option appears in both places, the value given here overrides
-the one given in the
-.B ServerFlags
-section.
-.TP 7
-.BI "Option \*qIsolateDevice\*q  \*q" bus\-id \*q
-Restrict device resets to the specified
-.IR bus\-id .
-See the
-.B BusID
-option (described in
-.BR "DEVICE SECTION" ,
-above) for the format of the
-.I bus\-id
-parameter.
-This option overrides
-.BR SingleCard ,
-if specified.
-At present, only PCI devices can be isolated in this manner.
-.TP 7
-.BI "Option \*qSingleCard\*q  \*q" boolean \*q
-As
-.BR IsolateDevice ,
-except that the bus ID of the first device in the layout is used.
-.PP
-Here is an example of a
-.B ServerLayout
-section for a dual headed configuration with two mice:
-.PP
-.RS 4
-.nf
-.B "Section \*qServerLayout\*q"
-.B "    Identifier  \*qLayout 1\*q"
-.B "    Screen      \*qMGA 1\*q"
-.B "    Screen      \*qMGA 2\*q RightOf \*qMGA 1\*q"
-.B "    InputDevice \*qKeyboard 1\*q \*qCoreKeyboard\*q"
-.B "    InputDevice \*qMouse 1\*q    \*qCorePointer\*q"
-.B "    InputDevice \*qMouse 2\*q    \*qSendCoreEvents\*q"
-.B "    Option      \*qBlankTime\*q  \*q5\*q"
-.B "EndSection"
-.fi
-.RE
-.SH "DRI SECTION"
-This optional section is used to provide some information for the
-Direct Rendering Infrastructure.
-Details about the format of this section can be found on-line at
-.IR <http://dri.freedesktop.org/> .
-.SH "VENDOR SECTION"
-The optional
-.B Vendor
-section may be used to provide vendor\-specific configuration information.
-Multiple
-.B Vendor
-sections may be present, and they may contain an
-.B Identifier
-entry and multiple
-.B Option
-flags.
-The data therein is not used in this release.
-.PP
-.SH "SEE ALSO"
-General:
-.BR X (__miscmansuffix__),
-.BR Xserver (__appmansuffix__),
-.BR __xservername__ (__appmansuffix__),
-.BR cvt (__appmansuffix__),
-.BR gtf (__appmansuffix__).
-.PP
-.B "Not all modules or interfaces are available on all platforms."
-.PP
-Display drivers:
-.BR apm (__drivermansuffix__),
-.BR ati (__drivermansuffix__),
-.BR chips (__drivermansuffix__),
-.BR cirrus (__drivermansuffix__),
-.BR cyrix (__drivermansuffix__),
-.BR fbdev (__drivermansuffix__),
-.BR glide (__drivermansuffix__),
-.BR glint (__drivermansuffix__),
-.BR i128 (__drivermansuffix__),
-.BR i740 (__drivermansuffix__),
-.BR imstt (__drivermansuffix__),
-.BR intel (__drivermansuffix__),
-.BR mga (__drivermansuffix__),
-.BR neomagic (__drivermansuffix__),
-.BR nv (__drivermansuffix__),
-.BR openchrome (__drivermansuffix__),
-.BR r128 (__drivermansuffix__),
-.BR radeon (__drivermansuffix__),
-.BR rendition (__drivermansuffix__),
-.BR savage (__drivermansuffix__),
-.BR s3virge (__drivermansuffix__),
-.BR siliconmotion (__drivermansuffix__),
-.BR sis (__drivermansuffix__),
-.BR sisusb (__drivermansuffix__),
-.BR sunbw2 (__drivermansuffix__),
-.BR suncg14 (__drivermansuffix__),
-.BR suncg3 (__drivermansuffix__),
-.BR suncg6 (__drivermansuffix__),
-.BR sunffb (__drivermansuffix__),
-.BR sunleo (__drivermansuffix__),
-.BR suntcx (__drivermansuffix__),
-.BR tdfx (__drivermansuffix__),
-.\" .BR tga (__drivermansuffix__),
-.BR trident (__drivermansuffix__),
-.BR tseng (__drivermansuffix__),
-.BR vesa (__drivermansuffix__),
-.BR vmware (__drivermansuffix__),
-.BR voodoo (__drivermansuffix__),
-.BR wsfb (__drivermansuffix__),
-.BR xgi (__drivermansuffix__),
-.BR xgixp (__drivermansuffix__).
-.PP
-Input drivers:
-.BR acecad (__drivermansuffix__),
-.BR citron (__drivermansuffix__),
-.BR elographics (__drivermansuffix__),
-.BR evdev (__drivermansuffix__),
-.BR fpit (__drivermansuffix__),
-.BR joystick (__drivermansuffix__),
-.BR kbd (__drivermansuffix__),
-.BR mousedrv (__drivermansuffix__),
-.BR mutouch (__drivermansuffix__),
-.BR penmount (__drivermansuffix__),
-.BR synaptics (__drivermansuffix__),
-.BR vmmouse (__drivermansuffix__),
-.BR void (__drivermansuffix__),
-.BR wacom (__drivermansuffix__).
-.PP
-Other modules and interfaces:
-.BR exa (__drivermansuffix__),
-.BR fbdevhw (__drivermansuffix__),
-.\" .BR shadowfb (__drivermansuffix__),
-.BR v4l (__drivermansuffix__).
-.br
-.SH AUTHORS
-This manual page was largely rewritten by David Dawes
-.IR <dawes at xfree86.org> .
commit dcdd8ea82c0e2f657abdc80a22aa0c01ead07e54
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Sun Jan 9 20:27:45 2011 -0500

    Xorg.man: fix whitespace issues
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/doc/man/Xorg.man.pre b/hw/xfree86/doc/man/Xorg.man.pre
index 86e89a9..6fa334c 100644
--- a/hw/xfree86/doc/man/Xorg.man.pre
+++ b/hw/xfree86/doc/man/Xorg.man.pre
@@ -15,7 +15,7 @@ is a full featured X server that was originally designed for UNIX and
 UNIX-like operating systems running on Intel x86 hardware.  It now runs
 on a wider range of hardware and OS platforms.
 .PP
-This work was derived by the X.Org Foundation from the XFree86 Project's 
+This work was derived by the X.Org Foundation from the XFree86 Project's
 .I "XFree86\ 4.4rc2"
 release.
 The XFree86 release was originally derived from
@@ -117,13 +117,13 @@ one way, the highest precedence mechanism is used.  The list of mechanisms
 is ordered from highest precedence to lowest.  Note that not all parameters
 can be supplied via all methods.  The available command line options
 and environment variables (and some defaults) are described here and in
-the Xserver(__appmansuffix__) manual page.  Most configuration file 
+the Xserver(__appmansuffix__) manual page.  Most configuration file
 parameters, with their defaults, are described in the
-__xconfigfile__(__filemansuffix__) manual page.  Driver and module specific 
-configuration parameters are described in the relevant driver or module 
+__xconfigfile__(__filemansuffix__) manual page.  Driver and module specific
+configuration parameters are described in the relevant driver or module
 manual page.
 .PP
-In addition to the normal server options described in the 
+In addition to the normal server options described in the
 Xserver(__appmansuffix__) manual page,
 .B __xservername__
 accepts the following command line switches:
@@ -673,7 +673,7 @@ information can be found from the X.Org web site
 .PP
 .B __xservername__
 is copyright software, provided under licenses that permit modification
-and redistribution in source and binary form without fee.  
+and redistribution in source and binary form without fee.
 .B __xservername__ is copyright by numerous authors and
 contributors from around the world.  Licensing information can be found
 at
@@ -684,6 +684,6 @@ Refer to the source code for specific copyright notices.
 is a trademark of The XFree86 Project, Inc.
 .PP
 .B X11(TM)
-and 
+and
 .B X Window System(TM)
 are trademarks of The Open Group.
commit d9225b9602c85603ae616a7381c784f5cf5e811c
Author: Julien Cristau <jcristau at debian.org>
Date:   Wed Nov 10 22:39:54 2010 +0100

    glx: validate numAttribs field before using it
    
    Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Julien Cristau <jcristau at debian.org>

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 566dbbe..3ef567d 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1283,6 +1283,11 @@ int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
     __GLXscreen *pGlxScreen;
     int err;
 
+    REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq);
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
     REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3);
 
     if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
@@ -1396,6 +1401,11 @@ int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
     CARD32			*attrs;
     int				 width, height, i;
 
+    REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq);
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
     REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3);
 
     attrs = (CARD32 *) (req + 1);
@@ -1483,6 +1493,11 @@ int __glXDisp_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
     xGLXChangeDrawableAttributesReq *req =
 	(xGLXChangeDrawableAttributesReq *) pc;
 
+    REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq);
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
     REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3);
 
     return DoChangeDrawableAttributes(cl->client, req->drawable,
@@ -1495,6 +1510,11 @@ int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
     xGLXChangeDrawableAttributesSGIXReq *req =
 	(xGLXChangeDrawableAttributesSGIXReq *)pc;
 
+    REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq);
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
     REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3);
 
     return DoChangeDrawableAttributes(cl->client, req->drawable,
@@ -1510,6 +1530,11 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
     DrawablePtr		 pDraw;
     int			 err;
 
+    REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq);
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
     REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3);
 
     LEGAL_NEW_RESOURCE(req->glxwindow, client);
diff --git a/glx/glxcmdsswap.c b/glx/glxcmdsswap.c
index 87bf75b..3bb4cad 100644
--- a/glx/glxcmdsswap.c
+++ b/glx/glxcmdsswap.c
@@ -319,6 +319,10 @@ int __glXDispSwap_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
     __GLX_SWAP_INT(&req->glxpixmap);
     __GLX_SWAP_INT(&req->numAttribs);
 
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
     REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
     __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
@@ -400,6 +404,10 @@ int __glXDispSwap_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
     __GLX_SWAP_INT(&req->pbuffer);
     __GLX_SWAP_INT(&req->numAttribs);
 
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
     REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
     __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
@@ -464,6 +472,10 @@ int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
     __GLX_SWAP_INT(&req->drawable);
     __GLX_SWAP_INT(&req->numAttribs);
 
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
     REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
     __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
@@ -486,6 +498,10 @@ int __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState *cl,
     __GLX_SWAP_INT(&req->drawable);
     __GLX_SWAP_INT(&req->numAttribs);
 
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
     REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
     __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
@@ -509,6 +525,10 @@ int __glXDispSwap_CreateWindow(__GLXclientState *cl, GLbyte *pc)
     __GLX_SWAP_INT(&req->glxwindow);
     __GLX_SWAP_INT(&req->numAttribs);
 
+    if (req->numAttribs > (UINT32_MAX >> 3)) {
+	client->errorValue = req->numAttribs;
+	return BadValue;
+    }
     REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
     __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
commit 62319e8381ebd645ae36b25e5fc3c0e9b098387b
Author: Julien Cristau <jcristau at debian.org>
Date:   Sun Aug 22 16:20:45 2010 +0100

    glx: swap the request arrays entirely, not just half of them
    
    Various glx requests include a list of pairs of attributes.  We were
    only swapping the first half.
    
    Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Julien Cristau <jcristau at debian.org>

diff --git a/glx/glxcmdsswap.c b/glx/glxcmdsswap.c
index 9276e2f..87bf75b 100644
--- a/glx/glxcmdsswap.c
+++ b/glx/glxcmdsswap.c
@@ -321,7 +321,7 @@ int __glXDispSwap_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
 
     REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
-    __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
+    __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
 
     return __glXDisp_CreatePixmap(cl, pc);
 }
@@ -402,7 +402,7 @@ int __glXDispSwap_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
 
     REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
-    __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
+    __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
 
     return __glXDisp_CreatePbuffer(cl, pc);
 }
@@ -466,7 +466,7 @@ int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
 
     REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
-    __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
+    __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
 
     return __glXDisp_ChangeDrawableAttributes(cl, pc);
 }
@@ -488,7 +488,7 @@ int __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState *cl,
 
     REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
-    __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
+    __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
 
     return __glXDisp_ChangeDrawableAttributesSGIX(cl, pc);
 }
@@ -511,7 +511,7 @@ int __glXDispSwap_CreateWindow(__GLXclientState *cl, GLbyte *pc)
 
     REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
-    __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
+    __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
 
     return __glXDisp_CreateWindow(cl, pc);
 }
commit 6c69235a9dfc52e4b4e47630ff4bab1a820eb543
Author: Julien Cristau <jcristau at debian.org>
Date:   Sun Aug 22 00:50:05 2010 +0100

    glx: check request length before swapping
    
    Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Julien Cristau <jcristau at debian.org>

diff --git a/glx/glxcmdsswap.c b/glx/glxcmdsswap.c
index ce4d69a..9276e2f 100644
--- a/glx/glxcmdsswap.c
+++ b/glx/glxcmdsswap.c
@@ -60,9 +60,12 @@
 
 int __glXDispSwap_CreateContext(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXCreateContextReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->context);
     __GLX_SWAP_INT(&req->visual);
@@ -74,9 +77,12 @@ int __glXDispSwap_CreateContext(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXCreateNewContextReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->context);
     __GLX_SWAP_INT(&req->fbconfig);
@@ -89,10 +95,13 @@ int __glXDispSwap_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreateContextWithConfigSGIXReq *req =
 	(xGLXCreateContextWithConfigSGIXReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->context);
     __GLX_SWAP_INT(&req->fbconfig);
@@ -105,9 +114,12 @@ int __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_DestroyContext(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXDestroyContextReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->context);
 
@@ -116,9 +128,12 @@ int __glXDispSwap_DestroyContext(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_MakeCurrent(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXMakeCurrentReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->drawable);
     __GLX_SWAP_INT(&req->context);
@@ -129,9 +144,12 @@ int __glXDispSwap_MakeCurrent(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXMakeContextCurrentReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->drawable);
     __GLX_SWAP_INT(&req->readdrawable);
@@ -143,9 +161,12 @@ int __glXDispSwap_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXMakeCurrentReadSGIReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->drawable);
     __GLX_SWAP_INT(&req->readable);
@@ -157,9 +178,12 @@ int __glXDispSwap_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_IsDirect(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXIsDirectReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->context);
 
@@ -168,9 +192,12 @@ int __glXDispSwap_IsDirect(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_QueryVersion(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXQueryVersionReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->majorVersion);
     __GLX_SWAP_INT(&req->minorVersion);
@@ -180,9 +207,12 @@ int __glXDispSwap_QueryVersion(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_WaitGL(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXWaitGLReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->contextTag);
 
@@ -191,9 +221,12 @@ int __glXDispSwap_WaitGL(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_WaitX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXWaitXReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->contextTag);
 
@@ -202,9 +235,12 @@ int __glXDispSwap_WaitX(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_CopyContext(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXCopyContextReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->source);
     __GLX_SWAP_INT(&req->dest);
@@ -215,36 +251,48 @@ int __glXDispSwap_CopyContext(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXGetVisualConfigsReq);
+
     __GLX_SWAP_INT(&req->screen);
     return __glXDisp_GetVisualConfigs(cl, pc);
 }
 
 int __glXDispSwap_GetFBConfigs(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXGetFBConfigsReq);
+
     __GLX_SWAP_INT(&req->screen);
     return __glXDisp_GetFBConfigs(cl, pc);
 }
 
 int __glXDispSwap_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXGetFBConfigsSGIXReq);
+
     __GLX_SWAP_INT(&req->screen);
     return __glXDisp_GetFBConfigsSGIX(cl, pc);
 }
 
 int __glXDispSwap_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->screen);
     __GLX_SWAP_INT(&req->visual);
@@ -256,17 +304,22 @@ int __glXDispSwap_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
     CARD32 *attribs;
     __GLX_DECLARE_SWAP_VARIABLES;
     __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
 
+    REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->screen);
     __GLX_SWAP_INT(&req->fbconfig);
     __GLX_SWAP_INT(&req->pixmap);
     __GLX_SWAP_INT(&req->glxpixmap);
     __GLX_SWAP_INT(&req->numAttribs);
+
+    REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
     __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
 
@@ -275,10 +328,13 @@ int __glXDispSwap_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreateGLXPixmapWithConfigSGIXReq *req = 
 	(xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->screen);
     __GLX_SWAP_INT(&req->fbconfig);
@@ -290,9 +346,12 @@ int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc
 
 int __glXDispSwap_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->glxpixmap);
 
@@ -301,9 +360,12 @@ int __glXDispSwap_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->glxpixmap);
 
@@ -312,9 +374,12 @@ int __glXDispSwap_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_QueryContext(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;    
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXQueryContextReq);
+
     __GLX_SWAP_INT(&req->context);
 
     return __glXDisp_QueryContext(cl, pc);
@@ -322,15 +387,20 @@ int __glXDispSwap_QueryContext(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;    
     __GLX_DECLARE_SWAP_VARIABLES;
     __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
     CARD32 *attribs;
 
+    REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq);
+
     __GLX_SWAP_INT(&req->screen);
     __GLX_SWAP_INT(&req->fbconfig);
     __GLX_SWAP_INT(&req->pbuffer);
     __GLX_SWAP_INT(&req->numAttribs);
+
+    REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
     __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
 
@@ -339,9 +409,12 @@ int __glXDispSwap_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;    
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXCreateGLXPbufferSGIXReq);
+
     __GLX_SWAP_INT(&req->screen);
     __GLX_SWAP_INT(&req->fbconfig);
     __GLX_SWAP_INT(&req->pbuffer);
@@ -353,9 +426,12 @@ int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXDestroyPbufferReq);
+
     __GLX_SWAP_INT(&req->pbuffer);
 
     return __glXDisp_DestroyPbuffer(cl, pc);
@@ -363,9 +439,12 @@ int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXDestroyGLXPbufferSGIXReq);
+
     __GLX_SWAP_INT(&req->pbuffer);
 
     return __glXDisp_DestroyGLXPbufferSGIX(cl, pc);
@@ -373,14 +452,19 @@ int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXChangeDrawableAttributesReq *req =
 	(xGLXChangeDrawableAttributesReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
     __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
     CARD32 *attribs;
 
+    REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq);
+
     __GLX_SWAP_INT(&req->drawable);
     __GLX_SWAP_INT(&req->numAttribs);
+
+    REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
     __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
 
@@ -390,14 +474,19 @@ int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
 int __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState *cl,
 					       GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXChangeDrawableAttributesSGIXReq *req =
 	(xGLXChangeDrawableAttributesSGIXReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
     __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
     CARD32 *attribs;
 
+    REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq);
+
     __GLX_SWAP_INT(&req->drawable);
     __GLX_SWAP_INT(&req->numAttribs);
+
+    REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
     __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
 
@@ -406,16 +495,21 @@ int __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState *cl,
 
 int __glXDispSwap_CreateWindow(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
     __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
     CARD32 *attribs;
 
+    REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq);
+
     __GLX_SWAP_INT(&req->screen);
     __GLX_SWAP_INT(&req->fbconfig);
     __GLX_SWAP_INT(&req->window);
     __GLX_SWAP_INT(&req->glxwindow);
     __GLX_SWAP_INT(&req->numAttribs);
+
+    REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3);
     attribs = (CARD32*)(req + 1);
     __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs);
 
@@ -424,9 +518,12 @@ int __glXDispSwap_CreateWindow(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXDestroyWindowReq);
+
     __GLX_SWAP_INT(&req->glxwindow);
 
     return __glXDisp_DestroyWindow(cl, pc);
@@ -434,9 +531,12 @@ int __glXDispSwap_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXSwapBuffersReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->contextTag);
     __GLX_SWAP_INT(&req->drawable);
@@ -446,9 +546,12 @@ int __glXDispSwap_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_UseXFont(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXUseXFontReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->contextTag);
     __GLX_SWAP_INT(&req->font);
@@ -462,9 +565,12 @@ int __glXDispSwap_UseXFont(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *)pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXQueryExtensionsStringReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->screen);
 
@@ -473,9 +579,12 @@ int __glXDispSwap_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_QueryServerString(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *)pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXQueryServerStringReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->screen);
     __GLX_SWAP_INT(&req->name);
@@ -485,9 +594,12 @@ int __glXDispSwap_QueryServerString(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_ClientInfo(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXClientInfoReq *req = (xGLXClientInfoReq *)pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->major);
     __GLX_SWAP_INT(&req->minor);
@@ -498,9 +610,12 @@ int __glXDispSwap_ClientInfo(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXQueryContextInfoEXTReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->context);
 
@@ -509,12 +624,14 @@ int __glXDispSwap_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
     GLXDrawable		 *drawId;
     int			 *buffer;
-    
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8);
+
     pc += __GLX_VENDPRIV_HDR_SIZE;
 
     drawId = ((GLXDrawable *) (pc));
@@ -530,12 +647,14 @@ int __glXDispSwap_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
     GLXDrawable		 *drawId;
     int			 *buffer;
-    
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8);
+
     pc += __GLX_VENDPRIV_HDR_SIZE;
 
     drawId = ((GLXDrawable *) (pc));
@@ -551,12 +670,14 @@ int __glXDispSwap_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
     GLXDrawable		 *drawId;
     int			 *buffer;
-
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 20);
+
     (void) drawId;
     (void) buffer;
 
@@ -576,11 +697,13 @@ int __glXDispSwap_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXVendorPrivateWithReplyReq *req = (xGLXVendorPrivateWithReplyReq *)pc;
     CARD32 *data;
-    
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq);
+
     data = (CARD32 *) (req + 1);
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->contextTag);
@@ -591,10 +714,12 @@ int __glXDispSwap_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDispSwap_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
-    
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesReq);
+
     __GLX_SWAP_SHORT(&req->length);
     __GLX_SWAP_INT(&req->drawable);
 
commit ec9c97c6bf70b523bc500bd3adf62176f1bb33a4
Author: Julien Cristau <jcristau at debian.org>
Date:   Sat Jul 3 19:47:55 2010 +0100

    glx: validate request lengths
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Julien Cristau <jcristau at debian.org>

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 419cc46..566dbbe 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -314,11 +314,14 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
 
 int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
     __GLXconfig *config;
     __GLXscreen *pGlxScreen;
     int err;
 
+    REQUEST_SIZE_MATCH(xGLXCreateContextReq);
+
     if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
 	return err;
     if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
@@ -330,11 +333,14 @@ int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
     __GLXconfig *config;
     __GLXscreen *pGlxScreen;
     int err;
 
+    REQUEST_SIZE_MATCH(xGLXCreateNewContextReq);
+
     if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
 	return err;
     if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
@@ -346,12 +352,15 @@ int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreateContextWithConfigSGIXReq *req = 
 	(xGLXCreateContextWithConfigSGIXReq *) pc;
     __GLXconfig *config;
     __GLXscreen *pGlxScreen;
     int err;
 
+    REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq);
+
     if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
 	return err;
     if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
@@ -362,10 +371,13 @@ int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
 }
 int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
     __GLXcontext *glxc;
     int err;
 
+    REQUEST_SIZE_MATCH(xGLXDestroyContextReq);
+
     if (!validGlxContext(cl->client, req->context, DixDestroyAccess,
 			 &glxc, &err))
 	    return err;
@@ -685,24 +697,33 @@ DoMakeCurrent(__GLXclientState *cl,
 
 int __glXDisp_MakeCurrent(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
 
+    REQUEST_SIZE_MATCH(xGLXMakeCurrentReq);
+
     return DoMakeCurrent( cl, req->drawable, req->drawable,
 			  req->context, req->oldContextTag );
 }
 
 int __glXDisp_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
 
+    REQUEST_SIZE_MATCH(xGLXMakeContextCurrentReq);
+
     return DoMakeCurrent( cl, req->drawable, req->readdrawable,
 			  req->context, req->oldContextTag );
 }
 
 int __glXDisp_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
 
+    REQUEST_SIZE_MATCH(xGLXMakeCurrentReadSGIReq);
+
     return DoMakeCurrent( cl, req->drawable, req->readable,
 			  req->context, req->oldContextTag );
 }
@@ -715,6 +736,8 @@ int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc)
     __GLXcontext *glxc;
     int err;
 
+    REQUEST_SIZE_MATCH(xGLXIsDirectReq);
+
     if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err))
 	return err;
 
@@ -739,6 +762,8 @@ int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc)
     xGLXQueryVersionReply reply;
     GLuint major, minor;
 
+    REQUEST_SIZE_MATCH(xGLXQueryVersionReq);
+
     major = req->majorVersion;
     minor = req->minorVersion;
     (void)major;
@@ -765,11 +790,15 @@ int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDisp_WaitGL(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc;
-    GLXContextTag tag = req->contextTag;
+    GLXContextTag tag;
     __GLXcontext *glxc = NULL;
     int error;
 
+    REQUEST_SIZE_MATCH(xGLXWaitGLReq);
+
+    tag = req->contextTag;
     if (tag) {
 	glxc = __glXLookupContextByTag(cl, tag);
 	if (!glxc)
@@ -789,11 +818,15 @@ int __glXDisp_WaitGL(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDisp_WaitX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXWaitXReq *req = (xGLXWaitXReq *)pc;
-    GLXContextTag tag = req->contextTag;
+    GLXContextTag tag;
     __GLXcontext *glxc = NULL;
     int error;
 
+    REQUEST_SIZE_MATCH(xGLXWaitXReq);
+
+    tag = req->contextTag;
     if (tag) {
 	glxc = __glXLookupContextByTag(cl, tag);
 	if (!glxc)
@@ -813,13 +846,19 @@ int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc)
 {
     ClientPtr client = cl->client;
     xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
-    GLXContextID source = req->source;
-    GLXContextID dest = req->dest;
-    GLXContextTag tag = req->contextTag;
-    unsigned long mask = req->mask;
+    GLXContextID source;
+    GLXContextID dest;
+    GLXContextTag tag;
+    unsigned long mask;
     __GLXcontext *src, *dst;
     int error;
 
+    REQUEST_SIZE_MATCH(xGLXCopyContextReq);
+
+    source = req->source;
+    dest = req->dest;
+    tag = req->contextTag;
+    mask = req->mask;
     if (!validGlxContext(cl->client, source, DixReadAccess, &src, &error))
 	return error;
     if (!validGlxContext(cl->client, dest, DixWriteAccess, &dst, &error))
@@ -902,6 +941,8 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
     __GLX_DECLARE_SWAP_VARIABLES;
     __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
 
+    REQUEST_SIZE_MATCH(xGLXGetVisualConfigsReq);
+
     if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
 	return err;
 
@@ -1081,13 +1122,17 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
 
 int __glXDisp_GetFBConfigs(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
+    REQUEST_SIZE_MATCH(xGLXGetFBConfigsReq);
     return DoGetFBConfigs(cl, req->screen);
 }
 
 int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
+    REQUEST_SIZE_MATCH(xGLXGetFBConfigsSGIXReq);
     return DoGetFBConfigs(cl, req->screen);
 }
 
@@ -1213,11 +1258,14 @@ determineTextureTarget(ClientPtr client, XID glxDrawableID,
 
 int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
     __GLXconfig *config;
     __GLXscreen *pGlxScreen;
     int err;
 
+    REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapReq);
+
     if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
 	return err;
     if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err))
@@ -1229,11 +1277,14 @@ int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
     __GLXconfig *config;
     __GLXscreen *pGlxScreen;
     int err;
 
+    REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3);
+
     if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
 	return err;
     if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
@@ -1252,12 +1303,15 @@ int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreateGLXPixmapWithConfigSGIXReq *req = 
 	(xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
     __GLXconfig *config;
     __GLXscreen *pGlxScreen;
     int err;
 
+    REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq);
+
     if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err))
 	return err;
     if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err))
@@ -1284,15 +1338,21 @@ static int DoDestroyDrawable(__GLXclientState *cl, XID glxdrawable, int type)
 
 int __glXDisp_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
 
+    REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq);
+
     return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
 }
 
 int __glXDisp_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc;
 
+    REQUEST_SIZE_MATCH(xGLXDestroyPixmapReq);
+
     return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
 }
 
@@ -1331,10 +1391,13 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
 
 int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreatePbufferReq	*req = (xGLXCreatePbufferReq *) pc;
     CARD32			*attrs;
     int				 width, height, i;
 
+    REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3);
+
     attrs = (CARD32 *) (req + 1);
     width = 0;
     height = 0;
@@ -1360,23 +1423,32 @@ int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDisp_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
 
+    REQUEST_SIZE_MATCH(xGLXCreateGLXPbufferSGIXReq);
+
     return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
 			   req->width, req->height, req->pbuffer);
 }
 
 int __glXDisp_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
 
+    REQUEST_SIZE_MATCH(xGLXDestroyPbufferReq);
+
     return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER);
 }
 
 int __glXDisp_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc;
 
+    REQUEST_SIZE_MATCH(xGLXDestroyGLXPbufferSGIXReq);
+
     return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER);
 }
 
@@ -1407,18 +1479,24 @@ DoChangeDrawableAttributes(ClientPtr client, XID glxdrawable,
 
 int __glXDisp_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXChangeDrawableAttributesReq *req =
 	(xGLXChangeDrawableAttributesReq *) pc;
 
+    REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3);
+
     return DoChangeDrawableAttributes(cl->client, req->drawable,
 				      req->numAttribs, (CARD32 *) (req + 1));
 }
 
 int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXChangeDrawableAttributesSGIXReq *req =
 	(xGLXChangeDrawableAttributesSGIXReq *)pc;
 
+    REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3);
+
     return DoChangeDrawableAttributes(cl->client, req->drawable,
 				      req->numAttribs, (CARD32 *) (req + 1));
 }
@@ -1432,6 +1510,8 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
     DrawablePtr		 pDraw;
     int			 err;
 
+    REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3);
+
     LEGAL_NEW_RESOURCE(req->glxwindow, client);
 
     if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
@@ -1455,8 +1535,11 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
 
+    REQUEST_SIZE_MATCH(xGLXDestroyWindowReq);
+
     return DoDestroyDrawable(cl, req->glxwindow, GLX_DRAWABLE_WINDOW);
 }
 
@@ -1472,12 +1555,16 @@ int __glXDisp_SwapBuffers(__GLXclientState *cl, GLbyte *pc)
 {
     ClientPtr client = cl->client;
     xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
-    GLXContextTag tag = req->contextTag;
-    XID drawId = req->drawable;
+    GLXContextTag tag;
+    XID drawId;
     __GLXcontext *glxc = NULL;
     __GLXdrawable *pGlxDraw;
     int error;
 
+    REQUEST_SIZE_MATCH(xGLXSwapBuffersReq);
+
+    tag = req->contextTag;
+    drawId = req->drawable;
     if (tag) {
 	glxc = __glXLookupContextByTag(cl, tag);
 	if (!glxc) {
@@ -1558,15 +1645,21 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
 
 int __glXDisp_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
 
+    REQUEST_SIZE_MATCH(xGLXQueryContextInfoEXTReq);
+
     return DoQueryContext(cl, req->context);
 }
 
 int __glXDisp_QueryContext(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
 
+    REQUEST_SIZE_MATCH(xGLXQueryContextReq);
+
     return DoQueryContext(cl, req->context);
 }
 
@@ -1580,6 +1673,8 @@ int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
     int			 buffer;
     int			 error;
 
+    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8);
+
     pc += __GLX_VENDPRIV_HDR_SIZE;
 
     drawId = *((CARD32 *) (pc));
@@ -1614,6 +1709,8 @@ int __glXDisp_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
     int			 buffer;
     int			 error;
 
+    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8);
+
     pc += __GLX_VENDPRIV_HDR_SIZE;
 
     drawId = *((CARD32 *) (pc));
@@ -1649,6 +1746,8 @@ int __glXDisp_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
     (void) client;
     (void) req;
 
+    REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 20);
+
     pc += __GLX_VENDPRIV_HDR_SIZE;
 
     drawId = *((CARD32 *) (pc));
@@ -1737,16 +1836,22 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
 
 int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
 
+    REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesReq);
+
     return DoGetDrawableAttributes(cl, req->drawable);
 }
 
 int __glXDisp_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXGetDrawableAttributesSGIXReq *req =
 	(xGLXGetDrawableAttributesSGIXReq *)pc;
     
+    REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq);
+
     return DoGetDrawableAttributes(cl, req->drawable);
 }
 
@@ -1771,6 +1876,8 @@ int __glXDisp_Render(__GLXclientState *cl, GLbyte *pc)
     __GLXcontext *glxc;
     __GLX_DECLARE_SWAP_VARIABLES;
 
+    REQUEST_AT_LEAST_SIZE(xGLXRenderReq);
+
     req = (xGLXRenderReq *) pc;
     if (client->swapped) {
 	__GLX_SWAP_SHORT(&req->length);
@@ -1791,6 +1898,9 @@ int __glXDisp_Render(__GLXclientState *cl, GLbyte *pc)
 	__GLXdispatchRenderProcPtr proc;
 	int err;
 
+	if (left < sizeof(__GLXrenderHeader))
+	    return BadLength;
+
 	/*
 	** Verify that the header length and the overall length agree.
 	** Also, each command must be word aligned.
@@ -2069,10 +2179,12 @@ int __glXDisp_RenderLarge(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDisp_VendorPrivate(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
     GLint vendorcode = req->vendorCode;
     __GLXdispatchVendorPrivProcPtr proc;
 
+    REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq);
 
     proc = (__GLXdispatchVendorPrivProcPtr)
       __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
@@ -2088,10 +2200,12 @@ int __glXDisp_VendorPrivate(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDisp_VendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
     GLint vendorcode = req->vendorCode;
     __GLXdispatchVendorPrivProcPtr proc;
 
+    REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq);
 
     proc = (__GLXdispatchVendorPrivProcPtr)
       __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info,
@@ -2114,6 +2228,8 @@ int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
     char *buf;
     int err;
 
+    REQUEST_SIZE_MATCH(xGLXQueryExtensionsStringReq);
+
     if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
 	return err;
 
@@ -2153,6 +2269,8 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
     int err;
     char ver_str[16];
 
+    REQUEST_SIZE_MATCH(xGLXQueryServerStringReq);
+
     if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
 	return err;
 
@@ -2200,13 +2318,19 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
 
 int __glXDisp_ClientInfo(__GLXclientState *cl, GLbyte *pc)
 {
+    ClientPtr client = cl->client;
     xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
     const char *buf;
    
+    REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq);
+
+    buf = (const char *)(req+1);
+    if (!memchr(buf, 0, (client->req_len << 2) - sizeof(xGLXClientInfoReq)))
+	return BadLength;
+
     cl->GLClientmajorVersion = req->major;
     cl->GLClientminorVersion = req->minor;
     free(cl->GLClientextensions);
-    buf = (const char *)(req+1);
     cl->GLClientextensions = strdup(buf);
 
     return Success;
diff --git a/glx/xfont.c b/glx/xfont.c
index 9943784..84a301f 100644
--- a/glx/xfont.c
+++ b/glx/xfont.c
@@ -154,6 +154,8 @@ int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc)
     __GLXcontext *cx;
     int error;
 
+    REQUEST_SIZE_MATCH(xGLXUseXFontReq);
+
     req = (xGLXUseXFontReq *) pc;
     cx = __glXForceCurrent(cl, req->contextTag, &error);
     if (!cx) {
commit 3f0d3f4d97bce75c1828635c322b6560a45a037f
Author: Julien Cristau <jcristau at debian.org>
Date:   Sat Jul 3 19:42:26 2010 +0100

    glx: make sure screen is non-negative in validGlxScreen
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Julien Cristau <jcristau at debian.org>

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index de9c3f0..419cc46 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
     /*
     ** Check if screen exists.
     */
-    if (screen >= screenInfo.numScreens) {
+    if (screen < 0 || screen >= screenInfo.numScreens) {
 	client->errorValue = screen;
 	*err = BadValue;
 	return FALSE;
commit 8456625d64bb0013a496f3b56ea3aa20cf7a6142
Merge: aa30a86... ce74e75...
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jan 7 09:35:07 2011 +1000

    Merge branch 'for-peter' of git://people.freedesktop.org/~daniels/xserver into for-keith

commit aa30a86583c3fc1a83c46e8c7583182d750edcde
Author: Tomas Carnecky <tom at dbservice.com>
Date:   Sun Aug 1 21:28:18 2010 +0200

    NO_PANORAMIX preprocessor symbol is nowhere defined
    
    Which makes it useless, so remove it.
    
    Signed-off-by: Tomas Carnecky <tom at dbservice.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/mi/miinitext.c b/mi/miinitext.c
index a7441c9..4499f37 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -389,9 +389,7 @@ InitExtensions(int argc, char *argv[])
     if (!noGEExtension) GEExtensionInit();
 
 #ifdef PANORAMIX
-# if !defined(NO_PANORAMIX)
   if (!noPanoramiXExtension) PanoramiXExtensionInit();
-# endif
 #endif
 #ifdef INXQUARTZ
     if(!noPseudoramiXExtension) PseudoramiXExtensionInit();
commit fc6cbee772bafabf7ddd7a75043bd55bb78ad09e
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jan 6 12:58:00 2011 +1000

    input: add valuator_mask_free() to free a valuator mask.
    
    Expecting the caller to free the mask requires us to keep it in a single
    memory block (which may be an issue lateron), aside from leaving the API
    asymetrical. Provide valuator_mask_free() to free the memory and reset the
    mask pointer to NULL.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Fernando Carrijo <fcarrijo at freedesktop.org>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/dix/inpututils.c b/dix/inpututils.c
index 2877804..ef3142c 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -433,6 +433,14 @@ valuator_mask_new(int num_valuators)
     return mask;
 }
 
+void
+valuator_mask_free(ValuatorMask **mask)
+{
+    free(*mask);
+    *mask = NULL;
+}
+
+
 /**
  * Sets a range of valuators between first_valuator and num_valuators with
  * the data in the valuators array. All other values are set to 0.
diff --git a/include/input.h b/include/input.h
index 9f3227f..412150c 100644
--- a/include/input.h
+++ b/include/input.h
@@ -567,6 +567,7 @@ extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode);
 extern Bool EnableCursor;
 
 extern _X_EXPORT ValuatorMask  *valuator_mask_new(int num_valuators);
+extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask);
 extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask,
                                        int first_valuator, int num_valuators,
                                        const int* valuators);
diff --git a/test/input.c b/test/input.c
index 1fe228c..39d0bad 100644
--- a/test/input.c
+++ b/test/input.c
@@ -1017,7 +1017,8 @@ static void dix_input_valuator_masks(void)
         g_assert(valuator_mask_get(mask, i) == valuator_mask_get(copy, i));
     }
 
-    free(mask);
+    valuator_mask_free(&mask);
+    g_assert(mask == NULL);
 }
 
 static void dix_valuator_mode(void)
commit 4fbadc8b17237f3c7f8c0bf56003d1139c86655e
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Thu Jan 6 11:32:26 2011 +1000

    Input: Prevent MD grabs from wandering on to other MDs
    
    The code to set sync.other in DeliverGrabbedEvents is supposed to reset
    sync.other for a paired MD to the grab under consideration, but was
    rather optimistic in resetting sync.other for _all_ devices.
    
    This would fall apart given two sets of MDs (A paired with B, Y paired
    with Z), where both MDs were in FREEZE_BOTH_NEXT_EVENT due to being
    called with SyncBoth, where no event had yet triggered the grab.  An
    event being processed on MD A would result in B, Y and Z all having
    sync.other set to A's grab, rather than just B.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/events.c b/dix/events.c
index f280f9d..c1cce92 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3889,7 +3889,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
 		    (CLIENT_BITS(grab->resource) ==
 		     CLIENT_BITS(dev->deviceGrab.grab->resource)))
 		    dev->deviceGrab.sync.state = FROZEN_NO_EVENT;
-		else
+		else if (GetPairedDevice(thisDev) == dev)
                     dev->deviceGrab.sync.other = grab;
 	    }
 	    /* fall through */
commit e65c3f8bcc86845f21ac575e2bfb4b21b67d5ebf
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Jan 5 12:04:19 2011 -0500

    dix: Add a Screen method for additional cursor confinement
    
    This just reserves the slot in the ABI. Confining cursors to CRTCs will
    come soon.
    
    v2: Just reserve the slot.
    
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 9952325..9f4fbf3 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -403,6 +403,9 @@ typedef    void (* DeviceCursorCleanupProcPtr)(
         DeviceIntPtr /* pDev */,
         ScreenPtr    /* pScreen */);
 
+typedef void (*ConstrainCursorHarderProcPtr)(
+       DeviceIntPtr, ScreenPtr, int *, int *);
+
 typedef struct _Screen {
     int			myNum;	/* index of this instance in Screens[] */
     ATOM		id;
@@ -469,6 +472,7 @@ typedef struct _Screen {
     /* Cursor Procedures */
 
     ConstrainCursorProcPtr	ConstrainCursor;
+    ConstrainCursorHarderProcPtr ConstrainCursorHarder;
     CursorLimitsProcPtr		CursorLimits;
     DisplayCursorProcPtr	DisplayCursor;
     RealizeCursorProcPtr	RealizeCursor;
commit ce74e7562dcc800306ff92b6d3c5ee885cd4763d
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Dec 7 11:48:14 2010 +0000

    Input: Make CheckPassiveGrabsOnWindow return grab, export
    
    Change CheckPassiveGrabsOnWindow to return the GrabPtr it used (or NULL
    if none) rather than a boolean, and export it.  Also add an additional
    boolean 'activate' parameter; use TRUE for existing behaviour, or FALSE
    to only find the grab and then return it.
    
    This will be used in forthcoming touch patches to find the grabs, rather
    than open-coding same.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/events.c b/dix/events.c
index ff6e008..4daed14 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -209,10 +209,6 @@ static void CheckPhysLimits(DeviceIntPtr pDev,
                             Bool generateEvents,
                             Bool confineToScreen,
                             ScreenPtr pScreen);
-static Bool CheckPassiveGrabsOnWindow(WindowPtr pWin,
-                                      DeviceIntPtr device,
-                                      DeviceEvent *event,
-                                      BOOL checkCore);
 
 /** Key repeat hack. Do not use but in TryClientEvents */
 extern BOOL EventIsKeyRepeat(xEvent *event);
@@ -2633,7 +2629,7 @@ ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
     event.deviceid = dev->id;
     event.sourceid = dev->id;
     event.detail.button = 0;
-    rc = CheckPassiveGrabsOnWindow(win, dev, &event, FALSE);
+    rc = (CheckPassiveGrabsOnWindow(win, dev, &event, FALSE, TRUE) != NULL);
     if (rc)
         DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab);
     return rc;
@@ -2670,10 +2666,9 @@ ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
     event.deviceid = dev->id;
     event.sourceid = dev->id;
     event.detail.button = 0;
-    rc = CheckPassiveGrabsOnWindow(win, dev, &event, FALSE);
+    rc = (CheckPassiveGrabsOnWindow(win, dev, &event, FALSE, TRUE) != NULL);
     if (rc)
         DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveGrab);
-
     return rc;
 }
 
@@ -3344,20 +3339,23 @@ BorderSizeNotEmpty(DeviceIntPtr pDev, WindowPtr pWin)
 /**
  * "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a
  * passive grab set on the window to be activated.
- * If a passive grab is activated, the event will be delivered to the client.
+ * If activate is true and a passive grab is found, it will be activated,
+ * and the event will be delivered to the client.
  *
  * @param pWin The window that may be subject to a passive grab.
  * @param device Device that caused the event.
  * @param event The current device event.
  * @param checkCore Check for core grabs too.
+ * @param activate If a grab is found, activate it and deliver the event.
  */
 
-static Bool
+GrabPtr
 CheckPassiveGrabsOnWindow(
     WindowPtr pWin,
     DeviceIntPtr device,
     DeviceEvent *event,
-    BOOL checkCore)
+    BOOL checkCore,
+    BOOL activate)
 {
     SpritePtr pSprite = device->spriteInfo->sprite;
     GrabPtr grab = wPassiveGrabs(pWin);
@@ -3369,7 +3367,7 @@ CheckPassiveGrabsOnWindow(
     int match = 0;
 
     if (!grab)
-	return FALSE;
+	return NULL;
     /* Fill out the grab details, but leave the type for later before
      * comparing */
     tempGrab.window = pWin;
@@ -3483,6 +3481,8 @@ CheckPassiveGrabsOnWindow(
                     continue;
             }
 
+            if (!activate)
+                return grab;
 
             if (match & CORE_MATCH)
             {
@@ -3540,10 +3540,10 @@ CheckPassiveGrabsOnWindow(
 
             if (match & (XI_MATCH | XI2_MATCH))
                 free(xE); /* on core match xE == &core */
-	    return TRUE;
+	    return grab;
 	}
     }
-    return FALSE;
+    return NULL;
 #undef CORE_MATCH
 #undef XI_MATCH
 #undef XI2_MATCH
@@ -3609,7 +3609,7 @@ CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor)
 	for (; i < focus->traceGood; i++)
 	{
 	    pWin = focus->trace[i];
-	    if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore))
+	    if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore, TRUE))
 		return TRUE;
 	}
 
@@ -3622,7 +3622,7 @@ CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor)
     for (; i < device->spriteInfo->sprite->spriteTraceGood; i++)
     {
 	pWin = device->spriteInfo->sprite->spriteTrace[i];
-	if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore))
+	if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore, TRUE))
 	    return TRUE;
     }
 
diff --git a/include/dix.h b/include/dix.h
index 7485e8e..12e4b59 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -372,6 +372,13 @@ extern void AllowSome(
 extern void ReleaseActiveGrabs(
     ClientPtr client);
 
+extern GrabPtr CheckPassiveGrabsOnWindow(
+    WindowPtr /* pWin */,
+    DeviceIntPtr /* device */,
+    DeviceEvent * /* event */,
+    BOOL /* checkCore */,
+    BOOL /* activate */);
+
 extern _X_EXPORT int DeliverEventsToWindow(
     DeviceIntPtr /* pWin */,
     WindowPtr /* pWin */,
commit eb5aaf5eb819f1287ce40da79edbe07bafb2b5c0
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Dec 28 12:15:28 2010 +0000

    Input: Export GetEventMask
    
    Make it non-static, add to headers.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/dix/events.c b/dix/events.c
index 45d9eab..ff6e008 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -439,7 +439,7 @@ GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev)
             (inputMasks->xi2mask[XIAllMasterDevices][evtype/8] && IsMaster(dev)));
 }
 
-static Mask
+Mask
 GetEventMask(DeviceIntPtr dev, xEvent *event, InputClients* other)
 {
     /* XI2 filters are only ever 8 bit, so let's return a 8 bit mask */
diff --git a/include/input.h b/include/input.h
index c1db544..56992d1 100644
--- a/include/input.h
+++ b/include/input.h
@@ -526,6 +526,7 @@ extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *attr
 extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs);
 
 /* misc event helpers */
+extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
 extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);
 extern Mask GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev);
 void FixUpEventFromWindow(SpritePtr pSprite,
commit 30c8c7a86310139e79c9698caee21b3bd51936bd
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Dec 28 12:13:29 2010 +0000

    Input: Handle grabs with no Xi 1.x equivalent
    
    Don't try to search for an Xi 1.x grab in CheckPassiveGrabsOnWindow for
    events with no Xi 1.x equivalent.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/dix/events.c b/dix/events.c
index 29033e2..45d9eab 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3415,9 +3415,9 @@ CheckPassiveGrabsOnWindow(
         tempGrab.detail.exact = event->detail.key;
         if (!match)
         {
-            tempGrab.type = GetXIType((InternalEvent*)event);
             tempGrab.grabtype = GRABTYPE_XI;
-            if (GrabMatchesSecond(&tempGrab, grab, FALSE))
+            if ((tempGrab.type = GetXIType((InternalEvent*)event)) &&
+                (GrabMatchesSecond(&tempGrab, grab, FALSE)))
                 match = XI_MATCH;
         }
 
commit 690476250f58616d5156317e01ba547497f4331a
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Sep 20 15:03:05 2010 +1000

    Input: Pass sprite instead of device to XYToWindow, make non-static
    
    XYToWindow calculates the position of the cursor and updates the sprite
    trace, but does nothing else with the device.  Pass a SpritePtr instead
    so we can update an alternate focus instead of hardcoding the device's
    sprite.  Also make this function non-static, so we can use it elsewhere.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/dix/events.c b/dix/events.c
index df59a4e..29033e2 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -332,12 +332,6 @@ IsMaster(DeviceIntPtr dev)
     return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD;
 }
 
-static WindowPtr XYToWindow(
-    DeviceIntPtr pDev,
-    int x,
-    int y
-);
-
 /**
  * Max event opcode.
  */
@@ -1290,7 +1284,8 @@ ComputeFreezes(void)
 
 	syncEvents.replayDev = (DeviceIntPtr)NULL;
 
-        w = XYToWindow(replayDev, event->root_x, event->root_y);
+        w = XYToWindow(replayDev->spriteInfo->sprite,
+                       event->root_x, event->root_y);
         if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin))
         {
             if (replayDev->focus && !IsPointerEvent((InternalEvent*)event))
@@ -2553,16 +2548,14 @@ PointInBorderSize(WindowPtr pWin, int x, int y)
  *
  * @returns the window at the given coordinates.
  */
-static WindowPtr
-XYToWindow(DeviceIntPtr pDev, int x, int y)
+WindowPtr
+XYToWindow(SpritePtr pSprite, int x, int y)
 {
     WindowPtr  pWin;
     BoxRec		box;
-    SpritePtr pSprite;
 
-    pSprite = pDev->spriteInfo->sprite;
     pSprite->spriteTraceGood = 1;	/* root window still there */
-    pWin = GetCurrentRootWindow(pDev)->firstChild;
+    pWin = RootWindow(pSprite)->firstChild;
     while (pWin)
     {
 	if ((pWin->mapped) &&
@@ -2775,7 +2768,7 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
 	ev->root_y = pSprite->hot.y;
     }
 
-    newSpriteWin = XYToWindow(pDev, pSprite->hot.x, pSprite->hot.y);
+    newSpriteWin = XYToWindow(pSprite, pSprite->hot.x, pSprite->hot.y);
 
     if (newSpriteWin != prevSpriteWin)
     {
diff --git a/include/input.h b/include/input.h
index a20f8a0..c1db544 100644
--- a/include/input.h
+++ b/include/input.h
@@ -533,6 +533,7 @@ void FixUpEventFromWindow(SpritePtr pSprite,
                           WindowPtr pWin,
                           Window child,
                           Bool calcChild);
+extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
 extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event,
                               WindowPtr win);
 /**
commit 07a892cd8276f8092de95f1909f2ebec6f5fdf08
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Sep 20 15:03:04 2010 +1000

    Input: Pass sprite instead of device to FixUpEventFromWindow
    
    Since FixUpEventFromWindow only uses the sprite trace to determine the
    window stack, pass in a sprite instead of hardcoding the device sprite,
    so we can deliver to windows other than the one currently containing the
    sprite.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 8615fd4..327873e 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1261,7 +1261,8 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
         xi2event->group.effective_group = dev->key->xkbInfo->state.group;
     }
 
-    FixUpEventFromWindow(dev, (xEvent*)xi2event, pWin, None, FALSE);
+    FixUpEventFromWindow(dev->spriteInfo->sprite, (xEvent*)xi2event, pWin,
+                         None, FALSE);
 
     DeliverEventsToWindow(dev, pWin, (xEvent*)xi2event, 1,
                           GetEventFilter(dev, (xEvent*)xi2event), NullGrab);
diff --git a/dix/events.c b/dix/events.c
index c24d772..df59a4e 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2181,9 +2181,8 @@ MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
     return 2;
 }
 
-static Window FindChildForEvent(DeviceIntPtr dev, WindowPtr event)
+static Window FindChildForEvent(SpritePtr pSprite, WindowPtr event)
 {
-    SpritePtr pSprite = dev->spriteInfo->sprite;
     WindowPtr w = pSprite->spriteTrace[pSprite->spriteTraceGood-1];
     Window child = None;
 
@@ -2222,16 +2221,14 @@ static Window FindChildForEvent(DeviceIntPtr dev, WindowPtr event)
  */
 void
 FixUpEventFromWindow(
-    DeviceIntPtr pDev,
+    SpritePtr pSprite,
     xEvent *xE,
     WindowPtr pWin,
     Window child,
     Bool calcChild)
 {
-    SpritePtr pSprite = pDev->spriteInfo->sprite;
-
     if (calcChild)
-        child = FindChildForEvent(pDev, pWin);
+        child = FindChildForEvent(pSprite, pWin);
 
     if (XI2_EVENT(xE))
     {
@@ -2247,7 +2244,7 @@ FixUpEventFromWindow(
             event->evtype == XI_PropertyEvent)
             return;
 
-        event->root = GetCurrentRootWindow(pDev)->drawable.id;
+        event->root = RootWindow(pSprite)->drawable.id;
         event->event = pWin->drawable.id;
         if (pSprite->hot.pScreen == pWin->drawable.pScreen)
         {
@@ -2268,7 +2265,7 @@ FixUpEventFromWindow(
 
     } else
     {
-        XE_KBPTR.root = GetCurrentRootWindow(pDev)->drawable.id;
+        XE_KBPTR.root = RootWindow(pSprite)->drawable.id;
         XE_KBPTR.event = pWin->drawable.id;
         if (pSprite->hot.pScreen == pWin->drawable.pScreen)
         {
@@ -2374,6 +2371,7 @@ int
 DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
                     WindowPtr stopAt, DeviceIntPtr dev)
 {
+    SpritePtr pSprite = dev->spriteInfo->sprite;
     Window child = None;
     Mask filter;
     int deliveries = 0;
@@ -2396,7 +2394,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
                 {
                     /* XXX: XACE */
                     filter = GetEventFilter(dev, xi2);
-                    FixUpEventFromWindow(dev, xi2, pWin, child, FALSE);
+                    FixUpEventFromWindow(pSprite, xi2, pWin, child, FALSE);
                     deliveries = DeliverEventsToWindow(dev, pWin, xi2, 1,
                                                        filter, grab);
                     free(xi2);
@@ -2414,7 +2412,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
                 if (rc == Success) {
                     if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, xE, count) == Success) {
                         filter = GetEventFilter(dev, xE);
-                        FixUpEventFromWindow(dev, xE, pWin, child, FALSE);
+                        FixUpEventFromWindow(pSprite, xE, pWin, child, FALSE);
                         deliveries = DeliverEventsToWindow(dev, pWin, xE, count,
                                                            filter, grab);
                         if (deliveries > 0)
@@ -2432,7 +2430,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
                 if (rc == Success) {
                     if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, &core, 1) == Success) {
                         filter = GetEventFilter(dev, &core);
-                        FixUpEventFromWindow(dev, &core, pWin, child, FALSE);
+                        FixUpEventFromWindow(pSprite, &core, pWin, child, FALSE);
                         deliveries = DeliverEventsToWindow(dev, pWin, &core, 1,
                                                            filter, grab);
                         if (deliveries > 0)
@@ -3368,6 +3366,7 @@ CheckPassiveGrabsOnWindow(
     DeviceEvent *event,
     BOOL checkCore)
 {
+    SpritePtr pSprite = device->spriteInfo->sprite;
     GrabPtr grab = wPassiveGrabs(pWin);
     GrabRec tempGrab;
     GrabInfoPtr grabinfo;
@@ -3531,7 +3530,7 @@ CheckPassiveGrabsOnWindow(
 
             if (xE)
             {
-                FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
+                FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE);
 
                 TryClientEvents(rClient(grab), device, xE, count,
                                        GetEventFilter(device, xE),
@@ -3683,7 +3682,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
     {
         /* XXX: XACE */
         int filter = GetEventFilter(keybd, xi2);
-        FixUpEventFromWindow(ptr, xi2, focus, None, FALSE);
+        FixUpEventFromWindow(ptr->spriteInfo->sprite, xi2, focus, None, FALSE);
         deliveries = DeliverEventsToWindow(keybd, focus, xi2, 1,
                                            filter, NullGrab);
         if (deliveries > 0)
@@ -3696,7 +3695,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
     if (rc == Success &&
         XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, xE, count) == Success)
     {
-        FixUpEventFromWindow(ptr, xE, focus, None, FALSE);
+        FixUpEventFromWindow(ptr->spriteInfo->sprite, xE, focus, None, FALSE);
         deliveries = DeliverEventsToWindow(keybd, focus, xE, count,
                 GetEventFilter(keybd, xE),
                 NullGrab);
@@ -3712,7 +3711,8 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
         rc = EventToCore(event, &core);
         if (rc == Success) {
             if (XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, &core, 1) == Success) {
-                FixUpEventFromWindow(keybd, &core, focus, None, FALSE);
+                FixUpEventFromWindow(keybd->spriteInfo->sprite, &core, focus,
+                                     None, FALSE);
                 deliveries = DeliverEventsToWindow(keybd, focus, &core, 1,
                                                    GetEventFilter(keybd, &core),
                                                    NullGrab);
@@ -3802,8 +3802,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
             rc = EventToCore(event, &core);
             if (rc == Success)
             {
-                FixUpEventFromWindow(thisDev, &core, grab->window,
-                        None, TRUE);
+                FixUpEventFromWindow(pSprite, &core, grab->window, None, TRUE);
                 if (XaceHook(XACE_SEND_ACCESS, 0, thisDev,
                             grab->window, &core, 1) ||
                         XaceHook(XACE_RECEIVE_ACCESS, rClient(grab),
@@ -3830,7 +3829,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
                     grab->xi2mask[XIAllMasterDevices][evtype/8] |
                     grab->xi2mask[thisDev->id][evtype/8];
                 /* try XI2 event */
-                FixUpEventFromWindow(thisDev, xi2, grab->window, None, TRUE);
+                FixUpEventFromWindow(pSprite, xi2, grab->window, None, TRUE);
                 /* XXX: XACE */
                 deliveries = TryClientEvents(rClient(grab), thisDev, xi2, 1, mask,
                         GetEventFilter(thisDev, xi2), grab);
@@ -3851,8 +3850,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
                 else
                     mask = grab->eventMask;
 
-                FixUpEventFromWindow(thisDev, xi, grab->window,
-                        None, TRUE);
+                FixUpEventFromWindow(pSprite, xi, grab->window, None, TRUE);
 
                 if (XaceHook(XACE_SEND_ACCESS, 0, thisDev,
                             grab->window, xi, count) ||
@@ -4198,7 +4196,7 @@ CoreEnterLeaveEvent(
     event.u.enterLeave.rootX = mouse->spriteInfo->sprite->hot.x;
     event.u.enterLeave.rootY = mouse->spriteInfo->sprite->hot.y;
     /* Counts on the same initial structure of crossing & button events! */
-    FixUpEventFromWindow(mouse, &event, pWin, None, FALSE);
+    FixUpEventFromWindow(mouse->spriteInfo->sprite, &event, pWin, None, FALSE);
     /* Enter/Leave events always set child */
     event.u.enterLeave.child = child;
     event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ?
@@ -4298,7 +4296,8 @@ DeviceEnterLeaveEvent(
         event->group.locked_group = kbd->key->xkbInfo->state.locked_group;
     }
 
-    FixUpEventFromWindow(mouse, (xEvent*)event, pWin, None, FALSE);
+    FixUpEventFromWindow(mouse->spriteInfo->sprite, (xEvent*)event, pWin,
+                         None, FALSE);
 
     filter = GetEventFilter(mouse, (xEvent*)event);
 
diff --git a/include/input.h b/include/input.h
index 76f646f..a20f8a0 100644
--- a/include/input.h
+++ b/include/input.h
@@ -528,7 +528,7 @@ extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs);
 /* misc event helpers */
 extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);
 extern Mask GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev);
-void FixUpEventFromWindow(DeviceIntPtr pDev,
+void FixUpEventFromWindow(SpritePtr pSprite,
                           xEvent *xE,
                           WindowPtr pWin,
                           Window child,
commit 10d6c3ca103ea155488cd2f29052334b5691e680
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Dec 27 13:06:03 2010 +0000

    Input: Make RootWindow() take a sprite instead of device
    
    GetCurrentRootWindow already works for the device case, although not as
    an lvalue.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/dix/events.c b/dix/events.c
index f280f9d..c24d772 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -256,7 +256,7 @@ EventSyncInfoRec syncEvents;
 /**
  * The root window the given device is currently on.
  */
-#define RootWindow(dev) dev->spriteInfo->sprite->spriteTrace[0]
+#define RootWindow(sprite) sprite->spriteTrace[0]
 
 static xEvent* swapEvent = NULL;
 static int swapEventLen = 0;
@@ -879,7 +879,7 @@ CheckVirtualMotion(
 #ifdef PANORAMIX
     if (noPanoramiXExtension) /* No typo. Only set the root win if disabled */
 #endif
-        RootWindow(pDev) = pSprite->hot.pScreen->root;
+        RootWindow(pDev->spriteInfo->sprite) = pSprite->hot.pScreen->root;
 }
 
 static void
@@ -1012,7 +1012,7 @@ PostNewCursor(DeviceIntPtr pDev)
 WindowPtr
 GetCurrentRootWindow(DeviceIntPtr dev)
 {
-    return RootWindow(dev);
+    return RootWindow(dev->spriteInfo->sprite);
 }
 
 /**
@@ -1511,7 +1511,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
     DoEnterLeaveEvents(mouse, mouse->id, grab->window,
                        mouse->spriteInfo->sprite->win, NotifyUngrab);
     if (grab->confineTo)
-	ConfineCursorToWindow(mouse, RootWindow(mouse), FALSE, FALSE);
+	ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE);
     PostNewCursor(mouse);
     if (grab->cursor)
 	FreeCursor(grab->cursor, (Cursor)0);
@@ -2247,7 +2247,7 @@ FixUpEventFromWindow(
             event->evtype == XI_PropertyEvent)
             return;
 
-        event->root = RootWindow(pDev)->drawable.id;
+        event->root = GetCurrentRootWindow(pDev)->drawable.id;
         event->event = pWin->drawable.id;
         if (pSprite->hot.pScreen == pWin->drawable.pScreen)
         {
@@ -2268,7 +2268,7 @@ FixUpEventFromWindow(
 
     } else
     {
-        XE_KBPTR.root = RootWindow(pDev)->drawable.id;
+        XE_KBPTR.root = GetCurrentRootWindow(pDev)->drawable.id;
         XE_KBPTR.event = pWin->drawable.id;
         if (pSprite->hot.pScreen == pWin->drawable.pScreen)
         {
@@ -2564,7 +2564,7 @@ XYToWindow(DeviceIntPtr pDev, int x, int y)
 
     pSprite = pDev->spriteInfo->sprite;
     pSprite->spriteTraceGood = 1;	/* root window still there */
-    pWin = RootWindow(pDev)->firstChild;
+    pWin = GetCurrentRootWindow(pDev)->firstChild;
     while (pWin)
     {
 	if ((pWin->mapped) &&
@@ -2737,7 +2737,8 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
             if (pSprite->hot.pScreen != pSprite->hotPhys.pScreen)
             {
                 pSprite->hot.pScreen = pSprite->hotPhys.pScreen;
-                RootWindow(pDev) = pSprite->hot.pScreen->root;
+                RootWindow(pDev->spriteInfo->sprite) =
+                    pSprite->hot.pScreen->root;
             }
         }
 
@@ -2942,7 +2943,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
 	    FatalError("Failed to allocate spriteTrace");
 	pSprite->spriteTraceSize = 32;
 
-	RootWindow(pDev) = pWin;
+	RootWindow(pDev->spriteInfo->sprite) = pWin;
 	pSprite->spriteTraceGood = 1;
 
 	pSprite->pEnqueueScreen = pScreen;
@@ -4554,7 +4555,8 @@ ProcGrabPointer(ClientPtr client)
     if (grab)
     {
         if (grab->confineTo && !confineTo)
-            ConfineCursorToWindow(device, RootWindow(device), FALSE, FALSE);
+            ConfineCursorToWindow(device, GetCurrentRootWindow(device), FALSE,
+                                  FALSE);
         oldCursor = grab->cursor;
     }
 
@@ -4883,7 +4885,7 @@ ProcQueryPointer(ClientPtr client)
     rep.mask = mouse->button ? (mouse->button->state) : 0;
     rep.mask |= XkbStateFieldFromRec(&keyboard->key->xkbInfo->state);
     rep.length = 0;
-    rep.root = (RootWindow(mouse))->drawable.id;
+    rep.root = (GetCurrentRootWindow(mouse))->drawable.id;
     rep.rootX = pSprite->hot.x;
     rep.rootY = pSprite->hot.y;
     rep.child = None;
@@ -5042,7 +5044,7 @@ ProcSendEvent(ClientPtr client)
 	/* If the input focus is PointerRootWin, send the event to where
 	the pointer is if possible, then perhaps propogate up to root. */
 	if (inputFocus == PointerRootWin)
-	    inputFocus = RootWindow(dev);
+	    inputFocus = GetCurrentRootWindow(dev);
 
 	if (IsParent(inputFocus, pSprite->win))
 	{
commit 23c37ce1fe42e3da0609a566478e947843b05023
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Dec 27 12:48:42 2010 +0000

    Input: Export SpriteRec for use in public API
    
    Change its definition to be more in line with other structs, so we can
    use it from input.h.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/include/input.h b/include/input.h
index 9f3227f..76f646f 100644
--- a/include/input.h
+++ b/include/input.h
@@ -103,6 +103,7 @@ typedef struct _OtherClients *OtherClientsPtr;
 typedef struct _InputClients *InputClientsPtr;
 typedef struct _DeviceIntRec *DeviceIntPtr;
 typedef struct _ClassesRec *ClassesPtr;
+typedef struct _SpriteRec *SpritePtr;
 typedef union _GrabMask GrabMask;
 
 typedef struct _EventList {
diff --git a/include/inputstr.h b/include/inputstr.h
index 44de9c4..b74ee04 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -203,6 +203,47 @@ typedef struct _GrabRec {
     unsigned char       xi2mask[EMASKSIZE][XI2MASKSIZE];
 } GrabRec;
 
+/**
+ * Sprite information for a device.
+ */
+typedef struct _SpriteRec {
+    CursorPtr	current;
+    BoxRec	hotLimits;	/* logical constraints of hot spot */
+    Bool	confined;	/* confined to screen */
+    RegionPtr	hotShape;	/* additional logical shape constraint */
+    BoxRec	physLimits;	/* physical constraints of hot spot */
+    WindowPtr	win;		/* window of logical position */
+    HotSpot	hot;		/* logical pointer position */
+    HotSpot	hotPhys;	/* physical pointer position */
+#ifdef PANORAMIX
+    ScreenPtr	screen;		/* all others are in Screen 0 coordinates */
+    RegionRec   Reg1;	        /* Region 1 for confining motion */
+    RegionRec   Reg2;		/* Region 2 for confining virtual motion */
+    WindowPtr   windows[MAXSCREENS];
+    WindowPtr	confineWin;	/* confine window */
+#endif
+    /* The window trace information is used at dix/events.c to avoid having
+     * to compute all the windows between the root and the current pointer
+     * window each time a button or key goes down. The grabs on each of those
+     * windows must be checked.
+     * spriteTraces should only be used at dix/events.c! */
+    WindowPtr *spriteTrace;
+    int spriteTraceSize;
+    int spriteTraceGood;
+
+    /* Due to delays between event generation and event processing, it is
+     * possible that the pointer has crossed screen boundaries between the
+     * time in which it begins generating events and the time when
+     * those events are processed.
+     *
+     * pEnqueueScreen: screen the pointer was on when the event was generated
+     * pDequeueScreen: screen the pointer was on when the event is processed
+     */
+    ScreenPtr pEnqueueScreen;
+    ScreenPtr pDequeueScreen;
+
+} SpriteRec;
+
 typedef struct _KeyClassRec {
     int			sourceid;
     CARD8		down[DOWN_LENGTH];
@@ -360,47 +401,6 @@ typedef struct _ClassesRec {
 } ClassesRec;
 
 
-/**
- * Sprite information for a device.
- */
-typedef struct {
-    CursorPtr	current;
-    BoxRec	hotLimits;	/* logical constraints of hot spot */
-    Bool	confined;	/* confined to screen */
-    RegionPtr	hotShape;	/* additional logical shape constraint */
-    BoxRec	physLimits;	/* physical constraints of hot spot */
-    WindowPtr	win;		/* window of logical position */
-    HotSpot	hot;		/* logical pointer position */
-    HotSpot	hotPhys;	/* physical pointer position */
-#ifdef PANORAMIX
-    ScreenPtr	screen;		/* all others are in Screen 0 coordinates */
-    RegionRec   Reg1;	        /* Region 1 for confining motion */
-    RegionRec   Reg2;		/* Region 2 for confining virtual motion */
-    WindowPtr   windows[MAXSCREENS];
-    WindowPtr	confineWin;	/* confine window */ 
-#endif
-    /* The window trace information is used at dix/events.c to avoid having
-     * to compute all the windows between the root and the current pointer
-     * window each time a button or key goes down. The grabs on each of those
-     * windows must be checked.
-     * spriteTraces should only be used at dix/events.c! */
-    WindowPtr *spriteTrace;
-    int spriteTraceSize;
-    int spriteTraceGood;
-
-    /* Due to delays between event generation and event processing, it is
-     * possible that the pointer has crossed screen boundaries between the
-     * time in which it begins generating events and the time when
-     * those events are processed.
-     *
-     * pEnqueueScreen: screen the pointer was on when the event was generated
-     * pDequeueScreen: screen the pointer was on when the event is processed
-     */
-    ScreenPtr pEnqueueScreen;
-    ScreenPtr pDequeueScreen;
-
-} SpriteRec, *SpritePtr;
-
 /* Device properties */
 typedef struct _XIPropertyValue
 {
commit 06a103ad1d6a0ef6146c97a8c81dc7de1c0a0083
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Dec 28 16:37:48 2010 +0000

    Test: Input: Test up to supported server, not protocol, events
    
    When building against a newer inputproto, the server may support fewer
    than XI_LASTEVENT events.  We already have XI2LASTEVENT for the highest
    event number supported by the server, so use that instead.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/test/xi2/protocol-xiselectevents.c b/test/xi2/protocol-xiselectevents.c
index fe1c26d..f951a14 100644
--- a/test/xi2/protocol-xiselectevents.c
+++ b/test/xi2/protocol-xiselectevents.c
@@ -131,7 +131,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
 {
     int i, j;
     xXIEventMask *mask;
-    int nmasks = (XI_LASTEVENT + 7)/8;
+    int nmasks = (XI2LASTEVENT + 7)/8;
     unsigned char *bits;
 
     mask = (xXIEventMask*)&req[1];
@@ -150,14 +150,14 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
         request_XISelectEvent(req, Success);
 
         /* Test 1:
-         * mask may be larger than needed for XI_LASTEVENT.
+         * mask may be larger than needed for XI2LASTEVENT.
          * Test setting each valid mask bit, while leaving unneeded bits 0.
          * -> Success
          */
         bits = (unsigned char*)&mask[1];
         mask->mask_len = (nmasks + 3)/4 * 10;
         memset(bits, 0, mask->mask_len * 4);
-        for (j = 0; j <= XI_LASTEVENT; j++)
+        for (j = 0; j <= XI2LASTEVENT; j++)
         {
             SetBit(bits, j);
             request_XISelectEvent(req, Success);
@@ -165,7 +165,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
         }
 
         /* Test 2:
-         * mask may be larger than needed for XI_LASTEVENT.
+         * mask may be larger than needed for XI2LASTEVENT.
          * Test setting all valid mask bits, while leaving unneeded bits 0.
          * -> Success
          */
@@ -173,21 +173,21 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
         mask->mask_len = (nmasks + 3)/4 * 10;
         memset(bits, 0, mask->mask_len * 4);
 
-        for (j = 0; j <= XI_LASTEVENT; j++)
+        for (j = 0; j <= XI2LASTEVENT; j++)
         {
             SetBit(bits, j);
             request_XISelectEvent(req, Success);
         }
 
         /* Test 3:
-         * mask is larger than needed for XI_LASTEVENT. If any unneeded bit
+         * mask is larger than needed for XI2LASTEVENT. If any unneeded bit
          * is set -> BadValue
          */
         bits = (unsigned char*)&mask[1];
         mask->mask_len = (nmasks + 3)/4 * 10;
         memset(bits, 0, mask->mask_len * 4);
 
-        for (j = XI_LASTEVENT + 1; j < mask->mask_len * 4; j++)
+        for (j = XI2LASTEVENT + 1; j < mask->mask_len * 4; j++)
         {
             SetBit(bits, j);
             request_XISelectEvent(req, BadValue);
@@ -200,7 +200,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
         bits = (unsigned char*)&mask[1];
         mask->mask_len = (nmasks + 3)/4;
         memset(bits, 0, mask->mask_len * 4);
-        for (j = 0; j <= XI_LASTEVENT; j++)
+        for (j = 0; j <= XI2LASTEVENT; j++)
         {
             SetBit(bits, j);
             request_XISelectEvent(req, Success);
@@ -228,7 +228,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req)
         bits = (unsigned char*)&mask[1];
         mask->mask_len = (nmasks + 3)/4;
         memset(bits, 0, mask->mask_len * 4);
-        for (j = 0; j <= XI_LASTEVENT; j++)
+        for (j = 0; j <= XI2LASTEVENT; j++)
             SetBit(bits, j);
         ClearBit(bits, XI_HierarchyChanged);
         for (j = 1; j < 6; j++)
commit a083efe8715e8b29c9bd7f4e7bb429a94620bfc4
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Dec 28 16:06:29 2010 +0000

    Test: Input: Check flags on DeviceEvent
    
    Add initial validation of acceptable flags for XI2 device events, and
    make sure they're swapped.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index 211cce6..0478c33 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -272,6 +272,7 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
     int buttons, valuators;
     int i;
     unsigned char *ptr;
+    uint32_t flagmask = 0;
     FP3232 *values;
 
     if (swap) {
@@ -297,6 +298,7 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
         swapl(&out->mods.latched_mods, n);
         swapl(&out->mods.locked_mods, n);
         swapl(&out->mods.effective_mods, n);
+        swapl(&out->flags, n);
     }
 
     g_assert(out->extension == 0); /* IReqCode defaults to 0 */
@@ -308,7 +310,15 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
     g_assert(out->deviceid == in->deviceid);
     g_assert(out->sourceid == in->sourceid);
 
-    g_assert(out->flags == 0); /* FIXME: we don't set the flags yet */
+    switch (in->type) {
+        case ET_KeyPress:
+            flagmask = XIKeyRepeat;
+            break;
+        default:
+            flagmask = 0;
+            break;
+    }
+    g_assert((out->flags & ~flagmask) == 0);
 
     g_assert(out->root == in->root);
     g_assert(out->event == None); /* set in FixUpEventFromWindow */
commit 2592effef5f171af3f01a2b5130d9747403140f6
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Dec 28 13:42:06 2010 +0000

    Test: Input: Add helper function for failing EventToCore
    
    We have quite a few tests which involve checking that EventToCore fails
    for specific events, so refactor them into a separate function.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/test/input.c b/test/input.c
index 1fe228c..c389a40 100644
--- a/test/input.c
+++ b/test/input.c
@@ -256,7 +256,7 @@ static void dix_event_to_core(int type)
 #undef test_event
 }
 
-static void dix_event_to_core_conversion(void)
+static void dix_event_to_core_fail(int evtype, int expected_rc)
 {
     DeviceEvent ev;
     xEvent core;
@@ -265,25 +265,18 @@ static void dix_event_to_core_conversion(void)
     ev.header   = 0xFF;
     ev.length   = sizeof(DeviceEvent);
 
-    ev.type     = 0;
-    rc = EventToCore((InternalEvent*)&ev, &core);
-    g_assert(rc == BadImplementation);
-
-    ev.type     = 1;
-    rc = EventToCore((InternalEvent*)&ev, &core);
-    g_assert(rc == BadImplementation);
-
-    ev.type     = ET_ProximityOut + 1;
-    rc = EventToCore((InternalEvent*)&ev, &core);
-    g_assert(rc == BadImplementation);
-
-    ev.type     = ET_ProximityIn;
+    ev.type     = evtype;
     rc = EventToCore((InternalEvent*)&ev, &core);
-    g_assert(rc == BadMatch);
+    g_assert(rc == expected_rc);
+}
 
-    ev.type     = ET_ProximityOut;
-    rc = EventToCore((InternalEvent*)&ev, &core);
-    g_assert(rc == BadMatch);
+static void dix_event_to_core_conversion(void)
+{
+    dix_event_to_core_fail(0, BadImplementation);
+    dix_event_to_core_fail(1, BadImplementation);
+    dix_event_to_core_fail(ET_ProximityOut + 1, BadImplementation);
+    dix_event_to_core_fail(ET_ProximityIn, BadMatch);
+    dix_event_to_core_fail(ET_ProximityOut, BadMatch);
 
     dix_event_to_core(ET_KeyPress);
     dix_event_to_core(ET_KeyRelease);
commit e1aed88be92c27d76bff1743f35f9915dea9264f
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Dec 28 17:00:29 2010 +0000

    Input: Swap flags in DeviceEvents
    
    Swap flags for different-endian clients when delivering XI2
    DeviceEvents.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 546ccb4..82df7eb 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -757,6 +757,7 @@ static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
     swapl(&to->mods.latched_mods, n);
     swapl(&to->mods.locked_mods, n);
     swapl(&to->mods.effective_mods, n);
+    swapl(&to->flags, n);
 
     ptr = (char*)(&to[1]);
     ptr += from->buttons_len * 4;


More information about the Xquartz-changes mailing list