diff --git a/Xext/xtest.c b/Xext/xtest.c
index 8fb5809272dccef6d6d5a06592b7e53c97c22ad2..b451e41cd513909f46ba6a3d9596f078845a936c 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -38,6 +38,7 @@
 #include <X11/extensions/XIproto.h>
 
 #include "dix/dix_priv.h"
+#include "dix/exevents_priv.h"
 #include "os/osdep.h"
 
 #include "misc.h"
@@ -55,7 +56,6 @@
 #include "exglobals.h"
 #include "mipointer.h"
 #include "xserver-properties.h"
-#include "exevents.h"
 #include "eventstr.h"
 #include "inpututils.h"
 #include "extinit_priv.h"
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index a778fa38010a2807b851c2d659beda47beef6a7f..a6325a1c6ddc3609d5653e8f47ac63f8be510659 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -54,14 +54,14 @@ SOFTWARE.
 #include <dix-config.h>
 #endif
 
-#include "inputstr.h"           /* DeviceIntPtr      */
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>     /* control constants */
-#include "XIstubs.h"
 
-#include "exglobals.h"
-#include "exevents.h"
+#include "dix/exevents_priv.h"
 
+#include "inputstr.h"           /* DeviceIntPtr      */
+#include "XIstubs.h"
+#include "exglobals.h"
 #include "chgdctl.h"
 
 /***********************************************************************
diff --git a/Xi/chgkmap.c b/Xi/chgkmap.c
index befe6e7ae7b99e9db14091a7f2a75036dc07d2d1..2940a2cb0e03bed8cd51043e7ba03705126dd7f7 100644
--- a/Xi/chgkmap.c
+++ b/Xi/chgkmap.c
@@ -54,10 +54,12 @@ SOFTWARE.
 #include <dix-config.h>
 #endif
 
-#include "inputstr.h"           /* DeviceIntPtr      */
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
-#include "exevents.h"
+
+#include "dix/exevents_priv.h"
+
+#include "inputstr.h"           /* DeviceIntPtr      */
 #include "exglobals.h"
 
 #include "chgkmap.h"
diff --git a/Xi/chgprop.c b/Xi/chgprop.c
index 892ac4a23429b58ccc000690d0716559a804922f..a97fab18dfab97fcc5ad2f46ed339b56c511eb8d 100644
--- a/Xi/chgprop.c
+++ b/Xi/chgprop.c
@@ -58,6 +58,7 @@ SOFTWARE.
 #include <X11/extensions/XIproto.h>
 
 #include "dix/dix_priv.h"
+#include "dix/exevents_priv.h"
 
 #include "inputstr.h"           /* DeviceIntPtr      */
 #include "windowstr.h"
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 7ef0f2df627136184b7277333c457c2dfe31ed88..61de1dfdae9e26d0aec7b7593b601f8d8485cae6 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -84,20 +84,20 @@ SOFTWARE.
 
 #include <X11/X.h>
 #include <X11/Xproto.h>
+#include <X11/extensions/geproto.h>
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
 #include <X11/extensions/XI2proto.h>
-#include <X11/extensions/geproto.h>
 #include <X11/extensions/XKBproto.h>
 
 #include "dix/dix_priv.h"
 #include "dix/eventconvert.h"
+#include "dix/exevents_priv.h"
 
 #include "inputstr.h"
 #include "windowstr.h"
 #include "miscstruct.h"
 #include "region.h"
-#include "exevents.h"
 #include "extnsionst.h"
 #include "exglobals.h"
 #include "eventstr.h"
diff --git a/Xi/extinit.c b/Xi/extinit.c
index e99da9ce690b79110c264b3a07364324e4e658b5..6354ad0594ac098763dcb0f3daaf0bd026bb4f83 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -61,13 +61,13 @@ SOFTWARE.
 #include <X11/extensions/geproto.h>
 
 #include "dix/dix_priv.h"
+#include "dix/exevents_priv.h"
 
 #include "inputstr.h"
 #include "gcstruct.h"           /* pointer for extnsionst.h */
 #include "extnsionst.h"         /* extension entry   */
 #include "geext.h"              /* extension interfaces for ge */
 #include "dixevents.h"
-#include "exevents.h"
 #include "extinit_priv.h"
 #include "exglobals.h"
 #include "swaprep.h"
diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c
index a2f7eb395f36f806a5e385ccb331cc5b9747d7c1..6b54dd425fc72c22c2d7d29fa4e617011a846f6a 100644
--- a/Xi/grabdevb.c
+++ b/Xi/grabdevb.c
@@ -54,14 +54,15 @@ SOFTWARE.
 #include <dix-config.h>
 #endif
 
-#include "inputstr.h"           /* DeviceIntPtr      */
-#include "windowstr.h"          /* window structure  */
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
-#include "exevents.h"
+
+#include "dix/exevents_priv.h"
+
+#include "inputstr.h"           /* DeviceIntPtr      */
+#include "windowstr.h"          /* window structure  */
 #include "exglobals.h"
 #include "xace.h"
-
 #include "grabdev.h"
 #include "grabdevb.h"
 
diff --git a/Xi/grabdevk.c b/Xi/grabdevk.c
index e856fa82c7f4fb88f2b52e3a3614d3f00840cc73..f63de62d3a1b993535504b9cc41e4ac8475f3376 100644
--- a/Xi/grabdevk.c
+++ b/Xi/grabdevk.c
@@ -54,14 +54,15 @@ SOFTWARE.
 #include <dix-config.h>
 #endif
 
-#include "inputstr.h"           /* DeviceIntPtr      */
-#include "windowstr.h"          /* window structure  */
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
-#include "exevents.h"
+
+#include "dix/exevents_priv.h"
+
+#include "inputstr.h"           /* DeviceIntPtr      */
+#include "windowstr.h"          /* window structure  */
 #include "exglobals.h"
 #include "xace.h"
-
 #include "grabdev.h"
 #include "grabdevk.h"
 
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index 7c6684996ba4a1c9cabe39c018c1ba08013bee35..57a25bb2ea5275e385aa21b20174c445c405c38e 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -54,12 +54,13 @@ SOFTWARE.
 #include <dix-config.h>
 #endif
 
-#include "inputstr.h"           /* DeviceIntPtr      */
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
-#include "exevents.h"
-#include "exglobals.h"
 
+#include "dix/exevents_priv.h"
+
+#include "inputstr.h"           /* DeviceIntPtr      */
+#include "exglobals.h"
 #include "gtmotion.h"
 
 /***********************************************************************
diff --git a/Xi/queryst.c b/Xi/queryst.c
index 6c9d66606b3d137b7073d156d3a274e2b1d7d3f8..34bfa9031efd451f974f06f6628179096a0d2b96 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -36,15 +36,16 @@ from The Open Group.
 #include <dix-config.h>
 #endif
 
-#include "inputstr.h"           /* DeviceIntPtr      */
-#include "windowstr.h"          /* window structure  */
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
-#include "exevents.h"
+
+#include "dix/exevents_priv.h"
+
+#include "inputstr.h"           /* DeviceIntPtr      */
+#include "windowstr.h"          /* window structure  */
 #include "exglobals.h"
 #include "xkbsrv.h"
 #include "xkbstr.h"
-
 #include "queryst.h"
 
 /***********************************************************************
diff --git a/Xi/selectev.c b/Xi/selectev.c
index 6b7bdc512244e724839d0aee42fffe53ea632763..378403d3b56cd5170078a2ca61b398565ab694d1 100644
--- a/Xi/selectev.c
+++ b/Xi/selectev.c
@@ -59,12 +59,11 @@ SOFTWARE.
 #include <X11/extensions/XIproto.h>
 
 #include "dix/dix_priv.h"
+#include "dix/exevents_priv.h"
 
 #include "inputstr.h"           /* DeviceIntPtr      */
 #include "windowstr.h"          /* window structure  */
-#include "exevents.h"
 #include "exglobals.h"
-
 #include "grabdev.h"
 #include "selectev.h"
 
diff --git a/Xi/sendexev.c b/Xi/sendexev.c
index 5c2e0fc56ca9d3e7cd10554bf34c72f04d5f269b..0f6b4e46a48f2246a907f50ef0c9da5f196af78d 100644
--- a/Xi/sendexev.c
+++ b/Xi/sendexev.c
@@ -54,14 +54,15 @@ SOFTWARE.
 #include <dix-config.h>
 #endif
 
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+
+#include "dix/exevents_priv.h"
+
 #include "inputstr.h"           /* DeviceIntPtr      */
 #include "windowstr.h"          /* Window            */
 #include "extnsionst.h"         /* EventSwapPtr      */
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "exevents.h"
 #include "exglobals.h"
-
 #include "grabdev.h"
 #include "sendexev.h"
 
diff --git a/Xi/xiallowev.c b/Xi/xiallowev.c
index ab83a19e758819f74bf5978867c3997603ba9fa5..03ced79bba28ce241ead29e998d09f08b944e757 100644
--- a/Xi/xiallowev.c
+++ b/Xi/xiallowev.c
@@ -37,13 +37,13 @@
 #include <X11/extensions/XI2proto.h>
 
 #include "dix/dix_priv.h"
+#include "dix/exevents_priv.h"
 
 #include "inputstr.h"           /* DeviceIntPtr      */
 #include "windowstr.h"          /* window structure  */
 #include "mi.h"
 #include "eventstr.h"
 #include "exglobals.h"          /* BadDevice */
-#include "exevents.h"
 #include "xiallowev.h"
 
 int _X_COLD
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index e31d3332d6f35c03a3f6c30fb6a8edee552e1d76..eea917ff655ecf1ab5814998753aca22bbb5aa38 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -41,12 +41,12 @@
 #include <X11/extensions/geproto.h>
 
 #include "dix/dix_priv.h"
+#include "dix/exevents_priv.h"
 
 #include "inputstr.h"           /* DeviceIntPtr      */
 #include "windowstr.h"          /* window structure  */
 #include "scrnintstr.h"         /* screen structure  */
 #include "extnsionst.h"
-#include "exevents.h"
 #include "exglobals.h"
 #include "geext.h"
 #include "xace.h"
diff --git a/Xi/xigrabdev.c b/Xi/xigrabdev.c
index d23d58ecdb0e96b49b4f80748cfba05069de3891..604f8c926d7fec7361b46c75baf80dfee559e972 100644
--- a/Xi/xigrabdev.c
+++ b/Xi/xigrabdev.c
@@ -37,11 +37,11 @@
 #include <X11/extensions/XI2proto.h>
 
 #include "dix/dix_priv.h"
+#include "dix/exevents_priv.h"
 
 #include "inputstr.h"           /* DeviceIntPtr      */
 #include "windowstr.h"          /* window structure  */
 #include "exglobals.h"          /* BadDevice */
-#include "exevents.h"
 #include "xigrabdev.h"
 #include "inpututils.h"
 
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index 900a3e113e28e91ccc433f3d96bd02051227d6cc..78147d8dd620d0c851e7161f153bbccb5a4a0db3 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -37,12 +37,12 @@
 #include <X11/extensions/XI2proto.h>
 
 #include "dix/dix_priv.h"
+#include "dix/exevents_priv.h"
 
 #include "inputstr.h"           /* DeviceIntPtr      */
 #include "windowstr.h"          /* window structure  */
 #include "swaprep.h"
 #include "exglobals.h"          /* BadDevice */
-#include "exevents.h"
 #include "xipassivegrab.h"
 #include "dixgrabs.h"
 #include "misc.h"
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index 9c44f9d3e217314b05ada16baf9358349209d26d..aaafc629be49544bed385e620ce96085d014eeba 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -29,16 +29,17 @@
 #include <dix-config.h>
 #endif
 
-#include "dix.h"
-#include "inputstr.h"
-#include <X11/extensions/XI.h>
 #include <X11/Xatom.h>
+#include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
 #include <X11/extensions/XI2proto.h>
+
+#include "dix/exevents_priv.h"
+
+#include "dix.h"
+#include "inputstr.h"
 #include "exglobals.h"
-#include "exevents.h"
 #include "swaprep.h"
-
 #include "xiproperty.h"
 #include "xserver-properties.h"
 
diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c
index e4731a11981df15a913a5af776a1a15b40a9e5b5..c9a9864bc4212a56b62f9dbf4b7e1203383b6f7f 100644
--- a/Xi/xiquerydevice.c
+++ b/Xi/xiquerydevice.c
@@ -32,20 +32,20 @@
 #include <dix-config.h>
 #endif
 
-#include "inputstr.h"
 #include <X11/X.h>
 #include <X11/Xatom.h>
 #include <X11/extensions/XI2proto.h>
+
+#include "dix/exevents_priv.h"
+
+#include "inputstr.h"
 #include "xkbstr.h"
 #include "xkbsrv.h"
 #include "xserver-properties.h"
-#include "exevents.h"
 #include "xace.h"
 #include "inpututils.h"
-
 #include "exglobals.h"
 #include "privates.h"
-
 #include "xiquerydevice.h"
 
 static Bool ShouldSkipDevice(ClientPtr client, int deviceid, DeviceIntPtr d);
diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
index 7da45fdc212a49c191e4c2b640d8111240cae84c..2ac3e73a009e5c7ddcf825aafa99d4131a9e6c68 100644
--- a/Xi/xiquerypointer.c
+++ b/Xi/xiquerypointer.c
@@ -40,11 +40,11 @@
 
 #include "dix/dix_priv.h"
 #include "dix/eventconvert.h"
+#include "dix/exevents_priv.h"
 
 #include "inputstr.h"           /* DeviceIntPtr      */
 #include "windowstr.h"          /* window structure  */
 #include "extnsionst.h"
-#include "exevents.h"
 #include "exglobals.h"
 #include "scrnintstr.h"
 #include "xkbsrv.h"
diff --git a/Xi/xiqueryversion.c b/Xi/xiqueryversion.c
index 111f1d61a8900c1be417206227dd895373ed3e2a..dc3860a21bd900eaa2c07a842050f7c3dabbcd5c 100644
--- a/Xi/xiqueryversion.c
+++ b/Xi/xiqueryversion.c
@@ -39,8 +39,9 @@
 #include <X11/X.h>
 #include <X11/extensions/XI2proto.h>
 
+#include "dix/exevents_priv.h"
+
 #include "exglobals.h"
-#include "exevents.h"
 #include "xiqueryversion.h"
 #include "misc.h"
 
diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c
index 4d025b6e0406ccdfc76478dc162843a0620c835b..6c6aff8843142cc9406b188ce711742fedbba0dc 100644
--- a/Xi/xiselectev.c
+++ b/Xi/xiselectev.c
@@ -30,11 +30,11 @@
 #include <X11/extensions/XI2proto.h>
 
 #include "dix/dix_priv.h"
+#include "dix/exevents_priv.h"
 
 #include "dixstruct.h"
 #include "windowstr.h"
 #include "exglobals.h"
-#include "exevents.h"
 #include "inpututils.h"
 #include "xiselectev.h"
 
diff --git a/dix/devices.c b/dix/devices.c
index 4d8974b679552b34d173fef76e38935af1b038ad..73402e091d2550c6db83d3420d1b2a2ac743cb82 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -58,6 +58,7 @@ SOFTWARE.
 #include <X11/extensions/XIproto.h>
 
 #include "dix/dix_priv.h"
+#include "dix/exevents_priv.h"
 #include "dix/ptrveloc_priv.h"
 #include "xkb/xkbsrv_priv.h"
 
@@ -79,7 +80,6 @@ SOFTWARE.
 #include "eventstr.h"
 #include "dixgrabs.h"
 #include "exglobals.h"
-#include "exevents.h"
 #include "xiquerydevice.h"      /* for SizeDeviceClasses */
 #include "xiproperty.h"
 #include "enterleave.h"         /* for EnterWindow() */
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 998304ad9195eef0559251ec40832f4e40a6bcb7..a7f43efe6b2aa7ebce85e09f71c16e0727ed4fe4 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -41,12 +41,12 @@
 
 #include "dix/dix_priv.h"
 #include "dix/eventconvert.h"
+#include "dix/exevents_priv.h"
 
 #include "dix.h"
 #include "inputstr.h"
 #include "misc.h"
 #include "eventstr.h"
-#include "exevents.h"
 #include "exglobals.h"
 #include "inpututils.h"
 #include "xiquerydevice.h"
diff --git a/dix/events.c b/dix/events.c
index 00ada334093dc7ab7b4fdc9f68daadf667db0f3e..361a1c2987b300afd8587cf7816192c4da98e5b7 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -116,6 +116,7 @@ Equipment Corporation.
 
 #include "dix/dix_priv.h"
 #include "dix/eventconvert.h"
+#include "dix/exevents_priv.h"
 #include "xkb/xkbsrv_priv.h"
 
 #include "misc.h"
@@ -134,7 +135,6 @@ Equipment Corporation.
 #include "xace.h"
 #include "probes.h"
 #include "exglobals.h"
-#include "exevents.h"
 #include "extnsionst.h"
 #include "dixevents.h"
 #include "dixgrabs.h"
diff --git a/dix/exevents_priv.h b/dix/exevents_priv.h
new file mode 100644
index 0000000000000000000000000000000000000000..b9e397987933ff6e957ebf5847bd0a44fea4c68f
--- /dev/null
+++ b/dix/exevents_priv.h
@@ -0,0 +1,158 @@
+/* SPDX-License-Identifier: MIT OR X11
+ *
+ * Copyright © 1996 Thomas E. Dickey <dickey@clark.net>
+ * Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
+ */
+#ifndef _XSERVER_EXEVENTS_PRIV_H
+#define _XSERVER_EXEVENTS_PRIV_H
+
+#include <X11/extensions/XIproto.h>
+#include "exevents.h"
+
+/**
+ * Attached to the devPrivates of each client. Specifies the version number as
+ * supported by the client.
+ */
+typedef struct _XIClientRec {
+    int major_version;
+    int minor_version;
+} XIClientRec, *XIClientPtr;
+
+typedef struct _GrabParameters {
+    int grabtype;               /* CORE, etc. */
+    unsigned int ownerEvents;
+    unsigned int this_device_mode;
+    unsigned int other_devices_mode;
+    Window grabWindow;
+    Window confineTo;
+    Cursor cursor;
+    unsigned int modifiers;
+} GrabParameters;
+
+int UpdateDeviceState(DeviceIntPtr device, DeviceEvent *xE);
+
+void ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr other);
+
+int CheckGrabValues(ClientPtr client, GrabParameters *param);
+
+int GrabButton(ClientPtr client,
+               DeviceIntPtr dev,
+               DeviceIntPtr modifier_device,
+               int button,
+               GrabParameters *param,
+               enum InputLevel grabtype,
+               GrabMask *eventMask);
+
+int GrabKey(ClientPtr client,
+            DeviceIntPtr dev,
+            DeviceIntPtr modifier_device,
+            int key,
+            GrabParameters *param,
+            enum InputLevel grabtype,
+            GrabMask *eventMask);
+
+int GrabWindow(ClientPtr client,
+               DeviceIntPtr dev,
+               int type,
+               GrabParameters *param,
+               GrabMask *eventMask);
+
+int GrabTouchOrGesture(ClientPtr client,
+                       DeviceIntPtr dev,
+                       DeviceIntPtr mod_dev,
+                       int type,
+                       GrabParameters *param,
+                       GrabMask *eventMask);
+
+int SelectForWindow(DeviceIntPtr dev,
+                    WindowPtr pWin,
+                    ClientPtr client,
+                    Mask mask,
+                    Mask exclusivemasks);
+
+int AddExtensionClient(WindowPtr pWin,
+                       ClientPtr client,
+                       Mask mask,
+                       int mskidx);
+
+void RecalculateDeviceDeliverableEvents(WindowPtr pWin);
+
+int InputClientGone(WindowPtr pWin, XID id);
+
+void WindowGone(WindowPtr win);
+
+int SendEvent(ClientPtr client,
+              DeviceIntPtr d,
+              Window dest,
+              Bool propagate,
+              xEvent *ev,
+              Mask mask ,
+              int count);
+
+int SetButtonMapping(ClientPtr client,
+                     DeviceIntPtr dev,
+                     int nElts,
+                     BYTE *map);
+
+int ChangeKeyMapping(ClientPtr client,
+                     DeviceIntPtr dev,
+                     unsigned len,
+                     int type,
+                     KeyCode firstKeyCode,
+                     CARD8 keyCodes,
+                     CARD8 keySymsPerKeyCode,
+                     KeySym *map);
+
+void DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources);
+
+int MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer *pEvents, Mask mask);
+
+void CheckDeviceGrabAndHintWindow(WindowPtr pWin,
+                                  int type,
+                                  deviceKeyButtonPointer *xE,
+                                  GrabPtr grab,
+                                  ClientPtr client,
+                                  Mask deliveryMask);
+
+void MaybeStopDeviceHint(DeviceIntPtr dev, ClientPtr client);
+
+int DeviceEventSuppressForWindow(WindowPtr pWin,
+                                 ClientPtr client,
+                                 Mask mask,
+                                 int maskndx);
+
+void SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent *ev, int count);
+
+void TouchRejected(DeviceIntPtr sourcedev,
+                   TouchPointInfoPtr ti,
+                   XID resource,
+                   TouchOwnershipEvent *ev);
+
+_X_HIDDEN void XI2EventSwap(xGenericEvent *from, xGenericEvent *to);
+
+/* For an event such as MappingNotify which affects client interpretation
+ * of input events sent by device dev, should we notify the client, or
+ * would it merely be irrelevant and confusing? */
+int XIShouldNotify(ClientPtr client,
+                   DeviceIntPtr dev);
+
+void XISendDeviceChangedEvent(DeviceIntPtr device,
+                              DeviceChangedEvent *dce);
+
+int XISetEventMask(DeviceIntPtr dev,
+                   WindowPtr win,
+                   ClientPtr client,
+                   unsigned int len,
+                   unsigned char *mask);
+
+int  XICheckInvalidMaskBits(ClientPtr client,
+                            unsigned char *mask,
+                            int len);
+
+void XTestDeviceSendEvents(DeviceIntPtr dev,
+                           int type,
+                           int detail,
+                           int flags,
+                           const ValuatorMask *mask);
+
+#endif /* _XSERVER_EXEVENTS_PRIV_H */
diff --git a/dix/grabs.c b/dix/grabs.c
index bc8fd69bbb4ba0c389fb4f9f9164ab3910af1b9f..d6017bef20a6483835d45c5df1d1c4080efea314 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -50,19 +50,19 @@ SOFTWARE.
 #endif
 
 #include <X11/X.h>
-#include "misc.h"
 #include <X11/Xproto.h>
 #include <X11/extensions/XI2.h>
 
 #include "dix/dix_priv.h"
+#include "dix/exevents_priv.h"
 #include "os/auth.h"
 
+#include "misc.h"
 #include "windowstr.h"
 #include "inputstr.h"
 #include "cursorstr.h"
 #include "dixgrabs.h"
 #include "xace.h"
-#include "exevents.h"
 #include "exglobals.h"
 #include "inpututils.h"
 #include "client.h"
diff --git a/dix/inpututils.c b/dix/inpututils.c
index 9026f651b54fd636550bd0322a11a3af54e0bbfc..240d0ff8aca2b72a488973f799009b406c3549bc 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -27,7 +27,8 @@
 #include "dix-config.h"
 #endif
 
-#include "exevents.h"
+#include "dix/exevents_priv.h"
+
 #include "exglobals.h"
 #include "misc.h"
 #include "input.h"
diff --git a/dix/touch.c b/dix/touch.c
index a2d65eee6503c691e0bb880c9f5c8b527eba07ae..ef5dd4ae342fbf3c832dfb5c692785d6ee0b20f3 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -30,13 +30,12 @@
 
 #include "dix/dix_priv.h"
 #include "dix/eventconvert.h"
+#include "dix/exevents_priv.h"
 
 #include "inputstr.h"
 #include "scrnintstr.h"
 #include "dixgrabs.h"
-
 #include "eventstr.h"
-#include "exevents.h"
 #include "exglobals.h"
 #include "inpututils.h"
 #include "windowstr.h"
diff --git a/dix/window.c b/dix/window.c
index d30aff35028990e13f55d326b34b734c80991b4e..3534ff19bc7388257636157239353ff07782a5f6 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -101,6 +101,7 @@ Equipment Corporation.
 #endif
 
 #include "dix/dix_priv.h"
+#include "dix/exevents_priv.h"
 #include "os/auth.h"
 
 #include "misc.h"
@@ -131,10 +132,8 @@ Equipment Corporation.
 #endif
 #include "selection.h"
 #include "inpututils.h"
-
 #include "privates.h"
 #include "xace.h"
-#include "exevents.h"
 
 #include <X11/Xatom.h>          /* must come after server includes */
 
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 97769c0b8a3b586595336bf89bd5cdd1456bba5e..614c35ae46ee06d5c05de8f00b1e41a018d61774 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -48,6 +48,7 @@
 
 #include "dix/dix_priv.h"
 #include "dix/eventconvert.h"
+#include "dix/exevents_priv.h"
 
 #include "xf86.h"
 #include "xf86str.h"
@@ -63,7 +64,6 @@
 #include "xkbsrv.h"
 #include "xf86Xinput.h"
 #include "exglobals.h"
-#include "exevents.h"
 #include "eventstr.h"
 #include "xf86Extensions.h"
 #include "mi.h"
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 9ad0cc66fdd159dd1de0409c47ecdddd59a3e43a..da7e80e888e034ae0352f8722ee0c0d5e4f265e9 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -30,9 +30,9 @@
 #include <sys/mman.h>
 
 #include "dix/dix_priv.h"
+#include "dix/exevents_priv.h"
 
 #include <inputstr.h>
-#include <exevents.h>
 #include <xkbsrv.h>
 #include <xserver-properties.h>
 #include <inpututils.h>
diff --git a/include/exevents.h b/include/exevents.h
index 7e3029fc9f37952d82b555cac3fda1a2001b2a65..50a777a333e8ff5bc6861e914b343db355a68ada 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -134,182 +134,4 @@ extern _X_EXPORT int XIPropToFloat(XIPropertyValuePtr val,
  *                      End of driver interface                             *
  ****************************************************************************/
 
-/**
- * Attached to the devPrivates of each client. Specifies the version number as
- * supported by the client.
- */
-typedef struct _XIClientRec {
-    int major_version;
-    int minor_version;
-} XIClientRec, *XIClientPtr;
-
-typedef struct _GrabParameters {
-    int grabtype;               /* CORE, etc. */
-    unsigned int ownerEvents;
-    unsigned int this_device_mode;
-    unsigned int other_devices_mode;
-    Window grabWindow;
-    Window confineTo;
-    Cursor cursor;
-    unsigned int modifiers;
-} GrabParameters;
-
-extern int
- UpdateDeviceState(DeviceIntPtr /* device */ ,
-                   DeviceEvent * /*  xE    */ );
-
-extern void
- ProcessOtherEvent(InternalEvent * /* ev */ ,
-                   DeviceIntPtr /* other */ );
-
-extern int
- CheckGrabValues(ClientPtr /* client */ ,
-                 GrabParameters * /* param */ );
-
-extern int
- GrabButton(ClientPtr /* client */ ,
-            DeviceIntPtr /* dev */ ,
-            DeviceIntPtr /* modifier_device */ ,
-            int /* button */ ,
-            GrabParameters * /* param */ ,
-            enum InputLevel /* grabtype */ ,
-            GrabMask * /* eventMask */ );
-
-extern int
- GrabKey(ClientPtr /* client */ ,
-         DeviceIntPtr /* dev */ ,
-         DeviceIntPtr /* modifier_device */ ,
-         int /* key */ ,
-         GrabParameters * /* param */ ,
-         enum InputLevel /* grabtype */ ,
-         GrabMask * /* eventMask */ );
-
-extern int
- GrabWindow(ClientPtr /* client */ ,
-            DeviceIntPtr /* dev */ ,
-            int /* type */ ,
-            GrabParameters * /* param */ ,
-            GrabMask * /* eventMask */ );
-
-extern int
- GrabTouchOrGesture(ClientPtr /* client */ ,
-                    DeviceIntPtr /* dev */ ,
-                    DeviceIntPtr /* mod_dev */ ,
-                    int /* type */ ,
-                    GrabParameters * /* param */ ,
-                    GrabMask * /* eventMask */ );
-
-extern int
- SelectForWindow(DeviceIntPtr /* dev */ ,
-                 WindowPtr /* pWin */ ,
-                 ClientPtr /* client */ ,
-                 Mask /* mask */ ,
-                 Mask /* exclusivemasks */ );
-
-extern int
- AddExtensionClient(WindowPtr /* pWin */ ,
-                    ClientPtr /* client */ ,
-                    Mask /* mask */ ,
-                    int /* mskidx */ );
-
-extern void
- RecalculateDeviceDeliverableEvents(WindowPtr /* pWin */ );
-
-extern int
- InputClientGone(WindowPtr /* pWin */ ,
-                 XID /* id */ );
-
-extern void
- WindowGone(WindowPtr /* win */ );
-
-extern int
- SendEvent(ClientPtr /* client */ ,
-           DeviceIntPtr /* d */ ,
-           Window /* dest */ ,
-           Bool /* propagate */ ,
-           xEvent * /* ev */ ,
-           Mask /* mask */ ,
-           int /* count */ );
-
-extern int
- SetButtonMapping(ClientPtr /* client */ ,
-                  DeviceIntPtr /* dev */ ,
-                  int /* nElts */ ,
-                  BYTE * /* map */ );
-
-extern int
- ChangeKeyMapping(ClientPtr /* client */ ,
-                  DeviceIntPtr /* dev */ ,
-                  unsigned /* len */ ,
-                  int /* type */ ,
-                  KeyCode /* firstKeyCode */ ,
-                  CARD8 /* keyCodes */ ,
-                  CARD8 /* keySymsPerKeyCode */ ,
-                  KeySym * /* map */ );
-
-extern void
- DeleteWindowFromAnyExtEvents(WindowPtr /* pWin */ ,
-                              Bool /* freeResources */ );
-
-extern int
- MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * /* pEvents */ ,
-                                 Mask /* mask */ );
-
-extern void
- CheckDeviceGrabAndHintWindow(WindowPtr /* pWin */ ,
-                              int /* type */ ,
-                              deviceKeyButtonPointer * /* xE */ ,
-                              GrabPtr /* grab */ ,
-                              ClientPtr /* client */ ,
-                              Mask /* deliveryMask */ );
-
-extern void
- MaybeStopDeviceHint(DeviceIntPtr /* dev */ ,
-                     ClientPtr /* client */ );
-
-extern int
- DeviceEventSuppressForWindow(WindowPtr /* pWin */ ,
-                              ClientPtr /* client */ ,
-                              Mask /* mask */ ,
-                              int /* maskndx */ );
-
-extern void
- SendEventToAllWindows(DeviceIntPtr /* dev */ ,
-                       Mask /* mask */ ,
-                       xEvent * /* ev */ ,
-                       int /* count */ );
-
-extern void
- TouchRejected(DeviceIntPtr /* sourcedev */ ,
-               TouchPointInfoPtr /* ti */ ,
-               XID /* resource */ ,
-               TouchOwnershipEvent * /* ev */ );
-
-extern _X_HIDDEN void XI2EventSwap(xGenericEvent * /* from */ ,
-                                   xGenericEvent * /* to */ );
-
-/* For an event such as MappingNotify which affects client interpretation
- * of input events sent by device dev, should we notify the client, or
- * would it merely be irrelevant and confusing? */
-extern int
- XIShouldNotify(ClientPtr client, DeviceIntPtr dev);
-
-extern void
- XISendDeviceChangedEvent(DeviceIntPtr device, DeviceChangedEvent *dce);
-
-extern int
-
-XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
-               unsigned int len, unsigned char *mask);
-
-extern int
- XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len);
-
-void
-XTestDeviceSendEvents(DeviceIntPtr dev,
-                      int type,
-                      int detail,
-                      int flags,
-                      const ValuatorMask *mask);
-
 #endif                          /* EXEVENTS_H */
diff --git a/test/input.c b/test/input.c
index 945680001c45f9f6f2211057fa7d561157661b5e..b0de203316d63261efdd4aeccc611659028d819b 100644
--- a/test/input.c
+++ b/test/input.c
@@ -30,18 +30,18 @@
 
 #include <stdint.h>
 #include <X11/X.h>
-#include "misc.h"
-#include "resource.h"
 #include <X11/Xproto.h>
 #include <X11/extensions/XI2proto.h>
 #include <X11/Xatom.h>
-#include "windowstr.h"
-#include "inputstr.h"
-#include "exevents.h"
 
 #include "dix/dix_priv.h"
 #include "dix/eventconvert.h"
+#include "dix/exevents_priv.h"
 
+#include "misc.h"
+#include "resource.h"
+#include "windowstr.h"
+#include "inputstr.h"
 #include "exglobals.h"
 #include "dixgrabs.h"
 #include "eventstr.h"
diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c
index b985e35b7aa1e1896c288cf7f421a7b968903dc1..aae84180ac1efd30129e73a1b3946304f89e1129 100644
--- a/test/xi2/protocol-common.c
+++ b/test/xi2/protocol-common.c
@@ -30,15 +30,16 @@
 
 #include <errno.h>
 #include <stdint.h>
+#include <X11/extensions/XI2.h>
 
 #include "dix/dix_priv.h"
+#include "dix/exevents_priv.h"
 
 #include "extinit_priv.h"
 #include "exglobals.h"
 #include "xkbsrv.h"             /* for XkbInitPrivates */
 #include "xserver-properties.h"
 #include "syncsrv.h"
-#include <X11/extensions/XI2.h>
 
 #include "protocol-common.h"
 
diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index fb0627bb52cbf9406e9c1aeba17555aa3e8e89b0..e1317ca1b2c3a97176f0d96e22066821e2f60bf6 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -28,14 +28,14 @@
 #endif
 
 #include <stdint.h>
+#include <X11/extensions/XI2proto.h>
 
+#include "dix/exevents_priv.h"
 #include "dix/eventconvert.h"
 
 #include "inputstr.h"
 #include "eventstr.h"
-#include "exevents.h"
 #include "inpututils.h"
-#include <X11/extensions/XI2proto.h>
 
 #include "protocol-common.h"
 
diff --git a/test/xi2/protocol-xigetselectedevents.c b/test/xi2/protocol-xigetselectedevents.c
index 2ea365d0114f74702cfe337ceef198d72ecd9acd..937b52b2edfcf00d84c8862fbc3d07f99607e333 100644
--- a/test/xi2/protocol-xigetselectedevents.c
+++ b/test/xi2/protocol-xigetselectedevents.c
@@ -43,12 +43,14 @@
 #include <X11/X.h>
 #include <X11/Xproto.h>
 #include <X11/extensions/XI2proto.h>
+
+#include "dix/exevents_priv.h"
+
 #include "inputstr.h"
 #include "windowstr.h"
 #include "extinit.h"            /* for XInputExtensionInit */
 #include "scrnintstr.h"
 #include "xiselectev.h"
-#include "exevents.h"
 
 #include "protocol-common.h"
 
diff --git a/test/xi2/protocol-xipassivegrabdevice.c b/test/xi2/protocol-xipassivegrabdevice.c
index d7aaf23d41f711d25cacf294beadcae69e008d04..bc986649310f6033fc7ba21f2d7c6e157df0155a 100644
--- a/test/xi2/protocol-xipassivegrabdevice.c
+++ b/test/xi2/protocol-xipassivegrabdevice.c
@@ -35,11 +35,13 @@
 #include <X11/X.h>
 #include <X11/Xproto.h>
 #include <X11/extensions/XI2proto.h>
+
+#include "dix/exevents_priv.h"
+
 #include "inputstr.h"
 #include "windowstr.h"
 #include "scrnintstr.h"
 #include "xipassivegrab.h"
-#include "exevents.h"
 #include "exglobals.h"
 
 #include "protocol-common.h"
diff --git a/test/xi2/protocol-xiqueryversion.c b/test/xi2/protocol-xiqueryversion.c
index 521703c5a8d3df24796254c9ab210190e414c71d..b8145bc1c3932905b21e38511482ac5e61fe8024 100644
--- a/test/xi2/protocol-xiqueryversion.c
+++ b/test/xi2/protocol-xiqueryversion.c
@@ -43,6 +43,9 @@
 #include <X11/X.h>
 #include <X11/Xproto.h>
 #include <X11/extensions/XI2proto.h>
+
+#include "dix/exevents_priv.h"
+
 #include "inputstr.h"
 #include "extinit.h"            /* for XInputExtensionInit */
 #include "scrnintstr.h"
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index c31f89740745b9ce10e4d0f6c1ffd5c84301ddbf..e6325d875b5a67f9ef74293745d7bae35351ad7f 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -34,8 +34,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <X11/keysym.h>
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
+
+#include "dix/exevents_priv.h"
+
 #include "inputstr.h"
-#include "exevents.h"
 #include "exglobals.h"
 #include "windowstr.h"
 #include "xkbsrv_priv.h"