xserver: Branch 'master' - 13 commits

Peter Hutterer whot at kemper.freedesktop.org
Mon Nov 3 21:57:43 PST 2008


 Xext/Makefile.am               |    9 
 Xext/xevie.c                   |  739 -----------------------------------------
 Xi/Makefile.am                 |    4 
 Xi/chaccess.c                  |  158 --------
 Xi/chaccess.h                  |   36 -
 Xi/exevents.c                  |   32 +
 Xi/extinit.c                   |   25 -
 Xi/qryacces.c                  |  121 ------
 Xi/qryacces.h                  |   38 --
 configure.ac                   |    9 
 dix/Makefile.am                |    1 
 dix/access.c                   |  315 -----------------
 dix/dispatch.c                 |    1 
 dix/events.c                   |  252 +++----------
 dix/getevents.c                |  393 +++++++++++++--------
 dix/protocol.txt               |    5 
 hw/xfree86/common/xf86Events.c |    3 
 hw/xfree86/loader/dixsym.c     |   10 
 hw/xfree86/loader/xf86sym.c    |    2 
 hw/xnest/Keyboard.c            |    4 
 hw/xquartz/darwin.c            |    8 
 include/Makefile.am            |    1 
 include/cursorstr.h            |    3 
 include/dix-config.h.in        |    3 
 include/exevents.h             |    2 
 include/globals.h              |    7 
 include/input.h                |   24 -
 include/windowstr.h            |    4 
 include/xkbrules.h             |  183 ++++++++++
 include/xkbsrv.h               |    2 
 include/xkbstr.h               |    4 
 mi/mieq.c                      |    2 
 mi/miinitext.c                 |   22 -
 os/utils.c                     |    6 
 xkb/Makefile.am                |    1 
 xkb/XKBMisc.c                  |    2 
 xkb/ddxDevBtn.c                |   26 +
 xkb/ddxFakeBtn.c               |   59 ---
 xkb/xkbActions.c               |   13 
 xkb/xkbEvents.c                |   14 
 xkb/xkbUtils.c                 |    7 
 41 files changed, 583 insertions(+), 1967 deletions(-)

New commits:
commit de1a8b68eb10c39a0d4a197107d68d7cc009edb2
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Mon Nov 3 11:30:48 2008 +1030

    xkb: extract the correct device in XkbFilterEvents.
    
    If the event is an XI event, we need to work on the correct device, not on
    the VCK.
    
    Adds XIGetDevice(event) function to extract the device from an event.

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 155cb9b..c520c7d 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -134,6 +134,37 @@ IsPointerEvent(xEvent* xE)
 }
 
 /**
+ * @return the device matching the deviceid of the device set in the event, or
+ * NULL if the event is not an XInput event.
+ */
+DeviceIntPtr
+XIGetDevice(xEvent* xE)
+{
+    DeviceIntPtr pDev = NULL;
+
+    if (xE->u.u.type == DeviceButtonPress ||
+        xE->u.u.type == DeviceButtonRelease ||
+        xE->u.u.type == DeviceMotionNotify ||
+        xE->u.u.type == DeviceEnterNotify ||
+        xE->u.u.type == DeviceLeaveNotify ||
+        xE->u.u.type == ProximityIn ||
+        xE->u.u.type == ProximityOut ||
+        xE->u.u.type == DevicePropertyNotify)
+    {
+        int rc;
+        int id;
+
+        id = ((deviceKeyButtonPointer*)xE)->deviceid;
+
+        rc = dixLookupDevice(&pDev, id, serverClient, DixUnknownAccess);
+        if (rc != Success)
+            ErrorF("[dix] XIGetDevice failed on XACE restrictions (%d)\n", rc);
+    }
+    return pDev;
+}
+
+
+/**
  * Copy the device->key into master->key and send a mapping notify to the
  * clients if appropriate.
  * master->key needs to be allocated by the caller.
@@ -2107,3 +2138,4 @@ SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count)
         FindInterestedChildren(dev, p1, mask, ev, count);
     }
 }
+
diff --git a/include/exevents.h b/include/exevents.h
index 667004a..8788295 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -249,4 +249,6 @@ extern Atom XIGetKnownProperty(
         char*                 name
 );
 
+extern DeviceIntPtr XIGetDevice(xEvent *ev);
+
 #endif /* EXEVENTS_H */
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index 335620b..151849c 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -37,6 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <X11/extensions/XIproto.h>
 #include "inputstr.h"
 #include "windowstr.h"
+#include "exevents.h"
 #include <xkbsrv.h>
 #include "xkb.h"
 
@@ -811,6 +812,13 @@ int	i, button_mask;
 DeviceIntPtr pXDev = inputInfo.keyboard;
 XkbSrvInfoPtr	xkbi;
 
+    if (xE->u.u.type & EXTENSION_EVENT_BASE)
+    {
+        pXDev = XIGetDevice(xE);
+        if (!pXDev)
+            pXDev = inputInfo.keyboard;
+    }
+
     xkbi= pXDev->key->xkbInfo;
     if ( pClient->xkbClientFlags & _XkbClientInitialized ) {
 	if ((xkbDebugFlags&0x10)&&
commit d97239956667f8181f30271759573b75bf455fbb
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Fri Oct 31 16:40:41 2008 +1030

    Purge device-based WindowAccess code.
    
    Really, this was a bad idea. It's not security, the UI features that would
    have been cool (e.g. clicking through windows) aren't implemented anyway, and
    there's nothing you can't achieve just by using plain XI anyway.
    
    Requires inputproto 1.9.99.6.

diff --git a/Xi/Makefile.am b/Xi/Makefile.am
index 768f996..09dd41d 100644
--- a/Xi/Makefile.am
+++ b/Xi/Makefile.am
@@ -21,8 +21,6 @@ libXi_la_SOURCES =	\
 	chgprop.h \
 	chgptr.c \
 	chgptr.h \
-	chaccess.c \
-	chaccess.h \
 	closedev.c \
 	closedev.h \
 	devbell.c \
@@ -68,8 +66,6 @@ libXi_la_SOURCES =	\
 	querydp.h \
 	queryst.c \
 	queryst.h \
-	qryacces.c \
-	qryacces.h \
 	selectev.c \
 	selectev.h \
 	sendexev.c \
diff --git a/Xi/chaccess.c b/Xi/chaccess.c
deleted file mode 100644
index a6798b7..0000000
--- a/Xi/chaccess.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * 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, University of South Australia, NICTA
- */
-
-#define	 NEED_EVENTS
-#define	 NEED_REPLIES
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>	/* for inputstr.h    */
-#include <X11/Xproto.h>	/* Request macro     */
-#include "inputstr.h"	/* DeviceIntPtr      */
-#include "windowstr.h"	/* window structure  */
-#include "scrnintstr.h"	/* screen structure  */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "extnsionst.h"
-#include "exevents.h"
-#include "exglobals.h"
-
-#include "chaccess.h"
-
-/***********************************************************************
- * This procedure allows a client to change window access control.
- */
-
-int
-SProcXChangeWindowAccess(ClientPtr client)
-{
-    char n;
-    REQUEST(xChangeWindowAccessReq);
-
-    swaps(&stuff->length, n);
-    swapl(&stuff->win, n);
-    return ProcXChangeWindowAccess(client);
-}
-
-int
-ProcXChangeWindowAccess(ClientPtr client)
-{
-    int padding, rc, i;
-    XID* deviceids = NULL;
-    WindowPtr win;
-    DeviceIntPtr* perm_devices = NULL;
-    DeviceIntPtr* deny_devices = NULL;
-    REQUEST(xChangeWindowAccessReq);
-    REQUEST_AT_LEAST_SIZE(xChangeWindowAccessReq);
-
-
-    padding = (4 - (((stuff->npermit + stuff->ndeny) * sizeof(XID)) % 4)) % 4;
-
-    if (stuff->length != ((sizeof(xChangeWindowAccessReq)  +
-            (((stuff->npermit + stuff->ndeny) * sizeof(XID)) + padding)) >> 2))
-    {
-        return BadLength;
-    }
-
-
-    rc = dixLookupWindow(&win, stuff->win, client, DixWriteAccess);
-    if (rc != Success)
-    {
-        return rc;
-    }
-
-    /* Are we clearing? if so, ignore the rest */
-    if (stuff->clear)
-    {
-        rc = ACClearWindowAccess(client, win, stuff->clear);
-        return rc;
-    }
-
-    if (stuff->npermit || stuff->ndeny)
-        deviceids = (XID*)&stuff[1];
-
-    if (stuff->npermit)
-    {
-        perm_devices =
-            (DeviceIntPtr*)xalloc(stuff->npermit * sizeof(DeviceIntPtr));
-        if (!perm_devices)
-        {
-            ErrorF("[Xi] ProcXChangeWindowAccess: alloc failure.\n");
-            return BadImplementation;
-        }
-
-        /* if one of the devices cannot be accessed, we don't do anything.*/
-        for (i = 0; i < stuff->npermit; i++)
-        {
-            rc = dixLookupDevice(&perm_devices[i], deviceids[i], client,
-                                  DixWriteAccess);
-            if (rc != Success)
-            {
-                xfree(perm_devices);
-                return rc;
-            }
-        }
-    }
-
-    if (stuff->ndeny)
-    {
-        deny_devices =
-            (DeviceIntPtr*)xalloc(stuff->ndeny * sizeof(DeviceIntPtr));
-        if (!deny_devices)
-        {
-            ErrorF("[Xi] ProcXChangeWindowAccecss: alloc failure.\n");
-            xfree(perm_devices);
-            return BadImplementation;
-        }
-
-        for (i = 0; i < stuff->ndeny; i++)
-        {
-            rc = dixLookupDevice(&deny_devices[i],
-                                  deviceids[i+stuff->npermit],
-                                  client,
-                                  DixWriteAccess);
-            if (rc != Success)
-            {
-                xfree(perm_devices);
-                xfree(deny_devices);
-                return rc;
-            }
-        }
-    }
-
-    rc = ACChangeWindowAccess(client, win, stuff->defaultRule,
-                               perm_devices, stuff->npermit,
-                               deny_devices, stuff->ndeny);
-    if (rc != Success)
-    {
-        return rc;
-    }
-
-    xfree(perm_devices);
-    xfree(deny_devices);
-    return Success;
-}
-
diff --git a/Xi/chaccess.h b/Xi/chaccess.h
deleted file mode 100644
index baea69c..0000000
--- a/Xi/chaccess.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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, University of South Australia, NICTA
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef CHACCESS_H
-#define CHACCESS_H 1
-
-int SProcXChangeWindowAccess(ClientPtr /* client */);
-int ProcXChangeWindowAccess(ClientPtr /* client */);
-
-#endif /* CHACCESS_H */
diff --git a/Xi/extinit.c b/Xi/extinit.c
index e222de6..673a7ee 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -76,7 +76,6 @@ SOFTWARE.
 
 /* modules local to Xi */
 #include "allowev.h"
-#include "chaccess.h"
 #include "chdevcur.h"
 #include "chgdctl.h"
 #include "chdevhier.h"
@@ -105,7 +104,6 @@ SOFTWARE.
 #include "gtmotion.h"
 #include "listdev.h"
 #include "opendev.h"
-#include "qryacces.h"
 #include "querydp.h"
 #include "queryst.h"
 #include "selectev.h"
@@ -219,12 +217,10 @@ static int (*ProcIVector[])(ClientPtr) = {
         ProcXWarpDevicePointer,                 /* 41 */
         ProcXChangeDeviceCursor,                /* 42 */
         ProcXChangeDeviceHierarchy,             /* 43 */
-        ProcXChangeWindowAccess,                /* 44 */
-        ProcXQueryWindowAccess,                 /* 45 */
-        ProcXSetClientPointer,                  /* 46 */
-        ProcXGetClientPointer,                  /* 47 */
-        ProcXiSelectEvent,                      /* 48 */
-        ProcXExtendedGrabDevice                 /* 49 */
+        ProcXSetClientPointer,                  /* 44 */
+        ProcXGetClientPointer,                  /* 45 */
+        ProcXiSelectEvent,                      /* 46 */
+        ProcXExtendedGrabDevice                 /* 47 */
 };
 
 /* For swapped clients */
@@ -273,12 +269,10 @@ static int (*SProcIVector[])(ClientPtr) = {
         SProcXWarpDevicePointer,                 /* 41 */
         SProcXChangeDeviceCursor,                /* 42 */
         SProcXChangeDeviceHierarchy,             /* 43 */
-        SProcXChangeWindowAccess,                /* 44 */
-        SProcXQueryWindowAccess,                 /* 45 */
-        SProcXSetClientPointer,                  /* 46 */
-        SProcXGetClientPointer,                  /* 47 */
-        SProcXiSelectEvent,                      /* 48 */
-        SProcXExtendedGrabDevice                 /* 49 */
+        SProcXSetClientPointer,                  /* 44 */
+        SProcXGetClientPointer,                  /* 45 */
+        SProcXiSelectEvent,                      /* 46 */
+        SProcXExtendedGrabDevice                 /* 47 */
 };
 
 /*****************************************************************
@@ -481,9 +475,6 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
     else if (rep->RepType == X_QueryDevicePointer)
 	SRepXQueryDevicePointer(client, len,
 				(xQueryDevicePointerReply *) rep);
-    else if (rep->RepType == X_QueryWindowAccess)
-        SRepXQueryWindowAccess(client, len,
-                               (xQueryWindowAccessReply*) rep);
     else if (rep->RepType == X_GetClientPointer)
         SRepXGetClientPointer(client, len, (xGetClientPointerReply*) rep);
     else if (rep->RepType == X_ExtendedGrabDevice)
diff --git a/Xi/qryacces.c b/Xi/qryacces.c
deleted file mode 100644
index 99221ea..0000000
--- a/Xi/qryacces.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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, University of South Australia, NICTA
- */
-
-#define	 NEED_EVENTS
-#define	 NEED_REPLIES
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>	/* for inputstr.h    */
-#include <X11/Xproto.h>	/* Request macro     */
-#include "inputstr.h"	/* DeviceIntPtr      */
-#include "windowstr.h"	/* window structure  */
-#include "scrnintstr.h"	/* screen structure  */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "extnsionst.h"
-#include "extinit.h"	/* LookupDeviceIntRec */
-#include "exevents.h"
-#include "exglobals.h"
-
-#include "qryacces.h"
-
-/***********************************************************************
- * This procedure allows a client to query window access control.
- */
-
-int
-SProcXQueryWindowAccess(ClientPtr client)
-{
-    char n;
-    REQUEST(xQueryWindowAccessReq);
-
-    swaps(&stuff->length, n);
-    swapl(&stuff->win, n);
-    return ProcXQueryWindowAccess(client);
-}
-
-int
-ProcXQueryWindowAccess(ClientPtr client)
-{
-    int rc;
-    WindowPtr win;
-    DeviceIntPtr *perm, *deny;
-    int nperm, ndeny, i;
-    int defaultRule;
-    XID* deviceids;
-    xQueryWindowAccessReply rep;
-
-    REQUEST(xQueryWindowAccessReq);
-    REQUEST_SIZE_MATCH(xQueryWindowAccessReq);
-
-    rc = dixLookupWindow(&win, stuff->win, client, DixReadAccess);
-    if (rc != Success)
-    {
-        return rc;
-    }
-
-    ACQueryWindowAccess(win, &defaultRule, &perm, &nperm, &deny, &ndeny);
-
-    rep.repType = X_Reply;
-    rep.RepType = X_QueryWindowAccess;
-    rep.sequenceNumber = client->sequence;
-    rep.length = ((nperm + ndeny) * sizeof(XID) + 3) >> 2;
-    rep.defaultRule = defaultRule;
-    rep.npermit = nperm;
-    rep.ndeny = ndeny;
-    WriteReplyToClient(client, sizeof(xQueryWindowAccessReply), &rep);
-
-    if (nperm + ndeny)
-    {
-        deviceids = (XID*)xalloc((nperm + ndeny) * sizeof(XID));
-        if (!deviceids)
-        {
-            ErrorF("[Xi] ProcXQueryWindowAccess: xalloc failure.\n");
-            return BadImplementation;
-        }
-
-        for (i = 0; i < nperm; i++)
-            deviceids[i] = perm[i]->id;
-        for (i = 0; i < ndeny; i++)
-            deviceids[i + nperm] = deny[i]->id;
-
-        WriteToClient(client, (nperm + ndeny) * sizeof(XID), (char*)deviceids);
-        xfree(deviceids);
-    }
-    return Success;
-}
-
-void
-SRepXQueryWindowAccess(ClientPtr client,
-                      int size,
-                      xQueryWindowAccessReply* rep)
-{
-    char n;
-    swaps(&rep->sequenceNumber, n);
-    swapl(&rep->length, n);
-    WriteToClient(client, size, (char*)rep);
-}
diff --git a/Xi/qryacces.h b/Xi/qryacces.h
deleted file mode 100644
index 238cdba..0000000
--- a/Xi/qryacces.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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, University of South Australia, NICTA
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef QRYACCES_H
-#define QRYACCES_H 1
-
-int SProcXQueryWindowAccess(ClientPtr /* client */);
-int ProcXQueryWindowAccess(ClientPtr /* client */);
-void SRepXQueryWindowAccess(ClientPtr /* client */,
-                            int /* size */,
-                            xQueryWindowAccessReply* /* rep */);
-#endif
diff --git a/configure.ac b/configure.ac
index 138208d..e75e6d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -657,7 +657,7 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.la'
 XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
 
 dnl Core modules for most extensions, et al.
-REQUIRED_MODULES="[randrproto >= 1.2] [renderproto >= 0.9.3] [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto [xextproto >= 7.0.3] [xproto >= 7.0.13] [xtrans >= 1.2.2] bigreqsproto resourceproto fontsproto [inputproto >= 1.9.99.5] [kbproto >= 1.0.3]" 
+REQUIRED_MODULES="[randrproto >= 1.2] [renderproto >= 0.9.3] [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto [xextproto >= 7.0.3] [xproto >= 7.0.13] [xtrans >= 1.2.2] bigreqsproto resourceproto fontsproto [inputproto >= 1.9.99.6] [kbproto >= 1.0.3]"
 REQUIRED_LIBS="xfont xau fontenc [pixman-1 >= 0.9.5]"
 
 dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
diff --git a/dix/Makefile.am b/dix/Makefile.am
index bdc2d45..a4b48c8 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -5,7 +5,6 @@ AM_CFLAGS = $(DIX_CFLAGS) \
 	-DVENDOR_RELEASE="@VENDOR_RELEASE@"
 
 libdix_la_SOURCES = 	\
-        access.c        \
 	atom.c		\
 	colormap.c	\
 	cursor.c	\
diff --git a/dix/access.c b/dix/access.c
deleted file mode 100644
index f71b3cc..0000000
--- a/dix/access.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * 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, University of South Australia, NICTA
- */
-
-/* This file controls the access control lists for each window. 
- * Each device can be explicitely allowed or denied access to a given window.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/Xlib.h>
-#include <X11/extensions/XI.h>
-#include "exglobals.h"
-
-#include "input.h"
-#include "inputstr.h"
-#include "windowstr.h"
-
-
-/* Only one single client can be responsible for window access control. */
-static ClientPtr ACClient = NULL;
-
-
-/* Forward declarations */
-static void acReplaceList(DeviceIntPtr** list, 
-                          int* count, 
-                          DeviceIntPtr* devices, 
-                          int ndevices);
-
-/* Register global window access control client
- * Return True on success or False otherwise.
- */ 
-
-Bool
-ACRegisterClient(ClientPtr client)
-{
-    if (ACClient && ACClient != client)
-        return False;
-
-    ACClient = client;
-    return True;
-}
-
-
-/* Unregister global client. If client is not the registered client, nothing
- * happens and False is returned. If no client is registered, return True.
- * Returns True if client was registred and is now unregistered.
- */ 
-
-Bool
-ACUnregisterClient(ClientPtr client)
-{
-    if (ACClient && ACClient != client)
-        return False;
-
-    ACClient = NULL;
-    return True;
-}
-
-/* Clears all access control for the window and remove the default rule,
- * depending on what is set. */
-int ACClearWindowAccess(ClientPtr client,
-                        WindowPtr win,
-                        int what)
-{
-    if (client != ACClient && client != wClient(win))
-        return BadAccess;
-
-    if (!win->optional)
-    {
-        /* we shouldn't get here if programmers know what they're doing. 
-         * A client should not request to clear a window's access controls 
-         * if they've never been set before anyway. If they do, do nothing and
-         * let the client figure out what to do next.
-         */
-        return Success;
-    }
-
-    if (what & WindowAccessClearPerm)
-    {
-        xfree(win->optional->access.perm);
-        win->optional->access.perm = NULL;
-        win->optional->access.nperm = 0;
-    }
-
-    if (what & WindowAccessClearDeny)
-    {
-        xfree(win->optional->access.deny);
-        win->optional->access.deny = NULL;
-        win->optional->access.ndeny = 0;
-    }
-
-    if (what & WindowAccessClearRule)
-        win->optional->access.defaultRule = WindowAccessNoRule;
-
-    return Success;
-}
-
-/*
- * Changes window access control.
- *
- * Returns Success or BadAccess if the client is not allowed to change
- * anything.
- */
-
-int
-ACChangeWindowAccess(ClientPtr client, 
-                     WindowPtr win, 
-                     int defaultRule,
-                     DeviceIntPtr* perm_devices,
-                     int nperm,
-                     DeviceIntPtr* deny_devices,
-                     int ndeny)
-{
-    if (client != ACClient && client != wClient(win))
-        return BadAccess;
-
-    if (!win->optional && !MakeWindowOptional(win))
-    {
-        ErrorF("[dix] ACChangeWindowAcccess: Failed to make window optional.\n");
-        return BadImplementation;
-    }
-
-    if (defaultRule != WindowAccessKeepRule)
-        win->optional->access.defaultRule = defaultRule;
-
-    if (nperm)
-    {
-        acReplaceList(&win->optional->access.perm, 
-                      &win->optional->access.nperm,
-                      perm_devices, nperm);
-    }
-
-    if (ndeny)
-    {
-        acReplaceList(&win->optional->access.deny, 
-                &win->optional->access.ndeny,
-                deny_devices, ndeny);
-    }
-
-    return Success;
-}
-
-static void
-acReplaceList(DeviceIntPtr** list, 
-              int* count, 
-              DeviceIntPtr* devices, 
-              int ndevices)
-{
-    xfree(*list);
-    *list = NULL;
-    *count = 0;
-
-    if (ndevices)
-    {
-        *list = 
-            xalloc(ndevices * sizeof(DeviceIntPtr*));
-        if (!*list)
-        {
-            ErrorF("[dix] ACChangeWindowAccess: out of memory\n");
-            return;
-        }
-        memcpy(*list,
-                devices, 
-                ndevices * sizeof(DeviceIntPtr));
-        *count = ndevices;
-    }
-    return;
-}
-
-/*
- * Query the given window for the devices allowed to access a window.
- * The caller is responsible for freeing perm and deny.
- */
-void
-ACQueryWindowAccess(WindowPtr win, 
-                    int* defaultRule,
-                    DeviceIntPtr** perm,
-                    int* nperm,
-                    DeviceIntPtr** deny,
-                    int* ndeny)
-{
-    *defaultRule = WindowAccessNoRule;
-    *perm = NULL;
-    *nperm = 0;
-    *deny = NULL;
-    *ndeny = 0;
-
-    if (!win->optional)
-        return;
-
-    *defaultRule = win->optional->access.defaultRule;
-
-    if (win->optional->access.nperm)
-    {
-        *nperm = win->optional->access.nperm;
-        *perm = (DeviceIntPtr*)xalloc(*nperm * sizeof(DeviceIntPtr));
-        if (!*perm)
-        {
-            ErrorF("[dix] ACQuerywinAccess: xalloc failure\n");
-            return;
-        }
-        memcpy(*perm, 
-               win->optional->access.perm, 
-               *nperm * sizeof(DeviceIntPtr));
-    }
-
-    if (win->optional->access.ndeny)
-    {
-        *ndeny = win->optional->access.ndeny;
-        *deny = (DeviceIntPtr*)xalloc(*ndeny * sizeof(DeviceIntPtr));
-        if (!*deny)
-        {
-            ErrorF("[dix] ACQuerywinAccess: xalloc failure\n");
-            return;
-        }
-        memcpy(*deny, 
-               win->optional->access.deny, 
-               *ndeny * sizeof(DeviceIntPtr));
-    }
-}
-
-/*
- * Check if the given device is allowed to send events to the window. Returns
- * true if device is allowed or false otherwise.
- *
- * Checks are done in the following order until a result is found:
- * If the device is explicitely permitted, allow.
- * If the window has a default of DenyAll, do not allow.
- * If the device is explicitely denied, do not allow.
- * If the window has a default of AllowAll, allow.
- * Check parent window. Rinse, wash, repeat.
- * If no rule could be found, allow.
- */
-Bool
-ACDeviceAllowed(WindowPtr win, DeviceIntPtr dev, xEvent* xE)
-{
-    int i;
-
-    if (!win) /* happens for parent of RootWindow */
-        return True;
-
-    /* there's a number of events we don't care about */
-    switch (xE->u.u.type)
-    {
-        case ButtonPress:
-        case ButtonRelease:
-        case MotionNotify:
-        case EnterNotify:
-        case LeaveNotify:
-        case KeyPress:
-        case KeyRelease:
-            break;
-        default:
-            if (xE->u.u.type == DeviceMotionNotify ||
-                    xE->u.u.type == DeviceButtonPress ||
-                    xE->u.u.type == DeviceButtonRelease ||
-                    xE->u.u.type == DeviceKeyPress ||
-                    xE->u.u.type == DeviceKeyRelease ||
-                    xE->u.u.type == DeviceEnterNotify ||
-                    xE->u.u.type == DeviceLeaveNotify)
-            {
-                break;
-            }
-            return True;
-    }
-
-
-    if (!win->optional) /* no list, check parent */
-        return ACDeviceAllowed(win->parent, dev, xE);
-
-    for (i = 0; i < win->optional->access.nperm; i++)
-    {
-        if (win->optional->access.perm[i]->id == dev->id)
-            return True;
-    }
-
-    if (win->optional->access.defaultRule == WindowAccessDenyAll)
-        return False;
-
-    for (i = 0; i < win->optional->access.ndeny; i++)
-    {
-        if (win->optional->access.deny[i]->id == dev->id)
-            return False;
-    }
-
-    if (win->optional->access.defaultRule == WindowAccessAllowAll)
-        return True;
-
-    return ACDeviceAllowed(win->parent, dev, xE);
-}
-
diff --git a/dix/dispatch.c b/dix/dispatch.c
index c4a6a9c..66f8f79 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3375,7 +3375,6 @@ CloseDownClient(ClientPtr client)
 	DeleteClientFromAnySelections(client);
 	ReleaseActiveGrabs(client);
 	DeleteClientFontStuff(client);
-        ACUnregisterClient(client);
 	if (!really_close_down)
 	{
 	    /*  This frees resources that should never be retained
diff --git a/dix/events.c b/dix/events.c
index 35c1bfa..dad786d 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2030,13 +2030,6 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
 		              this mask is the mask of the grab. */
     int type = pEvents->u.u.type;
 
-    /* if a  is denied, we return 0. This could cause the caller to
-     * traverse the parent. May be bad! (whot) */
-    if (!ACDeviceAllowed(pWin, pDev, pEvents))
-    {
-        return 0;
-    }
-
     /* CantBeFiltered means only window owner gets the event */
     if ((filter == CantBeFiltered) ||
             (!(type & EXTENSION_EVENT_BASE) && type != GenericEvent))
@@ -3633,83 +3626,80 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
     }
     if (!deliveries)
     {
-        if (ACDeviceAllowed(grab->window, thisDev, xE))
+        if (xE->u.u.type == GenericEvent)
         {
-            if (xE->u.u.type == GenericEvent)
-            {
-                /* find evmask for event's extension */
-                xGenericEvent* ge = ((xGenericEvent*)xE);
-                GenericMaskPtr    gemask = grab->genericMasks;
-
-                if (!gemask || !gemask->eventMask[GEEXTIDX(ge)])
-                    return;
-
-                if (GEEventFill(xE))
-                    GEEventFill(xE)(ge, thisDev, grab->window, grab);
-                deliveries = TryClientEvents(rClient(grab), thisDev, xE,
-                        count, gemask->eventMask[GEEXTIDX(ge)],
-                        generic_filters[GEEXTIDX(ge)][ge->evtype],
-                        grab);
-            } else
-            {
-                Mask mask = grab->eventMask;
+            /* find evmask for event's extension */
+            xGenericEvent* ge = ((xGenericEvent*)xE);
+            GenericMaskPtr    gemask = grab->genericMasks;
 
-                sendCore = (thisDev->isMaster && thisDev->coreEvents);
-                /* try core event */
-                if (sendCore && grab->coreGrab)
-                {
-                    core = *xE;
-                    core.u.u.type = XItoCoreType(xE->u.u.type);
-                    if(core.u.u.type) {
-                        FixUpEventFromWindow(thisDev, &core, grab->window,
-                                             None, TRUE);
-                        if (XaceHook(XACE_SEND_ACCESS, 0, thisDev,
-                                     grab->window, &core, 1) ||
-                                XaceHook(XACE_RECEIVE_ACCESS, rClient(grab),
-                                         grab->window, &core, 1))
-                            deliveries = 1; /* don't send, but pretend we did */
-                        else if (!IsInterferingGrab(rClient(grab), thisDev,
-                                    &core))
-                        {
-                            deliveries = TryClientEvents(rClient(grab), thisDev,
-                                                         &core, 1, mask,
-                                                         filters[thisDev->id][core.u.u.type],
-                                                         grab);
-                        }
-                    }
-                }
+            if (!gemask || !gemask->eventMask[GEEXTIDX(ge)])
+                return;
 
-                if (!deliveries)
-                {
-                    /* try XI event */
-                    if (grabinfo->fromPassiveGrab  &&
-                            grabinfo->implicitGrab &&
-                            (xE->u.u.type & EXTENSION_EVENT_BASE))
-                        mask = grab->deviceMask;
-                    FixUpEventFromWindow(thisDev, xE, grab->window,
-                                         None, TRUE);
+            if (GEEventFill(xE))
+                GEEventFill(xE)(ge, thisDev, grab->window, grab);
+            deliveries = TryClientEvents(rClient(grab), thisDev, xE,
+                    count, gemask->eventMask[GEEXTIDX(ge)],
+                    generic_filters[GEEXTIDX(ge)][ge->evtype],
+                    grab);
+        } else
+        {
+            Mask mask = grab->eventMask;
 
+            sendCore = (thisDev->isMaster && thisDev->coreEvents);
+            /* try core event */
+            if (sendCore && grab->coreGrab)
+            {
+                core = *xE;
+                core.u.u.type = XItoCoreType(xE->u.u.type);
+                if(core.u.u.type) {
+                    FixUpEventFromWindow(thisDev, &core, grab->window,
+                            None, TRUE);
                     if (XaceHook(XACE_SEND_ACCESS, 0, thisDev,
-                                 grab->window, xE, count) ||
+                                grab->window, &core, 1) ||
                             XaceHook(XACE_RECEIVE_ACCESS, rClient(grab),
-                                     grab->window, xE, count))
+                                grab->window, &core, 1))
                         deliveries = 1; /* don't send, but pretend we did */
-                    else
+                    else if (!IsInterferingGrab(rClient(grab), thisDev,
+                                &core))
                     {
-                        deliveries =
-                            TryClientEvents(rClient(grab), thisDev,
-                                           xE, count,
-                                           mask,
-                                           filters[thisDev->id][xE->u.u.type],
-                                           grab);
+                        deliveries = TryClientEvents(rClient(grab), thisDev,
+                                &core, 1, mask,
+                                filters[thisDev->id][core.u.u.type],
+                                grab);
                     }
+                }
+            }
 
+            if (!deliveries)
+            {
+                /* try XI event */
+                if (grabinfo->fromPassiveGrab  &&
+                        grabinfo->implicitGrab &&
+                        (xE->u.u.type & EXTENSION_EVENT_BASE))
+                    mask = grab->deviceMask;
+                FixUpEventFromWindow(thisDev, xE, grab->window,
+                        None, TRUE);
+
+                if (XaceHook(XACE_SEND_ACCESS, 0, thisDev,
+                            grab->window, xE, count) ||
+                        XaceHook(XACE_RECEIVE_ACCESS, rClient(grab),
+                            grab->window, xE, count))
+                    deliveries = 1; /* don't send, but pretend we did */
+                else
+                {
+                    deliveries =
+                        TryClientEvents(rClient(grab), thisDev,
+                                xE, count,
+                                mask,
+                                filters[thisDev->id][xE->u.u.type],
+                                grab);
                 }
+
             }
-            if (deliveries && (xE->u.u.type == MotionNotify
-                        || xE->u.u.type == DeviceMotionNotify))
-                thisDev->valuator->motionHintWindow = grab->window;
         }
+        if (deliveries && (xE->u.u.type == MotionNotify
+                    || xE->u.u.type == DeviceMotionNotify))
+            thisDev->valuator->motionHintWindow = grab->window;
     }
     if (deliveries && !deactivateGrab &&
        (xE->u.u.type != MotionNotify && xE->u.u.type != DeviceMotionNotify))
diff --git a/include/input.h b/include/input.h
index bf63f4b..0d348ec 100644
--- a/include/input.h
+++ b/include/input.h
@@ -526,30 +526,6 @@ extern void DeepCopyDeviceClasses(DeviceIntPtr from,
 extern int EnterLeaveSemaphoresIsset(WindowPtr win);
 extern int FocusSemaphoresIsset(WindowPtr win);
 
-/* Window/device based access control */
-extern Bool ACRegisterClient(ClientPtr client);
-extern Bool ACUnregisterClient(ClientPtr client);
-extern int ACClearWindowAccess(ClientPtr client,
-                        WindowPtr win,
-                        int what);
-extern int ACChangeWindowAccess(ClientPtr client, 
-                                WindowPtr win, 
-                                int defaultRule,
-                                DeviceIntPtr* perm_devices,
-                                int npermit,
-                                DeviceIntPtr* deny_devices,
-                                int ndeny);
-extern void ACQueryWindowAccess(WindowPtr win, 
-                                int* defaultRule,
-                                DeviceIntPtr** perm,
-                                int* nperm,
-                                DeviceIntPtr** deny,
-                                int* ndeny);
-
-extern Bool ACDeviceAllowed(WindowPtr win, 
-                            DeviceIntPtr dev,
-                            xEvent* xE);
-
 /* Implemented by the DDX. */
 extern int NewInputDeviceRequest(
     InputOption *options,
commit cbc6f983959595aa21c9dd72fac6a7070a650ef7
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Fri Oct 31 14:36:48 2008 +1030

    xkb: when faking mouse button events, fake them on the correct devices.
    
    When MouseKeys are activated, keyboard devices may generate fake mouse button
    events through XKB. Let's get then running through the appropriate paths, i.e.
    as XI events on the correct device.
    
    To make matters more fun, ProcessOtherEvents drops events if the DIX device
    state cannot be updated accordingly, i.e. all button events from keyboard
    devices.
    Hence we need to get the paired MD for the device in XkbDDXFakeDeviceButton,
    and post the event through the paired MD (usually the VCP).
    
    Removes now-unused ddxFakeBtn.c.
    
    Note: this patch only half-arsedly fixed button events, motion events are a
    more complicated matter.

diff --git a/mi/mieq.c b/mi/mieq.c
index 062dede..986e3a1 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -274,7 +274,7 @@ ChangeDeviceID(DeviceIntPtr dev, xEvent* event)
  * @param master The event after being copied
  * @param count Number of events in original.
  */
-static void
+void
 CopyGetMasterEvent(DeviceIntPtr mdev, xEvent* original,
                    xEvent** master, int count)
 {
diff --git a/xkb/Makefile.am b/xkb/Makefile.am
index 5b594c1..5967f42 100644
--- a/xkb/Makefile.am
+++ b/xkb/Makefile.am
@@ -6,7 +6,6 @@ AM_CFLAGS = $(DIX_CFLAGS) \
 DDX_SRCS = \
         ddxBeep.c \
         ddxCtrls.c \
-        ddxFakeBtn.c \
         ddxFakeMtn.c \
         ddxInit.c \
         ddxKeyClick.c \
diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c
index e812e0b..b68a28b 100644
--- a/xkb/ddxDevBtn.c
+++ b/xkb/ddxDevBtn.c
@@ -47,11 +47,13 @@ XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
 {
 int *			devVal;
 INT32 *			evVal;
-xEvent			events[2];
+xEvent			events[2],
+			*m_events = NULL; /* master dev */
 deviceKeyButtonPointer *btn;
 deviceValuator *	val;
 int			x,y;
 int			nAxes, i, count;
+DeviceIntPtr		master = NULL;
 
     if (dev == inputInfo.pointer || !dev->public.on)
 	return;
@@ -95,6 +97,28 @@ int			nAxes, i, count;
 	count= 1+((nAxes+5)/6);
     }
 
+    /* XXX: This is obnoxious. ProcessOtherEvent updates the DIX device state,
+     * but may not do anything if the device state is invalid. This happens if
+     * we post a mouse event from a pure keyboard device. So we need to hack
+     * around that by getting the master, then posting the event for the
+     * pointer paired with the master.
+     *
+     * Note:the DeviceButtonEvent on the SD itself will do nothing in most
+     * cases, unless dev is both a keyboard and a mouse.
+     */
+    if (!dev->isMaster && dev->u.master) {
+        master = dev->u.master;
+        if (!IsPointerDevice(master))
+            master = GetPairedDevice(dev->u.master);
+
+        CopyGetMasterEvent(master, &events, &m_events, count);
+    }
+
     (*dev->public.processInputProc)((xEventPtr)btn, dev, count);
+
+    if (master) {
+        (*master->public.processInputProc)(m_events, master, count);
+        xfree(m_events);
+    }
     return;
 }
diff --git a/xkb/ddxFakeBtn.c b/xkb/ddxFakeBtn.c
deleted file mode 100644
index f9dcbf7..0000000
--- a/xkb/ddxFakeBtn.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/************************************************************
-Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
-
-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 Silicon Graphics not be 
-used in advertising or publicity pertaining to distribution 
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability 
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS 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
-
-#include <stdio.h>
-#define	NEED_EVENTS 1
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/keysym.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include <xkbsrv.h>
-#include <X11/extensions/XI.h>
-
-void
-XkbDDXFakePointerButton(int event,int button)
-{
-xEvent	ev;
-int	x,y;
-DevicePtr ptr;
-
-    if ((ptr = (DevicePtr)inputInfo.pointer)==NULL)
-	return;
-    GetSpritePosition(inputInfo.pointer, &x,&y);
-    ev.u.u.type = event;
-    ev.u.u.detail = button;
-    ev.u.keyButtonPointer.time = GetTimeInMillis();
-    ev.u.keyButtonPointer.rootX = x;
-    ev.u.keyButtonPointer.rootY = y;
-    (*ptr->processInputProc)( &ev, (DeviceIntPtr)ptr, 1 );
-    return;
-}
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 35938a9..94420cf 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -595,9 +595,6 @@ _XkbFilterPointerBtn(	XkbSrvInfoPtr	xkbi,
 			unsigned	keycode,
 			XkbAction *	pAction)
 {
-    if (xkbi->device == inputInfo.keyboard)
-        return 0;
-
     if (filter->keycode==0) {		/* initial press */
 	int	button= pAction->btn.button;
 
@@ -617,7 +614,7 @@ _XkbFilterPointerBtn(	XkbSrvInfoPtr	xkbi,
 			((pAction->btn.flags&XkbSA_LockNoLock)==0)) {
 		    xkbi->lockedPtrButtons|= (1<<button);
 		    AccessXCancelRepeatKey(xkbi,keycode);
-		    XkbDDXFakePointerButton(ButtonPress,button);
+		    XkbDDXFakeDeviceButton(xkbi->device, 1, button);
 		    filter->upAction.type= XkbSA_NoAction;
 		}
 		break;
@@ -628,12 +625,12 @@ _XkbFilterPointerBtn(	XkbSrvInfoPtr	xkbi,
 		    if (pAction->btn.count>0) {
 			nClicks= pAction->btn.count;
 			for (i=0;i<nClicks;i++) {
-			    XkbDDXFakePointerButton(ButtonPress,button);
-			    XkbDDXFakePointerButton(ButtonRelease,button);
+			    XkbDDXFakeDeviceButton(xkbi->device, 1, button);
+			    XkbDDXFakeDeviceButton(xkbi->device, 0, button);
 			}
 			filter->upAction.type= XkbSA_NoAction;
 		    }
-		    else XkbDDXFakePointerButton(ButtonPress,button);
+		    else XkbDDXFakeDeviceButton(xkbi->device, 1, button);
 		}
 		break;
 	    case XkbSA_SetPtrDflt:
@@ -689,7 +686,7 @@ _XkbFilterPointerBtn(	XkbSrvInfoPtr	xkbi,
 		}
 		xkbi->lockedPtrButtons&= ~(1<<button);
 	    case XkbSA_PtrBtn:
-		XkbDDXFakePointerButton(ButtonRelease,button);
+		XkbDDXFakeDeviceButton(xkbi->device, 0, button);
 		break;
 	}
 	filter->active = 0;
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index 047efcd..335620b 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -870,7 +870,7 @@ XkbSrvInfoPtr	xkbi;
 	     * Faking a release of the button here solves the problem.
 	     */
 	    DebugF("[xkb] Faking release of button %d\n", xE[0].u.u.detail);
-	    XkbDDXFakePointerButton(ButtonRelease, xE[0].u.u.detail);
+	    XkbDDXFakeDeviceButton(xkbi->device, 0, xE[0].u.u.detail);
         }
     }
     else {
@@ -923,12 +923,12 @@ XkbSrvInfoPtr	xkbi;
 		((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
 		(xkbi->lockedPtrButtons & button_mask) == button_mask) {
 		DebugF("[xkb] Faking release of button %d\n", xE[i].u.u.detail);
-		XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail);
+		XkbDDXFakeDeviceButton(xkbi->device, 0, xE[i].u.u.detail);
 	    } else if (type == DeviceButtonPress &&
                     ((((deviceKeyButtonPointer*)&xE[i])->state >> 7) & button_mask) == button_mask &&
                     (xkbi->lockedPtrButtons & button_mask) == button_mask) {
 		DebugF("[xkb] Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state);
-		XkbDDXFakePointerButton(DeviceButtonRelease, ((deviceKeyButtonPointer*)&xE[i])->state);
+		XkbDDXFakeDeviceButton(xkbi->device, 0, ((deviceKeyButtonPointer*)&xE[i])->state);
             }
 	}
     }
commit 4971315296cbf868dd738c1c0c1c504fcfe1b619
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Mon Nov 3 17:47:36 2008 +1030

    dix: clean up GetPointerEvents and GetKeyboardValuatorEvents.
    
    Split into several functions, remove some stale comments.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index bf8b77c..620ce93 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -563,6 +563,218 @@ getValuatorEvents(EventList *events, DeviceIntPtr pDev,
     return events;
 }
 
+/**
+ * Create the DCCE event (does not update the master's device state yet, this
+ * is done in the event processing).
+ * Pull in the coordinates from the MD if necessary.
+ *
+ * @param events Pointer to a pre-allocated event list.
+ * @param dev The slave device that generated an event.
+ * @param num_events The current number of events, returns the number of
+ *        events if a DCCE was generated.
+ * @return The updated @events pointer.
+ */
+static EventListPtr
+updateFromMaster(EventListPtr events, DeviceIntPtr dev, int *num_events)
+{
+    DeviceIntPtr master = dev->u.master;
+    if (master && master->u.lastSlave != dev)
+    {
+        CreateClassesChangedEvent(events, master, dev);
+        updateSlaveDeviceCoords(master, dev);
+        master->u.lastSlave = dev;
+        master->last.numValuators = dev->last.numValuators;
+        (*num_events)++;
+        events++;
+    }
+    return events;
+}
+
+/**
+ * Move the device's pointer to the position given in the valuators.
+ *
+ * @param dev The device which's pointer is to be moved.
+ * @param x Returns the x position of the pointer after the move.
+ * @param y Returns the y position of the pointer after the move.
+ * @param first The first valuator in @valuators
+ * @param num Total number of valuators in @valuators.
+ * @param valuators Valuator data for each axis between @first and
+ *        @first+ at num.
+ */
+static void
+moveAbsolute(DeviceIntPtr dev, int *x, int *y,
+             int first, int num, int *valuators)
+{
+    int i;
+
+
+    if (num >= 1 && first == 0)
+        *x = *(valuators + 0);
+    else
+        *x = dev->last.valuators[0];
+
+    if (first <= 1 && num >= (2 - first))
+        *y = *(valuators + 1 - first);
+    else
+        *y = dev->last.valuators[1];
+
+    clipAxis(dev, 0, x);
+    clipAxis(dev, 1, y);
+
+    i = (first > 2) ? 0 : 2;
+    for (; i < num; i++)
+    {
+        dev->last.valuators[i + first] = valuators[i];
+        clipAxis(dev, i, &dev->last.valuators[i + first]);
+    }
+}
+
+/**
+ * Move the device's pointer by the values given in @valuators.
+ *
+ * @param dev The device which's pointer is to be moved.
+ * @param x Returns the x position of the pointer after the move.
+ * @param y Returns the y position of the pointer after the move.
+ * @param first The first valuator in @valuators
+ * @param num Total number of valuators in @valuators.
+ * @param valuators Valuator data for each axis between @first and
+ *        @first+ at num.
+ */
+static void
+moveRelative(DeviceIntPtr dev, int *x, int *y,
+             int first, int num, int *valuators)
+{
+    int i;
+
+    *x = dev->last.valuators[0];
+    *y = dev->last.valuators[1];
+
+    if (num >= 1 && first == 0)
+        *x += *(valuators +0);
+
+    if (first <= 1 && num >= (2 - first))
+        *y += *(valuators + 1 - first);
+
+    /* if attached, clip both x and y to the defined limits (usually
+     * co-ord space limit). If it is attached, we need x/y to go over the
+     * limits to be able to change screens. */
+    if(dev->u.master) {
+        clipAxis(dev, 0, x);
+        clipAxis(dev, 1, y);
+    }
+
+    /* calc other axes, clip, drop back into valuators */
+    i = (first > 2) ? 0 : 2;
+    for (; i < num; i++)
+    {
+        dev->last.valuators[i + first] += valuators[i];
+        clipAxis(dev, i, &dev->last.valuators[i + first]);
+        valuators[i] = dev->last.valuators[i + first];
+    }
+}
+
+/**
+ * Accelerate the data in valuators based on the device's acceleration scheme.
+ *
+ * @param dev The device which's pointer is to be moved.
+ * @param first The first valuator in @valuators
+ * @param num Total number of valuators in @valuators.
+ * @param valuators Valuator data for each axis between @first and
+ *        @first+ at num.
+ * @param ms Current time.
+ */
+static void
+accelPointer(DeviceIntPtr dev, int first, int num, int *valuators, CARD32 ms)
+{
+    if (dev->valuator->accelScheme.AccelSchemeProc)
+        dev->valuator->accelScheme.AccelSchemeProc(dev, first, num, valuators, ms);
+}
+
+/**
+ * If we have HW cursors, this actually moves the visible sprite. If not, we
+ * just do all the screen crossing, etc.
+ *
+ * We scale from device to screen coordinates here, call
+ * miPointerSetPosition() and then scale back into device coordinates (if
+ * needed). miPSP will change x/y if the screen was crossed.
+ *
+ * @param dev The device to be moved.
+ * @param x Pointer to current x-axis value, may be modified.
+ * @param y Pointer to current y-axis value, may be modified.
+ * @param scr Screen the device's sprite is currently on.
+ * @param screenx Screen x coordinate the sprite is on after the update.
+ * @param screeny Screen y coordinate the sprite is on after the update.
+ */
+static void
+positionSprite(DeviceIntPtr dev, int *x, int *y,
+               ScreenPtr scr, int *screenx, int *screeny)
+{
+    /* scale x&y to screen */
+    *screenx = rescaleValuatorAxis(*x, dev->valuator->axes + 0, NULL, scr->width);
+    *screeny = rescaleValuatorAxis(*y, dev->valuator->axes + 1, NULL, scr->height);
+    dev->last.valuators[0] = *screenx;
+    dev->last.valuators[1] = *screeny;
+
+    /* This takes care of crossing screens for us, as well as clipping
+     * to the current screen. */
+    miPointerSetPosition(dev, &dev->last.valuators[0], &dev->last.valuators[1]);
+
+    if (dev->u.master) {
+        dev->u.master->last.valuators[0] = dev->last.valuators[0];
+        dev->u.master->last.valuators[1] = dev->last.valuators[1];
+    }
+
+    /* Crossed screen? Scale back to device coordiantes */
+    if(*screenx != dev->last.valuators[0])
+    {
+        scr = miPointerGetScreen(dev);
+        *x = rescaleValuatorAxis(dev->last.valuators[0], NULL,
+                                dev->valuator->axes + 0, scr->width);
+        *screenx = dev->last.valuators[0];
+    }
+    if(*screeny != dev->last.valuators[1])
+    {
+        scr = miPointerGetScreen(dev);
+        *screeny = dev->last.valuators[1];
+        *y = rescaleValuatorAxis(dev->last.valuators[1], NULL,
+                                 dev->valuator->axes + 1, scr->height);
+    }
+
+}
+
+/**
+ * Update the motion history for the device and (if appropriate) for its
+ * master device.
+ * @param dev Slave device to update.
+ * @param first First valuator to append to history.
+ * @param num Total number of valuators to append to history.
+ * @param ms Current time
+ */
+static void
+updateHistory(DeviceIntPtr dev, int first, int num, CARD32 ms)
+{
+    updateMotionHistory(dev, ms, first, num, &dev->last.valuators[first]);
+    if (dev->u.master)
+        updateMotionHistory(dev->u.master, ms, first, num,
+                            &dev->last.valuators[first]);
+}
+
+/**
+ * Calculate how many DeviceValuator events are needed given a number of
+ * valuators.
+ * @param num_valuators Number of valuators to attach to event.
+ * @return the number of DeviceValuator events needed.
+ */
+static int
+countValuatorEvents(int num_valuators)
+{
+    if (num_valuators) {
+        if ((num_valuators / 6) + 1 > MAX_VALUATOR_EVENTS)
+            num_valuators = MAX_VALUATOR_EVENTS;
+        return (num_valuators / 6) + 1;
+    } else
+        return 0;
+}
 
 /**
  * Convenience wrapper around GetKeyboardValuatorEvents, that takes no
@@ -603,43 +815,21 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type,
     KeySym *map;
     KeySym sym;
     deviceKeyButtonPointer *kbp = NULL;
-    DeviceIntPtr master;
 
-    if (!events)
-        return 0;
-
-    /* DO NOT WANT */
-    if (type != KeyPress && type != KeyRelease)
-        return 0;
-
-    if (!pDev->key || !pDev->focus || !pDev->kbdfeed)
+    if (!events ||!pDev->key || !pDev->focus || !pDev->kbdfeed ||
+       (type != KeyPress && type != KeyRelease) ||
+       (key_code < 8 || key_code > 255))
         return 0;
 
     numEvents = 1;
 
-    if (key_code < 8 || key_code > 255)
-        return 0;
-
     map = pDev->key->curKeySyms.map;
     sym = map[(key_code - pDev->key->curKeySyms.minKeyCode)
               * pDev->key->curKeySyms.mapWidth];
 
-    master = pDev->u.master;
-    if (master && master->u.lastSlave != pDev)
-    {
-        CreateClassesChangedEvent(events, master, pDev);
-        updateSlaveDeviceCoords(master, pDev);
-        master->u.lastSlave = pDev;
-        master->last.numValuators = pDev->last.numValuators;
-        numEvents++;
-        events++;
-    }
+    events = updateFromMaster(events, pDev, &numEvents);
 
-    if (num_valuators) {
-        if ((num_valuators / 6) + 1 > MAX_VALUATOR_EVENTS)
-            num_valuators = MAX_VALUATOR_EVENTS;
-        numEvents += (num_valuators / 6) + 1;
-    }
+    numEvents += countValuatorEvents(num_valuators);
 
 #ifdef XKB
     if (noXkbExtension)
@@ -807,152 +997,44 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
     int num_events = 1;
     CARD32 ms;
     deviceKeyButtonPointer *kbp = NULL;
-    DeviceIntPtr master;
     int x, y, /* switches between device and screen coords */
         cx, cy; /* only screen coordinates */
     ScreenPtr scr = miPointerGetScreen(pDev);
-    int *v0 = NULL, *v1 = NULL;
-    int i;
 
     ms = GetTimeInMillis(); /* before pointer update to help precision */
 
-    /* Sanity checks. */
-    if (!scr) /* can happen during server shutdown */
-        return 0;
-    if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
-        return 0;
-    if (type != MotionNotify && !pDev->button)
-        return 0;
-    /* FIXME: I guess it should, in theory, be possible to post button events
-     *        from devices without valuators. */
-    if (!pDev->valuator)
-        return 0;
-    if (type == MotionNotify && num_valuators <= 0)
+    if (!scr || !pDev->valuator || first_valuator < 0 ||
+        ((num_valuators + first_valuator) > pDev->valuator->numAxes) ||
+        (type != MotionNotify && type != ButtonPress && type != ButtonRelease) ||
+        (type != MotionNotify && !pDev->button) ||
+        (type == MotionNotify && num_valuators <= 0))
         return 0;
 
-    /* Do we need to send a DeviceValuator event? */
-    if (num_valuators) {
-        if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
-            num_valuators = MAX_VALUATOR_EVENTS * 6;
-        num_events += ((num_valuators - 1) / 6) + 1;
-    }
-
-    /* You fail. */
-    if (first_valuator < 0 ||
-        (num_valuators + first_valuator) > pDev->valuator->numAxes)
-        return 0;
+    num_events += countValuatorEvents(num_valuators);
 
-    master = pDev->u.master;
-    if (master && master->u.lastSlave != pDev)
-    {
-        CreateClassesChangedEvent(events, master, pDev);
-        updateSlaveDeviceCoords(master, pDev);
-        master->u.lastSlave = pDev;
-        master->last.numValuators = pDev->last.numValuators;
-        num_events++;
-        events++;
-    }
+    events = updateFromMaster(events, pDev, &num_events);
 
-    /* Fetch pointers into the valuator array for more easy to read code */
-    if (num_valuators >= 1 && first_valuator == 0)
-        v0 = valuators + 0;
-    if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
-        v1 = valuators + 1 - first_valuator;
-
-    /* Set x and y based on whether this is absolute or relative, and
-     * accelerate if we need to. */
-    x = pDev->last.valuators[0];
-    y = pDev->last.valuators[1];
-    if (flags & POINTER_ABSOLUTE) {
-        if(v0) x = *v0;
-        if(v1) y = *v1;
-
-        /* Clip both x and y to the defined limits (usually co-ord space limit). */
-        clipAxis(pDev, 0, &x);
-        clipAxis(pDev, 1, &y);
-
-        i = (first_valuator > 2) ? 0 : 2;
-        for (; i < num_valuators; i++)
-        {
-            pDev->last.valuators[i + first_valuator] = valuators[i];
-            clipAxis(pDev, i, &pDev->last.valuators[i + first_valuator]);
-        }
-    }
+    if (flags & POINTER_ABSOLUTE)
+        moveAbsolute(pDev, &x, &y, first_valuator, num_valuators, valuators);
     else {
-        if (flags & POINTER_ACCELERATE &&
-            pDev->valuator->accelScheme.AccelSchemeProc){
-            pDev->valuator->accelScheme.AccelSchemeProc(
-                      pDev, first_valuator, num_valuators, valuators, ms);
-        }
-
-        if(v0) x += *v0;
-        if(v1) y += *v1;
-
-        /* if attached, clip both x and y to the defined limits (usually
-         * co-ord space limit). If it is attached, we need x/y to go over the
-         * limits to be able to change screens. */
-        if(master) {
-            clipAxis(pDev, 0, &x);
-            clipAxis(pDev, 1, &y);
-        }
-
-        /* calc other axes, clip, drop back into valuators */
-        i = (first_valuator > 2) ? 0 : 2;
-        for (; i < num_valuators; i++)
-        {
-            pDev->last.valuators[i + first_valuator] += valuators[i];
-            clipAxis(pDev, i, &pDev->last.valuators[i + first_valuator]);
-            valuators[i] = pDev->last.valuators[i + first_valuator];
-        }
+        if (flags & POINTER_ACCELERATE)
+            accelPointer(pDev, first_valuator, num_valuators, valuators, ms);
+        moveRelative(pDev, &x, &y, first_valuator, num_valuators, valuators);
     }
 
-    /* scale x&y to screen */
-    pDev->last.valuators[0] = cx = rescaleValuatorAxis(x, pDev->valuator->axes + 0,
-                                           NULL, scr->width);
-    pDev->last.valuators[1] = cy = rescaleValuatorAxis(y, pDev->valuator->axes + 1,
-                                           NULL, scr->height);
-
-    /* This takes care of crossing screens for us, as well as clipping
-     * to the current screen.  Right now, we only have one history buffer,
-     * so we don't set this for both the device and core.*/
-    miPointerSetPosition(pDev, &pDev->last.valuators[0], &pDev->last.valuators[1]);
-
-    if (master) {
-        master->last.valuators[0] = pDev->last.valuators[0];
-        master->last.valuators[1] = pDev->last.valuators[1];
-    }
-
-    /* Crossed screen? Scale back to device coordiantes */
-    if(cx != pDev->last.valuators[0])
-    {
-        scr = miPointerGetScreen(pDev);
-        x = rescaleValuatorAxis(pDev->last.valuators[0], NULL,
-                                pDev->valuator->axes + 0, scr->width);
-        cx = pDev->last.valuators[0];
-    }
-    if(cy != pDev->last.valuators[1])
-    {
-        scr = miPointerGetScreen(pDev);
-        cy = pDev->last.valuators[1];
-        y = rescaleValuatorAxis(pDev->last.valuators[1], NULL,
-                                pDev->valuator->axes + 1, scr->height);
-    }
-
-
-    updateMotionHistory(pDev, ms, first_valuator, num_valuators,
-            &pDev->last.valuators[first_valuator]);
-    if (master)
-        updateMotionHistory(master, ms, first_valuator, num_valuators,
-                &pDev->last.valuators[first_valuator]);
-
-    /* Update the valuators with the true value sent to the client*/
-    if(v0) *v0 = x;
-    if(v1) *v1 = y;
+    positionSprite(pDev, &x, &y, scr, &cx, &cy);
+    updateHistory(pDev, first_valuator, num_valuators, ms);
 
     /* dropy x/y (device coordinates) back into valuators for next event */
     pDev->last.valuators[0] = x;
     pDev->last.valuators[1] = y;
 
+    /* Update the valuators with the true value sent to the client*/
+    if (num_valuators >= 1 && first_valuator == 0)
+        valuators[0] = x;
+    if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
+        valuators[1 - first_valuator] = y;
+
     kbp = (deviceKeyButtonPointer *) events->event;
     kbp->time = ms;
     kbp->deviceid = pDev->id;
commit 6bb0e0a53656db6168a053fb51b242a8640c1461
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Fri Oct 24 16:22:09 2008 +1030

    xnest: I'm sure xfree works fine, even if we're 64 bit.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>

diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index bb3cb13..17d3e5e 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -236,11 +236,7 @@ XkbError:
 	XkbFreeKeyboard(xkb, 0, False);
       }
 #endif
-#ifdef _XSERVER64
       xfree(keymap);
-#else
-      XFree(keymap);
-#endif
       break;
     case DEVICE_ON: 
       xnestEventMask |= XNEST_KEYBOARD_EVENT_MASK;
commit 67b7e06c4fa4e8dafb64d9f3eb976836d0cc5889
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Apr 25 19:39:48 2008 +0300

    XKB: Remove pointless macros
    
    These weren't even being used, which isn't overly surprising, given that
    they were already in the struct.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>

diff --git a/include/xkbstr.h b/include/xkbstr.h
index 214a554..5eebe41 100644
--- a/include/xkbstr.h
+++ b/include/xkbstr.h
@@ -59,10 +59,6 @@ typedef struct _XkbStateRec {
 	unsigned char	compat_lookup_mods;
 	unsigned short	ptr_buttons;
 } XkbStateRec,*XkbStatePtr;
-#define	XkbModLocks(s)	 ((s)->locked_mods)
-#define	XkbStateMods(s)	 ((s)->base_mods|(s)->latched_mods|XkbModLocks(s))
-#define	XkbGroupLock(s)	 ((s)->locked_group)
-#define	XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s))
 #define	XkbStateFieldFromRec(s)	XkbBuildCoreState((s)->lookup_mods,(s)->group)
 #define	XkbGrabStateFromRec(s)	XkbBuildCoreState((s)->grab_mods,(s)->group)
 
commit d9ff20e323ba9fb309629ac21946e85709625589
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Thu Oct 23 16:48:15 2008 +1030

    DIX: Remove unnecessary prototype
    
    We don't call XkbCopyKeymap from getevents.c anymore, so axe it.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index 920cf05..bf8b77c 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -47,7 +47,6 @@
 #ifdef XKB
 #include <X11/extensions/XKBproto.h>
 #include <xkbsrv.h>
-extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies);
 #endif
 
 #ifdef PANORAMIX
commit 064ee458c7183eb91ef2e0f262b312ba1e3ad6e5
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Sat Aug 9 15:54:56 2008 +0300

    XKB: Tiny cleanups to _XkbLookupAnyDevice
    
    A couple of coding style cleanups, a warning fix via removing a
    now-unused label, and also put an else so we don't spuriously trip a
    condition that should admittedly never occur anyway.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>

diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 61d37af..aafc1ab 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -79,14 +79,15 @@ _XkbLookupAnyDevice(DeviceIntPtr *pDev, int id, ClientPtr client,
 {
     int rc = XkbKeyboardErrorCode;
 
-    if (id == XkbUseCoreKbd) {
+    if (id == XkbUseCoreKbd)
         id = PickKeyboard(client)->id;
-    } else if (id == XkbUseCorePtr) {
+    else if (id == XkbUseCorePtr)
         id = PickPointer(client)->id;
-    }
+
     rc = dixLookupDevice(pDev, id, client, access_mode);
     if (rc != Success)
 	*xkb_err = XkbErr_BadDevice;
+
     return rc;
 }
 
commit 97c9e6a7139e07a0761be05034fae42fcd65ba36
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Mar 28 17:10:28 2008 +0200

    XKB: Fix thinko, causing warning (erroneously fixed in 5544c51447)
    
    newTypes is a local variable which always has an address.  newTypesIn,
    on the other hand, might be sus.
    
    See also 5544c51447f551dfc6df64438873a7ce64743976.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>

diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c
index 6f63c2b..a9d8b17 100644
--- a/xkb/XKBMisc.c
+++ b/xkb/XKBMisc.c
@@ -480,7 +480,7 @@ register int	i;
 int		width,nOldGroups,oldWidth,newTypes[XkbNumKbdGroups];
 
     if ((!xkb) || (!XkbKeycodeInRange(xkb,key)) || (!xkb->map) ||
-	(!xkb->map->types)||((groups&XkbAllGroupsMask)==0)||
+	(!xkb->map->types)||(!newTypesIn)||((groups&XkbAllGroupsMask)==0)||
 	(nGroups>XkbNumKbdGroups)) {
 	return BadMatch;
     }
commit caf1e6a1c92a2e70de9159f93d6f5b48c202dd81
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Mar 18 10:05:00 2008 +0200

    XKB: Move XKBrules.h to the server too
    
    Get our own local copy of this, so we don't have to define XKB_IN_SERVER
    anymore.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>

diff --git a/include/Makefile.am b/include/Makefile.am
index f639048..f6b3670 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -54,6 +54,7 @@ sdk_HEADERS =		\
 	xkbfile.h	\
 	xkbsrv.h	\
 	xkbstr.h        \
+	xkbrules.h      \
 	xserver-properties.h
 
 nodist_sdk_HEADERS = xorg-server.h
diff --git a/include/xkbrules.h b/include/xkbrules.h
new file mode 100644
index 0000000..648e2e9
--- /dev/null
+++ b/include/xkbrules.h
@@ -0,0 +1,183 @@
+#ifndef _XKBRULES_H_
+#define	_XKBRULES_H_ 1
+
+/************************************************************
+ Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc.
+
+ 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 Silicon Graphics not be
+ used in advertising or publicity pertaining to distribution
+ of the software without specific prior written permission.
+ Silicon Graphics makes no representation about the suitability
+ of this software for any purpose. It is provided "as is"
+ without any express or implied warranty.
+
+ SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+ GRAPHICS 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.
+
+ ********************************************************/
+
+/***====================================================================***/
+
+typedef struct _XkbRF_VarDefs {
+	char *			model;
+	char *			layout;
+	char *			variant;
+	char *			options;
+	unsigned short		sz_extra;
+	unsigned short		num_extra;
+	char *			extra_names;
+	char **			extra_values;
+} XkbRF_VarDefsRec,*XkbRF_VarDefsPtr;
+
+typedef struct _XkbRF_VarDesc {
+	char *			name;
+	char *			desc;
+} XkbRF_VarDescRec, *XkbRF_VarDescPtr;
+
+typedef struct _XkbRF_DescribeVars {
+	int			sz_desc;
+	int			num_desc;
+	XkbRF_VarDescPtr	desc;
+} XkbRF_DescribeVarsRec,*XkbRF_DescribeVarsPtr;
+
+typedef struct _XkbRF_Rule {
+	int			number;
+        int			layout_num;
+        int			variant_num;
+	char *			model;
+	char *			layout;
+	char *			variant;
+	char *			option;
+	/* yields */
+	char *			keycodes;
+	char *			symbols;
+	char *			types;
+	char *			compat;
+	char *			geometry;
+	char *			keymap;
+	unsigned		flags;
+} XkbRF_RuleRec,*XkbRF_RulePtr;
+
+typedef struct _XkbRF_Group {
+	int			number;
+	char *			name;
+	char *			words;
+} XkbRF_GroupRec, *XkbRF_GroupPtr;
+
+#define	XkbRF_PendingMatch	(1L<<1)
+#define	XkbRF_Option		(1L<<2)
+#define	XkbRF_Append		(1L<<3)
+#define	XkbRF_Normal		(1L<<4)
+#define	XkbRF_Invalid		(1L<<5)
+
+typedef struct _XkbRF_Rules {
+	XkbRF_DescribeVarsRec	models;
+	XkbRF_DescribeVarsRec	layouts;
+	XkbRF_DescribeVarsRec	variants;
+	XkbRF_DescribeVarsRec	options;
+	unsigned short		sz_extra;
+	unsigned short		num_extra;
+	char **			extra_names;
+	XkbRF_DescribeVarsPtr	extra;
+
+	unsigned short		sz_rules;
+	unsigned short		num_rules;
+	XkbRF_RulePtr		rules;
+	unsigned short		sz_groups;
+	unsigned short		num_groups;
+        XkbRF_GroupPtr		groups;
+} XkbRF_RulesRec, *XkbRF_RulesPtr;
+
+/***====================================================================***/
+
+_XFUNCPROTOBEGIN
+
+extern Bool	XkbRF_GetComponents(
+    XkbRF_RulesPtr		/* rules */,
+    XkbRF_VarDefsPtr		/* var_defs */,
+    XkbComponentNamesPtr	/* names */
+);
+
+extern XkbRF_RulePtr	XkbRF_AddRule(
+    XkbRF_RulesPtr	/* rules */
+);
+
+extern XkbRF_GroupPtr XkbRF_AddGroup(XkbRF_RulesPtr  rules);
+
+extern Bool	XkbRF_LoadRules(
+    FILE *		/* file */,
+    XkbRF_RulesPtr	/* rules */
+);
+
+extern Bool XkbRF_LoadRulesByName(
+    char *		/* base */,
+    char *		/* locale */,
+    XkbRF_RulesPtr	/* rules */
+);
+
+/***====================================================================***/
+
+extern XkbRF_VarDescPtr	XkbRF_AddVarDesc(
+    XkbRF_DescribeVarsPtr	/* vars */
+);
+
+extern XkbRF_VarDescPtr	XkbRF_AddVarDescCopy(
+    XkbRF_DescribeVarsPtr	/* vars */,
+    XkbRF_VarDescPtr		/* copy_from */
+);
+
+extern XkbRF_DescribeVarsPtr XkbRF_AddVarToDescribe(
+    XkbRF_RulesPtr		/* rules */,
+    char *			/* name */
+);
+
+extern Bool	XkbRF_LoadDescriptions(
+    FILE *		/* file */,
+    XkbRF_RulesPtr	/* rules */
+);
+
+extern Bool XkbRF_LoadDescriptionsByName(
+    char *		/* base */,
+    char *		/* locale */,
+    XkbRF_RulesPtr	/* rules */
+);
+
+extern XkbRF_RulesPtr XkbRF_Load(
+    char *		/* base */,
+    char *		/* locale */,
+    Bool		/* wantDesc */,
+    Bool		/* wantRules */
+);
+
+extern XkbRF_RulesPtr XkbRF_Create(
+    int			/* sz_rules */,
+    int			/* sz_extra */
+);
+
+/***====================================================================***/
+
+extern void XkbRF_Free(
+    XkbRF_RulesPtr	/* rules */,
+    Bool		/* freeRules */
+);
+
+
+/***====================================================================***/
+
+#define	_XKB_RF_NAMES_PROP_ATOM		"_XKB_RULES_NAMES"
+#define	_XKB_RF_NAMES_PROP_MAXLEN	1024
+
+_XFUNCPROTOEND
+
+#endif /* _XKBRULES_H_ */
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index e2fff4e..d43755e 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -992,7 +992,7 @@ extern void XkbSendNewKeyboardNotify(
 
 #include "xkbfile.h"
 #include <X11/extensions/XKMformat.h>
-#include <X11/extensions/XKBrules.h>
+#include "xkbrules.h"
 
 #define	_XkbListKeymaps		0
 #define	_XkbListKeycodes	1
commit f4036f6ace5f770f0fe6a6e3dc3749051a81325a
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Wed Oct 22 22:40:44 2008 +1030

    Remove XEvIE
    
    It's unmaintained and has been broken for quite a while; MPX finally
    smashed it completely.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>

diff --git a/Xext/Makefile.am b/Xext/Makefile.am
index fc4376e..2f5c98b 100644
--- a/Xext/Makefile.am
+++ b/Xext/Makefile.am
@@ -90,14 +90,6 @@ BUILTIN_SRCS += $(XCALIBRATE_SRCS)
 # XCalibrate needs tslib
 endif
 
-# X EVent Interception Extension: allows accessibility helpers & composite
-# managers to intercept events from input devices and transform as needed
-# before the clients see them.
-XEVIE_SRCS = xevie.c
-if XEVIE
-BUILTIN_SRCS += $(XEVIE_SRCS)
-endif
-
 # Multi-buffering extension
 MULTIBUFFER_SRCS = mbuf.c
 EXTRA_MULTIBUFFER_SRCS = mbufbf.c mbufpx.c
@@ -136,7 +128,6 @@ EXTRA_DIST = \
 	$(XCSECURITY_SRCS) \
 	$(XCALIBRATE_SRCS) \
 	$(XINERAMA_SRCS) \
-	$(XEVIE_SRCS) \
 	$(MULTIBUFFER_SRCS) \
 	$(EXTRA_MULTIBUFFER_SRCS) \
 	$(FONTCACHE_SRCS) \
diff --git a/Xext/xevie.c b/Xext/xevie.c
deleted file mode 100644
index dfec68f..0000000
--- a/Xext/xevie.c
+++ /dev/null
@@ -1,739 +0,0 @@
-/************************************************************
-
-Copyright 2003-2005 Sun Microsystems, Inc.
-
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-************************************************************/
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "colormapst.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-#define  _XEVIE_SERVER_
-#include <X11/extensions/Xeviestr.h>
-#include <X11/Xfuncproto.h>
-#include "input.h"
-#include "inputstr.h"
-#include "windowstr.h"
-#include "cursorstr.h"
-#include <xkbsrv.h>
-
-#include "../os/osdep.h"
-#include "modinit.h"
-
-#define NoSuchEvent 0x80000000
-
-#ifdef XKB
-extern Bool noXkbExtension;
-#endif
-extern int    xeviegrabState;
-
-static DISPATCH_PROC(ProcXevieDispatch);
-static DISPATCH_PROC(SProcXevieDispatch);
-
-static unsigned char	XevieReqCode = 0;
-static int		XevieErrorBase;
-
-int			xevieFlag = 0;
-int	 		xevieClientIndex = 0;
-DeviceIntPtr		xeviekb = NULL;
-DeviceIntPtr		xeviemouse = NULL;
-Mask			xevieMask = 0;
-int       		xevieEventSent = 0;
-int			xevieKBEventSent = 0;
-static Bool             xevieModifiersOn = FALSE;
-
-static int xevieDevicePrivateKeyIndex;
-static DevPrivateKey xevieDevicePrivateKey = &xevieDevicePrivateKeyIndex;
-
-#define XEVIEINFO(dev)  ((xevieDeviceInfoPtr) \
-    dixLookupPrivate(&(dev)->devPrivates, xevieDevicePrivateKey))
-
-Mask xevieFilters[128] = 
-{
-        NoSuchEvent,                   /* 0 */
-        NoSuchEvent,                   /* 1 */
-        KeyPressMask,                  /* KeyPress */
-        KeyReleaseMask,                /* KeyRelease */
-        ButtonPressMask,               /* ButtonPress */
-        ButtonReleaseMask,             /* ButtonRelease */
-        PointerMotionMask              /* MotionNotify (initial state) */
-};
-
-typedef struct {
-    ProcessInputProc processInputProc;
-    ProcessInputProc realInputProc;
-    DeviceUnwrapProc unwrapProc;
-} xevieDeviceInfoRec, *xevieDeviceInfoPtr;
-
-typedef struct {
-    CARD32 time;
-    KeyClassPtr keyc;
-} xevieKeycQueueRec, *xevieKeycQueuePtr;
-
-#define KEYC_QUEUE_SIZE	    100
-static xevieKeycQueueRec keycq[KEYC_QUEUE_SIZE] = {{0, NULL}};
-static int keycqHead = 0, keycqTail = 0;
-
-static Bool XevieStart(void);
-static void XevieEnd(int clientIndex);
-static void XevieClientStateCallback(CallbackListPtr *pcbl, pointer nulldata,
-                                    pointer calldata);
-static void XevieServerGrabStateCallback(CallbackListPtr *pcbl,
-                                         pointer nulldata,
-                                         pointer calldata);
-
-static Bool XevieAdd(DeviceIntPtr device, pointer data);
-static void XevieWrap(DeviceIntPtr device, ProcessInputProc proc);
-static Bool XevieRemove(DeviceIntPtr device, pointer data);
-static void doSendEvent(xEvent *xE, DeviceIntPtr device);
-static void XeviePointerProcessInputProc(xEvent *xE, DeviceIntPtr dev,
-                                         int count);
-static void XevieKbdProcessInputProc(xEvent *xE, DeviceIntPtr dev, int count);
-
-void
-XevieExtensionInit (void)
-{
-    ExtensionEntry* extEntry;
-
-    if (!AddCallback(&ServerGrabCallback,XevieServerGrabStateCallback,NULL))
-       return;
-
-    if ((extEntry = AddExtension (XEVIENAME,
-				0,
-				XevieNumberErrors,
-				ProcXevieDispatch,
-				SProcXevieDispatch,
-				NULL,
-				StandardMinorOpcode))) {
-	XevieReqCode = (unsigned char)extEntry->base;
-	XevieErrorBase = extEntry->errorBase;
-    }
-}
-
-static 
-int ProcXevieQueryVersion (ClientPtr client)
-{
-    xXevieQueryVersionReply rep;
-    int n;
-
-    REQUEST_SIZE_MATCH (xXevieQueryVersionReq);
-    rep.type = X_Reply;
-    rep.length = 0;
-    rep.sequence_number = client->sequence;
-    rep.server_major_version = XEVIE_MAJOR_VERSION;
-    rep.server_minor_version = XEVIE_MINOR_VERSION;
-    if (client->swapped) {
-	swaps(&rep.sequence_number, n);
-	swapl(&rep.length, n);
-	swaps(&rep.server_major_version, n);
-	swaps(&rep.server_minor_version, n);
-    }
-    WriteToClient (client, sizeof (xXevieQueryVersionReply), (char *)&rep);
-    return client->noClientException;
-}
-
-static
-int ProcXevieStart (ClientPtr client)
-{
-    xXevieStartReply rep;
-    int n;
-
-    REQUEST_SIZE_MATCH (xXevieStartReq);
-    rep.pad1 = 0;
-
-    if(!xevieFlag){
-        if (AddCallback(&ClientStateCallback,XevieClientStateCallback,NULL)) {
-           xevieFlag = 1;
-           rep.pad1 = 1;
-           xevieClientIndex = client->index;
-	   if(!keycq[0].time ) {
-		int i;
-		for(i=0; i<KEYC_QUEUE_SIZE; i++) {
-		    keycq[i].keyc = xalloc(sizeof(KeyClassRec));	
-		    keycq[i].keyc->xkbInfo = xalloc(sizeof(XkbSrvInfoRec));
-		}
-	   }
-        } else
-           return BadAlloc;
-    } else
-        return BadAccess;
-#ifdef XKB
-    if (!noXkbExtension) {
-	if (!XevieStart()) {
-            DeleteCallback(&ClientStateCallback,XevieClientStateCallback,NULL);
-            return BadAlloc;
-        }
-    }
-#endif
-    
-    xevieModifiersOn = FALSE;
-
-    rep.length = 0;
-    rep.type = X_Reply;
-    rep.sequence_number = client->sequence;
-    if (client->swapped) {
-	swaps(&rep.sequence_number, n);
-	swapl(&rep.length, n);
-    }
-    WriteToClient (client, sizeof (xXevieStartReply), (char *)&rep);
-    return client->noClientException;
-}
-
-static
-int ProcXevieEnd (ClientPtr client)
-{
-    xXevieEndReply rep;
-    int n;
-
-    REQUEST_SIZE_MATCH (xXevieEndReq);
-    
-    if (xevieFlag) {
-        if (client->index != xevieClientIndex)
-            return BadAccess;
-
-        DeleteCallback(&ClientStateCallback,XevieClientStateCallback,NULL);
-        XevieEnd(xevieClientIndex);
-    }
-
-    rep.length = 0;
-    rep.type = X_Reply;
-    rep.sequence_number = client->sequence;
-    if (client->swapped) {
-	swaps(&rep.sequence_number, n);
-	swapl(&rep.length, n);
-    }
-    WriteToClient (client, sizeof (xXevieEndReply), (char *)&rep);
-    return client->noClientException;
-}
-
-static
-int ProcXevieSend (ClientPtr client)
-{
-    REQUEST (xXevieSendReq);
-    xXevieSendReply rep;
-    xEvent *xE;
-    static unsigned char lastDetail = 0, lastType = 0;
-    int n;
-
-    REQUEST_SIZE_MATCH (xXevieSendReq);
-    
-    if (client->index != xevieClientIndex)
-        return BadAccess;
-
-    xE = (xEvent *)&stuff->event;
-    rep.length = 0;
-    rep.type = X_Reply;
-    rep.sequence_number = client->sequence;
-    if (client->swapped) {
-	swaps(&rep.sequence_number, n);
-	swapl(&rep.length, n);
-    }
-    WriteToClient (client, sizeof (xXevieSendReply), (char *)&rep);
-
-    switch(xE->u.u.type) {
-	case KeyPress:
-        case KeyRelease:
-	  xevieKBEventSent = 1;
-#ifdef XKB
-          if(!noXkbExtension)
-	    doSendEvent(xE, inputInfo.keyboard);
-	  else 
-#endif
-            CoreProcessKeyboardEvent (xE, xeviekb, 1);
-	  break;
-	case ButtonPress:
-	case ButtonRelease:
-	case MotionNotify:
-	  xevieEventSent = 1;
-#ifdef XKB
-	  if(!noXkbExtension)
-	    doSendEvent(xE, inputInfo.pointer);
-	  else
-#endif
-	    CoreProcessPointerEvent(xE, xeviemouse, 1); 
-	  break; 
-	default:
-	  break;
-    }
-    lastType = xE->u.u.type;
-    lastDetail = xE->u.u.detail;
-    return client->noClientException;
-}
-
-static
-int ProcXevieSelectInput (ClientPtr client)
-{
-    REQUEST (xXevieSelectInputReq);
-    xXevieSelectInputReply rep;
-    int n;
-
-    REQUEST_SIZE_MATCH (xXevieSelectInputReq);
-
-    if (client->index != xevieClientIndex)
-        return BadAccess;
-
-    xevieMask = stuff->event_mask;
-    rep.length = 0;
-    rep.type = X_Reply;
-    rep.sequence_number = client->sequence;
-    if (client->swapped) {
-	swaps(&rep.sequence_number, n);
-	swapl(&rep.length, n);
-    }
-    WriteToClient (client, sizeof (xXevieSelectInputReply), (char *)&rep);
-    return client->noClientException;
-}
-
-static 
-int ProcXevieDispatch (ClientPtr client)
-{
-    REQUEST (xReq);
-    switch (stuff->data)
-    {
-    case X_XevieQueryVersion:
-	return ProcXevieQueryVersion (client);
-    case X_XevieStart:
-	return ProcXevieStart (client);
-    case X_XevieEnd:
-	return ProcXevieEnd (client);
-    case X_XevieSend:
-	return ProcXevieSend (client);
-    case X_XevieSelectInput:
-	return ProcXevieSelectInput(client);
-    default:
-	return BadRequest;
-    }
-}
-
-static 
-int SProcXevieQueryVersion (ClientPtr client)
-{
-    int n;
-
-    REQUEST(xXevieQueryVersionReq);
-    swaps (&stuff->length, n);
-    REQUEST_SIZE_MATCH (xXevieQueryVersionReq);
-    swaps (&stuff->client_major_version, n);
-    swaps (&stuff->client_minor_version, n);
-    return ProcXevieQueryVersion(client);
-}
-
-static 
-int SProcXevieStart (ClientPtr client)
-{
-    int n;
-
-    REQUEST (xXevieStartReq);
-    swaps (&stuff->length, n);
-    REQUEST_SIZE_MATCH (xXevieStartReq);
-    swapl (&stuff->screen, n);
-    return ProcXevieStart (client);
-}
-
-static 
-int SProcXevieEnd (ClientPtr client)
-{
-    int n;
-
-    REQUEST (xXevieEndReq);
-    swaps (&stuff->length, n);
-    REQUEST_SIZE_MATCH (xXevieEndReq);
-    swapl (&stuff->cmap, n);
-    return ProcXevieEnd (client);
-}
-
-static
-int SProcXevieSend (ClientPtr client)
-{
-    int n;
-    xEvent eventT;
-    EventSwapPtr proc;
-
-    REQUEST (xXevieSendReq);
-    swaps (&stuff->length, n);
-    REQUEST_SIZE_MATCH (xXevieSendReq);
-    swapl (&stuff->dataType, n);
-
-    /* Swap event */
-    proc = EventSwapVector[stuff->event.u.u.type & 0177];
-    if (!proc ||  proc == NotImplemented) /* no swapping proc; invalid event type? */
-	return (BadValue);
-    (*proc)(&stuff->event, &eventT);
-    stuff->event = eventT;
-    
-    return ProcXevieSend (client);
-}
-
-static
-int SProcXevieSelectInput (ClientPtr client)
-{
-    int n;
-
-    REQUEST (xXevieSelectInputReq);
-    swaps (&stuff->length, n);
-    REQUEST_SIZE_MATCH (xXevieSelectInputReq);
-    swapl (&stuff->event_mask, n);
-    return ProcXevieSelectInput (client);
-}
-
-
-static 
-int SProcXevieDispatch (ClientPtr client)
-{
-    REQUEST(xReq);
-    switch (stuff->data)
-    {
-    case X_XevieQueryVersion:
-	return SProcXevieQueryVersion (client);
-    case X_XevieStart:
-	return SProcXevieStart (client);
-    case X_XevieEnd:
-	return SProcXevieEnd (client);
-    case X_XevieSend:
-	return SProcXevieSend (client);
-    case X_XevieSelectInput:
-	return SProcXevieSelectInput(client);
-    default:
-	return BadRequest;
-    }
-}
-/*======================================================*/
-
-#define WRAP_INPUTPROC(dev,store,inputProc) \
-   store->processInputProc = dev->public.processInputProc; \
-   dev->public.processInputProc = inputProc; \
-   store->realInputProc = dev->public.realInputProc; \
-   dev->public.realInputProc = inputProc;
-
-#define COND_WRAP_INPUTPROC(dev,store,inputProc) \
-   if (dev->public.processInputProc == dev->public.realInputProc) \
-          dev->public.processInputProc = inputProc; \
-   store->processInputProc =  \
-   store->realInputProc = dev->public.realInputProc; \
-   dev->public.realInputProc = inputProc;
-
-#define UNWRAP_INPUTPROC(dev,restore) \
-   dev->public.processInputProc = restore->processInputProc; \
-   dev->public.realInputProc = restore->realInputProc;
-
-#define UNWRAP_INPUTPROC(dev,restore) \
-   dev->public.processInputProc = restore->processInputProc; \
-   dev->public.realInputProc = restore->realInputProc;
-
-#define XEVIE_EVENT(xE) \
-      (xevieFlag \
-       && !xeviegrabState \
-       && clients[xevieClientIndex] \
-       && (xevieMask & xevieFilters[xE->u.u.type]))
-
-
-static void
-sendEvent(ClientPtr pClient, xEvent *xE)
-{
-    if(pClient->swapped) {
-        xEvent    eventTo;
-
-        /* Remember to strip off the leading bit of type in case
-           this event was sent with "SendEvent." */
-        (*EventSwapVector[xE->u.u.type & 0177]) (xE, &eventTo);
-        (void)WriteToClient(pClient, sizeof(xEvent), (char *)&eventTo);
-    } else {
-        (void)WriteToClient(pClient, sizeof(xEvent), (char *) xE);
-    }
-}
-
-static void
-XevieKbdProcessInputProc(xEvent *xE, DeviceIntPtr dev, int count)
-{
-    int             key, bit;
-    BYTE   *kptr;
-    ProcessInputProc tmp;
-    KeyClassPtr keyc = dev->key;
-    xevieDeviceInfoPtr xeviep = XEVIEINFO(dev);
-
-    if(XEVIE_EVENT(xE)) {
-        key = xE->u.u.detail;
-        kptr = &keyc->down[key >> 3];
-        bit = 1 << (key & 7);
-
-	if (dev->key->modifierMap[xE->u.u.detail])
-            xevieModifiersOn = TRUE;
-
-        xE->u.keyButtonPointer.event = xeviewin->drawable.id;
-        xE->u.keyButtonPointer.root = GetCurrentRootWindow(dev)->drawable.id;
-        xE->u.keyButtonPointer.child = (xeviewin->firstChild)
-            ? xeviewin->firstChild->drawable.id:0;
-        xE->u.keyButtonPointer.rootX = xeviehot.x;
-        xE->u.keyButtonPointer.rootY = xeviehot.y;
-        xE->u.keyButtonPointer.state = keyc->state | inputInfo.pointer->button->state;
-        /* fix bug: sequence lost in Xlib */
-        xE->u.u.sequenceNumber = clients[xevieClientIndex]->sequence;
-#ifdef XKB
-	/* fix for bug5092586 */
-	if(!noXkbExtension) {
-          switch(xE->u.u.type) {
-	    case KeyPress: *kptr |= bit; break;
-	    case KeyRelease: *kptr &= ~bit; break;
-	  }
-	}
-#endif
-	keycq[keycqHead].time = xE->u.keyButtonPointer.time;
-	memcpy(keycq[keycqHead].keyc, keyc, sizeof(KeyClassRec) - sizeof(KeyClassPtr));
-	memcpy(keycq[keycqHead].keyc->xkbInfo, keyc->xkbInfo, sizeof(XkbSrvInfoRec));
-	if(++keycqHead >=KEYC_QUEUE_SIZE)
-	    keycqHead = 0;
-        sendEvent(clients[xevieClientIndex], xE);
-        return;
-    }
-
-    tmp = dev->public.realInputProc;
-    UNWRAP_INPUTPROC(dev,xeviep);
-    dev->public.processInputProc(xE,dev,count);
-    COND_WRAP_INPUTPROC(dev,xeviep,tmp);
-}
-
-static void
-XeviePointerProcessInputProc(xEvent *xE, DeviceIntPtr dev, int count)
-{
-    xevieDeviceInfoPtr xeviep = XEVIEINFO(dev);
-    ProcessInputProc tmp;
-
-    if (XEVIE_EVENT(xE)) {
-        /* fix bug: sequence lost in Xlib */
-        xE->u.u.sequenceNumber = clients[xevieClientIndex]->sequence;
-        sendEvent(clients[xevieClientIndex], xE);
-        return;
-    }
-
-    tmp = dev->public.realInputProc;
-    UNWRAP_INPUTPROC(dev,xeviep);
-    dev->public.processInputProc(xE,dev,count);
-    COND_WRAP_INPUTPROC(dev,xeviep,tmp);
-}
-
-static Bool
-XevieStart(void)
-{
-    ProcessInputProc prp;
-    prp = XevieKbdProcessInputProc;
-    if (!XevieAdd(inputInfo.keyboard,&prp))
-        return FALSE;
-    prp = XeviePointerProcessInputProc;
-    if (!XevieAdd(inputInfo.pointer,&prp))
-        return FALSE;
-
-    return TRUE;
-}
-
-
-static void
-XevieEnd(int clientIndex)
-{
-    if (!clientIndex || clientIndex == xevieClientIndex) {
-
-#ifdef XKB
-       if(!noXkbExtension) {
-
-	   XevieRemove(inputInfo.keyboard,NULL);
-
-	   inputInfo.keyboard->public.processInputProc = CoreProcessKeyboardEvent;
-           inputInfo.keyboard->public.realInputProc = CoreProcessKeyboardEvent;
-           XkbSetExtension(inputInfo.keyboard,ProcessKeyboardEvent);
-
-
-           XevieRemove(inputInfo.pointer,NULL);
-
-	   inputInfo.pointer->public.processInputProc = CoreProcessPointerEvent;
-           inputInfo.pointer->public.realInputProc = CoreProcessPointerEvent;
-           XkbSetExtension(inputInfo.pointer,ProcessPointerEvent);
-       }
-#endif
-
-       xevieFlag = 0;
-       xevieClientIndex = 0;
-       DeleteCallback (&ClientStateCallback, XevieClientStateCallback, NULL);
-    }
-}
-
-static void
-XevieClientStateCallback(CallbackListPtr *pcbl, pointer nulldata,
-                        pointer calldata)
-{
-    NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
-    ClientPtr client = pci->client;
-    if (client->clientState == ClientStateGone
-       || client->clientState == ClientStateRetained)
-       XevieEnd(client->index);
-}
-
-static void
-XevieServerGrabStateCallback(CallbackListPtr *pcbl, pointer nulldata,
-                            pointer calldata)
-{
-    ServerGrabInfoRec *grbinfo = (ServerGrabInfoRec *)calldata;
-    if (grbinfo->grabstate == SERVER_GRABBED)
-       xeviegrabState = TRUE;
-    else
-       xeviegrabState = FALSE;
-}
-
-#define UNWRAP_UNWRAPPROC(device,proc_store) \
-    device->unwrapProc = proc_store;
-
-#define WRAP_UNWRAPPROC(device,proc_store,proc) \
-    proc_store = device->unwrapProc; \
-    device->unwrapProc = proc;
-
-static void
-xevieUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, pointer data)
-{
-    xevieDeviceInfoPtr xeviep = XEVIEINFO(device);
-    ProcessInputProc tmp = device->public.processInputProc;
-
-    UNWRAP_INPUTPROC(device,xeviep);
-    UNWRAP_UNWRAPPROC(device,xeviep->unwrapProc);
-    proc(device,data);
-    WRAP_INPUTPROC(device,xeviep,tmp);
-    WRAP_UNWRAPPROC(device,xeviep->unwrapProc,xevieUnwrapProc);
-}
-
-static Bool
-XevieUnwrapAdd(DeviceIntPtr device, void* data)
-{
-    if (device->unwrapProc)
-        device->unwrapProc(device,XevieUnwrapAdd,data);
-    else {
-        ProcessInputProc *ptr = data;
-        XevieWrap(device,*ptr);
-    }
-
-    return TRUE;
-}
-
-static Bool
-XevieAdd(DeviceIntPtr device, void* data)
-{
-    xevieDeviceInfoPtr xeviep;
-
-    xeviep = xalloc (sizeof (xevieDeviceInfoRec));
-    if (!xeviep)
-            return FALSE;
-
-    dixSetPrivate(&device->devPrivates, xevieDevicePrivateKey, xeviep);
-    XevieUnwrapAdd(device, data);
-
-    return TRUE;
-}
-
-static Bool
-XevieRemove(DeviceIntPtr device,pointer data)
-{
-    xevieDeviceInfoPtr xeviep = XEVIEINFO(device);
-
-    if (!xeviep) return TRUE;
-
-    UNWRAP_INPUTPROC(device,xeviep);
-    UNWRAP_UNWRAPPROC(device,xeviep->unwrapProc);
-
-    xfree(xeviep);
-    dixSetPrivate(&device->devPrivates, xevieDevicePrivateKey, NULL);
-    return TRUE;
-}
-
-static void
-XevieWrap(DeviceIntPtr device, ProcessInputProc proc)
-{
-    xevieDeviceInfoPtr xeviep = XEVIEINFO(device);
-
-    WRAP_INPUTPROC(device,xeviep,proc);
-    WRAP_UNWRAPPROC(device,xeviep->unwrapProc,xevieUnwrapProc);
-}
-
-static void
-doSendEvent(xEvent *xE, DeviceIntPtr dev)
-{
-    xevieDeviceInfoPtr xeviep = XEVIEINFO(dev);
-    ProcessInputProc tmp = dev->public.realInputProc;
-    if (((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))
-        && !xevieModifiersOn) {
-	KeyClassPtr keyc =  dev->key;
-        CARD8 realModes = dev->key->modifierMap[xE->u.u.detail];
-	int notFound = 0;
-	/* if some events are consumed by client, move the queue tail pointer to the current 
-           event which just comes back from Xevie client . 
-	*/
-        if(keycq[keycqTail].time != xE->u.keyButtonPointer.time) {
-	    while(keycq[keycqTail].time != xE->u.keyButtonPointer.time) {
-		if(++keycqTail >= KEYC_QUEUE_SIZE)
-		    keycqTail = 0;
-		if(keycqTail == keycqHead) {
-		    notFound = 1;
-		    break;
-		}
-	    }
-	}
-	if(!notFound) {
-	    dev->key = keycq[keycqTail].keyc;
-	    if(++keycqTail >= KEYC_QUEUE_SIZE)
-	        keycqTail = 0;
-	}
-        dev->key->modifierMap[xE->u.u.detail] = 0;  
-
-	if(dev->key->xkbInfo->repeatKey != 0 && xE->u.u.type != KeyPress)
-            XkbLastRepeatEvent=     (pointer)xE;
-        UNWRAP_INPUTPROC(dev,xeviep);
-        dev->public.processInputProc(xE,dev,1);
-        COND_WRAP_INPUTPROC(dev,xeviep,tmp);
-        XkbLastRepeatEvent= NULL;
-
-        dev->key->modifierMap[xE->u.u.detail] = realModes;
-	dev->key = keyc;
-	if(notFound) {
-	    DeleteCallback(&ClientStateCallback,XevieClientStateCallback,NULL);
-            XevieEnd(xevieClientIndex);
-	    ErrorF("Error: Xevie keyc queue size is not enough, disable Xevie\n");
-	}	
-    } else {
-        UNWRAP_INPUTPROC(dev,xeviep);
-        dev->public.processInputProc(xE,dev,1);
-        COND_WRAP_INPUTPROC(dev,xeviep,tmp);
-    }
-}
-
diff --git a/configure.ac b/configure.ac
index 869e8e8..138208d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -532,7 +532,6 @@ AC_ARG_ENABLE(xselinux,       AS_HELP_STRING([--disable-xselinux], [Build SELinu
 AC_ARG_ENABLE(xcsecurity,     AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
 AC_ARG_ENABLE(xcalibrate,     AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no])
 AC_ARG_ENABLE(tslib,          AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
-AC_ARG_ENABLE(xevie,          AS_HELP_STRING([--disable-xevie], [Build XEvIE extension (default: enabled)]), [XEVIE=$enableval], [XEVIE=yes])
 AC_ARG_ENABLE(multibuffer,    AS_HELP_STRING([--enable-multibuffer], [Build Multibuffer extension (default: disabled)]), [MULTIBUFFER=$enableval], [MULTIBUFFER=no])
 AC_ARG_ENABLE(dbe,            AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
 AC_ARG_ENABLE(xf86bigfont,    AS_HELP_STRING([--disable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
@@ -901,12 +900,6 @@ if test "x$XCSECURITY" = xyes; then
 	AC_DEFINE(XCSECURITY, 1, [Build Security extension])
 fi
 
-AM_CONDITIONAL(XEVIE, [test "x$XEVIE" = xyes])
-if test "x$XEVIE" = xyes; then
-	AC_DEFINE(XEVIE, 1, [Build XEvIE extension])
-	REQUIRED_MODULES="$REQUIRED_MODULES evieproto"
-fi
-
 AM_CONDITIONAL(MULTIBUFFER, [test "x$MULTIBUFFER" = xyes])
 if test "x$MULTIBUFFER" = xyes; then
 	AC_DEFINE(MULTIBUFFER, 1, [Build Multibuffer extension])
diff --git a/dix/events.c b/dix/events.c
index 6833a6b..35c1bfa 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -149,18 +149,6 @@ typedef const char *string;
 #include "Xserver-dtrace.h"
 #endif
 
-#ifdef XEVIE
-extern int       xevieFlag;
-extern int       xevieClientIndex;
-extern DeviceIntPtr     xeviemouse;
-extern DeviceIntPtr     xeviekb;
-extern Mask      xevieMask;
-extern Mask      xevieFilters[128];
-extern int       xevieEventSent;
-extern int       xevieKBEventSent;
-int    xeviegrabState = 0;
-#endif
-
 #include <X11/extensions/XIproto.h>
 #include <X11/extensions/XI.h>
 #include "exglobals.h"
@@ -338,11 +326,6 @@ IsKeyboardDevice(DeviceIntPtr dev)
     return (dev->key && dev->kbdfeed) && !IsPointerDevice(dev);;
 }
 
-#ifdef XEVIE
-_X_EXPORT WindowPtr xeviewin;
-_X_EXPORT HotSpot xeviehot;
-#endif
-
 static void DoEnterLeaveEvents(
     DeviceIntPtr pDev,
     WindowPtr fromWin,
@@ -634,10 +617,6 @@ XineramaCheckVirtualMotion(
 	    qe->event->u.keyButtonPointer.rootY = pSprite->hot.y;
 	}
     }
-#ifdef XEVIE
-    xeviehot.x = pSprite->hot.x;
-    xeviehot.y = pSprite->hot.y;
-#endif
 }
 
 
@@ -683,11 +662,6 @@ XineramaCheckMotion(xEvent *xE, DeviceIntPtr pDev)
 	XE_KBPTR.rootY = pSprite->hot.y;
     }
 
-#ifdef XEVIE
-    xeviehot.x = pSprite->hot.x;
-    xeviehot.y = pSprite->hot.y;
-    xeviewin =
-#endif
     pSprite->win = XYToWindow(pDev, pSprite->hot.x, pSprite->hot.y);
 
     if (pSprite->win != prevSpriteWin)
@@ -945,10 +919,6 @@ CheckVirtualMotion(
 	    qe->event->u.keyButtonPointer.rootY = pSprite->hot.y;
 	}
     }
-#ifdef XEVIE
-    xeviehot.x = pSprite->hot.x;
-    xeviehot.y = pSprite->hot.y;
-#endif
     RootWindow(pDev) = WindowTable[pSprite->hot.pScreen->myNum];
 }
 
@@ -2711,10 +2681,6 @@ CheckMotion(xEvent *xE, DeviceIntPtr pDev)
             pSprite->hot.y = pSprite->physLimits.y2 - 1;
 	if (pSprite->hotShape)
 	    ConfineToShape(pDev, pSprite->hotShape, &pSprite->hot.x, &pSprite->hot.y);
-#ifdef XEVIE
-        xeviehot.x = pSprite->hot.x;
-        xeviehot.y = pSprite->hot.y;
-#endif
 	pSprite->hotPhys = pSprite->hot;
 
 	if ((pSprite->hotPhys.x != *rootX) ||
@@ -2729,9 +2695,6 @@ CheckMotion(xEvent *xE, DeviceIntPtr pDev)
 	*rootY = pSprite->hot.y;
     }
 
-#ifdef XEVIE
-    xeviewin =
-#endif
     pSprite->win = XYToWindow(pDev, pSprite->hot.x, pSprite->hot.y);
 #ifdef notyet
     if (!(pSprite->win->deliverableEvents &
@@ -2828,14 +2791,12 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
 /**
  * Called from main() with the root window on the first screen. Used to do a
  * lot more when MPX wasn't around yet. Things change.
+ *
+ * Should delete this now? -ds
  */
 void
 DefineInitialRootWindow(WindowPtr win)
 {
-#ifdef XEVIE
-    xeviewin = win;
-#endif
-
 }
 
 /**
@@ -2988,9 +2949,6 @@ UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen)
     pSprite->hot = pSprite->hotPhys;
     pSprite->hotLimits.x2 = pScreen->width;
     pSprite->hotLimits.y2 = pScreen->height;
-#ifdef XEVIE
-    xeviewin =
-#endif
     pSprite->win = win;
     pSprite->current = wCursor (win);
     pSprite->current->refcnt++;
@@ -3813,45 +3771,6 @@ ProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count)
     GrabInfoPtr     grabinfo;
     Bool            deactivateGrab = FALSE;
     KeyClassPtr     keyc = keybd->key;
-#ifdef XEVIE
-    static Window   rootWin = 0;
-
-    if(!xeviegrabState && xevieFlag && clients[xevieClientIndex] &&
-          (xevieMask & xevieFilters[xE->u.u.type])) {
-      key = xE->u.u.detail;
-      kptr = &keyc->down[key >> 3];
-      bit = 1 << (key & 7);
-      if((xE->u.u.type == KeyPress &&  (*kptr & bit)) ||
-         (xE->u.u.type == KeyRelease && !(*kptr & bit)))
-      {} else {
-#ifdef XKB
-        if(!noXkbExtension)
-	    xevieKBEventSent = 1;
-#endif
-        if(!xevieKBEventSent)
-        {
-          xeviekb = keybd;
-          if(!rootWin) {
-	      rootWin = GetCurrentRootWindow(keybd)->drawable.id;
-          }
-          xE->u.keyButtonPointer.event = xeviewin->drawable.id;
-          xE->u.keyButtonPointer.root = rootWin;
-          xE->u.keyButtonPointer.child = (xeviewin->firstChild) ? xeviewin->firstChild->
-drawable.id:0;
-          xE->u.keyButtonPointer.rootX = xeviehot.x;
-          xE->u.keyButtonPointer.rootY = xeviehot.y;
-          xE->u.keyButtonPointer.state = keyc->state;
-          WriteToClient(clients[xevieClientIndex], sizeof(xEvent), (char *)xE);
-#ifdef XKB
-          if(noXkbExtension)
-#endif
-            return;
-        } else {
-	    xevieKBEventSent = 0;
-        }
-      }
-    }
-#endif
 
     if (xE->u.u.type & EXTENSION_EVENT_BASE)
         grabinfo = &keybd->deviceGrab;
@@ -3871,15 +3790,6 @@ drawable.id:0;
 	    CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
 	}
     }
-#ifdef XEVIE
-    /* fix for bug5094030: don't change the state bit if the event is from XEvIE client */
-    if(!(!xeviegrabState && xevieFlag && clients[xevieClientIndex] &&
-	 (xevieMask & xevieFilters[xE->u.u.type]
-#ifdef XKB
-	  && !noXkbExtension
-#endif
-    )))
-#endif
     /* ProcessOtherEvent already updated the keyboard's state, so we need to
      * access prev_state here! */
     XE_KBPTR.state = (keyc->prev_state | GetPairedDevice(keybd)->button->state);
@@ -3889,16 +3799,6 @@ drawable.id:0;
     kptr = &keyc->down[key >> 3];
     bit = 1 << (key & 7);
     modifiers = keyc->modifierMap[key];
-#if defined(XKB) && defined(XEVIE)
-    if(!noXkbExtension && !xeviegrabState &&
-       xevieFlag && clients[xevieClientIndex] &&
-       (xevieMask & xevieFilters[xE->u.u.type])) {
-	switch(xE->u.u.type) {
-	  case KeyPress: *kptr &= ~bit; break;
-	  case KeyRelease: *kptr |= bit; break;
-	}
-    }
-#endif
 
     switch (xE->u.u.type)
     {
@@ -3996,18 +3896,6 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
 #ifdef XKB
     XkbSrvInfoPtr xkbi= GetPairedDevice(mouse)->key->xkbInfo;
 #endif
-#ifdef XEVIE
-    if(xevieFlag && clients[xevieClientIndex] && !xeviegrabState &&
-       (xevieMask & xevieFilters[xE->u.u.type])) {
-      if(xevieEventSent)
-        xevieEventSent = 0;
-      else {
-        xeviemouse = mouse;
-        WriteToClient(clients[xevieClientIndex], sizeof(xEvent), (char *)xE);
-        return;
-      }
-    }
-#endif
 
     if (!syncEvents.playingEvents)
 	NoticeTime(xE)
@@ -5454,10 +5342,6 @@ InitEvents(void)
         memcpy(&filters[i], filters[0], sizeof(filters[0]));
     }
 
-#ifdef XEVIE
-    xeviewin = NULL;
-#endif
-
     syncEvents.replayDev = (DeviceIntPtr)NULL;
     syncEvents.replayWin = NullWindow;
     while (syncEvents.pending)
diff --git a/dix/protocol.txt b/dix/protocol.txt
index 0a85ca8..c085fde 100644
--- a/dix/protocol.txt
+++ b/dix/protocol.txt
@@ -731,11 +731,6 @@ E000 XC-APPGROUP:BadAppGroup
 R000 XC-MISC:GetVersion
 R001 XC-MISC:GetXIDRange
 R002 XC-MISC:GetXIDList
-R000 XEVIE:QueryVersion
-R001 XEVIE:Start
-R002 XEVIE:End
-R003 XEVIE:Send
-R004 XEVIE:SelectInput
 R000 XFIXES:QueryVersion
 R001 XFIXES:ChangeSaveSet
 R002 XFIXES:SelectSelectionInput
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index 190626e..19b93c5 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -193,10 +193,6 @@ _X_HIDDEN void *dixLookupTab[] = {
     SYMFUNC(CheckExtension)
     SYMFUNC(MinorOpcodeOfRequest)
     SYMFUNC(StandardMinorOpcode)
-#ifdef XEVIE
-    SYMVAR(xeviehot)
-    SYMVAR(xeviewin)
-#endif
     /* gc.c */
     SYMFUNC(CopyGC)
     SYMFUNC(CreateGC)
@@ -358,9 +354,6 @@ _X_HIDDEN void *dixLookupTab[] = {
 #ifdef RES
     SYMVAR(noResExtension)
 #endif
-#ifdef XEVIE
-    SYMVAR(noXevieExtension)
-#endif
 #ifdef XF86BIGFONT
     SYMVAR(noXFree86BigfontExtension)
 #endif
diff --git a/include/cursorstr.h b/include/cursorstr.h
index bca3596..3ff56e2 100644
--- a/include/cursorstr.h
+++ b/include/cursorstr.h
@@ -92,7 +92,4 @@ typedef struct {
     ScreenPtr  pScreen;
 } HotSpot;
 
-#ifdef XEVIE
-extern HotSpot xeviehot;
-#endif
 #endif /* CURSORSTRUCT_H */
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 954a428..cfaea30 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -303,9 +303,6 @@
 /* Support Xdmcp */
 #undef XDMCP
 
-/* Build XEvIE extension */
-#undef XEVIE
-
 /* Build XFree86 BigFont extension */
 #undef XF86BIGFONT
 
diff --git a/include/globals.h b/include/globals.h
index 68ea2cb..c3d2dcf 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -94,10 +94,6 @@ extern Bool noSecurityExtension;
 extern Bool noResExtension;
 #endif
 
-#ifdef XEVIE
-extern Bool noXevieExtension;
-#endif
-
 #ifdef XF86BIGFONT
 extern Bool noXFree86BigfontExtension;
 #endif
diff --git a/include/windowstr.h b/include/windowstr.h
index 9bdcadd..3beb01c 100644
--- a/include/windowstr.h
+++ b/include/windowstr.h
@@ -257,8 +257,4 @@ typedef struct _FocusSemaphores {
     char                focusinout[(MAXDEVICES + 7)/8];
 } FocusSemaphoresRec, *FocusSemaphoresPtr;
 
-#ifdef XEVIE
-extern WindowPtr xeviewin;
-#endif
-
 #endif /* WINDOWSTRUCT_H */
diff --git a/mi/miinitext.c b/mi/miinitext.c
index bfcb10d..753abc1 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -119,9 +119,6 @@ extern Bool noSecurityExtension;
 #ifdef RES
 extern Bool noResExtension;
 #endif
-#ifdef XEVIE
-extern Bool noXevieExtension;
-#endif
 #ifdef XF86BIGFONT
 extern Bool noXFree86BigfontExtension;
 #endif
@@ -265,9 +262,6 @@ extern void ResExtensionInit(INITARGS);
 #ifdef DMXEXT
 extern void DMXExtensionInit(INITARGS);
 #endif
-#ifdef XEVIE
-extern void XevieExtensionInit(INITARGS);
-#endif
 #ifdef XFIXES
 extern void XFixesExtensionInit(INITARGS);
 #endif
@@ -327,9 +321,6 @@ static ExtensionToggle ExtensionToggleList[] =
 #ifdef RES
     { "X-Resource", &noResExtension },
 #endif
-#ifdef XEVIE
-    { "XEVIE", &noXevieExtension },
-#endif
 #ifdef XF86BIGFONT
     { "XFree86-Bigfont", &noXFree86BigfontExtension },
 #endif
@@ -474,9 +465,6 @@ InitExtensions(int argc, char *argv[])
 #ifdef DMXEXT
     DMXExtensionInit(); /* server-specific extension, cannot be disabled */
 #endif
-#ifdef XEVIE
-    if (!noXevieExtension) XevieExtensionInit();
-#endif
 #ifdef COMPOSITE
     if (!noCompositeExtension) CompositeExtensionInit();
 #endif
@@ -533,9 +521,6 @@ static ExtensionModule staticExtensions[] = {
 #ifdef DAMAGE
     { DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL },
 #endif
-#ifdef XEVIE
-    { XevieExtensionInit, "XEVIE", &noXevieExtension, NULL },
-#endif 
     { NULL, NULL, NULL, NULL, NULL }
 };
     
diff --git a/os/utils.c b/os/utils.c
index b936d4c..f0bb717 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -160,11 +160,6 @@ _X_EXPORT Bool noSecurityExtension = FALSE;
 #ifdef RES
 _X_EXPORT Bool noResExtension = FALSE;
 #endif
-#ifdef XEVIE
-/* Xevie is disabled by default for now until the
- * interface is stable */
-_X_EXPORT Bool noXevieExtension = TRUE;
-#endif
 #ifdef XF86BIGFONT
 _X_EXPORT Bool noXFree86BigfontExtension = FALSE;
 #endif
commit 8c3753a0b711b5708b61f64ab4010ca01608d679
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Wed Oct 22 22:29:54 2008 +1030

    A bit of whitespace cleanup in include directives.
    
    It's #include <foo>, not # include <foo>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>

diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index d3a7807..f2b7e93 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -64,7 +64,7 @@
 #include "xf86_OSproc.h"
 #include "xf86Parser.h"
 #include "xf86Config.h"
-# include "xf86Xinput.h"
+#include "xf86Xinput.h"
 #ifdef XV
 #include "xf86xv.h"
 #include "xf86xvmc.h"
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 9e4da61..0dd1279 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -46,10 +46,10 @@
 #include "globals.h"
 #include "dix.h"
 
-# include <X11/extensions/XI.h>
-# include <X11/extensions/XIproto.h>
-# include "exevents.h"
-# include "extinit.h"
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "exevents.h"
+#include "extinit.h"
 
 #include <sys/types.h>
 #include <sys/time.h>
commit 889a8dc02bbd3926eaf16dce8f844dc58558e982
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Wed Oct 22 22:29:54 2008 +1030

    Xi: XINPUT has been mandatory for ages
    
    Ditch all #ifdef XINPUT, since it's always built.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index babe45b..d6ef93a 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -68,12 +68,9 @@
 #include "dgaproc.h"
 #endif
 
-#ifdef XINPUT
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
-#else
 #include "inputstr.h"
-#endif
 #include "xf86Xinput.h"
 
 #include "mi.h"
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index 683c166..190626e 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -383,9 +383,6 @@ _X_HIDDEN void *dixLookupTab[] = {
 #ifdef PANORAMIX
     SYMVAR(noPanoramiXExtension)
 #endif
-
-    SYMVAR(noXInputExtension)
-
 #ifdef XSELINUX
     SYMVAR(noSELinuxExtension)
 #endif
diff --git a/include/globals.h b/include/globals.h
index 63e998a..68ea2cb 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -127,9 +127,6 @@ extern Bool noXkbExtension;
 extern Bool noPanoramiXExtension;
 #endif
 
-extern Bool noXInputExtension;
-
-
 #ifdef XSELINUX
 extern Bool noSELinuxExtension;
 
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 3a943b3..bfcb10d 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -147,7 +147,6 @@ extern Bool noPanoramiXExtension;
 #ifdef INXQUARTZ
 extern Bool noPseudoramiXExtension;
 #endif
-extern Bool noXInputExtension;
 #ifdef XSELINUX
 extern Bool noSELinuxExtension;
 #endif
@@ -349,7 +348,7 @@ static ExtensionToggle ExtensionToggleList[] =
 #ifdef PANORAMIX
     { "XINERAMA", &noPanoramiXExtension },
 #endif
-    { "XInputExtension", &noXInputExtension },
+    { "XInputExtension", NULL },
 #ifdef XKB
     { "XKEYBOARD", &noXkbExtension },
 #endif
@@ -411,7 +410,7 @@ InitExtensions(int argc, char *argv[])
 #ifdef MULTIBUFFER
     if (!noMultibufferExtension) MultibufferExtensionInit();
 #endif
-    if (!noXInputExtension) XInputExtensionInit();
+    XInputExtensionInit();
 #ifdef XTEST
     if (!noTestExtensions) XTestExtensionInit();
 #endif
@@ -499,7 +498,7 @@ static ExtensionModule staticExtensions[] = {
 #ifdef MITSHM
     { ShmExtensionInit, SHMNAME, &noMITShmExtension, NULL, NULL },
 #endif
-    { XInputExtensionInit, "XInputExtension", &noXInputExtension, NULL, NULL },
+    { XInputExtensionInit, "XInputExtension", NULL, NULL, NULL },
 #ifdef XTEST
     { XTestExtensionInit, XTestExtensionName, &noTestExtensions, NULL, NULL },
 #endif
diff --git a/os/utils.c b/os/utils.c
index b5dcd65..b936d4c 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -185,7 +185,6 @@ _X_EXPORT Bool noXFixesExtension = FALSE;
 /* Xinerama is disabled by default unless enabled via +xinerama */
 _X_EXPORT Bool noPanoramiXExtension = TRUE;
 #endif
-_X_EXPORT Bool noXInputExtension = FALSE;
 #ifdef XSELINUX
 _X_EXPORT Bool noSELinuxExtension = FALSE;
 _X_EXPORT int selinuxEnforcingState = SELINUX_MODE_DEFAULT;


More information about the xorg-commit mailing list