diff --git a/include/protocol-versions.h b/include/protocol-versions.h
index da9770c..9b0c565 100644
--- a/include/protocol-versions.h
+++ b/include/protocol-versions.h
@@ -126,7 +126,7 @@
 #define SERVER_XF86VIDMODE_MINOR_VERSION    2
 
 /* Fixes */
-#define SERVER_XFIXES_MAJOR_VERSION        4
+#define SERVER_XFIXES_MAJOR_VERSION        5
 #define SERVER_XFIXES_MINOR_VERSION        0
 
 /* X Input */
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 318e9fc..45e03e7 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -235,7 +235,9 @@ static void
 miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
                       BoxPtr pHotBox, BoxPtr pTopLeftBox)
 {
-    *pTopLeftBox = *pHotBox;
+    miPointerPtr pPointer = MIPOINTER(pDev);
+
+    *pTopLeftBox = pPointer->limits;
 }
 
 static Bool GenerateEvent;
diff --git a/xfixes/region.c b/xfixes/region.c
index 966eda0..074f5d2 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -26,6 +26,7 @@
 
 #include "xfixesint.h"
 #include "scrnintstr.h"
+#include "inputstr.h"
 #ifdef RENDER
 #include <picturestr.h>
 extern int RenderErrBase;
@@ -864,3 +865,49 @@ SProcXFixesExpandRegion (ClientPtr client)
     return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
 }
 
+int
+ProcXFixesSetCursorRegion (ClientPtr client)
+{
+    WindowPtr        pWin;
+    ScreenPtr        pScreen;
+    RegionPtr        pRegion;
+    BoxPtr          pLimits;
+    DeviceIntPtr    dev;
+    int rc;
+    REQUEST(xXFixesSetCursorRegionReq);
+
+    REQUEST_SIZE_MATCH(xXFixesSetCursorRegionReq);
+    rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
+               client, DixSetAttrAccess);
+    if (rc != Success)
+    {
+    client->errorValue = stuff->window;
+    return (rc == BadValue) ? BadWindow : rc;
+    }
+    VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixWriteAccess);
+    pScreen = pWin->drawable.pScreen;
+
+    pLimits = REGION_EXTENTS(0, pRegion);
+
+    for (dev = inputInfo.devices; dev; dev = dev->next)
+    {
+        if (IsMaster(dev) && IsPointerDevice(dev)) {
+            (*pScreen->ConstrainCursor) (dev, pScreen, pLimits);
+            break;
+        }
+    }
+    return (client->noClientException);
+}
+
+int
+SProcXFixesSetCursorRegion (ClientPtr client)
+{
+    int n;
+    REQUEST(xXFixesSetCursorRegionReq);
+
+    swaps (&stuff->length, n);
+    REQUEST_SIZE_MATCH(xXFixesSetCursorRegionReq);
+    swapl (&stuff->region, n);
+    return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
+}
+
diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c
index 5163dc1..2006b5f 100644
--- a/xfixes/xfixes.c
+++ b/xfixes/xfixes.c
@@ -102,10 +102,11 @@ static const int version_requests[] = {
     X_XFixesChangeCursorByName,    /* Version 2 */
     X_XFixesExpandRegion,    /* Version 3 */
     X_XFixesShowCursor,            /* Version 4 */
+    X_XFixesSetCursorRegion,    /* Version 5 */
 };
 
 #define NUM_VERSION_REQUESTS    (sizeof (version_requests) / sizeof (version_requests[0]))
-    
+
 int    (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
 /*************** Version 1 ******************/
     ProcXFixesQueryVersion,
@@ -142,6 +143,8 @@ int    (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
 /*************** Version 4 ****************/
     ProcXFixesHideCursor,
     ProcXFixesShowCursor,
+/*************** Version 5 *****************/
+    ProcXFixesSetCursorRegion,
 };
 
 static int
@@ -205,6 +208,8 @@ static int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
 /*************** Version 4 ****************/
     SProcXFixesHideCursor,
     SProcXFixesShowCursor,
+/*************** Version 5 *****************/
+    SProcXFixesSetCursorRegion,
 };
 
 static int
diff --git a/xfixes/xfixesint.h b/xfixes/xfixesint.h
index f3d5361..9103f9a 100644
--- a/xfixes/xfixesint.h
+++ b/xfixes/xfixesint.h
@@ -257,16 +257,24 @@ SProcXFixesExpandRegion (ClientPtr client);
 
 /* Cursor Visibility (Version 4) */
 
 int 
 ProcXFixesHideCursor (ClientPtr client);
 
 int 
 SProcXFixesHideCursor (ClientPtr client);
 
 int 
 ProcXFixesShowCursor (ClientPtr client);
 
 int 
 SProcXFixesShowCursor (ClientPtr client);
 
+/* Cursor Constraint (Version 5) */
+
+int
+ProcXFixesSetCursorRegion (ClientPtr client);
+
+int
+SProcXFixesSetCursorRegion (ClientPtr client);
+
 #endif /* _XFIXESINT_H_ */
