xserver: Branch 'mpx' - 23 commits

Peter Hutterer whot at kemper.freedesktop.org
Sun Apr 27 22:20:43 PDT 2008


 COPYING                         |    1 
 Xext/geext.c                    |   50 ++---
 Xext/geint.h                    |   50 ++---
 Xi/chaccess.c                   |   49 ++---
 Xi/chaccess.h                   |   49 ++---
 Xi/chdevcur.c                   |   49 ++---
 Xi/chdevcur.h                   |   48 ++---
 Xi/chdevhier.c                  |   49 ++---
 Xi/chdevhier.h                  |   49 ++---
 Xi/chpkpair.h                   |   45 -----
 Xi/exevents.c                   |    1 
 Xi/exglobals.h                  |    2 
 Xi/extgrbdev.c                  |   49 ++---
 Xi/extgrbdev.h                  |   49 ++---
 Xi/extinit.c                    |  337 ++++++++++++++++------------------------
 Xi/getcptr.c                    |   49 ++---
 Xi/getcptr.h                    |   48 ++---
 Xi/getvers.c                    |   29 ++-
 Xi/listdev.c                    |   67 ++++++-
 Xi/opendev.c                    |   11 +
 Xi/qryacces.c                   |   49 ++---
 Xi/qryacces.h                   |   49 ++---
 Xi/querydp.c                    |   49 ++---
 Xi/querydp.h                    |   48 ++---
 Xi/setcptr.c                    |   49 ++---
 Xi/setcptr.h                    |   49 ++---
 Xi/warpdevp.c                   |   50 ++---
 Xi/warpdevp.h                   |   48 ++---
 Xi/xiselev.c                    |   49 ++---
 Xi/xiselev.h                    |   50 ++---
 configure.ac                    |    2 
 dix/access.c                    |   49 ++---
 dix/devices.c                   |   14 +
 dix/events.c                    |  229 +++------------------------
 dix/main.c                      |    2 
 dix/window.c                    |   15 -
 hw/dmx/dmxclient.h              |    2 
 hw/dmx/dmxlog.c                 |    4 
 hw/dmx/dmxlog.h                 |    2 
 hw/dmx/input/dmxcommon.h        |    4 
 hw/dmx/input/dmxeq.c            |   23 --
 hw/dmx/input/dmxevents.c        |   14 -
 hw/dmx/input/dmxinputinit.c     |   19 --
 hw/xfree86/common/xf86Config.c  |    2 
 hw/xfree86/common/xf86Cursor.c  |    2 
 hw/xfree86/common/xf86Globals.c |    2 
 hw/xfree86/common/xf86Init.c    |    4 
 hw/xfree86/common/xf86MiscExt.c |    4 
 hw/xfree86/common/xf86Privstr.h |    2 
 hw/xfree86/common/xf86Xinput.c  |   15 -
 hw/xfree86/common/xf86Xinput.h  |    4 
 hw/xfree86/loader/dixsym.c      |    6 
 hw/xfree86/loader/loadmod.c     |    2 
 hw/xfree86/loader/xf86sym.c     |    6 
 hw/xgl/egl/kinput.c             |    2 
 hw/xprint/ddxInit.c             |    4 
 hw/xquartz/darwin.c             |    2 
 hw/xwin/winmouse.c              |    8 
 include/dix-config.h.in         |    3 
 include/dix.h                   |    4 
 include/exevents.h              |    9 +
 include/globals.h               |    2 
 include/window.h                |    2 
 include/windowstr.h             |    6 
 mi/mieq.c                       |    7 
 mi/miinitext.c                  |    8 
 mi/mipointer.c                  |    7 
 mi/misprite.c                   |   11 -
 os/utils.c                      |    2 
 69 files changed, 834 insertions(+), 1242 deletions(-)

New commits:
commit 53dba5381fdd8f644e16aaa0ecb05df4dc615b23
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Mon Apr 28 11:37:52 2008 +0930

    dix: if alloc of a master keyboard fails, remove the master pointer.

diff --git a/dix/devices.c b/dix/devices.c
index b3c9efc..37feb34 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -863,6 +863,11 @@ UndisplayDevices()
  * resources.
  * Removes both enabled and disabled devices and notifies all devices about
  * the removal of the device.
+ *
+ * No PresenceNotify is sent for device that the client never saw. This can
+ * happen if a malloc fails during the addition of master devices. If
+ * dev->init is FALSE it means the client never received a DeviceAdded event,
+ * so let's not send a DeviceRemoved event either.
  */
 int
 RemoveDevice(DeviceIntPtr dev)
@@ -873,12 +878,14 @@ RemoveDevice(DeviceIntPtr dev)
     DeviceIntRec dummyDev;
     ScreenPtr screen = screenInfo.screens[0];
     int deviceid;
+    int initialized;
 
     DebugF("(dix) removing device %d\n", dev->id);
 
     if (!dev || dev == inputInfo.keyboard || dev == inputInfo.pointer)
         return BadImplementation;
 
+    initialized = dev->inited;
     screen->UndisplayCursor(dev, screen);
 
     deviceid = dev->id;
@@ -914,7 +921,7 @@ RemoveDevice(DeviceIntPtr dev)
 	}
     }
 
-    if (ret == Success) {
+    if (ret == Success && initialized) {
         inputInfo.numDevices--;
         ev.type = DevicePresenceNotify;
         ev.time = currentTime.milliseconds;
@@ -2587,7 +2594,10 @@ AllocMasterDevice(ClientPtr client, char* name, DeviceIntPtr* ptr, DeviceIntPtr*
 
     keyboard = AddInputDevice(client, CoreKeyboardProc, TRUE);
     if (!keyboard)
+    {
+        RemoveDevice(pointer);
         return BadAlloc;
+    }
 
     keyboard->name = xcalloc(strlen(name) + strlen(" keyboard") + 1, sizeof(char));
     strcpy(keyboard->name, name);
commit 1fab51edfc82e1ef60dfa29fd5d93478066a3998
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Mon Apr 28 11:37:21 2008 +0930

    mi: guard against NULL-pointer dereference.

diff --git a/mi/misprite.c b/mi/misprite.c
index c998e55..9e4b685 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -916,12 +916,15 @@ miSpriteUndisplayCursor(pDev, pScreen)
     DeviceIntPtr pDev;
     ScreenPtr    pScreen;
 {
+    miCursorInfoPtr pCursorInfo;
+
     if (!pDev->isMaster && !pDev->u.master)
     {
         ErrorF("[mi] miSpriteUndisplayCursor called for floating device.\n");
         return;
     }
-    if (MISPRITE(pDev)->isUp)
+    pCursorInfo = MISPRITE(pDev);
+    if (pCursorInfo && pCursorInfo->isUp)
         miSpriteRemoveCursor(pDev, pScreen);
 }
 
commit b5004722a208479a4bc762ff428bf4cbeb430d53
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Mon Apr 28 10:26:01 2008 +0930

    Xi: Only return VCP, VCK and floating SDs to Xi 1.x clients.
    
    This is better than the approach implemented with
    8973a3f7983240407dd6da59b3643f40e6a3d83a which disabled XI altogether for 1.x.
    Instead, return a device list that resembles a traditional XI setup on pre XI
    2.0 servers. If the client tries to open a device other than a floating SD,
    return a BadDevice error.

diff --git a/Xi/listdev.c b/Xi/listdev.c
index b588c24..c484dcc 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -315,9 +315,9 @@ CopySwapClasses(ClientPtr client, DeviceIntPtr dev, CARD8 *num_classes,
  * This procedure lists the input devices available to the server.
  *
  * If this request is called by a client that has not issued a
- * GetExtensionVersion request with major/minor version set, we pretend no
- * devices are available. It's the only thing we can do to stop pre-XI 2
- * clients.
+ * GetExtensionVersion request with major/minor version set, we don't send the
+ * complete device list. Instead, we only send the VCP, the VCK and floating
+ * SDs. This resembles the setup found on XI 1.x machines.
  */
 
 int
@@ -347,34 +347,35 @@ ProcXListInputDevices(ClientPtr client)
 
     AddOtherInputDevices();
 
-    if (pXIClient->major_version >= XI_2_Major) {
-        for (d = inputInfo.devices; d; d = d->next) {
-            rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
-            if (rc != Success)
-                return rc;
-            SizeDeviceInfo(d, &namesize, &size);
-            numdevs++;
-        }
-        for (d = inputInfo.off_devices; d; d = d->next) {
-            rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
-            if (rc != Success)
-                return rc;
-            SizeDeviceInfo(d, &namesize, &size);
-            numdevs++;
+    for (d = inputInfo.devices; d; d = d->next) {
+        if (pXIClient->major_version < XI_2_Major)
+        {
+            if (d->isMaster &&
+                d != inputInfo.pointer &&
+                d != inputInfo.keyboard)
+                continue; /* don't send master devices other than VCP/VCK */
+
+            if (!d->isMaster && d->u.master)
+                continue; /* don't send attached SDs */
         }
-    } else
-    {
-        /* Pretend we don't have XI devices connected */
-        rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.pointer, DixGetAttrAccess);
+        rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
         if (rc != Success)
             return rc;
-        rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, DixGetAttrAccess);
+        SizeDeviceInfo(d, &namesize, &size);
+        numdevs++;
+    }
+
+    for (d = inputInfo.off_devices; d; d = d->next) {
+        if (pXIClient->major_version < XI_2_Major &&
+            !d->isMaster &&
+            d->u.master) /* XXX can off_devices be attached? */
+                continue; /* don't send attached SDs */
+
+        rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
         if (rc != Success)
             return rc;
-
-        SizeDeviceInfo(inputInfo.pointer, &namesize, &size);
-        SizeDeviceInfo(inputInfo.keyboard, &namesize, &size);
-        numdevs = 2;
+        SizeDeviceInfo(d, &namesize, &size);
+        numdevs++;
     }
 
     total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
@@ -384,18 +385,30 @@ ProcXListInputDevices(ClientPtr client)
     savbuf = devbuf;
 
     dev = (xDeviceInfoPtr) devbuf;
-    if (pXIClient->major_version >= XI_2_Major)
-    {
-        for (d = inputInfo.devices; d; d = d->next, dev++)
-            ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
-        for (d = inputInfo.off_devices; d; d = d->next, dev++)
-            ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
-    } else
+    for (d = inputInfo.devices; d; d = d->next)
     {
-        ListDeviceInfo(client, inputInfo.pointer, dev, &devbuf, &classbuf, &namebuf);
-        ListDeviceInfo(client, inputInfo.keyboard, dev, &devbuf, &classbuf, &namebuf);
+        if (pXIClient->major_version < XI_2_Major)
+        {
+            if (d->isMaster &&
+                    d != inputInfo.pointer &&
+                    d != inputInfo.keyboard)
+                continue; /* don't count master devices other than VCP/VCK */
+
+            if (!d->isMaster && d->u.master)
+                continue; /* don't count attached SDs */
+        }
+        ListDeviceInfo(client, d, dev++, &devbuf, &classbuf, &namebuf);
     }
 
+    for (d = inputInfo.off_devices; d; d = d->next)
+    {
+        if (pXIClient->major_version < XI_2_Major &&
+                !d->isMaster &&
+                d->u.master) /* XXX can off_devices be attached? */
+            continue; /* don't send attached SDs */
+
+        ListDeviceInfo(client, d, dev++, &devbuf, &classbuf, &namebuf);
+    }
     rep.ndevices = numdevs;
     rep.length = (total_length + 3) >> 2;
     WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
diff --git a/Xi/opendev.c b/Xi/opendev.c
index f14f848..c51bb7e 100644
--- a/Xi/opendev.c
+++ b/Xi/opendev.c
@@ -62,6 +62,7 @@ SOFTWARE.
 #include "XIstubs.h"
 #include "windowstr.h"	/* window structure  */
 #include "exglobals.h"
+#include "exevents.h"
 
 #include "opendev.h"
 
@@ -98,6 +99,7 @@ ProcXOpenDevice(ClientPtr client)
     int status = Success;
     xOpenDeviceReply rep;
     DeviceIntPtr dev;
+    XIClientPtr pXIClient;
 
     REQUEST(xOpenDeviceReq);
     REQUEST_SIZE_MATCH(xOpenDeviceReq);
@@ -113,6 +115,15 @@ ProcXOpenDevice(ClientPtr client)
     } else if (status != Success)
 	return status;
 
+    /* Don't let XI 1.x clients open devices other than floating SDs. */
+    pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
+    if (pXIClient->major_version < XI_2_Major)
+    {
+        if (dev->isMaster || (!dev->isMaster && dev->u.master))
+            return BadDevice;
+    }
+
+
     OpenInputDevice(dev, client, &status);
     if (status != Success)
 	return status;
commit 684b5d8382bf0bc6cd55774226ee362e81c0adbf
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sat Apr 26 19:55:59 2008 +0930

    Xi: whoops, stray ! caused a bit of memory mess.

diff --git a/Xi/listdev.c b/Xi/listdev.c
index fc2748e..b588c24 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -347,7 +347,7 @@ ProcXListInputDevices(ClientPtr client)
 
     AddOtherInputDevices();
 
-    if (!pXIClient->major_version >= XI_2_Major) {
+    if (pXIClient->major_version >= XI_2_Major) {
         for (d = inputInfo.devices; d; d = d->next) {
             rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
             if (rc != Success)
commit 87071b604c4b7c3c79ab784e2c09ff691e2bc5ad
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sat Apr 26 19:37:57 2008 +0930

    Revert "Xi: disable XI for clients < XI 2.0"
    
    Turns out some programs don't like this change. gnome-settings-daemon crashes
    hard if you tell it that XI doesn't exist. So, tell them we have XI, but leave
    the other change (the one that pretends no devices are available).
    
    This reverts commit 8973a3f7983240407dd6da59b3643f40e6a3d83a.

diff --git a/Xi/getvers.c b/Xi/getvers.c
index daf9a02..43a1a4d 100644
--- a/Xi/getvers.c
+++ b/Xi/getvers.c
@@ -122,10 +122,7 @@ ProcXGetExtensionVersion(ClientPtr client)
     rep.RepType = X_GetExtensionVersion;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    if (!pXIClient->major_version < XI_2_Major) /* sorry, no XI 1.x anymore. */
-        rep.present = FALSE;
-    else
-        rep.present = TRUE;
+    rep.present = TRUE;
     rep.major_version = AllExtensionVersions[IReqCode - 128].major_version;
     rep.minor_version = AllExtensionVersions[IReqCode - 128].minor_version;
 
commit 7447a30fb27ed50a20a85b5a2de9afe7dea8cfa5
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sat Apr 26 19:03:13 2008 +0930

    Xi: if a pre-XI2 client tries to list the devices, pretend we don't have any.
    
    XI 1.x isn't supported anymore, so let's pretend we don't have any devices.
    This stops clients from opening them and thus stops interference.

diff --git a/Xi/listdev.c b/Xi/listdev.c
index 3fb0ab3..fc2748e 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -64,6 +64,7 @@ SOFTWARE.
 #include "XIstubs.h"
 #include "extnsionst.h"
 #include "exglobals.h"	/* FIXME */
+#include "exevents.h"
 #include "xace.h"
 
 #include "listdev.h"
@@ -313,12 +314,17 @@ CopySwapClasses(ClientPtr client, DeviceIntPtr dev, CARD8 *num_classes,
  *
  * This procedure lists the input devices available to the server.
  *
+ * If this request is called by a client that has not issued a
+ * GetExtensionVersion request with major/minor version set, we pretend no
+ * devices are available. It's the only thing we can do to stop pre-XI 2
+ * clients.
  */
 
 int
 ProcXListInputDevices(ClientPtr client)
 {
     xListInputDevicesReply rep;
+    XIClientPtr pXIClient;
     int numdevs = 0;
     int namesize = 1;	/* need 1 extra byte for strcpy */
     int rc, size = 0;
@@ -337,21 +343,38 @@ ProcXListInputDevices(ClientPtr client)
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
 
+    pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
+
     AddOtherInputDevices();
 
-    for (d = inputInfo.devices; d; d = d->next) {
-	rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
-	if (rc != Success)
-	    return rc;
-	SizeDeviceInfo(d, &namesize, &size);
-        numdevs++;
-    }
-    for (d = inputInfo.off_devices; d; d = d->next) {
-	rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
-	if (rc != Success)
-	    return rc;
-	SizeDeviceInfo(d, &namesize, &size);
-        numdevs++;
+    if (!pXIClient->major_version >= XI_2_Major) {
+        for (d = inputInfo.devices; d; d = d->next) {
+            rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
+            if (rc != Success)
+                return rc;
+            SizeDeviceInfo(d, &namesize, &size);
+            numdevs++;
+        }
+        for (d = inputInfo.off_devices; d; d = d->next) {
+            rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
+            if (rc != Success)
+                return rc;
+            SizeDeviceInfo(d, &namesize, &size);
+            numdevs++;
+        }
+    } else
+    {
+        /* Pretend we don't have XI devices connected */
+        rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.pointer, DixGetAttrAccess);
+        if (rc != Success)
+            return rc;
+        rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, DixGetAttrAccess);
+        if (rc != Success)
+            return rc;
+
+        SizeDeviceInfo(inputInfo.pointer, &namesize, &size);
+        SizeDeviceInfo(inputInfo.keyboard, &namesize, &size);
+        numdevs = 2;
     }
 
     total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
@@ -361,10 +384,17 @@ ProcXListInputDevices(ClientPtr client)
     savbuf = devbuf;
 
     dev = (xDeviceInfoPtr) devbuf;
-    for (d = inputInfo.devices; d; d = d->next, dev++)
-	ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
-    for (d = inputInfo.off_devices; d; d = d->next, dev++)
-	ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
+    if (pXIClient->major_version >= XI_2_Major)
+    {
+        for (d = inputInfo.devices; d; d = d->next, dev++)
+            ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
+        for (d = inputInfo.off_devices; d; d = d->next, dev++)
+            ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
+    } else
+    {
+        ListDeviceInfo(client, inputInfo.pointer, dev, &devbuf, &classbuf, &namebuf);
+        ListDeviceInfo(client, inputInfo.keyboard, dev, &devbuf, &classbuf, &namebuf);
+    }
 
     rep.ndevices = numdevs;
     rep.length = (total_length + 3) >> 2;
commit 8973a3f7983240407dd6da59b3643f40e6a3d83a
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sat Apr 26 17:48:52 2008 +0930

    Xi: disable XI for clients < XI 2.0
    
    Sorry. With the huge changes in the device handling I honestly don't know how
    to support XI and XI2 alongside. So let's just pretend XI doesn't exist if a
    client doesn't request it supporting XI2.

diff --git a/Xi/getvers.c b/Xi/getvers.c
index 43a1a4d..daf9a02 100644
--- a/Xi/getvers.c
+++ b/Xi/getvers.c
@@ -122,7 +122,10 @@ ProcXGetExtensionVersion(ClientPtr client)
     rep.RepType = X_GetExtensionVersion;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.present = TRUE;
+    if (!pXIClient->major_version < XI_2_Major) /* sorry, no XI 1.x anymore. */
+        rep.present = FALSE;
+    else
+        rep.present = TRUE;
     rep.major_version = AllExtensionVersions[IReqCode - 128].major_version;
     rep.minor_version = AllExtensionVersions[IReqCode - 128].minor_version;
 
commit b304b0a65cc57127cdea103f2c5114e4ea79af41
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sat Apr 26 17:38:55 2008 +0930

    Xi: add versioning support.
    
    Remember the version the client sent to us, so we can adjust our replies
    accordingly. This requires the client to use the {major|minor}Version fields
    in the GetExtensionVersion request. However, they were padding before, so we
    must assume they are garbage if nbytes is non-zero. If nbytes is zero, the
    client is probably a new client and we can handle it correctly.

diff --git a/Xi/exglobals.h b/Xi/exglobals.h
index 8cbccf2..4c23d84 100644
--- a/Xi/exglobals.h
+++ b/Xi/exglobals.h
@@ -31,6 +31,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
 #endif
+#include "privates.h"
 
 #ifndef EXGLOBALS_H
 #define EXGLOBALS_H 1
@@ -75,4 +76,5 @@ extern int DeviceLeaveNotify;
 
 extern int RT_INPUTCLIENT;
 
+extern DevPrivateKey XIClientPrivateKey;
 #endif /* EXGLOBALS_H */
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 838efdd..a647b9e 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -72,6 +72,7 @@ SOFTWARE.
 #include "exglobals.h"
 #include "swaprep.h"
 #include "registry.h"
+#include "privates.h"
 
 /* modules local to Xi */
 #include "allowev.h"
@@ -324,20 +325,43 @@ int RT_INPUTCLIENT;
 
 extern XExtensionVersion AllExtensionVersions[];
 
+
 Mask PropagateMask[MAX_DEVICES];
 
 /*****************************************************************
  *
- * Declarations of local routines.
+ * Versioning support
  *
  */
 
+DevPrivateKey XIClientPrivateKey = &XIClientPrivateKey;
+
 static XExtensionVersion thisversion = { XI_Present,
     XI_2_Major,
     XI_2_Minor
 };
 
 
+/*****************************************************************
+ *
+ * Declarations of local routines.
+ *
+ */
+
+static void
+XIClientCallback(CallbackListPtr        *list,
+                 pointer                closure,
+                 pointer                data)
+{
+    NewClientInfoRec *clientinfo = (NewClientInfoRec*)data;
+    ClientPtr pClient = clientinfo->client;
+    XIClientPtr pXIClient;
+
+    pXIClient = dixLookupPrivate(&pClient->devPrivates, XIClientPrivateKey);
+    pXIClient->major_version = 0;
+    pXIClient->minor_version = 0;
+}
+
 /*************************************************************************
  *
  * ProcIDispatch - main dispatch routine for requests to this extension.
@@ -1080,6 +1104,7 @@ XIGEEventFill(xGenericEvent* ev, DeviceIntPtr pDev,
  *
  * This extension has several events and errors.
  *
+ * XI is mandatory nowadays, so if we fail to init XI, we die.
  */
 
 void
@@ -1087,6 +1112,12 @@ XInputExtensionInit(void)
 {
     ExtensionEntry *extEntry;
 
+    if (!dixRequestPrivate(XIClientPrivateKey, sizeof(XIClientRec)))
+        FatalError("Cannot request private for XI.\n");
+
+    if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
+        FatalError("Failed to add callback to XI.\n");
+
     extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
 			    SProcIDispatch, IResetProc, StandardMinorOpcode);
     if (extEntry) {
diff --git a/Xi/getvers.c b/Xi/getvers.c
index 1e17eea..43a1a4d 100644
--- a/Xi/getvers.c
+++ b/Xi/getvers.c
@@ -59,6 +59,7 @@ SOFTWARE.
 #include "inputstr.h"	/* DeviceIntPtr      */
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
+#include "exevents.h"
 #include "exglobals.h"
 
 #include "getvers.h"
@@ -93,6 +94,7 @@ int
 ProcXGetExtensionVersion(ClientPtr client)
 {
     xGetExtensionVersionReply rep;
+    XIClientPtr pXIClient;
 
     REQUEST(xGetExtensionVersionReq);
     REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
@@ -101,6 +103,21 @@ ProcXGetExtensionVersion(ClientPtr client)
 			  stuff->nbytes + 3) >> 2)
 	return BadLength;
 
+    pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
+
+    /* GetExtensionVersionReq before XI 2 didn't supply the client's
+     * major/minor. So we don't actually have a clue what they support.
+     * {major|minor}Version was added as part of XI, so if they are set, we
+     * know we can trust it. In this case the client must set nbytes to 0
+     * though, otherwise we have to assume that the version are padding
+     * garbage.
+     */
+    if (!stuff->nbytes) /* Client using XQueryInputVersion(). */
+    {
+        pXIClient->major_version = stuff->majorVersion;
+        pXIClient->minor_version = stuff->minorVersion;
+    } /* else version unknown, leave it at 0.0 */
+
     rep.repType = X_Reply;
     rep.RepType = X_GetExtensionVersion;
     rep.length = 0;
diff --git a/include/exevents.h b/include/exevents.h
index 0892f4d..8d5d5dd 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -32,6 +32,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 #include <X11/extensions/XIproto.h>
 
+/**
+ * Attached to the devPrivates of each client. Specifies the version number as
+ * supported by the client.
+ */
+typedef struct _XIClientRec {
+        int major_version;
+        int minor_version;
+} XIClientRec, *XIClientPtr;
+
 extern void RegisterOtherDevice (
 	DeviceIntPtr           /* device */);
 
commit e251c9e75afdc5e32f2bc9801712272358934266
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 16:49:35 2008 +0930

    Remove all traces of #ifdef XINPUT and the matching bits from the configure.ac

diff --git a/configure.ac b/configure.ac
index d3a2317..166d9f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1004,7 +1004,7 @@ DAMAGE_INC='-I$(top_srcdir)/damageext'
 MIEXT_DAMAGE_LIB='$(top_builddir)/miext/damage/libdamage.la'
 MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage'
 
-AC_DEFINE(XINPUT, 1, [Support X Input extension])
+# XINPUT extension is integral part of the server
 XI_LIB='$(top_builddir)/Xi/libXi.la'
 XI_INC='-I$(top_srcdir)/Xi'
 
diff --git a/hw/dmx/dmxclient.h b/hw/dmx/dmxclient.h
index 8f018d1..91ba049 100644
--- a/hw/dmx/dmxclient.h
+++ b/hw/dmx/dmxclient.h
@@ -98,9 +98,7 @@ typedef XID           KeySym64;
 #include <X11/extensions/XKBstr.h>
 #endif
 
-#ifdef XINPUT
 #include <X11/extensions/XI.h>
-#endif
 
 /* Always include these, since we query them even if we don't export XINPUT. */
 #include <X11/extensions/XInput.h> /* For XDevice */
diff --git a/hw/dmx/dmxlog.c b/hw/dmx/dmxlog.c
index 31a74cd..94b8035 100644
--- a/hw/dmx/dmxlog.c
+++ b/hw/dmx/dmxlog.c
@@ -42,10 +42,8 @@
 #include "dmx.h"
 #include "dmxlog.h"
 #include "dmxinput.h"
-#ifdef XINPUT
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
-#endif
 
 static dmxLogLevel dmxCurrentLogLevel = dmxDebug;
 
@@ -279,7 +277,6 @@ void dmxLogVisual(DMXScreenInfo *dmxScreen, XVisualInfo *vi, int defaultVisual)
     }
 }
 
-#ifdef XINPUT
 /** Translate a (normalized) XInput event \a type into a human-readable
  * string. */
 const char *dmxXInputEventName(int type)
@@ -305,7 +302,6 @@ const char *dmxXInputEventName(int type)
 }
 
 #endif
-#endif
 
 /** Translate an event \a type into a human-readable string. */
 const char *dmxEventName(int type)
diff --git a/hw/dmx/dmxlog.h b/hw/dmx/dmxlog.h
index 8a5f725..7b614bd 100644
--- a/hw/dmx/dmxlog.h
+++ b/hw/dmx/dmxlog.h
@@ -70,9 +70,7 @@ extern void dmxLogInputCont(DMXInputInfo *dmxInput, const char *format, ...);
 extern void dmxLogArgs(dmxLogLevel logLevel, int argc, char **argv);
 extern void dmxLogVisual(DMXScreenInfo *dmxScreen, XVisualInfo *vi,
                          int defaultVisual);
-#ifdef XINPUT
 extern const char *dmxXInputEventName(int type);
 #endif
-#endif
 
 #endif
diff --git a/hw/dmx/input/dmxcommon.h b/hw/dmx/input/dmxcommon.h
index 1cc935d..a9b260c 100644
--- a/hw/dmx/input/dmxcommon.h
+++ b/hw/dmx/input/dmxcommon.h
@@ -63,13 +63,9 @@
 #define DMX_COMMON_XKB      DMX_COMMON_OTHER
 #endif
 
-#ifdef XINPUT
 #define DMX_COMMON_PRIVATE                  \
     DMX_COMMON_XKB;                         \
     XDevice                 *xi
-#else
-#define DMX_COMMON_PRIVATE  DMX_COMMON_OTHER
-#endif
 
 #define GETONLYPRIVFROMPRIVATE                                          \
     myPrivate            *priv     = private
diff --git a/hw/dmx/input/dmxeq.c b/hw/dmx/input/dmxeq.c
index dff0b44..afa2b2c 100644
--- a/hw/dmx/input/dmxeq.c
+++ b/hw/dmx/input/dmxeq.c
@@ -79,10 +79,8 @@
 #include "inputstr.h"
 #include "scrnintstr.h"         /* For screenInfo */
 
-#ifdef XINPUT
 #include <X11/extensions/XIproto.h>
 #define EXTENSION_PROC_ARGS void *
-#endif
 
 #if DMX_EQ_DEBUG
 #define DMXDBG2(f,a,b)           dmxLog(dmxDebug,f,a,b)
@@ -100,9 +98,7 @@
 typedef struct _Event {
     xEvent	   event;    /**< Event. */
     ScreenPtr	   pScreen;  /**< Screen on which event occurred. */
-#ifdef XINPUT
     deviceValuator valuator; /**< XInput device valuator information. */
-#endif
 } EventRec, *EventPtr;
 
 /** Event queue. */
@@ -183,15 +179,11 @@ void dmxeqEnqueue(xEvent *e)
 
                                 /* Store the event in the queue */
     dmxEventQueue.events[oldtail].event   = *e;
-#ifdef XINPUT
-    {
-                                /* If this is an XInput event, store the
-                                 * valuator event, too */
-        deviceKeyButtonPointer *ev = (deviceKeyButtonPointer *)e;
-        if (e->u.u.type >= LASTEvent && (ev->deviceid & MORE_EVENTS))
-            dmxEventQueue.events[oldtail].valuator = *(deviceValuator *)(ev+1);
-    }
-#endif
+                            /* If this is an XInput event, store the
+                             * valuator event, too */
+    deviceKeyButtonPointer *ev = (deviceKeyButtonPointer *)e;
+    if (e->u.u.type >= LASTEvent && (ev->deviceid & MORE_EVENTS))
+        dmxEventQueue.events[oldtail].valuator = *(deviceValuator *)(ev+1);
 
                                 /* Make sure that event times don't go
                                  * backwards - this is "unnecessary",
@@ -211,7 +203,6 @@ void dmxeqSwitchScreen(ScreenPtr pScreen, Bool fromDIX)
     if (fromDIX) dmxEventQueue.pDequeueScreen = pScreen;
 }
 
-#ifdef XINPUT
 static void dmxeqProcessXInputEvent(xEvent *xe, EventRec *e)
 {
     deviceKeyButtonPointer *ev     = (deviceKeyButtonPointer *)xe;
@@ -238,7 +229,6 @@ static void dmxeqProcessXInputEvent(xEvent *xe, EventRec *e)
         pDevice->public.processInputProc(xe, pDevice, 1);
     }
 }
-#endif
 
 /**
  * This function is called from #ProcessInputEvents() to remove events
@@ -285,11 +275,8 @@ void dmxeqProcessInputEvents(void)
                                        (DeviceIntPtr)dmxEventQueue.pKbd, 1);
 	    	break;
             default:
-#ifdef XINPUT
                 dmxeqProcessXInputEvent(xe, e);
                 break;
-#endif
-                /* ifndef XINPUT, fall through */
             case ButtonPress:
             case ButtonRelease:
             case MotionNotify:
diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 26dc067..2e24ff4 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -57,9 +57,7 @@
 #include "mipointer.h"
 #include "mi.h"
 
-#ifdef XINPUT
 #include "XIstubs.h"
-#endif
 
 static int  dmxGlobalX, dmxGlobalY; /* Global cursor position */
 static int  dmxGlobalInvalid;       /* Flag indicating dmxCoreMotion
@@ -154,7 +152,6 @@ static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
     return 0;
 }
 
-#ifdef XINPUT
 static void dmxEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, xEvent *e,
                                DMXBlockType block)
 {
@@ -208,7 +205,6 @@ static void dmxEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, xEvent *e,
     if (block)
         dmxSigioUnblock();
 }
-#endif
 
 DMXScreenInfo *dmxFindFirstScreen(int x, int y)
 {
@@ -331,7 +327,6 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
 
 
 
-#ifdef XINPUT
 #define DMX_MAX_AXES 32         /* Max axes reported by this routine */
 static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
                          int *v, int firstAxis, int axesCount,
@@ -537,7 +532,6 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
     }
     return 0;
 }
-#endif
 
 static int dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
 {
@@ -578,14 +572,12 @@ void dmxInvalidateGlobalPosition(void)
 void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
                DMXMotionType type, DMXBlockType block)
 {
-#ifdef XINPUT
     GETDMXLOCALFROMPDEV;
 
     if (!dmxLocal->sendsCore) {
         dmxExtMotion(dmxLocal, v, firstAxes, axesCount, type, block);
         return;
     }
-#endif
     if (axesCount == 2) {
         switch (type) {
         case DMX_RELATIVE:
@@ -739,17 +731,13 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
                                  * control of the input device LEDs. */
         return;
     default:
-#ifdef XINPUT
         if (type == ProximityIn || type == ProximityOut) {
             if (dmxLocal->sendsCore)
                 return; /* Not a core event */
             break;
         }
-#endif
         if (type >= LASTEvent) {
-#ifdef XINPUT
             if (dmxTranslateAndEnqueueExtEvent(dmxLocal, e, block))
-#endif
                 dmxLogInput(dmxInput, "Unhandled extension event: %d\n", type);
         } else {
             dmxLogInput(dmxInput, "Unhandled event: %d (%s)\n",
@@ -764,11 +752,9 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
     xE.u.u.detail              = detail;
     xE.u.keyButtonPointer.time = GetTimeInMillis();
 
-#ifdef XINPUT
     if (!dmxLocal->sendsCore)
         dmxEnqueueExtEvent(dmxLocal, &xE, block);
     else
-#endif
         dmxeqEnqueue(&xE);
 #endif /*00*/
 }
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index fd4eeaa..7b5cc73 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -73,13 +73,11 @@
 #include "windowstr.h"
 #include "mi.h"
 
-#ifdef XINPUT
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
 #include "exevents.h"
 #define EXTENSION_PROC_ARGS void *
 #include "extinit.h"
-#endif
 
 /* From XI.h */
 #ifndef Relative
@@ -462,9 +460,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
     GETDMXINPUTFROMPDEVICE;
     int              fd;
     DMXLocalInitInfo info;
-#ifdef XINPUT
     int              i;
-#endif
     
     if (dmxInput->detached) return Success;
 
@@ -504,41 +500,33 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
                                               GetMaximumEventsNum(),
 #endif
                                               Relative);
-#ifdef XINPUT
                 for (i = 0; i < info.numRelAxes; i++)
                     InitValuatorAxisStruct(pDevice, i, info.minval[0],
                                            info.maxval[0], info.res[0],
                                            info.minres[0], info.maxres[0]);
-#endif
             } else if (info.numRelAxes) {
                 InitValuatorClassDeviceStruct(pDevice, info.numRelAxes,
                                               dmxPointerGetMotionEvents,
                                               dmxPointerGetMotionBufferSize(),
                                               Relative);
-#ifdef XINPUT
                 for (i = 0; i < info.numRelAxes; i++)
                     InitValuatorAxisStruct(pDevice, i, info.minval[0],
                                            info.maxval[0], info.res[0],
                                            info.minres[0], info.maxres[0]);
-#endif
             } else if (info.numAbsAxes) {
                 InitValuatorClassDeviceStruct(pDevice, info.numAbsAxes,
                                               dmxPointerGetMotionEvents,
                                               dmxPointerGetMotionBufferSize(),
                                               Absolute);
-#ifdef XINPUT
                 for (i = 0; i < info.numAbsAxes; i++)
                     InitValuatorAxisStruct(pDevice, i+info.numRelAxes,
                                            info.minval[i+1], info.maxval[i+1],
                                            info.res[i+1], info.minres[i+1],
                                            info.maxres[i+1]);
-#endif
             }
         }
         if (info.focusClass)       InitFocusClassDeviceStruct(pDevice);
-#ifdef XINPUT
         if (info.proximityClass)   InitProximityClassDeviceStruct(pDevice);
-#endif
         if (info.ptrFeedbackClass)
             InitPtrFeedbackClassDeviceStruct(pDevice, dmxChangePointerControl);
         if (info.kbdFeedbackClass)
@@ -759,17 +747,10 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
         }
     }
 
-#ifdef XINPUT
     if (!name) {
         name            = "extension";
         registerProcPtr = RegisterOtherDevice;
     }
-#else
-    if (!name)
-        dmxLog(dmxFatal,
-               "Server not build with XINPUT support (cannot add %s)\n",
-               dmxLocal->name);
-#endif
 
     if (!name || !registerProcPtr)
         dmxLog(dmxFatal, "Cannot add device %s\n", dmxLocal->name);
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index b6e1186..601b9bb 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -62,10 +62,8 @@
 #include "extension.h"
 #include "Pci.h"
 
-#ifdef XINPUT
 #include "xf86Xinput.h"
 extern DeviceAssocRec mouse_assoc;
-#endif
 
 #ifdef XKB
 #undef XKB_IN_SERVER
diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index 725fcb2..c6f6039 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -44,10 +44,8 @@
 #include "xf86Priv.h"
 #include "xf86_OSproc.h"
 
-#ifdef XINPUT
 #include <X11/extensions/XIproto.h>
 #include "xf86Xinput.h"
-#endif
 
 #ifdef XFreeXDGA
 #include "dgaproc.h"
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 0dc42c6..14bef39 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -100,9 +100,7 @@ xf86InfoRec xf86Info = {
 	FALSE,		/* vtSysreq */
 	SKWhenNeeded,	/* ddxSpecialKeys */
 	NULL,		/* pMouse */
-#ifdef XINPUT
 	NULL,		/* mouseLocal */
-#endif
 	-1,		/* lastEventTime */
 	FALSE,		/* vtRequestsPending */
 	FALSE,		/* inputPending */
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 6d5eaad..bf45d76 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -71,12 +71,8 @@
 #include "xf86Date.h"
 #include "xf86Build.h"
 #include "mipointer.h"
-#ifdef XINPUT
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
-#else
-#include "inputstr.h"
-#endif
 #include "xf86DDC.h"
 #include "xf86Xinput.h"
 #include "xf86InPriv.h"
diff --git a/hw/xfree86/common/xf86MiscExt.c b/hw/xfree86/common/xf86MiscExt.c
index 40c196a..8817b79 100644
--- a/hw/xfree86/common/xf86MiscExt.c
+++ b/hw/xfree86/common/xf86MiscExt.c
@@ -48,13 +48,9 @@
 #define XF86_OS_PRIVS
 #include "xf86_OSlib.h"
 
-#ifdef XINPUT
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
 #include "xf86Xinput.h"
-#else
-#include "inputstr.h"
-#endif
 
 #include "xf86OSmouse.h"
 
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index 8cab56e..318a59f 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -80,9 +80,7 @@ typedef struct {
 
     /* mouse part */
     DeviceIntPtr	pMouse;
-#ifdef XINPUT
     pointer		mouseLocal;
-#endif
 
     /* event handler part */
     int			lastEventTime;
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 9f293cc..5279306 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -52,17 +52,13 @@
 
 #include <X11/Xfuncproto.h>
 #include <X11/Xmd.h>
-#ifdef XINPUT
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
-#endif
 #include "xf86.h"
 #include "xf86Priv.h"
 #include "xf86Xinput.h"
-#ifdef XINPUT
 #include "XIstubs.h"
 #include "xf86Optrec.h"
-#endif
 #include "mipointer.h"
 #include "xf86InPriv.h"
 
@@ -193,7 +189,6 @@ xf86ActivateDevice(LocalDevicePtr local)
 }
 
 
-#ifdef XINPUT
 /***********************************************************************
  *
  * Caller:	ProcXOpenDevice
@@ -322,7 +317,6 @@ void
 AddOtherInputDevices()
 {
 }
-#endif
 
 int
 NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev)
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index d88bbbe..dd72ec7 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -57,11 +57,9 @@
 #endif
 #include "xf86str.h"
 #include "inputstr.h"
-#ifdef XINPUT
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
 #include "XIstubs.h"
-#endif
 
 /* Input device flags */
 #define XI86_OPEN_ON_INIT       0x01 /* open the device at startup time */
@@ -89,7 +87,6 @@
 #define TS_Raw 60
 #define TS_Scaled 61
 
-#ifdef XINPUT
 /* This holds the input driver entry and module information. */
 typedef struct _InputDriverRec {
     int			    driverVersion;
@@ -103,7 +100,6 @@ typedef struct _InputDriverRec {
     pointer		    module;
     int			    refCount;
 } InputDriverRec, *InputDriverPtr;
-#endif
 
 /* This is to input devices what the ScrnInfoRec is to screens. */
 
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index 61dec59..a2a2390 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -422,9 +422,9 @@ _X_HIDDEN void *dixLookupTab[] = {
 #ifdef PANORAMIX
     SYMVAR(noPanoramiXExtension)
 #endif
-#ifdef XINPUT
+
     SYMVAR(noXInputExtension)
-#endif
+
 #ifdef XIDLE
     SYMVAR(noXIdleExtension)
 #endif
@@ -481,14 +481,12 @@ _X_HIDDEN void *dixLookupTab[] = {
     SYMVAR(XkbDfltRepeatInterval)
 #endif
 
-#ifdef XINPUT
     /* Xi */
     /* exevents.c */
     SYMFUNC(InitValuatorAxisStruct)
     SYMFUNC(InitProximityClassDeviceStruct)
     /* extinit.c */
     SYMFUNC(AssignTypeAndName)
-#endif
 
     /* xf86DGA.c */
     /* XXX This is exported from the DDX, not DIX. */
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 7f3bbe4..04719a6 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -59,9 +59,7 @@
 #include "misc.h"
 #include "xf86.h"
 #include "xf86Priv.h"
-#ifdef XINPUT
 #include "xf86Xinput.h"
-#endif
 #include "loader.h"
 #include "xf86Optrec.h"
 
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index 1d3e639..e15b07a 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -64,9 +64,7 @@
 #include "xf86_OSproc.h"
 #include "xf86Parser.h"
 #include "xf86Config.h"
-#ifdef XINPUT
 # include "xf86Xinput.h"
-#endif
 #include "xf86OSmouse.h"
 #ifdef XV
 #include "xf86xv.h"
@@ -291,14 +289,12 @@ _X_HIDDEN void *xfree86LookupTab[] = {
     SYMFUNC(xf86UnbindGARTMemory)
     SYMFUNC(xf86EnableAGP)
     SYMFUNC(xf86GARTCloseScreen)
-#ifdef XINPUT
     SYMFUNC(XisbNew)
     SYMFUNC(XisbFree)
     SYMFUNC(XisbRead)
     SYMFUNC(XisbWrite)
     SYMFUNC(XisbTrace)
     SYMFUNC(XisbBlockDuration)
-#endif
 
     /* xf86Bus.c */
     SYMFUNC(xf86CheckPciSlot)
@@ -673,7 +669,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
     SYMFUNC(GetTimeInMillis)
 
     /* xf86Xinput.c */
-#ifdef XINPUT
     SYMFUNC(xf86ProcessCommonOptions)
     SYMFUNC(xf86PostMotionEvent)
     SYMFUNC(xf86PostProximityEvent)
@@ -684,7 +679,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
     SYMFUNC(xf86ActivateDevice)
     SYMFUNC(xf86XInputSetScreen)
     SYMFUNC(xf86ScaleAxis)
-#endif
 #ifdef DPMSExtension
     SYMFUNC(DPMSGet)
     SYMFUNC(DPMSSet)
diff --git a/hw/xgl/egl/kinput.c b/hw/xgl/egl/kinput.c
index f892dc1..6c1018c 100644
--- a/hw/xgl/egl/kinput.c
+++ b/hw/xgl/egl/kinput.c
@@ -612,7 +612,6 @@ eglInitInput(KdMouseFuncs    *pMouseFuncs,
     RegisterKeyboardDevice(pKeyboard);
     miRegisterPointerDevice(screenInfo.screens[0], pPointer);
     mieqInit(&pKeyboard->public, &pPointer->public);
-#ifdef XINPUT
     {
 	static long zero1, zero2;
 
@@ -620,7 +619,6 @@ eglInitInput(KdMouseFuncs    *pMouseFuncs,
 	ErrorF("Extended Input Devices not yet supported. Impelement it at line %d in %s\n",
 	       __LINE__, __FILE__);
     }
-#endif
 }
 
 /*
diff --git a/hw/xprint/ddxInit.c b/hw/xprint/ddxInit.c
index d744121..5cb2472 100644
--- a/hw/xprint/ddxInit.c
+++ b/hw/xprint/ddxInit.c
@@ -284,8 +284,6 @@ ddxProcessArgument (
     return(0);
 }
 
-#ifdef XINPUT
-
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
 #include "XIstubs.h"
@@ -373,8 +371,6 @@ SetDeviceValuators (
 }
 
 
-#endif /* XINPUT */
-
 #ifdef AIXV3
 /*
  * This is just to get the server to link on AIX, where some bits
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index aad55fc..7e927c8 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -47,12 +47,10 @@
 #include "globals.h"
 #include "dix.h"
 
-#ifdef XINPUT
 # include <X11/extensions/XI.h>
 # include <X11/extensions/XIproto.h>
 # include "exevents.h"
 # include "extinit.h"
-#endif
 
 #include <sys/types.h>
 #include <sys/time.h>
diff --git a/hw/xwin/winmouse.c b/hw/xwin/winmouse.c
index 1507dd3..be2b66a 100644
--- a/hw/xwin/winmouse.c
+++ b/hw/xwin/winmouse.c
@@ -36,7 +36,7 @@
 #endif
 #include "win.h"
 
-#if defined(XFree86Server) && defined(XINPUT)
+#if defined(XFree86Server)
 #include "inputstr.h"
 
 /* Peek the internal button mapping */
@@ -106,7 +106,7 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
 			       2);
       free(map);
 
-#if defined(XFree86Server) && defined(XINPUT)
+#if defined(XFree86Server)
       g_winMouseButtonMap = pDeviceInt->button->map;
 #endif
       break;
@@ -116,7 +116,7 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
       break;
 
     case DEVICE_CLOSE:
-#if defined(XFree86Server) && defined(XINPUT)
+#if defined(XFree86Server)
       g_winMouseButtonMap = NULL;
 #endif
     case DEVICE_OFF:
@@ -225,7 +225,7 @@ winMouseButtonsSendEvent (int iEventType, int iButton)
 
   /* Load an xEvent and enqueue the event */
   xCurrentEvent.u.u.type = iEventType;
-#if defined(XFree86Server) && defined(XINPUT)
+#if defined(XFree86Server)
   if (g_winMouseButtonMap)
     xCurrentEvent.u.u.detail = g_winMouseButtonMap[iButton];
   else
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 1779082..2d1ec91 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -371,9 +371,6 @@
 /* Support Xinerama extension */
 #undef XINERAMA
 
-/* Support X Input extension */
-#undef XINPUT
-
 /* Build XKB */
 #undef XKB
 
diff --git a/include/globals.h b/include/globals.h
index 9e5060d..e2e4804 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -151,9 +151,7 @@ extern Bool noXkbExtension;
 extern Bool noPanoramiXExtension;
 #endif
 
-#ifdef XINPUT
 extern Bool noXInputExtension;
-#endif
 
 #ifdef XIDLE
 extern Bool noXIdleExtension;
diff --git a/include/windowstr.h b/include/windowstr.h
index a895a88..0e45262 100644
--- a/include/windowstr.h
+++ b/include/windowstr.h
@@ -113,9 +113,7 @@ typedef struct _WindowOpt {
     RegionPtr		clipShape;	   /* default: NULL */
     RegionPtr		inputShape;	   /* default: NULL */
 #endif
-#ifdef XINPUT
     struct _OtherInputMasks *inputMasks;   /* default: NULL */
-#endif
     DevCursorList       deviceCursors;     /* default: NULL */
     struct _GenericClientMasks *geMasks;/* default: NULL */
     WindowAccessRec     access;
@@ -214,11 +212,7 @@ extern Mask	    DontPropagateMasks[];
 #define wDontPropagateMask(w)	wUseDefault(w, dontPropagateMask, DontPropagateMasks[(w)->dontPropagate])
 #define wOtherEventMasks(w)	wUseDefault(w, otherEventMasks, 0)
 #define wOtherClients(w)	wUseDefault(w, otherClients, NULL)
-#ifdef XINPUT
 #define wOtherInputMasks(w)	wUseDefault(w, inputMasks, NULL)
-#else
-#define wOtherInputMasks(w)	NULL
-#endif
 #define wPassiveGrabs(w)	wUseDefault(w, passiveGrabs, NULL)
 #define wUserProps(w)		wUseDefault(w, userProps, NULL)
 #define wBackingBitPlanes(w)	wUseDefault(w, backingBitPlanes, ~0L)
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 4f3b92e..00f0d27 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -197,9 +197,7 @@ extern Bool noPanoramiXExtension;
 #ifdef INXQUARTZ
 extern Bool noPseudoramiXExtension;
 #endif
-#ifdef XINPUT
 extern Bool noXInputExtension;
-#endif
 #ifdef XIDLE
 extern Bool noXIdleExtension;
 #endif
@@ -262,9 +260,7 @@ extern void PanoramiXExtensionInit(INITARGS);
 #ifdef INXQUARTZ
 extern void PseudoramiXExtensionInit(INITARGS);
 #endif
-#ifdef XINPUT
 extern void XInputExtensionInit(INITARGS);
-#endif
 #ifdef XTEST
 extern void XTestExtensionInit(INITARGS);
 #endif
@@ -448,9 +444,7 @@ static ExtensionToggle ExtensionToggleList[] =
 #ifdef PANORAMIX
     { "XINERAMA", &noPanoramiXExtension },
 #endif
-#ifdef XINPUT
     { "XInputExtension", &noXInputExtension },
-#endif
 #ifdef XKB
     { "XKEYBOARD", &noXkbExtension },
 #endif
@@ -632,9 +626,7 @@ static ExtensionModule staticExtensions[] = {
 #ifdef MITSHM
     { ShmExtensionInit, SHMNAME, &noMITShmExtension, NULL, NULL },
 #endif
-#ifdef XINPUT
     { XInputExtensionInit, "XInputExtension", &noXInputExtension, NULL, NULL },
-#endif
 #ifdef XTEST
     { XTestExtensionInit, XTestExtensionName, &noTestExtensions, NULL, NULL },
 #endif
diff --git a/os/utils.c b/os/utils.c
index d1bc1a1..4bebeca 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -214,9 +214,7 @@ _X_EXPORT Bool noXFixesExtension = FALSE;
 /* Xinerama is disabled by default unless enabled via +xinerama */
 _X_EXPORT Bool noPanoramiXExtension = TRUE;
 #endif
-#ifdef XINPUT
 _X_EXPORT Bool noXInputExtension = FALSE;
-#endif
 #ifdef XIDLE
 _X_EXPORT Bool noXIdleExtension = FALSE;
 #endif
commit 1d0438de176551aaeff549664f00b8bd83d465af
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 16:28:58 2008 +0930

    Xi: remove RemoveOtherCoreGrabs()
    
    PickPointer() returns grabbed devices, so we can't get a double grab anyway.

diff --git a/dix/events.c b/dix/events.c
index 779be81..73b7fa0 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -5161,9 +5161,6 @@ ProcGrabPointer(ClientPtr client)
 	if (oldCursor)
 	    FreeCursor (oldCursor, (Cursor)0);
 	rep.status = GrabSuccess;
-
-        /* guarantee only one core pointer grab at a time by this client */
-        RemoveOtherCoreGrabs(client, device);
     }
     WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep);
     return Success;
@@ -5345,47 +5342,6 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
 }
 
 /**
- * Deactivate any core grabs on the given client except the given device.
- *
- * This fixes race conditions where clients deal with implicit passive grabs
- * on one device, but then actively grab their client pointer, which is
- * another device.
- *
- * Grabs are only removed if the other device matches the type of device. If
- * dev is a pointer device, only other pointer grabs are removed. Likewise, if
- * dev is a keyboard device, only keyboard grabs are removed.
- *
- * If dev doesn't have a grab, do nothing and go for a beer.
- *
- * @param client The client that is to be limited.
- * @param dev The only device allowed to have a grab on the client.
- */
-
-_X_EXPORT void
-RemoveOtherCoreGrabs(ClientPtr client, DeviceIntPtr dev)
-{
-    if (!dev || !dev->deviceGrab.grab)
-        return;
-
-    DeviceIntPtr it = inputInfo.devices;
-    for (; it; it = it->next)
-    {
-        if (it == dev)
-            continue;
-        /* check for IsPointer Device */
-
-        if (it->deviceGrab.grab &&
-                it->deviceGrab.grab->coreGrab &&
-                SameClient(it->deviceGrab.grab, client))
-        {
-            if ((IsPointerDevice(dev) && IsPointerDevice(it)) ||
-                    (IsKeyboardDevice(dev) && IsKeyboardDevice(it)))
-                (*it->deviceGrab.DeactivateGrab)(it);
-        }
-    }
-}
-
-/**
  * Server-side protocol handling for GrabKeyboard request.
  *
  * Grabs the client's keyboard and returns success status to client.
@@ -5405,9 +5361,6 @@ ProcGrabKeyboard(ClientPtr client)
             stuff->ownerEvents, stuff->time,
             KeyPressMask | KeyReleaseMask, &rep.status, TRUE);
 
-    /* ensure only one core keyboard grab by this client */
-    RemoveOtherCoreGrabs(client, keyboard);
-
     if (result != Success)
 	return result;
     rep.type = X_Reply;
diff --git a/include/dix.h b/include/dix.h
index 57ffee9..970b1d8 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -460,10 +460,6 @@ extern int GrabDevice(
     CARD8 * /* status */,
     Bool /* coreGrab */);
 
-extern void RemoveOtherCoreGrabs(
-    ClientPtr /* client */,
-    DeviceIntPtr /* dev */);
-
 extern void InitEvents(void);
 extern void InitSprite(
         DeviceIntPtr /* pDev */, 
commit be5ff2b8d8a392eb8611e1fcd6da4752d68a7f9d
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 16:25:13 2008 +0930

    Xi: remove some superflous code

diff --git a/Xi/getvers.c b/Xi/getvers.c
index a4afe80..1e17eea 100644
--- a/Xi/getvers.c
+++ b/Xi/getvers.c
@@ -85,7 +85,7 @@ SProcXGetExtensionVersion(ClientPtr client)
 
 /***********************************************************************
  *
- * This procedure lists the input devices available to the server.
+ * This procedure returns the major/minor version of the X Input extension.
  *
  */
 
@@ -105,14 +105,10 @@ ProcXGetExtensionVersion(ClientPtr client)
     rep.RepType = X_GetExtensionVersion;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.major_version = 0;
-    rep.minor_version = 0;
-
     rep.present = TRUE;
-    if (rep.present) {
-	rep.major_version = AllExtensionVersions[IReqCode - 128].major_version;
-	rep.minor_version = AllExtensionVersions[IReqCode - 128].minor_version;
-    }
+    rep.major_version = AllExtensionVersions[IReqCode - 128].major_version;
+    rep.minor_version = AllExtensionVersions[IReqCode - 128].minor_version;
+
     WriteReplyToClient(client, sizeof(xGetExtensionVersionReply), &rep);
 
     return Success;
commit b093bf3ec37367172be3b44a04f0f43890ba7d7d
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 15:15:31 2008 +0930

    dix: don't search for grabbed devices, PickPointer does it for us now.
    
    Follow-up to 93ee33830778b9ec85ad81496572677a30022b09.

diff --git a/dix/events.c b/dix/events.c
index 5919e26..779be81 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1861,44 +1861,20 @@ AllowSome(ClientPtr client,
  * Server-side protocol handling for AllowEvents request.
  *
  * Release some events from a frozen device.
- *
- * In some cases, the grab the client has is not on the ClientPointer but on
- * some other device (see ProcGrabPointer comments). To cover this case, we
- * need to run through all devices to ensure we don't forget the device we
- * actually have a grab on.
  */
 int
 ProcAllowEvents(ClientPtr client)
 {
     TimeStamp		time;
-    DeviceIntPtr	mouse = NULL,
-			grabbed;
+    DeviceIntPtr	mouse = NULL;
     DeviceIntPtr	keybd = NULL;
-    GrabPtr		grab;
     REQUEST(xAllowEventsReq);
 
     REQUEST_SIZE_MATCH(xAllowEventsReq);
     time = ClientTimeToServerTime(stuff->time);
 
-    for (grabbed = inputInfo.devices; grabbed; grabbed = grabbed->next)
-    {
-        grab = grabbed->deviceGrab.grab;
-        if (grab && grab->coreGrab && SameClient(grab, client))
-        {
-            if (IsPointerDevice(grabbed))
-                mouse = grabbed;
-            else if (IsKeyboardDevice(grabbed))
-                keybd = grabbed;
-
-	    if (mouse && keybd)
-		break;
-        }
-    }
-
-    if (!mouse)
-        mouse = PickPointer(client);
-    if (!keybd)
-        keybd = PickKeyboard(client);
+    mouse = PickPointer(client);
+    keybd = PickKeyboard(client);
 
     switch (stuff->mode)
     {
@@ -5061,12 +5037,6 @@ ProcGetInputFocus(ClientPtr client)
  *
  * Sets an active grab on the client's ClientPointer and returns success
  * status to client.
- *
- * A special case of GrabPointer is when there is already a grab on some
- * device (by the same client). In this case, this grab is overwritten, and
- * the device stays as it is. This case can happen when a client has a passive
- * grab and then grabs the pointer, or when the client already has an active
- * grab and the ClientPointer was changed since.
  */
 int
 ProcGrabPointer(ClientPtr client)
@@ -5080,7 +5050,6 @@ ProcGrabPointer(ClientPtr client)
     TimeStamp time;
     Mask access_mode = DixGrabAccess;
     int rc;
-    DeviceIntPtr grabbed = NULL;
 
     REQUEST_SIZE_MATCH(xGrabPointerReq);
     UpdateCurrentTime();
@@ -5144,20 +5113,6 @@ ProcGrabPointer(ClientPtr client)
     rep.sequenceNumber = client->sequence;
     rep.length = 0;
 
-    /* Check if a the client already has a grab on a device */
-    for(grabbed = inputInfo.devices; grabbed; grabbed = grabbed->next)
-    {
-        if (IsPointerDevice(grabbed))
-        {
-            grab = grabbed->deviceGrab.grab;
-            if (grab && grab->coreGrab && SameClient(grab, client))
-            {
-                device = grabbed;
-                break;
-            }
-        }
-    }
-
     grab = device->deviceGrab.grab;
     /* check for
        1. other client has a grab on the device already.
@@ -5219,15 +5174,11 @@ ProcGrabPointer(ClientPtr client)
  *
  * Changes properties of the grab hold by the client. If the client does not
  * hold an active grab on the device, nothing happens.
- *
- * Works on the client's ClientPointer, but in some cases the client may have
- * a grab on a device that isn't the ClientPointer (see ProcGrabPointer
- * comments).
  */
 int
 ProcChangeActivePointerGrab(ClientPtr client)
 {
-    DeviceIntPtr device, grabbed;
+    DeviceIntPtr device;
     GrabPtr      grab;
     CursorPtr newCursor, oldCursor;
     REQUEST(xChangeActivePointerGrabReq);
@@ -5255,26 +5206,6 @@ ProcChangeActivePointerGrab(ClientPtr client)
     device = PickPointer(client);
     grab = device->deviceGrab.grab;
 
-    if (!grab || !SameClient(grab, client))
-    {
-        /* no grab on ClientPointer, or some other client has a grab on our
-         * ClientPointer, let's check if we have a pointer grab on some other
-         * device. */
-        for(grabbed = inputInfo.devices; grabbed; grabbed = grabbed->next)
-        {
-            if (IsPointerDevice(grabbed))
-            {
-                grab = grabbed->deviceGrab.grab;
-                if (grab && grab->coreGrab && SameClient(grab, client))
-                {
-                    device = grabbed;
-                    grab = device->deviceGrab.grab;
-                    break;
-                }
-            }
-        }
-    }
-
     if (!grab)
 	return Success;
     if (!SameClient(grab, client))
@@ -5297,17 +5228,12 @@ ProcChangeActivePointerGrab(ClientPtr client)
 /**
  * Server-side protocol handling for UngrabPointer request.
  *
- * Deletes a pointer grab on a device the client has grabbed. This should be
- * the ClientPointer, but may not be. So we search the device list for a
- * device we have a pointer grab on and then ungrab this device. (see
- * ProcGrabPointer comments). We are guaranteed that the client doesn't have
- * more than one core pointer grab at a time.
+ * Deletes a pointer grab on a device the client has grabbed.
  */
 int
 ProcUngrabPointer(ClientPtr client)
 {
-    DeviceIntPtr device = PickPointer(client),
-                 grabbed;
+    DeviceIntPtr device = PickPointer(client);
     GrabPtr grab;
     TimeStamp time;
     REQUEST(xResourceReq);
@@ -5316,30 +5242,6 @@ ProcUngrabPointer(ClientPtr client)
     UpdateCurrentTime();
     grab = device->deviceGrab.grab;
 
-    if (!grab || !grab->coreGrab || !SameClient(grab, client))
-    {
-        /* No pointer grab on ClientPointer. May be a pointer grab on some
-         * other device */
-        for(grabbed = inputInfo.devices; grabbed; grabbed = grabbed->next)
-        {
-            if (IsPointerDevice(grabbed))
-            {
-                grab = grabbed->deviceGrab.grab;
-                if (grab && grab->coreGrab && SameClient(grab, client))
-                {
-                    device = grabbed;
-                    break;
-                }
-            }
-        }
-        /* nope. no grab on any actual device */
-        if (!grabbed)
-        {
-            device = inputInfo.pointer;
-            grab = inputInfo.pointer->deviceGrab.grab;
-        }
-    }
-
     time = ClientTimeToServerTime(stuff->id);
     if ((CompareTimeStamps(time, currentTime) != LATER) &&
 	    (CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) &&
@@ -5487,15 +5389,6 @@ RemoveOtherCoreGrabs(ClientPtr client, DeviceIntPtr dev)
  * Server-side protocol handling for GrabKeyboard request.
  *
  * Grabs the client's keyboard and returns success status to client.
- *
- * In some special cases the client may already have a grab on a keyboard that
- * is not the one that is paired with the ClientPointer. This can happen when
- * the client alreay has a passive grab on some keyboard device, or when the
- * client actively grabbed the keyboard and the ClientPointer or keyboard
- * pairing was changed since.
- * Therefore, we need to run through all the keyboards available and check if
- * there's already a grab on it from our client. The client will only ever
- * have one core keyboard grab at a time.
  */
 int
 ProcGrabKeyboard(ClientPtr client)
@@ -5503,24 +5396,10 @@ ProcGrabKeyboard(ClientPtr client)
     xGrabKeyboardReply rep;
     REQUEST(xGrabKeyboardReq);
     int result;
-    DeviceIntPtr keyboard = PickKeyboard(client),
-                 grabbed;
-    GrabPtr      grab;
+    DeviceIntPtr keyboard = PickKeyboard(client);
 
     REQUEST_SIZE_MATCH(xGrabKeyboardReq);
 
-    for (grabbed = inputInfo.devices; grabbed; grabbed = grabbed->next)
-    {
-	if (IsKeyboardDevice(grabbed))
-	{
-	    grab = grabbed->deviceGrab.grab;
-	    if (grab && grab->coreGrab && SameClient(grab, client))
-	    {
-		keyboard = grabbed;
-		break;
-	    }
-	}
-    }
     result = GrabDevice(client, keyboard, stuff->keyboardMode,
             stuff->pointerMode, stuff->grabWindow,
             stuff->ownerEvents, stuff->time,
@@ -5542,16 +5421,11 @@ ProcGrabKeyboard(ClientPtr client)
  * Server-side protocol handling for UngrabKeyboard request.
  *
  * Deletes a possible grab on the client's keyboard.
- *
- * We may have a grab on a keyboard that isn't the ClientPointer's keyboard.
- * Thus we need to check all keyboar devices for a grab. (see ProcGrabKeyboard
- * comments)
  */
 int
 ProcUngrabKeyboard(ClientPtr client)
 {
-    DeviceIntPtr device = PickKeyboard(client),
-		 grabbed;
+    DeviceIntPtr device = PickKeyboard(client);
     GrabPtr grab;
     TimeStamp time;
     REQUEST(xResourceReq);
@@ -5561,21 +5435,6 @@ ProcUngrabKeyboard(ClientPtr client)
 
     grab = device->deviceGrab.grab;
 
-    if (!grab || !grab->coreGrab || !SameClient(grab, client))
-    {
-	for (grabbed = inputInfo.devices; grabbed; grabbed = grabbed->next)
-	{
-	    if (IsKeyboardDevice(grabbed))
-	    {
-		grab = device->deviceGrab.grab;
-		if (grab && grab->coreGrab && SameClient(grab, client))
-		{
-		    device = grabbed;
-		    break;
-		}
-	    }
-	}
-    }
     grab = device->deviceGrab.grab;
 
     time = ClientTimeToServerTime(stuff->id);
commit 6198bad07edc51ff4a264a9361c5e9b6c74647a6
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 15:02:40 2008 +0930

    dix: remove misleading (stale) comment

diff --git a/dix/events.c b/dix/events.c
index 9bf40f8..5919e26 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -6479,8 +6479,6 @@ PickPointer(ClientPtr client)
 /* PickKeyboard will pick an appropriate keyboard for the given client by
  * searching the list of devices for the keyboard device that is paired with
  * the client's pointer.
- * If no pointer is paired with the keyboard, the virtual core keyboard is
- * returned.
  */
 _X_EXPORT DeviceIntPtr
 PickKeyboard(ClientPtr client)
commit 93ee33830778b9ec85ad81496572677a30022b09
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 15:02:13 2008 +0930

    dix: let PickPointer() return devices that are core-grabbed by the client.
    
    If the client currently holds a core grab on any device, this device has
    priority, even over the ClientPointer.

diff --git a/dix/events.c b/dix/events.c
index 04342fc..9bf40f8 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -6435,10 +6435,31 @@ SetClientPointer(ClientPtr client, ClientPtr setter, DeviceIntPtr device)
     return TRUE;
 }
 
-/* PickPointer will pick an appropriate pointer for the given client.  */
+/* PickPointer will pick an appropriate pointer for the given client.
+ *
+ * An "appropriate device" is (in order of priority):
+ *  1) A device the given client has a core grab on.
+ *  2) A device set as ClientPointer for the given client.
+ *  3) The first master device.
+ */
 _X_EXPORT DeviceIntPtr
 PickPointer(ClientPtr client)
 {
+    DeviceIntPtr it = inputInfo.devices;
+
+    /* First, check if the client currently has a grab on a device. Even
+     * keyboards count. */
+    for(it = inputInfo.devices; it; it = it->next)
+    {
+        GrabPtr grab = it->deviceGrab.grab;
+        if (grab && grab->coreGrab && SameClient(grab, client))
+        {
+            if (!IsPointerDevice(it))
+                it = GetPairedDevice(it);
+            return it; /* Always return a core grabbed device */
+        }
+    }
+
     if (!client->clientPtr)
     {
         DeviceIntPtr it = inputInfo.devices;
commit f5ac98747de921d48f36d4f3f66dbe73e26a6760
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 14:50:24 2008 +0930

    Standardise copyright headers for all new files created as part of MPX.

diff --git a/COPYING b/COPYING
index 2b464e0..ddfb201 100644
--- a/COPYING
+++ b/COPYING
@@ -9,6 +9,7 @@ Stone).
 Copyright © 2000-2001 Juliusz Chroboczek
 Copyright © 2006-2007 Intel Corporation
 Copyright © 2006 Nokia Corporation
+Copyright © 2006-2008 Peter Hutterer
 Copyright © 1999 Keith Packard
 Copyright © 2005-2007 Daniel Stone
 Copyright © 2006 Luc Verhaegen
diff --git a/Xext/geext.c b/Xext/geext.c
index 29ddacd..afede22 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -1,31 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
-
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
diff --git a/Xext/geint.h b/Xext/geint.h
index 7747234..2e0eb09 100644
--- a/Xext/geint.h
+++ b/Xext/geint.h
@@ -1,31 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
-
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
 #endif
diff --git a/Xi/chaccess.c b/Xi/chaccess.c
index a58409b..3ef29fc 100644
--- a/Xi/chaccess.c
+++ b/Xi/chaccess.c
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 #define	 NEED_EVENTS
 #define	 NEED_REPLIES
diff --git a/Xi/chaccess.h b/Xi/chaccess.h
index 8c2c600..090258c 100644
--- a/Xi/chaccess.h
+++ b/Xi/chaccess.h
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
diff --git a/Xi/chdevcur.c b/Xi/chdevcur.c
index 0a14900..867bf97 100644
--- a/Xi/chdevcur.c
+++ b/Xi/chdevcur.c
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2006 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 /***********************************************************************
  *
diff --git a/Xi/chdevcur.h b/Xi/chdevcur.h
index 92c8d4f..af86279 100644
--- a/Xi/chdevcur.h
+++ b/Xi/chdevcur.h
@@ -1,27 +1,27 @@
-/************************************************************
-
-Copyright 2006 by Peter Hutterer <peter at cs.unisa.edu.au>
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of the above listed
-copyright holder(s) not be used in advertising or publicity pertaining
-to distribution of the software without specific, written prior
-permission.
-
-THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
-TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
-LIABLE FOR ANY SPECIAL, 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.
-
-********************************************************/
+/*
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
diff --git a/Xi/chdevhier.c b/Xi/chdevhier.c
index 36797d9..1d57843 100644
--- a/Xi/chdevhier.c
+++ b/Xi/chdevhier.c
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 /***********************************************************************
  *
diff --git a/Xi/chdevhier.h b/Xi/chdevhier.h
index 1853fa7..85c1a39 100644
--- a/Xi/chdevhier.h
+++ b/Xi/chdevhier.h
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 /***********************************************************************
  *
diff --git a/Xi/extgrbdev.c b/Xi/extgrbdev.c
index 6458404..c92c31d 100644
--- a/Xi/extgrbdev.c
+++ b/Xi/extgrbdev.c
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 /***********************************************************************
  *
diff --git a/Xi/extgrbdev.h b/Xi/extgrbdev.h
index 93075b1..7e2b0ea 100644
--- a/Xi/extgrbdev.h
+++ b/Xi/extgrbdev.h
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
diff --git a/Xi/getcptr.c b/Xi/getcptr.c
index ba69f9c..c85fced 100644
--- a/Xi/getcptr.c
+++ b/Xi/getcptr.c
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 #define	 NEED_EVENTS
 #define	 NEED_REPLIES
diff --git a/Xi/getcptr.h b/Xi/getcptr.h
index 456d1ba..cf8cd2e 100644
--- a/Xi/getcptr.h
+++ b/Xi/getcptr.h
@@ -1,27 +1,27 @@
-/************************************************************
-
-Copyright 2007 by Peter Hutterer <peter at cs.unisa.edu.au>
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of the above listed
-copyright holder(s) not be used in advertising or publicity pertaining
-to distribution of the software without specific, written prior
-permission.
-
-THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
-TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
-LIABLE FOR ANY SPECIAL, 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.
-
-********************************************************/
+/*
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
diff --git a/Xi/qryacces.c b/Xi/qryacces.c
index ab627e2..b3cc27a 100644
--- a/Xi/qryacces.c
+++ b/Xi/qryacces.c
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 #define	 NEED_EVENTS
 #define	 NEED_REPLIES
diff --git a/Xi/qryacces.h b/Xi/qryacces.h
index 5fce9ae..085d93a 100644
--- a/Xi/qryacces.h
+++ b/Xi/qryacces.h
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
diff --git a/Xi/querydp.c b/Xi/querydp.c
index ac11025..bd0a1c5 100644
--- a/Xi/querydp.c
+++ b/Xi/querydp.c
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2006 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 /***********************************************************************
  *
diff --git a/Xi/querydp.h b/Xi/querydp.h
index acad548..e8c5165 100644
--- a/Xi/querydp.h
+++ b/Xi/querydp.h
@@ -1,27 +1,27 @@
-/************************************************************
-
-Copyright 2006 by Peter Hutterer <peter at cs.unisa.edu.au>
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of the above listed
-copyright holder(s) not be used in advertising or publicity pertaining
-to distribution of the software without specific, written prior
-permission.
-
-THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
-TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
-LIABLE FOR ANY SPECIAL, 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.
-
-********************************************************/
+/*
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
diff --git a/Xi/setcptr.c b/Xi/setcptr.c
index 7313a9d..f73a44c 100644
--- a/Xi/setcptr.c
+++ b/Xi/setcptr.c
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 /***********************************************************************
  *
diff --git a/Xi/setcptr.h b/Xi/setcptr.h
index 0c24fd4..114623c 100644
--- a/Xi/setcptr.h
+++ b/Xi/setcptr.h
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
diff --git a/Xi/warpdevp.c b/Xi/warpdevp.c
index 21fe22c..5ea6132 100644
--- a/Xi/warpdevp.c
+++ b/Xi/warpdevp.c
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2006 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 /***********************************************************************
  *
diff --git a/Xi/warpdevp.h b/Xi/warpdevp.h
index 8ce5b70..7034e16 100644
--- a/Xi/warpdevp.h
+++ b/Xi/warpdevp.h
@@ -1,27 +1,27 @@
-/************************************************************
-
-Copyright 2006 by Peter Hutterer <peter at cs.unisa.edu.au>
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of the above listed
-copyright holder(s) not be used in advertising or publicity pertaining
-to distribution of the software without specific, written prior
-permission.
-
-THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
-TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
-LIABLE FOR ANY SPECIAL, 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.
-
-********************************************************/
+/*
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
diff --git a/Xi/xiselev.c b/Xi/xiselev.c
index 2bfbd82..fc0a0f0 100644
--- a/Xi/xiselev.c
+++ b/Xi/xiselev.c
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 #define	 NEED_EVENTS
 #define	 NEED_REPLIES
diff --git a/Xi/xiselev.h b/Xi/xiselev.h
index 9102815..e846407 100644
--- a/Xi/xiselev.h
+++ b/Xi/xiselev.h
@@ -1,31 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
-
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
diff --git a/dix/access.c b/dix/access.c
index dc66db8..e29ab86 100644
--- a/dix/access.c
+++ b/dix/access.c
@@ -1,30 +1,27 @@
 /*
-
-Copyright 2007 Peter Hutterer <peter at cs.unisa.edu.au>
-
-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 AUTHOR 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 author 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 author.
-
-*/
+ * Copyright 2007-2008 Peter Hutterer
+ *
+ * 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 (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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Peter Hutterer, UniSA, NICTA
+ */
 
 /* This file controls the access control lists for each window. 
  * Each device can be explicitely allowed or denied access to a given window.
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 8ff31e8..9f293cc 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -46,15 +46,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
- /* 
-  * MPX additions:
-  * Copyright © 2006 Peter Hutterer
-  * License see above.
-  * Author: Peter Hutterer <peter at cs.unisa.edu.au>
-  *
-  */
-
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/mi/mieq.c b/mi/mieq.c
index 1c85030..082ebab 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -24,13 +24,6 @@ in this Software without prior written authorization from The Open Group.
  *
  * Author:  Keith Packard, MIT X Consortium
  */
- /* 
-  * MPX additions:
-  * Copyright © 2006 Peter Hutterer
-  * License see above.
-  * Author: Peter Hutterer <peter at cs.unisa.edu.au>
-  *
-  */
 
 /*
  * mieq.c
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 42d38c0..8f8086c 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -22,13 +22,6 @@ 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.
 */
- /* 
-  * MPX additions:
-  * Copyright © 2006 Peter Hutterer
-  * License see above.
-  * Author: Peter Hutterer <peter at cs.unisa.edu.au>
-  *
-  */
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
diff --git a/mi/misprite.c b/mi/misprite.c
index 2be814f..c998e55 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -29,12 +29,6 @@ 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.
 */
-/* 
- * MPX additions:
- * Copyright © 2006 Peter Hutterer
- * Author: Peter Hutterer <peter at cs.unisa.edu.au>
- *
- */
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
commit 3fc67b4205851dcffcc431a07a885828549bd9cf
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 11:37:32 2008 +0930

    Xi: remove leftover chpkpair.h file.
    
    Used to contain declarations for ChangePointerKeyboardPairing request
    handling.

diff --git a/Xi/chpkpair.h b/Xi/chpkpair.h
deleted file mode 100644
index b0d410d..0000000
--- a/Xi/chpkpair.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/************************************************************
-
-Copyright 2006 by Peter Hutterer <peter at cs.unisa.edu.au>
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of the above listed
-copyright holder(s) not be used in advertising or publicity pertaining
-to distribution of the software without specific, written prior
-permission.
-
-THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
-TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
-LIABLE FOR ANY SPECIAL, 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.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef CHPKPAIR_H
-#define CHPKPAIR_H 1
-
-int SProcXChangePointerKeyboardPairing(ClientPtr	/* client */
-    );
-
-int ProcXChangePointerKeyboardPairing(ClientPtr	/* client */
-    );
-
-void 
-SPointerKeyboardPairingChangedNotifyEvent (pairingChangedNotify* /* from */, 
-                                           pairingChangedNotify* /* to */
-   );
-
-#endif /* WARPDEVP_H */
-
commit 89add4ee986e38b833bb58750b3e5a664efb6f4a
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 11:19:12 2008 +0930

    dix: remove obsolete InitWindowPrivates().

diff --git a/dix/main.c b/dix/main.c
index f7824ee..d99cb2d 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -377,8 +377,6 @@ main(int argc, char *argv[], char *envp[])
 		FatalError("failed to create scratch GCs");
 	    if (!CreateDefaultStipple(i))
 		FatalError("failed to create default stipple");
-            if (!InitWindowPrivates(pScreen))
-                FatalError("Failed to init window privates.");
 	    if (!CreateRootWindow(pScreen))
 		FatalError("failed to create root window");
 	}
diff --git a/dix/window.c b/dix/window.c
index 98a905c..6b95068 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -3924,19 +3924,6 @@ WindowParentHasDeviceCursor(WindowPtr pWin,
     return FALSE;
 }
 
-/**
- * Initialize some mandatory devPrivates for windows. 
- *
- * At the moment, this includes only the enter/leave semaphore.
- *
- * Returns TRUE on success.
- */
-_X_EXPORT Bool
-InitWindowPrivates(ScreenPtr screen)
-{
-    /* obsolete with devPrivates rework */
-}
-
 #ifndef NOLOGOHACK
 static void
 DrawLogo(WindowPtr pWin)
diff --git a/include/window.h b/include/window.h
index 8dbef22..04cbe26 100644
--- a/include/window.h
+++ b/include/window.h
@@ -269,6 +269,4 @@ extern void DisableMapUnmapEvents(
 extern void EnableMapUnmapEvents(
     WindowPtr /* pWin */ );
 
-Bool InitWindowPrivates(
-    ScreenPtr /* screen */);
 #endif /* WINDOW_H */
commit dcdc66fcfc7957aa7875fbf74fa3a55989a9a187
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 11:14:32 2008 +0930

    dix: add mi.h include to stop compiler warning

diff --git a/dix/window.c b/dix/window.c
index 08d738e..98a905c 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -123,6 +123,7 @@ Equipment Corporation.
 #endif
 #include "dixevents.h"
 #include "globals.h"
+#include "mi.h" /* miPaintWindow */
 
 #include "privates.h"
 #include "xace.h"
commit 97552413d213337e4bff8c89b06d58a09d722b05
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 11:13:05 2008 +0930

    dix: remove "unused variable" compiler warning.

diff --git a/dix/window.c b/dix/window.c
index 33e9752..08d738e 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -367,7 +367,6 @@ CreateRootWindow(ScreenPtr pScreen)
     WindowPtr	pWin;
     BoxRec	box;
     PixmapFormatRec *format;
-    FocusSemaphoresPtr sem;
 
     pWin = (WindowPtr)xalloc(sizeof(WindowRec));
     if (!pWin)
commit d9c38e84cc492b931a2238757d438f562946e5bc
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 11:04:02 2008 +0930

    dix: remove pairingClient definition.
    
    This variable was used originally to determine which client is allowed to
    change the pointer-keyboard pairing. For now, we just let anyone change it and
    see how that works out.

diff --git a/dix/devices.c b/dix/devices.c
index 656707c..b3c9efc 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -86,8 +86,6 @@ SOFTWARE.
  * This file handles input device-related stuff.
  */
 
-/* The client that is allowed to change pointer-keyboard pairings. */
-static ClientPtr pairingClient = NULL;
 DevPrivateKey CoreDevicePrivateKey = &CoreDevicePrivateKey;
 /* Used to sture classes currently not in use by an MD */
 DevPrivateKey UnusedClassesPrivateKey = &UnusedClassesPrivateKey;
commit c14b858aeced81ff43723644f2de0f5c43f55755
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 11:02:12 2008 +0930

    Xi: fix two compiler warnings
    
    unused variable in exevents.c
    implicit declaration in warpdevp.c

diff --git a/Xi/exevents.c b/Xi/exevents.c
index a828044..a83d5ed 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -952,7 +952,6 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
     KeyClassPtr k;
     ValuatorClassPtr v;
     deviceValuator *xV  = (deviceValuator *) xE;
-    int coretype = 0;
     int ret = 0;
 
     ret = UpdateDeviceState(device, xE, count);
diff --git a/Xi/warpdevp.c b/Xi/warpdevp.c
index 26081eb..21fe22c 100644
--- a/Xi/warpdevp.c
+++ b/Xi/warpdevp.c
@@ -48,6 +48,7 @@ from the author.
 #include "extnsionst.h"
 #include "exevents.h"
 #include "exglobals.h"
+#include "mipointer.h" /* for miPointerUpdateSprite */
 
 
 #include "warpdevp.h"
commit 6015b7a81252cd1729e6f4045f9b0c885c95b183
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 10:41:30 2008 +0930

    Xi: handle requests through a dispatch handler.
    
    Same principle as e.g. in the RandR extension, rather than having a load of
        if (type == XI_whatever)
    use an array of function pointers.

diff --git a/Xi/extinit.c b/Xi/extinit.c
index fa15478..838efdd 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -166,6 +166,109 @@ static struct dev_type
 CARD8 event_base[numInputClasses];
 XExtEventInfo EventInfo[32];
 
+/**
+ * Dispatch vector. Functions defined in here will be called when the matching
+ * request arrives.
+ */
+static int (*ProcIVector[])(ClientPtr) = {
+        NULL,                                   /*  0 */
+	ProcXGetExtensionVersion,               /*  1 */
+	ProcXListInputDevices,                  /*  2 */
+	ProcXOpenDevice,                        /*  3 */
+	ProcXCloseDevice,                       /*  4 */
+	ProcXSetDeviceMode,                     /*  5 */
+	ProcXSelectExtensionEvent,              /*  6 */
+	ProcXGetSelectedExtensionEvents,        /*  7 */
+	ProcXChangeDeviceDontPropagateList,     /*  8 */
+	ProcXGetDeviceDontPropagateList,        /*  9 */
+	ProcXGetDeviceMotionEvents,             /* 10 */
+	ProcXChangeKeyboardDevice,              /* 11 */
+	ProcXChangePointerDevice,               /* 12 */
+	ProcXGrabDevice,                        /* 13 */
+	ProcXUngrabDevice,                      /* 14 */
+	ProcXGrabDeviceKey,                     /* 15 */
+	ProcXUngrabDeviceKey,                   /* 16 */
+	ProcXGrabDeviceButton,                  /* 17 */
+	ProcXUngrabDeviceButton,                /* 18 */
+	ProcXAllowDeviceEvents,                 /* 19 */
+	ProcXGetDeviceFocus,                    /* 20 */
+	ProcXSetDeviceFocus,                    /* 21 */
+	ProcXGetFeedbackControl,                /* 22 */
+	ProcXChangeFeedbackControl,             /* 23 */
+	ProcXGetDeviceKeyMapping,               /* 24 */
+	ProcXChangeDeviceKeyMapping,            /* 25 */
+	ProcXGetDeviceModifierMapping,          /* 26 */
+	ProcXSetDeviceModifierMapping,          /* 27 */
+	ProcXGetDeviceButtonMapping,            /* 28 */
+	ProcXSetDeviceButtonMapping,            /* 29 */
+	ProcXQueryDeviceState,                  /* 30 */
+	ProcXSendExtensionEvent,                /* 31 */
+	ProcXDeviceBell,                        /* 32 */
+	ProcXSetDeviceValuators,                /* 33 */
+	ProcXGetDeviceControl,                  /* 34 */
+	ProcXChangeDeviceControl,               /* 35 */
+        ProcXQueryDevicePointer,                /* 36 */
+        ProcXWarpDevicePointer,                 /* 37 */
+        ProcXChangeDeviceCursor,                /* 38 */
+        ProcXChangeDeviceHierarchy,             /* 39 */
+        ProcXiSelectEvent,                      /* 40 */
+        ProcXChangeWindowAccess,                /* 41 */
+        ProcXQueryWindowAccess,                 /* 42 */
+        ProcXSetClientPointer,                  /* 43 */
+        ProcXGetClientPointer,                  /* 44 */
+        ProcXExtendedGrabDevice                 /* 45 */
+};
+
+/* For swapped clients */
+static int (*SProcIVector[])(ClientPtr) = {
+        NULL,                                    /*  0 */
+	SProcXGetExtensionVersion,               /*  1 */
+	SProcXListInputDevices,                  /*  2 */
+	SProcXOpenDevice,                        /*  3 */
+	SProcXCloseDevice,                       /*  4 */
+	SProcXSetDeviceMode,                     /*  5 */
+	SProcXSelectExtensionEvent,              /*  6 */
+	SProcXGetSelectedExtensionEvents,        /*  7 */
+	SProcXChangeDeviceDontPropagateList,     /*  8 */
+	SProcXGetDeviceDontPropagateList,        /*  9 */
+	SProcXGetDeviceMotionEvents,             /* 10 */
+	SProcXChangeKeyboardDevice,              /* 11 */
+	SProcXChangePointerDevice,               /* 12 */
+	SProcXGrabDevice,                        /* 13 */
+	SProcXUngrabDevice,                      /* 14 */
+	SProcXGrabDeviceKey,                     /* 15 */
+	SProcXUngrabDeviceKey,                   /* 16 */
+	SProcXGrabDeviceButton,                  /* 17 */
+	SProcXUngrabDeviceButton,                /* 18 */
+	SProcXAllowDeviceEvents,                 /* 19 */
+	SProcXGetDeviceFocus,                    /* 20 */
+	SProcXSetDeviceFocus,                    /* 21 */
+	SProcXGetFeedbackControl,                /* 22 */
+	SProcXChangeFeedbackControl,             /* 23 */
+	SProcXGetDeviceKeyMapping,               /* 24 */
+	SProcXChangeDeviceKeyMapping,            /* 25 */
+	SProcXGetDeviceModifierMapping,          /* 26 */
+	SProcXSetDeviceModifierMapping,          /* 27 */
+	SProcXGetDeviceButtonMapping,            /* 28 */
+	SProcXSetDeviceButtonMapping,            /* 29 */
+	SProcXQueryDeviceState,                  /* 30 */
+	SProcXSendExtensionEvent,                /* 31 */
+	SProcXDeviceBell,                        /* 32 */
+	SProcXSetDeviceValuators,                /* 33 */
+	SProcXGetDeviceControl,                  /* 34 */
+	SProcXChangeDeviceControl,               /* 35 */
+        SProcXQueryDevicePointer,                /* 36 */
+        SProcXWarpDevicePointer,                 /* 37 */
+        SProcXChangeDeviceCursor,                /* 38 */
+        SProcXChangeDeviceHierarchy,             /* 39 */
+        SProcXiSelectEvent,                      /* 40 */
+        SProcXChangeWindowAccess,                /* 41 */
+        SProcXQueryWindowAccess,                 /* 42 */
+        SProcXSetClientPointer,                  /* 43 */
+        SProcXGetClientPointer,                  /* 44 */
+        SProcXExtendedGrabDevice                 /* 45 */
+};
+
 /*****************************************************************
  *
  * Globals referenced elsewhere in the server.
@@ -246,100 +349,10 @@ static int
 ProcIDispatch(ClientPtr client)
 {
     REQUEST(xReq);
-    if (stuff->data == X_GetExtensionVersion)
-	return (ProcXGetExtensionVersion(client));
-    if (stuff->data == X_ListInputDevices)
-	return (ProcXListInputDevices(client));
-    else if (stuff->data == X_OpenDevice)
-	return (ProcXOpenDevice(client));
-    else if (stuff->data == X_CloseDevice)
-	return (ProcXCloseDevice(client));
-    else if (stuff->data == X_SetDeviceMode)
-	return (ProcXSetDeviceMode(client));
-    else if (stuff->data == X_SelectExtensionEvent)
-	return (ProcXSelectExtensionEvent(client));
-    else if (stuff->data == X_GetSelectedExtensionEvents)
-	return (ProcXGetSelectedExtensionEvents(client));
-    else if (stuff->data == X_ChangeDeviceDontPropagateList)
-	return (ProcXChangeDeviceDontPropagateList(client));
-    else if (stuff->data == X_GetDeviceDontPropagateList)
-	return (ProcXGetDeviceDontPropagateList(client));
-    else if (stuff->data == X_GetDeviceMotionEvents)
-	return (ProcXGetDeviceMotionEvents(client));
-    else if (stuff->data == X_ChangeKeyboardDevice)
-	return (ProcXChangeKeyboardDevice(client));
-    else if (stuff->data == X_ChangePointerDevice)
-	return (ProcXChangePointerDevice(client));
-    else if (stuff->data == X_GrabDevice)
-	return (ProcXGrabDevice(client));
-    else if (stuff->data == X_UngrabDevice)
-	return (ProcXUngrabDevice(client));
-    else if (stuff->data == X_GrabDeviceKey)
-	return (ProcXGrabDeviceKey(client));
-    else if (stuff->data == X_UngrabDeviceKey)
-	return (ProcXUngrabDeviceKey(client));
-    else if (stuff->data == X_GrabDeviceButton)
-	return (ProcXGrabDeviceButton(client));
-    else if (stuff->data == X_UngrabDeviceButton)
-	return (ProcXUngrabDeviceButton(client));
-    else if (stuff->data == X_AllowDeviceEvents)
-	return (ProcXAllowDeviceEvents(client));
-    else if (stuff->data == X_GetDeviceFocus)
-	return (ProcXGetDeviceFocus(client));
-    else if (stuff->data == X_SetDeviceFocus)
-	return (ProcXSetDeviceFocus(client));
-    else if (stuff->data == X_GetFeedbackControl)
-	return (ProcXGetFeedbackControl(client));
-    else if (stuff->data == X_ChangeFeedbackControl)
-	return (ProcXChangeFeedbackControl(client));
-    else if (stuff->data == X_GetDeviceKeyMapping)
-	return (ProcXGetDeviceKeyMapping(client));
-    else if (stuff->data == X_ChangeDeviceKeyMapping)
-	return (ProcXChangeDeviceKeyMapping(client));
-    else if (stuff->data == X_GetDeviceModifierMapping)
-	return (ProcXGetDeviceModifierMapping(client));
-    else if (stuff->data == X_SetDeviceModifierMapping)
-	return (ProcXSetDeviceModifierMapping(client));
-    else if (stuff->data == X_GetDeviceButtonMapping)
-	return (ProcXGetDeviceButtonMapping(client));
-    else if (stuff->data == X_SetDeviceButtonMapping)
-	return (ProcXSetDeviceButtonMapping(client));
-    else if (stuff->data == X_QueryDeviceState)
-	return (ProcXQueryDeviceState(client));
-    else if (stuff->data == X_SendExtensionEvent)
-	return (ProcXSendExtensionEvent(client));
-    else if (stuff->data == X_DeviceBell)
-	return (ProcXDeviceBell(client));
-    else if (stuff->data == X_SetDeviceValuators)
-	return (ProcXSetDeviceValuators(client));
-    else if (stuff->data == X_GetDeviceControl)
-	return (ProcXGetDeviceControl(client));
-    else if (stuff->data == X_ChangeDeviceControl)
-	return (ProcXChangeDeviceControl(client));
-    else if (stuff->data == X_QueryDevicePointer)
-        return (ProcXQueryDevicePointer(client));
-    else if (stuff->data == X_WarpDevicePointer)
-        return (ProcXWarpDevicePointer(client));
-    else if (stuff->data == X_ChangeDeviceCursor)
-        return (ProcXChangeDeviceCursor(client));
-    else if (stuff->data == X_ChangeDeviceHierarchy)
-        return (ProcXChangeDeviceHierarchy(client));
-    else if (stuff->data == X_XiSelectEvent)
-        return (ProcXiSelectEvent(client));
-    else if (stuff->data == X_ChangeWindowAccess)
-        return (ProcXChangeWindowAccess(client));
-    else if (stuff->data == X_QueryWindowAccess)
-        return ProcXQueryWindowAccess(client);
-    else if (stuff->data == X_SetClientPointer)
-        return ProcXSetClientPointer(client);
-    else if (stuff->data == X_GetClientPointer)
-        return ProcXGetClientPointer(client);
-    else if (stuff->data == X_ExtendedGrabDevice)
-        return ProcXExtendedGrabDevice(client);
-    else {
-	SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
-    }
-    return (BadRequest);
+    if (stuff->data > IREQUESTS || !ProcIVector[stuff->data])
+        return BadRequest;
+
+    return (*ProcIVector[stuff->data])(client);
 }
 
 /*******************************************************************************
@@ -355,100 +368,10 @@ static int
 SProcIDispatch(ClientPtr client)
 {
     REQUEST(xReq);
-    if (stuff->data == X_GetExtensionVersion)
-	return (SProcXGetExtensionVersion(client));
-    if (stuff->data == X_ListInputDevices)
-	return (SProcXListInputDevices(client));
-    else if (stuff->data == X_OpenDevice)
-	return (SProcXOpenDevice(client));
-    else if (stuff->data == X_CloseDevice)
-	return (SProcXCloseDevice(client));
-    else if (stuff->data == X_SetDeviceMode)
-	return (SProcXSetDeviceMode(client));
-    else if (stuff->data == X_SelectExtensionEvent)
-	return (SProcXSelectExtensionEvent(client));
-    else if (stuff->data == X_GetSelectedExtensionEvents)
-	return (SProcXGetSelectedExtensionEvents(client));
-    else if (stuff->data == X_ChangeDeviceDontPropagateList)
-	return (SProcXChangeDeviceDontPropagateList(client));
-    else if (stuff->data == X_GetDeviceDontPropagateList)
-	return (SProcXGetDeviceDontPropagateList(client));
-    else if (stuff->data == X_GetDeviceMotionEvents)
-	return (SProcXGetDeviceMotionEvents(client));
-    else if (stuff->data == X_ChangeKeyboardDevice)
-	return (SProcXChangeKeyboardDevice(client));
-    else if (stuff->data == X_ChangePointerDevice)
-	return (SProcXChangePointerDevice(client));
-    else if (stuff->data == X_GrabDevice)
-	return (SProcXGrabDevice(client));
-    else if (stuff->data == X_UngrabDevice)
-	return (SProcXUngrabDevice(client));
-    else if (stuff->data == X_GrabDeviceKey)
-	return (SProcXGrabDeviceKey(client));
-    else if (stuff->data == X_UngrabDeviceKey)
-	return (SProcXUngrabDeviceKey(client));
-    else if (stuff->data == X_GrabDeviceButton)
-	return (SProcXGrabDeviceButton(client));
-    else if (stuff->data == X_UngrabDeviceButton)
-	return (SProcXUngrabDeviceButton(client));
-    else if (stuff->data == X_AllowDeviceEvents)
-	return (SProcXAllowDeviceEvents(client));
-    else if (stuff->data == X_GetDeviceFocus)
-	return (SProcXGetDeviceFocus(client));
-    else if (stuff->data == X_SetDeviceFocus)
-	return (SProcXSetDeviceFocus(client));
-    else if (stuff->data == X_GetFeedbackControl)
-	return (SProcXGetFeedbackControl(client));
-    else if (stuff->data == X_ChangeFeedbackControl)
-	return (SProcXChangeFeedbackControl(client));
-    else if (stuff->data == X_GetDeviceKeyMapping)
-	return (SProcXGetDeviceKeyMapping(client));
-    else if (stuff->data == X_ChangeDeviceKeyMapping)
-	return (SProcXChangeDeviceKeyMapping(client));
-    else if (stuff->data == X_GetDeviceModifierMapping)
-	return (SProcXGetDeviceModifierMapping(client));
-    else if (stuff->data == X_SetDeviceModifierMapping)
-	return (SProcXSetDeviceModifierMapping(client));
-    else if (stuff->data == X_GetDeviceButtonMapping)
-	return (SProcXGetDeviceButtonMapping(client));
-    else if (stuff->data == X_SetDeviceButtonMapping)
-	return (SProcXSetDeviceButtonMapping(client));
-    else if (stuff->data == X_QueryDeviceState)
-	return (SProcXQueryDeviceState(client));
-    else if (stuff->data == X_SendExtensionEvent)
-	return (SProcXSendExtensionEvent(client));
-    else if (stuff->data == X_DeviceBell)
-	return (SProcXDeviceBell(client));
-    else if (stuff->data == X_SetDeviceValuators)
-	return (SProcXSetDeviceValuators(client));
-    else if (stuff->data == X_GetDeviceControl)
-	return (SProcXGetDeviceControl(client));
-    else if (stuff->data == X_ChangeDeviceControl)
-	return (SProcXChangeDeviceControl(client));
-    else if (stuff->data == X_QueryDevicePointer)
-	return (SProcXQueryDevicePointer(client));
-    else if (stuff->data == X_WarpDevicePointer)
-	return (SProcXWarpDevicePointer(client));
-    else if (stuff->data == X_ChangeDeviceCursor)
-        return (SProcXChangeDeviceCursor(client));
-    else if (stuff->data == X_ChangeDeviceHierarchy)
-        return (SProcXChangeDeviceHierarchy(client));
-    else if (stuff->data == X_XiSelectEvent)
-        return (SProcXiSelectEvent(client));
-    else if (stuff->data == X_ChangeWindowAccess)
-        return (SProcXChangeWindowAccess(client));
-    else if (stuff->data == X_QueryWindowAccess)
-        return SProcXQueryWindowAccess(client);
-    else if (stuff->data == X_SetClientPointer)
-        return SProcXSetClientPointer(client);
-    else if (stuff->data == X_GetClientPointer)
-        return SProcXGetClientPointer(client);
-    else if (stuff->data == X_ExtendedGrabDevice)
-        return SProcXExtendedGrabDevice(client);
-    else {
-	SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
-    }
-    return (BadRequest);
+    if (stuff->data > IREQUESTS || !SProcIVector[stuff->data])
+        return BadRequest;
+
+    return (*SProcIVector[stuff->data])(client);
 }
 
 /**********************************************************************
commit cb8cb87bc6decf75832c3724687000ecb658226e
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Apr 25 10:09:50 2008 +0930

    Xi: remove unused #define DISPATCH

diff --git a/Xi/extinit.c b/Xi/extinit.c
index f1c2824..fa15478 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -458,11 +458,6 @@ SProcIDispatch(ClientPtr client)
  *
  */
 
-/* FIXME: this would be more concise and readable in ANSI C */
-#define DISPATCH(code) \
-    if (rep->RepType == X_##code) \
-	SRepX##code (client, len, (x##code##Reply *) rep)
-
 static void
 SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
 					/* All we look at is the type field */


More information about the xorg-commit mailing list