xserver: Branch 'master' - 3 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 16 02:18:13 UTC 2024


 Xext/dpms.c                    |    2 -
 Xext/panoramiXprocs.c          |    2 -
 Xext/saver.c                   |   22 ++++++-------
 Xext/security.c                |   14 ++++----
 Xext/shape.c                   |    4 +-
 Xext/shm.c                     |   18 +++++------
 Xext/sleepuntil.c              |    4 +-
 Xext/sync.c                    |   28 ++++++++---------
 Xext/xselinux_hooks.c          |    6 +--
 Xext/xselinux_label.c          |    8 ++--
 Xext/xtest.c                   |    2 -
 Xext/xvmc.c                    |    6 +--
 Xi/closedev.c                  |    2 -
 Xi/exevents.c                  |   12 +++----
 Xi/xibarriers.c                |    2 -
 Xi/xichangecursor.c            |    2 -
 Xi/xipassivegrab.c             |    2 -
 composite/compalloc.c          |    6 +--
 composite/compext.c            |   41 +++++++++++++------------
 composite/compoverlay.c        |    4 +-
 composite/compwindow.c         |    4 +-
 damageext/damageext.c          |    6 +--
 dbe/dbe.c                      |    4 +-
 dbe/midbe.c                    |    6 +--
 dix/colormap.c                 |   28 ++++++++---------
 dix/cursor.c                   |   16 ++++-----
 dix/dispatch.c                 |   67 +++++++++++++++++++++--------------------
 dix/dixfonts.c                 |   16 ++++-----
 dix/dixutils.c                 |    6 +--
 dix/events.c                   |   18 +++++------
 dix/gc.c                       |   12 +++----
 dix/gestures.c                 |    4 +-
 dix/grabs.c                    |    8 ++--
 dix/privates.c                 |   22 ++++++-------
 dix/registry.c                 |   20 ++++++------
 dix/resource.c                 |   40 ++++++++++++------------
 dix/touch.c                    |    8 ++--
 dix/window.c                   |   40 ++++++++++++------------
 doc/Xserver-spec.xml           |    2 -
 dri3/dri3_request.c            |   16 ++++-----
 glx/glxcmds.c                  |    6 +--
 glx/glxext.c                   |    2 -
 glx/vndext.c                   |    2 -
 hw/kdrive/src/kcmap.c          |    2 -
 hw/xfree86/common/xf86DGA.c    |   10 +++---
 hw/xfree86/common/xf86cmap.c   |    2 -
 hw/xnest/Color.c               |   10 +++---
 hw/xnest/Window.c              |    6 +--
 hw/xquartz/applewm.c           |    2 -
 hw/xwayland/xwayland-input.c   |    2 -
 hw/xwayland/xwayland-output.c  |    2 -
 hw/xwin/wincmap.c              |    2 -
 hw/xwin/winmultiwindowwindow.c |    2 -
 include/resource.h             |   36 +++++++++++++++-------
 mi/micmap.c                    |    2 -
 present/present_event.c        |    4 +-
 present/present_request.c      |    2 -
 randr/rrdispatch.c             |    2 -
 randr/rrlease.c                |    4 +-
 record/record.c                |    2 -
 render/animcur.c               |    4 +-
 render/picture.c               |   10 +++---
 render/render.c                |   20 ++++++------
 xfixes/cursor.c                |   26 ++++++++-------
 xfixes/region.c                |    8 ++--
 65 files changed, 361 insertions(+), 339 deletions(-)

New commits:
commit 85d4bd0dba6ac5adb73864396d260be92a23ea50
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date:   Mon Mar 11 11:01:02 2024 +0100

    rename remaining RT_* defines to X11_RESTYPE_*
    
    Since we already had to rename some of them, in order to fix name clashes
    on win32, it's now time to rename all the remaining ones.
    
    The old ones are still present as define's to the new ones, just for
    backwards compatibility.
    
    Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
    Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>

diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 9c46e3291..3e3567590 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -478,7 +478,7 @@ PanoramiXConfigureWindow(ClientPtr client)
 
     /* because we need the parent */
     result = dixLookupResourceByType((void **) &pWin, stuff->window,
-                                     RT_WINDOW, client, DixWriteAccess);
+                                     X11_RESTYPE_WINDOW, client, DixWriteAccess);
     if (result != Success)
         return result;
 
diff --git a/Xext/saver.c b/Xext/saver.c
index 17d74772e..29f280369 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -451,7 +451,7 @@ UninstallSaverColormap(ScreenPtr pScreen)
 
     if (pPriv && pPriv->installedMap != None) {
         rc = dixLookupResourceByType((void **) &pCmap, pPriv->installedMap,
-                                     RT_COLORMAP, serverClient,
+                                     X11_RESTYPE_COLORMAP, serverClient,
                                      DixUninstallAccess);
         if (rc == Success)
             (*pCmap->pScreen->UninstallColormap) (pCmap);
@@ -499,7 +499,7 @@ CreateSaverWindow(ScreenPtr pScreen)
     if (!pWin)
         return FALSE;
 
-    if (!AddResource(pWin->drawable.id, RT_WINDOW, pWin))
+    if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW, pWin))
         return FALSE;
 
     mask = 0;
@@ -547,7 +547,7 @@ CreateSaverWindow(ScreenPtr pScreen)
     if (wantMap == None || IsMapInstalled(wantMap, pWin))
         return TRUE;
 
-    result = dixLookupResourceByType((void **) &pCmap, wantMap, RT_COLORMAP,
+    result = dixLookupResourceByType((void **) &pCmap, wantMap, X11_RESTYPE_COLORMAP,
                                      serverClient, DixInstallAccess);
     if (result != Success)
         return TRUE;
@@ -900,7 +900,7 @@ ScreenSaverSetAttributes(ClientPtr client)
             else {
                 ret =
                     dixLookupResourceByType((void **) &pPixmap, pixID,
-                                            RT_PIXMAP, client, DixReadAccess);
+                                            X11_RESTYPE_PIXMAP, client, DixReadAccess);
                 if (ret == Success) {
                     if ((pPixmap->drawable.depth != depth) ||
                         (pPixmap->drawable.pScreen != pScreen)) {
@@ -932,7 +932,7 @@ ScreenSaverSetAttributes(ClientPtr client)
             else {
                 ret =
                     dixLookupResourceByType((void **) &pPixmap, pixID,
-                                            RT_PIXMAP, client, DixReadAccess);
+                                            X11_RESTYPE_PIXMAP, client, DixReadAccess);
                 if (ret == Success) {
                     if ((pPixmap->drawable.depth != depth) ||
                         (pPixmap->drawable.pScreen != pScreen)) {
@@ -1015,7 +1015,7 @@ ScreenSaverSetAttributes(ClientPtr client)
             break;
         case CWColormap:
             cmap = (Colormap) * pVlist;
-            ret = dixLookupResourceByType((void **) &pCmap, cmap, RT_COLORMAP,
+            ret = dixLookupResourceByType((void **) &pCmap, cmap, X11_RESTYPE_COLORMAP,
                                           client, DixUseAccess);
             if (ret != Success) {
                 client->errorValue = cmap;
diff --git a/Xext/security.c b/Xext/security.c
index 49e97a0ca..cf5f4051a 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -751,12 +751,12 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
     subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
 
     /* disable background None for untrusted windows */
-    if ((requested & DixCreateAccess) && (rec->rtype == RT_WINDOW))
+    if ((requested & DixCreateAccess) && (rec->rtype == X11_RESTYPE_WINDOW))
         if (subj->haveState && subj->trustLevel != XSecurityClientTrusted)
             ((WindowPtr) rec->res)->forcedBG = TRUE;
 
     /* additional permissions for specific resource types */
-    if (rec->rtype == RT_WINDOW)
+    if (rec->rtype == X11_RESTYPE_WINDOW)
         allowed |= SecurityWindowExtraMask;
 
     /* special checks for server-owned resources */
@@ -765,7 +765,7 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
             /* additional operations allowed on root windows */
             allowed |= SecurityRootWindowExtraMask;
 
-        else if (rec->rtype == RT_COLORMAP)
+        else if (rec->rtype == X11_RESTYPE_COLORMAP)
             /* allow access to default colormaps */
             allowed = requested;
 
diff --git a/Xext/shape.c b/Xext/shape.c
index 0e86b8f83..792c20f71 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -365,7 +365,7 @@ ProcShapeMask(ClientPtr client)
         srcRgn = 0;
     else {
         rc = dixLookupResourceByType((void **) &pPixmap, stuff->src,
-                                     RT_PIXMAP, client, DixReadAccess);
+                                     X11_RESTYPE_PIXMAP, client, DixReadAccess);
         if (rc != Success)
             return rc;
         if (pPixmap->drawable.pScreen != pScreen ||
diff --git a/Xext/shm.c b/Xext/shm.c
index b418f53a5..3a5a4c7f2 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -1002,7 +1002,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
 
         if (pMap) {
             result = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid,
-                              RT_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
+                              X11_RESTYPE_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
             if (result != Success) {
                 pDraw->pScreen->DestroyPixmap(pMap);
                 break;
@@ -1011,7 +1011,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
             shmdesc->refcnt++;
             pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
             pMap->drawable.id = newPix->info[j].id;
-            if (!AddResource(newPix->info[j].id, RT_PIXMAP, (void *) pMap)) {
+            if (!AddResource(newPix->info[j].id, X11_RESTYPE_PIXMAP, (void *) pMap)) {
                 result = BadAlloc;
                 break;
             }
@@ -1116,7 +1116,7 @@ ProcShmCreatePixmap(ClientPtr client)
                                                    shmdesc->addr +
                                                    stuff->offset);
     if (pMap) {
-        rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
+        rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, X11_RESTYPE_PIXMAP,
                       pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
         if (rc != Success) {
             pDraw->pScreen->DestroyPixmap(pMap);
@@ -1126,7 +1126,7 @@ ProcShmCreatePixmap(ClientPtr client)
         shmdesc->refcnt++;
         pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
         pMap->drawable.id = stuff->pid;
-        if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap)) {
+        if (AddResource(stuff->pid, X11_RESTYPE_PIXMAP, (void *) pMap)) {
             return Success;
         }
     }
diff --git a/Xext/xselinux_hooks.c b/Xext/xselinux_hooks.c
index d0ddf22e6..63fc18f93 100644
--- a/Xext/xselinux_hooks.c
+++ b/Xext/xselinux_hooks.c
@@ -201,7 +201,7 @@ SELinuxLabelInitial(void)
 
         /* Do the default colormap */
         dixLookupResourceByType(&unused, screenInfo.screens[i]->defColormap,
-                                RT_COLORMAP, serverClient, DixCreateAccess);
+                                X11_RESTYPE_COLORMAP, serverClient, DixCreateAccess);
     }
 }
 
@@ -664,7 +664,7 @@ SELinuxResource(CallbackListPtr *pcbl, void *unused, void *calldata)
         rec->status = rc;
 
     /* Perform the background none check on windows */
-    if (access_mode & DixCreateAccess && rec->rtype == RT_WINDOW) {
+    if (access_mode & DixCreateAccess && rec->rtype == X11_RESTYPE_WINDOW) {
         rc = SELinuxDoCheck(subj, obj, class, DixBlendAccess, &auditdata);
         if (rc != Success)
             ((WindowPtr) rec->res)->forcedBG = TRUE;
@@ -766,7 +766,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
     SELinuxObjectRec *obj;
     WindowPtr pWin;
 
-    if (rec->type != RT_WINDOW)
+    if (rec->type != X11_RESTYPE_WINDOW)
         return;
     if (rec->state != ResourceStateAdding)
         return;
diff --git a/Xext/xselinux_label.c b/Xext/xselinux_label.c
index 3bb597ee2..08159ff0b 100644
--- a/Xext/xselinux_label.c
+++ b/Xext/xselinux_label.c
@@ -323,13 +323,13 @@ SELinuxTypeToClass(RESTYPE type)
 
         if (type & RC_DRAWABLE)
             class = SECCLASS_X_DRAWABLE;
-        else if (type == RT_GC)
+        else if (type == X11_RESTYPE_GC)
             class = SECCLASS_X_GC;
         else if (type == X11_RESTYPE_FONT)
             class = SECCLASS_X_FONT;
         else if (type == X11_RESTYPE_CURSOR)
             class = SECCLASS_X_CURSOR;
-        else if (type == RT_COLORMAP)
+        else if (type == X11_RESTYPE_COLORMAP)
             class = SECCLASS_X_COLORMAP;
         else {
             /* Need to do a string lookup */
diff --git a/composite/compext.c b/composite/compext.c
index 1f8194f80..cfdb7a216 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -130,7 +130,7 @@ ProcCompositeQueryVersion(ClientPtr client)
     do {								\
 	int err;							\
 	err = dixLookupResourceByType((void **) &pWindow, wid,	\
-				      RT_WINDOW, client, mode);		\
+				      X11_RESTYPE_WINDOW, client, mode);\
 	if (err != Success) {						\
 	    client->errorValue = wid;					\
 	    return err;							\
@@ -252,14 +252,14 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
         return BadMatch;
 
     /* security creation/labeling check */
-    rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,
-                  pPixmap, RT_WINDOW, pWin, DixCreateAccess);
+    rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, X11_RESTYPE_PIXMAP,
+                  pPixmap, X11_RESTYPE_WINDOW, pWin, DixCreateAccess);
     if (rc != Success)
         return rc;
 
     ++pPixmap->refcnt;
 
-    if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pPixmap))
+    if (!AddResource(stuff->pixmap, X11_RESTYPE_PIXMAP, (void *) pPixmap))
         return BadAlloc;
 
     if (pScreen->NameWindowPixmap) {
@@ -307,7 +307,8 @@ ProcCompositeGetOverlayWindow(ClientPtr client)
         }
 
     rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id,
-                  RT_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, NULL, DixGetAttrAccess);
+                  X11_RESTYPE_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE,
+                  NULL, DixGetAttrAccess);
     if (rc != Success) {
         FreeResource(pOc->resource, X11_RESTYPE_NONE);
         return rc;
@@ -515,7 +516,7 @@ GetCompositeWindowBytes(void *value, XID id, ResourceSizePtr size)
     /* account for redirection */
     if (window->redirectDraw != RedirectDrawNone)
     {
-        SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP);
+        SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(X11_RESTYPE_PIXMAP);
         ResourceSizeRec pixmapSize = { 0, 0 };
         ScreenPtr screen = window->drawable.pScreen;
         PixmapPtr pixmap = screen->GetWindowPixmap(window);
@@ -556,8 +557,8 @@ CompositeExtensionInit(void)
     if (!CompositeClientWindowType)
         return;
 
-    coreGetWindowBytes = GetResourceTypeSizeFunc(RT_WINDOW);
-    SetResourceTypeSizeFunc(RT_WINDOW, GetCompositeWindowBytes);
+    coreGetWindowBytes = GetResourceTypeSizeFunc(X11_RESTYPE_WINDOW);
+    SetResourceTypeSizeFunc(X11_RESTYPE_WINDOW, GetCompositeWindowBytes);
 
     CompositeClientSubwindowsType = CreateNewResourceType
         (FreeCompositeClientSubwindows, "CompositeClientSubwindows");
@@ -728,7 +729,8 @@ PanoramiXCompositeNameWindowPixmap(ClientPtr client)
 
     FOR_NSCREENS(i) {
         rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
-                                     RT_WINDOW, client, DixGetAttrAccess);
+                                     X11_RESTYPE_WINDOW, client,
+                                     DixGetAttrAccess);
         if (rc != Success) {
             client->errorValue = stuff->window;
             free(newPix);
@@ -752,7 +754,7 @@ PanoramiXCompositeNameWindowPixmap(ClientPtr client)
             return BadMatch;
         }
 
-        if (!AddResource(newPix->info[i].id, RT_PIXMAP, (void *) pPixmap))
+        if (!AddResource(newPix->info[i].id, X11_RESTYPE_PIXMAP, (void *) pPixmap))
             return BadAlloc;
 
         ++pPixmap->refcnt;
@@ -796,7 +798,8 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
 
     FOR_NSCREENS_BACKWARD(i) {
         rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
-                                     RT_WINDOW, client, DixGetAttrAccess);
+                                     X11_RESTYPE_WINDOW, client,
+                                     DixGetAttrAccess);
         if (rc != Success) {
             client->errorValue = stuff->window;
             free(overlayWin);
@@ -827,7 +830,7 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
 
         rc = XaceHook(XACE_RESOURCE_ACCESS, client,
                       cs->pOverlayWin->drawable.id,
-                      RT_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, NULL,
+                      X11_RESTYPE_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, NULL,
                       DixGetAttrAccess);
         if (rc != Success) {
             FreeResource(pOc->resource, X11_RESTYPE_NONE);
diff --git a/composite/compoverlay.c b/composite/compoverlay.c
index 1e077b892..18538ed98 100644
--- a/composite/compoverlay.c
+++ b/composite/compoverlay.c
@@ -152,7 +152,7 @@ compCreateOverlayWindow(ScreenPtr pScreen)
     if (pWin == NULL)
         return FALSE;
 
-    if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin))
+    if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW, (void *) pWin))
         return FALSE;
 
     MapWindow(pWin, serverClient);
diff --git a/dbe/midbe.c b/dbe/midbe.c
index c646bc0c7..eb6057748 100644
--- a/dbe/midbe.c
+++ b/dbe/midbe.c
@@ -171,7 +171,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
         /* Security creation/labeling check. */
         rc = XaceHook(XACE_RESOURCE_ACCESS, serverClient, bufId,
                       dbeDrawableResType, pDbeWindowPriv->pBackBuffer,
-                      RT_WINDOW, pWin, DixCreateAccess);
+                      X11_RESTYPE_WINDOW, pWin, DixCreateAccess);
 
         /* Make the back pixmap a DBE drawable resource. */
         if (rc != Success || !AddResource(bufId, dbeDrawableResType,
diff --git a/dix/colormap.c b/dix/colormap.c
index 1a46d01ab..4276973b6 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -370,13 +370,13 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
     }
     pmap->flags |= BeingCreated;
 
-    if (!AddResource(mid, RT_COLORMAP, (void *) pmap))
+    if (!AddResource(mid, X11_RESTYPE_COLORMAP, (void *) pmap))
         return BadAlloc;
 
     /*
      * Security creation/labeling check
      */
-    i = XaceHook(XACE_RESOURCE_ACCESS, clients[client], mid, RT_COLORMAP,
+    i = XaceHook(XACE_RESOURCE_ACCESS, clients[client], mid, X11_RESTYPE_COLORMAP,
                  pmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
     if (i != Success) {
         FreeResource(mid, X11_RESTYPE_NONE);
@@ -566,7 +566,7 @@ CopyColormapAndFree(Colormap mid, ColormapPtr pSrc, int client)
     }
     if (pmap->class & DynamicClass)
         UpdateColors(pmap);
-    /* XXX should worry about removing any RT_CMAPENTRY resource */
+    /* XXX should worry about removing any X11_RESTYPE_CMAPENTRY resource */
     return Success;
 }
 
@@ -1016,7 +1016,7 @@ AllocColor(ColormapPtr pmap,
             ColormapPtr prootmap;
 
             dixLookupResourceByType((void **) &prootmap,
-                                    pmap->pScreen->defColormap, RT_COLORMAP,
+                                    pmap->pScreen->defColormap, X11_RESTYPE_COLORMAP,
                                     clients[client], DixReadAccess);
 
             if (pmap->class == prootmap->class)
@@ -1034,7 +1034,7 @@ AllocColor(ColormapPtr pmap,
             ColormapPtr prootmap;
 
             dixLookupResourceByType((void **) &prootmap,
-                                    pmap->pScreen->defColormap, RT_COLORMAP,
+                                    pmap->pScreen->defColormap, X11_RESTYPE_COLORMAP,
                                     clients[client], DixReadAccess);
 
             if (pmap->class == prootmap->class) {
@@ -1087,7 +1087,7 @@ AllocColor(ColormapPtr pmap,
         }
         pcr->mid = pmap->mid;
         pcr->client = client;
-        if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr))
+        if (!AddResource(FakeClientID(client), X11_RESTYPE_CMAPENTRY, (void *) pcr))
             return BadAlloc;
     }
     return Success;
@@ -1472,7 +1472,7 @@ FreeClientPixels(void *value, XID fakeid)
     colorResource *pcr = value;
     int rc;
 
-    rc = dixLookupResourceByType(&pmap, pcr->mid, RT_COLORMAP, serverClient,
+    rc = dixLookupResourceByType(&pmap, pcr->mid, X11_RESTYPE_COLORMAP, serverClient,
                                  DixRemoveAccess);
     if (rc == Success)
         FreePixels((ColormapPtr) pmap, pcr->client);
@@ -1535,7 +1535,7 @@ AllocColorCells(int client, ColormapPtr pmap, int colors, int planes,
     if ((ok == Success) && pcr) {
         pcr->mid = pmap->mid;
         pcr->client = client;
-        if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr))
+        if (!AddResource(FakeClientID(client), X11_RESTYPE_CMAPENTRY, (void *) pcr))
             ok = BadAlloc;
     }
     else
@@ -1617,7 +1617,7 @@ AllocColorPlanes(int client, ColormapPtr pmap, int colors,
     if ((ok == Success) && pcr) {
         pcr->mid = pmap->mid;
         pcr->client = client;
-        if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr))
+        if (!AddResource(FakeClientID(client), X11_RESTYPE_CMAPENTRY, (void *) pcr))
             ok = BadAlloc;
     }
     else
@@ -2092,7 +2092,7 @@ FreeColors(ColormapPtr pmap, int client, int count, Pixel * pixels, Pixel mask)
         clients[client]->errorValue = *pixels | mask;
         result = BadValue;
     }
-    /* XXX should worry about removing any RT_CMAPENTRY resource */
+    /* XXX should worry about removing any X11_RESTYPE_CMAPENTRY resource */
     return result;
 }
 
@@ -2539,7 +2539,7 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth)
 
     cdata.visuals = visuals;
     cdata.pScreen = pScreen;
-    FindClientResourcesByType(serverClient, RT_COLORMAP,
+    FindClientResourcesByType(serverClient, X11_RESTYPE_COLORMAP,
                               _colormap_find_resource, &cdata);
 
     pScreen->visuals = visuals;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index aeb9d0717..b9daec5ca 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -769,7 +769,7 @@ ProcCreateWindow(ClientPtr client)
         Mask mask = pWin->eventMask;
 
         pWin->eventMask = 0;    /* subterfuge in case AddResource fails */
-        if (!AddResource(stuff->wid, RT_WINDOW, (void *) pWin))
+        if (!AddResource(stuff->wid, X11_RESTYPE_WINDOW, (void *) pWin))
             return BadAlloc;
         pWin->eventMask = mask;
     }
@@ -1515,13 +1515,13 @@ ProcCreatePixmap(ClientPtr client)
         pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
         pMap->drawable.id = stuff->pid;
         /* security creation/labeling check */
-        rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
+        rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, X11_RESTYPE_PIXMAP,
                       pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
         if (rc != Success) {
             (*pDraw->pScreen->DestroyPixmap) (pMap);
             return rc;
         }
-        if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap))
+        if (AddResource(stuff->pid, X11_RESTYPE_PIXMAP, (void *) pMap))
             return Success;
     }
     return BadAlloc;
@@ -1536,7 +1536,7 @@ ProcFreePixmap(ClientPtr client)
     REQUEST(xResourceReq);
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    rc = dixLookupResourceByType((void **) &pMap, stuff->id, RT_PIXMAP,
+    rc = dixLookupResourceByType((void **) &pMap, stuff->id, X11_RESTYPE_PIXMAP,
                                  client, DixDestroyAccess);
     if (rc == Success) {
         FreeResource(stuff->id, X11_RESTYPE_NONE);
@@ -1573,7 +1573,7 @@ ProcCreateGC(ClientPtr client)
                           stuff->gc, client);
     if (error != Success)
         return error;
-    if (!AddResource(stuff->gc, RT_GC, (void *) pGC))
+    if (!AddResource(stuff->gc, X11_RESTYPE_GC, (void *) pGC))
         return BadAlloc;
     return Success;
 }
@@ -2471,7 +2471,7 @@ ProcFreeColormap(ClientPtr client)
     REQUEST(xResourceReq);
 
     REQUEST_SIZE_MATCH(xResourceReq);
-    rc = dixLookupResourceByType((void **) &pmap, stuff->id, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pmap, stuff->id, X11_RESTYPE_COLORMAP,
                                  client, DixDestroyAccess);
     if (rc == Success) {
         /* Freeing a default colormap is a no-op */
@@ -2498,7 +2498,7 @@ ProcCopyColormapAndFree(ClientPtr client)
     mid = stuff->mid;
     LEGAL_NEW_RESOURCE(mid, client);
     rc = dixLookupResourceByType((void **) &pSrcMap, stuff->srcCmap,
-                                 RT_COLORMAP, client,
+                                 X11_RESTYPE_COLORMAP, client,
                                  DixReadAccess | DixRemoveAccess);
     if (rc == Success)
         return CopyColormapAndFree(mid, pSrcMap, client->index);
@@ -2515,7 +2515,7 @@ ProcInstallColormap(ClientPtr client)
     REQUEST(xResourceReq);
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->id, X11_RESTYPE_COLORMAP,
                                  client, DixInstallAccess);
     if (rc != Success)
         goto out;
@@ -2544,7 +2544,7 @@ ProcUninstallColormap(ClientPtr client)
     REQUEST(xResourceReq);
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->id, X11_RESTYPE_COLORMAP,
                                  client, DixUninstallAccess);
     if (rc != Success)
         goto out;
@@ -2612,7 +2612,7 @@ ProcAllocColor(ClientPtr client)
     REQUEST(xAllocColorReq);
 
     REQUEST_SIZE_MATCH(xAllocColorReq);
-    rc = dixLookupResourceByType((void **) &pmap, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pmap, stuff->cmap, X11_RESTYPE_COLORMAP,
                                  client, DixAddAccess);
     if (rc == Success) {
         xAllocColorReply acr = {
@@ -2649,7 +2649,7 @@ ProcAllocNamedColor(ClientPtr client)
     REQUEST(xAllocNamedColorReq);
 
     REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
-    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, X11_RESTYPE_COLORMAP,
                                  client, DixAddAccess);
     if (rc == Success) {
         xAllocNamedColorReply ancr = {
@@ -2694,7 +2694,7 @@ ProcAllocColorCells(ClientPtr client)
     REQUEST(xAllocColorCellsReq);
 
     REQUEST_SIZE_MATCH(xAllocColorCellsReq);
-    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, X11_RESTYPE_COLORMAP,
                                  client, DixAddAccess);
     if (rc == Success) {
         int npixels, nmasks;
@@ -2755,7 +2755,7 @@ ProcAllocColorPlanes(ClientPtr client)
     REQUEST(xAllocColorPlanesReq);
 
     REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
-    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, X11_RESTYPE_COLORMAP,
                                  client, DixAddAccess);
     if (rc == Success) {
         xAllocColorPlanesReply acpr;
@@ -2817,7 +2817,7 @@ ProcFreeColors(ClientPtr client)
     REQUEST(xFreeColorsReq);
 
     REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
-    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, X11_RESTYPE_COLORMAP,
                                  client, DixRemoveAccess);
     if (rc == Success) {
         int count;
@@ -2843,7 +2843,7 @@ ProcStoreColors(ClientPtr client)
     REQUEST(xStoreColorsReq);
 
     REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
-    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, X11_RESTYPE_COLORMAP,
                                  client, DixWriteAccess);
     if (rc == Success) {
         int count;
@@ -2869,7 +2869,7 @@ ProcStoreNamedColor(ClientPtr client)
     REQUEST(xStoreNamedColorReq);
 
     REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes);
-    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, X11_RESTYPE_COLORMAP,
                                  client, DixWriteAccess);
     if (rc == Success) {
         xColorItem def;
@@ -2901,7 +2901,7 @@ ProcQueryColors(ClientPtr client)
     REQUEST(xQueryColorsReq);
 
     REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
-    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, X11_RESTYPE_COLORMAP,
                                  client, DixReadAccess);
     if (rc == Success) {
         int count;
@@ -2948,7 +2948,7 @@ ProcLookupColor(ClientPtr client)
     REQUEST(xLookupColorReq);
 
     REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes);
-    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, X11_RESTYPE_COLORMAP,
                                  client, DixReadAccess);
     if (rc == Success) {
         CARD16 exactRed, exactGreen, exactBlue;
@@ -3002,7 +3002,7 @@ ProcCreateCursor(ClientPtr client)
     REQUEST_SIZE_MATCH(xCreateCursorReq);
     LEGAL_NEW_RESOURCE(stuff->cid, client);
 
-    rc = dixLookupResourceByType((void **) &src, stuff->source, RT_PIXMAP,
+    rc = dixLookupResourceByType((void **) &src, stuff->source, X11_RESTYPE_PIXMAP,
                                  client, DixReadAccess);
     if (rc != Success) {
         client->errorValue = stuff->source;
@@ -3014,7 +3014,7 @@ ProcCreateCursor(ClientPtr client)
 
     /* Find and validate cursor mask pixmap, if one is provided */
     if (stuff->mask != None) {
-        rc = dixLookupResourceByType((void **) &msk, stuff->mask, RT_PIXMAP,
+        rc = dixLookupResourceByType((void **) &msk, stuff->mask, X11_RESTYPE_PIXMAP,
                                      client, DixReadAccess);
         if (rc != Success) {
             client->errorValue = stuff->mask;
@@ -4079,7 +4079,7 @@ RemoveGPUScreen(ScreenPtr pScreen)
     /* this gets freed later in the resource list, but without
      * the screen existing it causes crashes - so remove it here */
     if (pScreen->defColormap)
-        FreeResource(pScreen->defColormap, RT_COLORMAP);
+        FreeResource(pScreen->defColormap, X11_RESTYPE_COLORMAP);
     free(pScreen);
 
 }
diff --git a/dix/dixutils.c b/dix/dixutils.c
index 2672d3e9d..440b4d08c 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -197,7 +197,7 @@ dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
 int
 dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access)
 {
-    return dixLookupResourceByType((void **) pGC, id, RT_GC, client, access);
+    return dixLookupResourceByType((void **) pGC, id, X11_RESTYPE_GC, client, access);
 }
 
 int
@@ -211,7 +211,7 @@ dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access)
                                  access);
     if (rc != BadFont)
         return rc;
-    rc = dixLookupResourceByType((void **) &pGC, id, RT_GC, client, access);
+    rc = dixLookupResourceByType((void **) &pGC, id, X11_RESTYPE_GC, client, access);
     if (rc == BadGC)
         return BadFont;
     if (rc == Success)
diff --git a/dix/events.c b/dix/events.c
index 2f42268cc..f5a719a85 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4534,7 +4534,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
     check = (mask & ManagerMask);
     if (check) {
         rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id,
-                      RT_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixManageAccess);
+                      X11_RESTYPE_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixManageAccess);
         if (rc != Success)
             return rc;
     }
@@ -4577,7 +4577,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
         others->resource = FakeClientID(client->index);
         others->next = pWin->optional->otherClients;
         pWin->optional->otherClients = others;
-        if (!AddResource(others->resource, RT_OTHERCLIENT, (void *) pWin))
+        if (!AddResource(others->resource, X11_RESTYPE_OTHERCLIENT, (void *) pWin))
             return BadAlloc;
     }
  maskSet:
diff --git a/dix/gc.c b/dix/gc.c
index 3d41a5407..24444f49a 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -423,10 +423,10 @@ static const struct {
     RESTYPE type;
     Mask access_mode;
 } xidfields[] = {
-    {GCTile, RT_PIXMAP, DixReadAccess},
-    {GCStipple, RT_PIXMAP, DixReadAccess},
-    {GCFont, X11_RESTYPE_FONT, DixUseAccess},
-    {GCClipMask, RT_PIXMAP, DixReadAccess},
+    {GCTile,     X11_RESTYPE_PIXMAP, DixReadAccess},
+    {GCStipple,  X11_RESTYPE_PIXMAP, DixReadAccess},
+    {GCFont,     X11_RESTYPE_FONT,   DixUseAccess},
+    {GCClipMask, X11_RESTYPE_PIXMAP, DixReadAccess},
 };
 
 int
@@ -549,7 +549,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
     }
 
     /* security creation/labeling check */
-    *pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, RT_GC, pGC,
+    *pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, X11_RESTYPE_GC, pGC,
                         X11_RESTYPE_NONE, NULL, DixCreateAccess | DixSetAttrAccess);
     if (*pStatus != Success)
         goto out;
diff --git a/dix/grabs.c b/dix/grabs.c
index 199445fac..bc8fd69bb 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -567,7 +567,7 @@ AddPassiveGrabToList(ClientPtr client, GrabPtr pGrab)
 
     pGrab->next = pGrab->window->optional->passiveGrabs;
     pGrab->window->optional->passiveGrabs = pGrab;
-    if (AddResource(pGrab->resource, RT_PASSIVEGRAB, (void *) pGrab))
+    if (AddResource(pGrab->resource, X11_RESTYPE_PASSIVEGRAB, (void *) pGrab))
         return Success;
     return BadAlloc;
 }
@@ -664,7 +664,7 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
                 FreeGrab(pNewGrab);
                 ok = FALSE;
             }
-            else if (!AddResource(pNewGrab->resource, RT_PASSIVEGRAB,
+            else if (!AddResource(pNewGrab->resource, X11_RESTYPE_PASSIVEGRAB,
                                   (void *) pNewGrab))
                 ok = FALSE;
             else
diff --git a/dix/privates.c b/dix/privates.c
index 91244edbc..01686637c 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -257,7 +257,7 @@ fixupDefaultColormaps(FixupFunc fixup, unsigned bytes)
         ColormapPtr cmap;
 
         dixLookupResourceByType((void **) &cmap,
-                                screenInfo.screens[s]->defColormap, RT_COLORMAP,
+                                screenInfo.screens[s]->defColormap, X11_RESTYPE_COLORMAP,
                                 serverClient, DixCreateAccess);
         if (cmap &&
             !fixup(&cmap->devPrivates, screenInfo.screens[s]->screenSpecificPrivates[PRIVATE_COLORMAP].offset, bytes))
@@ -564,13 +564,13 @@ dixPrivatesSize(DevPrivateType type)
 
 /* Table of devPrivates offsets */
 static const int offsets[] = {
-    -1,                         /* RT_NONE / X11_RESTYPE_NONE */
-    offsetof(WindowRec, devPrivates),   /* RT_WINDOW */
-    offsetof(PixmapRec, devPrivates),   /* RT_PIXMAP */
-    offsetof(GC, devPrivates),  /* RT_GC */
-    -1,                         /* RT_FONT / X11_RESTYPE_FONT */
-    offsetof(CursorRec, devPrivates),   /* RT_CURSOR / X11_RESTYPE_CURSOR */
-    offsetof(ColormapRec, devPrivates), /* RT_COLORMAP */
+    -1,                                 /* X11_RESTYPE_NONE */
+    offsetof(WindowRec, devPrivates),   /* X11_RESTYPE_WINDOW */
+    offsetof(PixmapRec, devPrivates),   /* X11_RESTYPE_PIXMAP */
+    offsetof(GC, devPrivates),          /* X11_RESTYPE_GC */
+    -1,                                 /* X11_RESTYPE_FONT */
+    offsetof(CursorRec, devPrivates),   /* X11_RESTYPE_CURSOR */
+    offsetof(ColormapRec, devPrivates), /* X11_RESTYPE_COLORMAP */
 };
 
 int
@@ -581,10 +581,10 @@ dixLookupPrivateOffset(RESTYPE type)
      * points at pixmaps (thanks, DBE)
      */
     if (type & RC_DRAWABLE) {
-        if (type == RT_WINDOW)
-            return offsets[RT_WINDOW & TypeMask];
+        if (type == X11_RESTYPE_WINDOW)
+            return offsets[X11_RESTYPE_WINDOW & TypeMask];
         else
-            return offsets[RT_PIXMAP & TypeMask];
+            return offsets[X11_RESTYPE_PIXMAP & TypeMask];
     }
     type = type & TypeMask;
     if (type < ARRAY_SIZE(offsets))
diff --git a/dix/registry.c b/dix/registry.c
index f770359ef..e04a26727 100644
--- a/dix/registry.c
+++ b/dix/registry.c
@@ -364,14 +364,14 @@ dixResetRegistry(void)
 #ifdef X_REGISTRY_RESOURCE
     /* Add built-in resources */
     RegisterResourceName(X11_RESTYPE_NONE, "NONE");
-    RegisterResourceName(RT_WINDOW, "WINDOW");
-    RegisterResourceName(RT_PIXMAP, "PIXMAP");
-    RegisterResourceName(RT_GC, "GC");
+    RegisterResourceName(X11_RESTYPE_WINDOW, "WINDOW");
+    RegisterResourceName(X11_RESTYPE_PIXMAP, "PIXMAP");
+    RegisterResourceName(X11_RESTYPE_GC, "GC");
     RegisterResourceName(X11_RESTYPE_FONT, "FONT");
     RegisterResourceName(X11_RESTYPE_CURSOR, "CURSOR");
-    RegisterResourceName(RT_COLORMAP, "COLORMAP");
-    RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY");
-    RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT");
-    RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB");
+    RegisterResourceName(X11_RESTYPE_COLORMAP, "COLORMAP");
+    RegisterResourceName(X11_RESTYPE_CMAPENTRY, "COLORMAP ENTRY");
+    RegisterResourceName(X11_RESTYPE_OTHERCLIENT, "OTHER CLIENT");
+    RegisterResourceName(X11_RESTYPE_PASSIVEGRAB, "PASSIVE GRAB");
 #endif
 }
diff --git a/dix/resource.c b/dix/resource.c
index 57e066290..f6fa42247 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -299,7 +299,7 @@ GetPixmapBytes(void *value, XID id, ResourceSizePtr size)
 static void
 GetWindowBytes(void *value, XID id, ResourceSizePtr size)
 {
-    SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP);
+    SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(X11_RESTYPE_PIXMAP);
     ResourceSizeRec pixmapSize = { 0, 0, 0 };
     WindowPtr window = value;
 
@@ -348,12 +348,12 @@ FindWindowSubRes(void *value, FindAllRes func, void *cdata)
     if (window->backgroundState == BackgroundPixmap)
     {
         PixmapPtr pixmap = window->background.pixmap;
-        func(window->background.pixmap, pixmap->drawable.id, RT_PIXMAP, cdata);
+        func(window->background.pixmap, pixmap->drawable.id, X11_RESTYPE_PIXMAP, cdata);
     }
     if (window->border.pixmap && !window->borderIsPixel)
     {
         PixmapPtr pixmap = window->border.pixmap;
-        func(window->background.pixmap, pixmap->drawable.id, RT_PIXMAP, cdata);
+        func(window->background.pixmap, pixmap->drawable.id, X11_RESTYPE_PIXMAP, cdata);
     }
 }
 
@@ -372,7 +372,7 @@ FindWindowSubRes(void *value, FindAllRes func, void *cdata)
 static void
 GetGcBytes(void *value, XID id, ResourceSizePtr size)
 {
-    SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP);
+    SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(X11_RESTYPE_PIXMAP);
     ResourceSizeRec pixmapSize = { 0, 0, 0 };
     GCPtr gc = value;
 
@@ -420,12 +420,12 @@ FindGCSubRes(void *value, FindAllRes func, void *cdata)
     if (gc->stipple)
     {
         PixmapPtr pixmap = gc->stipple;
-        func(pixmap, pixmap->drawable.id, RT_PIXMAP, cdata);
+        func(pixmap, pixmap->drawable.id, X11_RESTYPE_PIXMAP, cdata);
     }
     if (gc->tile.pixmap && !gc->tileIsPixel)
     {
         PixmapPtr pixmap = gc->tile.pixmap;
-        func(pixmap, pixmap->drawable.id, RT_PIXMAP, cdata);
+        func(pixmap, pixmap->drawable.id, X11_RESTYPE_PIXMAP, cdata);
     }
 }
 
@@ -438,19 +438,19 @@ static const struct ResourceType predefTypes[] = {
                                        .findSubResFunc = DefaultFindSubRes,
                                        .errorValue = BadValue,
                                        },
-    [RT_WINDOW & (RC_LASTPREDEF - 1)] = {
+    [X11_RESTYPE_WINDOW & (RC_LASTPREDEF - 1)] = {
                                          .deleteFunc = DeleteWindow,
                                          .sizeFunc = GetWindowBytes,
                                          .findSubResFunc = FindWindowSubRes,
                                          .errorValue = BadWindow,
                                          },
-    [RT_PIXMAP & (RC_LASTPREDEF - 1)] = {
+    [X11_RESTYPE_PIXMAP & (RC_LASTPREDEF - 1)] = {
                                          .deleteFunc = dixDestroyPixmap,
                                          .sizeFunc = GetPixmapBytes,
                                          .findSubResFunc = DefaultFindSubRes,
                                          .errorValue = BadPixmap,
                                          },
-    [RT_GC & (RC_LASTPREDEF - 1)] = {
+    [X11_RESTYPE_GC & (RC_LASTPREDEF - 1)] = {
                                      .deleteFunc = FreeGC,
                                      .sizeFunc = GetGcBytes,
                                      .findSubResFunc = FindGCSubRes,
@@ -468,25 +468,25 @@ static const struct ResourceType predefTypes[] = {
                                          .findSubResFunc = DefaultFindSubRes,
                                          .errorValue = BadCursor,
                                          },
-    [RT_COLORMAP & (RC_LASTPREDEF - 1)] = {
+    [X11_RESTYPE_COLORMAP & (RC_LASTPREDEF - 1)] = {
                                            .deleteFunc = FreeColormap,
                                            .sizeFunc = GetDefaultBytes,
                                            .findSubResFunc = DefaultFindSubRes,
                                            .errorValue = BadColor,
                                            },
-    [RT_CMAPENTRY & (RC_LASTPREDEF - 1)] = {
+    [X11_RESTYPE_CMAPENTRY & (RC_LASTPREDEF - 1)] = {
                                             .deleteFunc = FreeClientPixels,
                                             .sizeFunc = GetDefaultBytes,
                                             .findSubResFunc = DefaultFindSubRes,
                                             .errorValue = BadColor,
                                             },
-    [RT_OTHERCLIENT & (RC_LASTPREDEF - 1)] = {
+    [X11_RESTYPE_OTHERCLIENT & (RC_LASTPREDEF - 1)] = {
                                               .deleteFunc = OtherClientGone,
                                               .sizeFunc = GetDefaultBytes,
                                               .findSubResFunc = DefaultFindSubRes,
                                               .errorValue = BadValue,
                                               },
-    [RT_PASSIVEGRAB & (RC_LASTPREDEF - 1)] = {
+    [X11_RESTYPE_PASSIVEGRAB & (RC_LASTPREDEF - 1)] = {
                                               .deleteFunc = DeletePassiveGrab,
                                               .sizeFunc = GetDefaultBytes,
                                               .findSubResFunc = DefaultFindSubRes,
@@ -552,7 +552,7 @@ GetResourceTypeSizeFunc(RESTYPE type)
  * Override the default function that calculates resource size. For
  * example, video driver knows better how to calculate pixmap memory
  * usage and can therefore wrap or override size calculation for
- * RT_PIXMAP.
+ * X11_RESTYPE_PIXMAP.
  *
  * @param[in] type     Resource type used in size calculations.
  *
@@ -646,7 +646,7 @@ InitClientResources(ClientPtr client)
     int i, j;
 
     if (client == serverClient) {
-        lastResourceType = RT_LASTPREDEF;
+        lastResourceType = X11_RESTYPE_LASTPREDEF;
         lastResourceClass = RC_LASTPREDEF;
         TypeMask = RC_LASTPREDEF - 1;
         free(resourceTypes);
diff --git a/dix/touch.c b/dix/touch.c
index 441e36d0d..a2d65eee6 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -800,7 +800,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
         /* window owner */
         if (IsMaster(dev) && (win->eventMask & core_filter)) {
             TouchEventHistoryAllocate(ti);
-            TouchAddListener(ti, win->drawable.id, RT_WINDOW, CORE,
+            TouchAddListener(ti, win->drawable.id, X11_RESTYPE_WINDOW, CORE,
                              TOUCH_LISTENER_POINTER_REGULAR,
                              TOUCH_LISTENER_AWAITING_BEGIN,
                              win, NULL);
@@ -813,7 +813,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
                 continue;
 
             TouchEventHistoryAllocate(ti);
-            TouchAddListener(ti, oclients->resource, RT_OTHERCLIENT, CORE,
+            TouchAddListener(ti, oclients->resource, X11_RESTYPE_OTHERCLIENT, CORE,
                              type, TOUCH_LISTENER_AWAITING_BEGIN, win, NULL);
             return TRUE;
         }
diff --git a/dix/window.c b/dix/window.c
index 96af1253d..d30aff350 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -396,7 +396,7 @@ PrintPassiveGrabs(void)
             FreeLocalClientCreds(lcc);
         }
 
-        FindClientResourcesByType(clients[i], RT_PASSIVEGRAB, log_grab_info, NULL);
+        FindClientResourcesByType(clients[i], X11_RESTYPE_PASSIVEGRAB, log_grab_info, NULL);
     }
     ErrorF("End list of registered passive grabs\n");
 }
@@ -640,10 +640,10 @@ CreateRootWindow(ScreenPtr pScreen)
     /*  security creation/labeling check
      */
     if (XaceHook(XACE_RESOURCE_ACCESS, serverClient, pWin->drawable.id,
-                 RT_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixCreateAccess))
+                 X11_RESTYPE_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixCreateAccess))
         return FALSE;
 
-    if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin))
+    if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW, (void *) pWin))
         return FALSE;
 
     if (disableBackingStore)
@@ -868,8 +868,8 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
 
     /*  security creation/labeling check
      */
-    *error = XaceHook(XACE_RESOURCE_ACCESS, client, wid, RT_WINDOW, pWin,
-                      RT_WINDOW, pWin->parent,
+    *error = XaceHook(XACE_RESOURCE_ACCESS, client, wid, X11_RESTYPE_WINDOW, pWin,
+                      X11_RESTYPE_WINDOW, pWin->parent,
                       DixCreateAccess | DixSetAttrAccess);
     if (*error != Success) {
         dixFreeObjectWithPrivates(pWin, PRIVATE_WINDOW);
@@ -1043,7 +1043,7 @@ CrushTree(WindowPtr pWin)
                 event.u.destroyNotify.window = pChild->drawable.id;
                 DeliverEvents(pChild, &event, 1, NullWindow);
             }
-            FreeResource(pChild->drawable.id, RT_WINDOW);
+            FreeResource(pChild->drawable.id, X11_RESTYPE_WINDOW);
             pSib = pChild->nextSib;
             pChild->viewable = FALSE;
             if (pChild->realized) {
@@ -1117,7 +1117,7 @@ DestroySubwindows(WindowPtr pWin, ClientPtr client)
     UnmapSubwindows(pWin);
     while (pWin->lastChild) {
         int rc = XaceHook(XACE_RESOURCE_ACCESS, client,
-                          pWin->lastChild->drawable.id, RT_WINDOW,
+                          pWin->lastChild->drawable.id, X11_RESTYPE_WINDOW,
                           pWin->lastChild, X11_RESTYPE_NONE, NULL, DixDestroyAccess);
 
         if (rc != Success)
@@ -1219,7 +1219,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
             }
             else {
                 rc = dixLookupResourceByType((void **) &pPixmap, pixID,
-                                             RT_PIXMAP, client, DixReadAccess);
+                                             X11_RESTYPE_PIXMAP, client, DixReadAccess);
                 if (rc == Success) {
                     if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
                         (pPixmap->drawable.pScreen != pScreen)) {
@@ -1272,7 +1272,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
                     pixID = pWin->parent->border.pixmap->drawable.id;
                 }
             }
-            rc = dixLookupResourceByType((void **) &pPixmap, pixID, RT_PIXMAP,
+            rc = dixLookupResourceByType((void **) &pPixmap, pixID, X11_RESTYPE_PIXMAP,
                                          client, DixReadAccess);
             if (rc == Success) {
                 if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
@@ -1399,7 +1399,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
             }
             if (val == xTrue) {
                 rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id,
-                              RT_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixGrabAccess);
+                              X11_RESTYPE_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixGrabAccess);
                 if (rc != Success) {
                     error = rc;
                     client->errorValue = pWin->drawable.id;
@@ -1424,7 +1424,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
                 error = BadMatch;
                 goto PatchUp;
             }
-            rc = dixLookupResourceByType((void **) &pCmap, cmap, RT_COLORMAP,
+            rc = dixLookupResourceByType((void **) &pCmap, cmap, X11_RESTYPE_COLORMAP,
                                          client, DixUseAccess);
             if (rc != Success) {
                 error = rc;
@@ -2665,7 +2665,7 @@ MapWindow(WindowPtr pWin, ClientPtr client)
         return Success;
 
     /* general check for permission to map window */
-    if (XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW,
+    if (XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, X11_RESTYPE_WINDOW,
                  pWin, X11_RESTYPE_NONE, NULL, DixShowAccess) != Success)
         return Success;
 
@@ -3294,7 +3294,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
     if (!pWin)
         return FALSE;
 
-    if (!AddResource(pWin->drawable.id, RT_WINDOW,
+    if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW,
                      (void *) pScreen->screensaver.pWindow))
         return FALSE;
 
diff --git a/dri3/dri3_request.c b/dri3/dri3_request.c
index e45e3d9bb..27d3c73a7 100644
--- a/dri3/dri3_request.c
+++ b/dri3/dri3_request.c
@@ -238,14 +238,14 @@ proc_dri3_pixmap_from_buffer(ClientPtr client)
     pixmap->drawable.id = stuff->pixmap;
 
     /* security creation/labeling check */
-    rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,
+    rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, X11_RESTYPE_PIXMAP,
                   pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
 
     if (rc != Success) {
         (*drawable->pScreen->DestroyPixmap) (pixmap);
         return rc;
     }
-    if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pixmap))
+    if (!AddResource(stuff->pixmap, X11_RESTYPE_PIXMAP, (void *) pixmap))
         return BadAlloc;
 
     return Success;
@@ -266,7 +266,7 @@ proc_dri3_buffer_from_pixmap(ClientPtr client)
     PixmapPtr pixmap;
 
     REQUEST_SIZE_MATCH(xDRI3BufferFromPixmapReq);
-    rc = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, RT_PIXMAP,
+    rc = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, X11_RESTYPE_PIXMAP,
                                  client, DixWriteAccess);
     if (rc != Success) {
         client->errorValue = stuff->pixmap;
@@ -502,14 +502,14 @@ proc_dri3_pixmap_from_buffers(ClientPtr client)
     pixmap->drawable.id = stuff->pixmap;
 
     /* security creation/labeling check */
-    rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,
+    rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, X11_RESTYPE_PIXMAP,
                   pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
 
     if (rc != Success) {
         (*screen->DestroyPixmap) (pixmap);
         return rc;
     }
-    if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pixmap))
+    if (!AddResource(stuff->pixmap, X11_RESTYPE_PIXMAP, (void *) pixmap))
         return BadAlloc;
 
     return Success;
@@ -532,7 +532,7 @@ proc_dri3_buffers_from_pixmap(ClientPtr client)
     PixmapPtr pixmap;
 
     REQUEST_SIZE_MATCH(xDRI3BuffersFromPixmapReq);
-    rc = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, RT_PIXMAP,
+    rc = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, X11_RESTYPE_PIXMAP,
                                  client, DixWriteAccess);
     if (rc != Success) {
         client->errorValue = stuff->pixmap;
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 9ad99da8e..651e8d39b 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1395,7 +1395,7 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
     if (!pPixmap)
         return BadAlloc;
 
-    err = XaceHook(XACE_RESOURCE_ACCESS, client, glxDrawableId, RT_PIXMAP,
+    err = XaceHook(XACE_RESOURCE_ACCESS, client, glxDrawableId, X11_RESTYPE_PIXMAP,
                    pPixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
     if (err != Success) {
         (*pGlxScreen->pScreen->DestroyPixmap) (pPixmap);
@@ -1406,7 +1406,7 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
      * resource so it and the DRI2 drawable will be reclaimed when the
      * pbuffer is destroyed. */
     pPixmap->drawable.id = glxDrawableId;
-    if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap))
+    if (!AddResource(pPixmap->drawable.id, X11_RESTYPE_PIXMAP, pPixmap))
         return BadAlloc;
 
     return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable,
diff --git a/glx/glxext.c b/glx/glxext.c
index c3f67a5ec..585f64eda 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -308,7 +308,7 @@ GetGLXDrawableBytes(void *value, XID id, ResourceSizePtr size)
     size->refCnt = 1;
 
     if (draw->type == GLX_DRAWABLE_PIXMAP) {
-        SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP);
+        SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(X11_RESTYPE_PIXMAP);
         ResourceSizeRec pixmapSize = { 0, };
         pixmapSizeFunc((PixmapPtr)draw->pDraw, draw->pDraw->id, &pixmapSize);
         size->pixmapRefSize += pixmapSize.pixmapRefSize;
diff --git a/hw/kdrive/src/kcmap.c b/hw/kdrive/src/kcmap.c
index b8697ca63..2e65bdde4 100644
--- a/hw/kdrive/src/kcmap.c
+++ b/hw/kdrive/src/kcmap.c
@@ -169,7 +169,7 @@ KdUninstallColormap(ColormapPtr pCmap)
         return;
 
     /* install default */
-    dixLookupResourceByType((void **) &defMap, defMapID, RT_COLORMAP,
+    dixLookupResourceByType((void **) &defMap, defMapID, X11_RESTYPE_COLORMAP,
                             serverClient, DixInstallAccess);
     if (defMap)
         (*pCmap->pScreen->InstallColormap) (defMap);
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 7fa6b98c1..910141755 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -1459,7 +1459,7 @@ ProcXDGASetMode(ClientPtr client)
     DGA_SETCLIENT(stuff->screen, client);
 
     if (pPix) {
-        if (AddResource(stuff->pid, RT_PIXMAP, (void *) (pPix))) {
+        if (AddResource(stuff->pid, X11_RESTYPE_PIXMAP, (void *) (pPix))) {
             pPix->drawable.id = (int) stuff->pid;
             rep.flags = DGA_PIXMAP_AVAILABLE;
         }
@@ -1537,7 +1537,7 @@ ProcXDGAInstallColormap(ClientPtr client)
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    rc = dixLookupResourceByType((void **) &cmap, stuff->cmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &cmap, stuff->cmap, X11_RESTYPE_COLORMAP,
                                  client, DixInstallAccess);
     if (rc != Success)
         return rc;
@@ -1973,7 +1973,7 @@ ProcXF86DGAInstallColormap(ClientPtr client)
     if (!DGAActive(stuff->screen))
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP,
+    rc = dixLookupResourceByType((void **) &pcmp, stuff->id, X11_RESTYPE_COLORMAP,
                                  client, DixInstallAccess);
     if (rc == Success) {
         DGAInstallCmap(pcmp);
diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index 501125671..152b5821a 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -219,7 +219,7 @@ xf86HandleColormaps(ScreenPtr pScreen,
 
     /* get the default map */
     dixLookupResourceByType((void **) &pDefMap, pScreen->defColormap,
-                            RT_COLORMAP, serverClient, DixInstallAccess);
+                            X11_RESTYPE_COLORMAP, serverClient, DixInstallAccess);
 
     if (!CMapAllocateColormapPrivate(pDefMap)) {
         CMapUnwrapScreen(pScreen);
diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c
index 7a1d9333a..bb829847e 100644
--- a/hw/xnest/Color.c
+++ b/hw/xnest/Color.c
@@ -252,11 +252,11 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
 
             if (visual == xnestDefaultVisual(pScreen))
                 dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
-                                        RT_COLORMAP, serverClient,
+                                        X11_RESTYPE_COLORMAP, serverClient,
                                         DixUseAccess);
             else
                 dixLookupResourceByType((void **) &pCmap,
-                                        pScreen->defColormap, RT_COLORMAP,
+                                        pScreen->defColormap, X11_RESTYPE_COLORMAP,
                                         serverClient, DixUseAccess);
 
             XSetWindowColormap(xnestDisplay,
@@ -308,7 +308,7 @@ xnestDirectInstallColormaps(ScreenPtr pScreen)
     for (i = 0; i < n; i++) {
         ColormapPtr pCmap;
 
-        dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], RT_COLORMAP,
+        dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], X11_RESTYPE_COLORMAP,
                                 serverClient, DixInstallAccess);
         if (pCmap)
             XInstallColormap(xnestDisplay, xnestColormap(pCmap));
@@ -329,7 +329,7 @@ xnestDirectUninstallColormaps(ScreenPtr pScreen)
     for (i = 0; i < n; i++) {
         ColormapPtr pCmap;
 
-        dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], RT_COLORMAP,
+        dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], X11_RESTYPE_COLORMAP,
                                 serverClient, DixUninstallAccess);
         if (pCmap)
             XUninstallColormap(xnestDisplay, xnestColormap(pCmap));
@@ -365,7 +365,7 @@ xnestUninstallColormap(ColormapPtr pCmap)
         if (pCmap->mid != pCmap->pScreen->defColormap) {
             dixLookupResourceByType((void **) &pCurCmap,
                                     pCmap->pScreen->defColormap,
-                                    RT_COLORMAP,
+                                    X11_RESTYPE_COLORMAP,
                                     serverClient, DixInstallAccess);
             (*pCmap->pScreen->InstallColormap) (pCurCmap);
         }
diff --git a/hw/xnest/Window.c b/hw/xnest/Window.c
index 7b410c4a3..932db760c 100644
--- a/hw/xnest/Window.c
+++ b/hw/xnest/Window.c
@@ -99,7 +99,7 @@ xnestCreateWindow(WindowPtr pWin)
                 mask |= CWColormap;
                 if (pWin->optional->colormap) {
                     dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
-                                            RT_COLORMAP, serverClient,
+                                            X11_RESTYPE_COLORMAP, serverClient,
                                             DixUseAccess);
                     attributes.colormap = xnestColormap(pCmap);
                 }
@@ -112,7 +112,7 @@ xnestCreateWindow(WindowPtr pWin)
         else {                  /* root windows have their own colormaps at creation time */
             visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
             dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
-                                    RT_COLORMAP, serverClient, DixUseAccess);
+                                    X11_RESTYPE_COLORMAP, serverClient, DixUseAccess);
             mask |= CWColormap;
             attributes.colormap = xnestColormap(pCmap);
         }
@@ -334,7 +334,7 @@ xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
         ColormapPtr pCmap;
 
         dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
-                                RT_COLORMAP, serverClient, DixUseAccess);
+                                X11_RESTYPE_COLORMAP, serverClient, DixUseAccess);
 
         attributes.colormap = xnestColormap(pCmap);
 
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 65f9e6311..9ad0cc66f 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -1592,7 +1592,7 @@ xwl_keyboard_search_window(ClientPtr client)
 {
     WindowPtr window = NullWindow;
 
-    FindClientResourcesByType(client, RT_WINDOW, find_toplevel_callback, &window);
+    FindClientResourcesByType(client, X11_RESTYPE_WINDOW, find_toplevel_callback, &window);
 
     return window;
 }
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 6e263dde6..7449ba193 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -477,7 +477,7 @@ xwl_output_set_randr_emu_props(struct xwl_screen *xwl_screen, ClientPtr client)
     struct xwl_output_randr_emu_prop prop = {};
 
     xwl_output_randr_emu_prop(xwl_screen, client, &prop);
-    FindClientResourcesByType(client, RT_WINDOW,
+    FindClientResourcesByType(client, X11_RESTYPE_WINDOW,
                               xwl_output_set_randr_emu_prop_callback, &prop);
 }
 
diff --git a/hw/xwin/wincmap.c b/hw/xwin/wincmap.c
index 0df14c0f5..df69ba78b 100644
--- a/hw/xwin/wincmap.c
+++ b/hw/xwin/wincmap.c
@@ -178,7 +178,7 @@ winUninstallColormap(ColormapPtr pmap)
     /* Install the default cmap in place of the cmap to be uninstalled */
     if (pmap->mid != pmap->pScreen->defColormap) {
         dixLookupResourceByType((void *) &curpmap, pmap->pScreen->defColormap,
-                                RT_COLORMAP, NullClient, DixUnknownAccess);
+                                X11_RESTYPE_COLORMAP, NullClient, DixUnknownAccess);
         (*pmap->pScreen->InstallColormap) (curpmap);
     }
 }
diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index 030546527..4aca28930 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -717,7 +717,7 @@ winGetWindowID(WindowPtr pWin)
     ClientPtr c = wClient(pWin);
 
     /* */
-    FindClientResourcesByType(c, RT_WINDOW, winFindWindow, &wi);
+    FindClientResourcesByType(c, X11_RESTYPE_WINDOW, winFindWindow, &wi);
 
 #if ENABLE_DEBUG
     ErrorF("winGetWindowID - Window ID: %u\n", (unsigned int)wi.id);
diff --git a/include/resource.h b/include/resource.h
index 4e3980153..a48735ba0 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -73,21 +73,29 @@ typedef uint32_t RESTYPE;
 
 // prevent namespace clash with Windows
 #define X11_RESTYPE_NONE	((RESTYPE)0)
+#define X11_RESTYPE_WINDOW	((RESTYPE)1|RC_DRAWABLE)
+#define X11_RESTYPE_PIXMAP	((RESTYPE)2|RC_DRAWABLE)
+#define X11_RESTYPE_GC		((RESTYPE)3)
 #define X11_RESTYPE_FONT	((RESTYPE)4)
 #define X11_RESTYPE_CURSOR	((RESTYPE)5)
-
-#define RT_WINDOW	((RESTYPE)1|RC_DRAWABLE)
-#define RT_PIXMAP	((RESTYPE)2|RC_DRAWABLE)
-#define RT_GC		((RESTYPE)3)
+#define X11_RESTYPE_COLORMAP	((RESTYPE)6)
+#define X11_RESTYPE_CMAPENTRY	((RESTYPE)7)
+#define X11_RESTYPE_OTHERCLIENT	((RESTYPE)8|RC_NEVERRETAIN)
+#define X11_RESTYPE_PASSIVEGRAB	((RESTYPE)9|RC_NEVERRETAIN)
+#define X11_RESTYPE_LASTPREDEF	((RESTYPE)9)
+
+#define RT_WINDOW	X11_RESTYPE_WINDOW
+#define RT_PIXMAP	X11_RESTYPE_PIXMAP
+#define RT_GC		X11_RESTYPE_GC
 #undef RT_FONT
 #undef RT_CURSOR
 #define RT_FONT		X11_RESTYPE_FONT
 #define RT_CURSOR	X11_RESTYPE_CURSOR
-#define RT_COLORMAP	((RESTYPE)6)
-#define RT_CMAPENTRY	((RESTYPE)7)
-#define RT_OTHERCLIENT	((RESTYPE)8|RC_NEVERRETAIN)
-#define RT_PASSIVEGRAB	((RESTYPE)9|RC_NEVERRETAIN)
-#define RT_LASTPREDEF	((RESTYPE)9)
+#define RT_COLORMAP	X11_RESTYPE_COLORMAP
+#define RT_CMAPENTRY	X11_RESTYPE_CMAPENTRY
+#define RT_OTHERCLIENT	X11_RESTYPE_OTHERCLIENT
+#define RT_PASSIVEGRAB	X11_RESTYPE_PASSIVEGRAB
+#define RT_LASTPREDEF	X11_RESTYPE_LASTPREDEF
 #define RT_NONE		X11_RESTYPE_NONE
 
 
diff --git a/mi/micmap.c b/mi/micmap.c
index 0bbe4f70d..b4fbbe712 100644
--- a/mi/micmap.c
+++ b/mi/micmap.c
@@ -77,7 +77,7 @@ miUninstallColormap(ColormapPtr pmap)
         if (pmap->mid != pmap->pScreen->defColormap) {
             dixLookupResourceByType((void **) &curpmap,
                                     pmap->pScreen->defColormap,
-                                    RT_COLORMAP, serverClient, DixUseAccess);
+                                    X11_RESTYPE_COLORMAP, serverClient, DixUseAccess);
             (*pmap->pScreen->InstallColormap) (curpmap);
         }
     }
diff --git a/present/present_request.c b/present/present_request.c
index ff1d71cc4..cc947b11b 100644
--- a/present/present_request.c
+++ b/present/present_request.c
@@ -120,7 +120,7 @@ proc_present_pixmap_common(ClientPtr client,
     ret = dixLookupWindow(&window, req_window, client, DixWriteAccess);
     if (ret != Success)
         return ret;
-    ret = dixLookupResourceByType((void **) &pixmap, req_pixmap, RT_PIXMAP, client, DixReadAccess);
+    ret = dixLookupResourceByType((void **) &pixmap, req_pixmap, X11_RESTYPE_PIXMAP, client, DixReadAccess);
     if (ret != Success)
         return ret;
 
diff --git a/render/picture.c b/render/picture.c
index 6f139b520..45498b093 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -422,7 +422,7 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format)
 
     if (format->index.vid == pScreen->rootVisual) {
         dixLookupResourceByType((void **) &format->index.pColormap,
-                                pScreen->defColormap, RT_COLORMAP,
+                                pScreen->defColormap, X11_RESTYPE_COLORMAP,
                                 serverClient, DixGetAttrAccess);
     }
     else {
@@ -590,7 +590,7 @@ GetPictureBytes(void *value, XID id, ResourceSizePtr size)
     size->pixmapRefSize = 0;
     if (picture->pDrawable && (picture->pDrawable->type == DRAWABLE_PIXMAP))
     {
-        SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP);
+        SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(X11_RESTYPE_PIXMAP);
         ResourceSizeRec pixmapSize = { 0, 0, 0 };
         PixmapPtr pixmap = (PixmapPtr)picture->pDrawable;
         pixmapSizeFunc(pixmap, pixmap->drawable.id, &pixmapSize);
@@ -761,7 +761,7 @@ CreatePicture(Picture pid,
 
     /* security creation/labeling check */
     *error = XaceHook(XACE_RESOURCE_ACCESS, client, pid, PictureType, pPicture,
-                      RT_PIXMAP, pDrawable, DixCreateAccess | DixSetAttrAccess);
+                      X11_RESTYPE_PIXMAP, pDrawable, DixCreateAccess | DixSetAttrAccess);
     if (*error != Success)
         goto out;
 
@@ -1028,7 +1028,7 @@ cpClipMask(void **result, XID id, ScreenPtr screen, ClientPtr client, Mask mode)
         id = res->info[screen->myNum].id;
     }
 #endif
-    return dixLookupResourceByType(result, id, RT_PIXMAP, client, mode);
+    return dixLookupResourceByType(result, id, X11_RESTYPE_PIXMAP, client, mode);
 }
 
 #define NEXT_VAL(_type) (vlist ? (_type) *vlist++ : (_type) ulist++->val)
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 7d5d70ad8..51c7b3010 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -597,7 +597,9 @@ typedef struct {
 } ReplaceCursorLookupRec, *ReplaceCursorLookupPtr;
 
 static const RESTYPE CursorRestypes[] = {
-    RT_WINDOW, RT_PASSIVEGRAB, X11_RESTYPE_CURSOR
+    X11_RESTYPE_WINDOW,
+    X11_RESTYPE_PASSIVEGRAB,
+    X11_RESTYPE_CURSOR
 };
 
 static Bool
@@ -610,14 +612,14 @@ ReplaceCursorLookup(void *value, XID id, void *closure)
     XID cursor = 0;
 
     switch (rcl->type) {
-    case RT_WINDOW:
+    case X11_RESTYPE_WINDOW:
         pWin = (WindowPtr) value;
         if (pWin->optional) {
             pCursorRef = &pWin->optional->cursor;
             pCursor = *pCursorRef;
         }
         break;
-    case RT_PASSIVEGRAB:
+    case X11_RESTYPE_PASSIVEGRAB:
         pGrab = (GrabPtr) value;
         pCursorRef = &pGrab->cursor;
         pCursor = *pCursorRef;
@@ -856,7 +858,7 @@ ProcXFixesHideCursor(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xXFixesHideCursorReq);
 
-    ret = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW,
+    ret = dixLookupResourceByType((void **) &pWin, stuff->window, X11_RESTYPE_WINDOW,
                                   client, DixGetAttrAccess);
     if (ret != Success) {
         client->errorValue = stuff->window;
@@ -920,7 +922,7 @@ ProcXFixesShowCursor(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xXFixesShowCursorReq);
 
-    rc = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW,
+    rc = dixLookupResourceByType((void **) &pWin, stuff->window, X11_RESTYPE_WINDOW,
                                  client, DixGetAttrAccess);
     if (rc != Success) {
         client->errorValue = stuff->window;
diff --git a/xfixes/region.c b/xfixes/region.c
index 81a0dfcd0..4595f8f2d 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -117,7 +117,7 @@ ProcXFixesCreateRegionFromBitmap(ClientPtr client)
     REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq);
     LEGAL_NEW_RESOURCE(stuff->region, client);
 
-    rc = dixLookupResourceByType((void **) &pPixmap, stuff->bitmap, RT_PIXMAP,
+    rc = dixLookupResourceByType((void **) &pPixmap, stuff->bitmap, X11_RESTYPE_PIXMAP,
                                  client, DixReadAccess);
     if (rc != Success) {
         client->errorValue = stuff->bitmap;
@@ -161,7 +161,7 @@ ProcXFixesCreateRegionFromWindow(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq);
     LEGAL_NEW_RESOURCE(stuff->region, client);
-    rc = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW,
+    rc = dixLookupResourceByType((void **) &pWin, stuff->window, X11_RESTYPE_WINDOW,
                                  client, DixGetAttrAccess);
     if (rc != Success) {
         client->errorValue = stuff->window;
@@ -652,7 +652,7 @@ ProcXFixesSetWindowShapeRegion(ClientPtr client)
     REQUEST(xXFixesSetWindowShapeRegionReq);
 
     REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
-    rc = dixLookupResourceByType((void **) &pWin, stuff->dest, RT_WINDOW,
+    rc = dixLookupResourceByType((void **) &pWin, stuff->dest, X11_RESTYPE_WINDOW,
                                  client, DixSetAttrAccess);
     if (rc != Success) {
         client->errorValue = stuff->dest;
commit 1ca48d0a48dbec38d2765d8626f7983751226966
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date:   Mon Mar 11 10:08:13 2024 +0100

    dix: workaround for win32 name clash on CreateWindow()
    
    The problem is, ming32 headers unconditionally define CreateWindow() to
    alias CreateWindowA() in winuser.h, which is included by windows.h, which
    is included by *a lot* common headers. So it highly depends on the exact
    include order, whether it works. (also weird things could happen, e.g.
    the Xserver's CreateWindow() ending up renamed to CreateWindowA(), ...)
    
    Until we've found a really clean solution to this problem (which might
    involve fixing mingw32 first), just add a little workaround by undef'ing
    CreateWindow symbol whereever necessary.
    
    Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
    Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 04a50259d..aeb9d0717 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -132,6 +132,9 @@ Equipment Corporation.
 #include "client.h"
 #include "xfixesint.h"
 
+// temporary workaround for win32/mingw32 name clash
+#undef CreateWindow
+
 #ifdef XSERVER_DTRACE
 #include "probes.h"
 #endif
commit 232cad9ec36631379b23ce29d577332f82565803
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date:   Mon Mar 4 15:08:32 2024 +0100

    prevent name clash on Windows w/ RT_* defines
    
    Windows' native headers using some our RT_* define's names for other things.
    Since the naming isn't very nice anyways, introducing some new ones
    (X11_RESTYPE_NONE, X11_RESTYPE_FONT, X11_RESTYPE_CURSOR) and define the old
    ones as an alias to them, in case some out-of-tree code still uses them.
    
    With thins change, we don't need to be so extremely careful about include
    ordering and have explicit #undef's in order to prevent name clashes on
    Win32 targets.
    
    Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
    Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>

diff --git a/Xext/dpms.c b/Xext/dpms.c
index a0df33f3d..bbc7890eb 100644
--- a/Xext/dpms.c
+++ b/Xext/dpms.c
@@ -163,7 +163,7 @@ ProcDPMSSelectInput(register ClientPtr client)
             pHead = (DPMSEventPtr *)malloc(sizeof(DPMSEventPtr));
             if (!pHead ||
                     !AddResource(eventResource, DPMSEventType, (void *)pHead)) {
-                FreeResource(clientResource, RT_NONE);
+                FreeResource(clientResource, X11_RESTYPE_NONE);
                 return BadAlloc;
             }
             *pHead = 0;
diff --git a/Xext/saver.c b/Xext/saver.c
index d9f0c9a64..17d74772e 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -475,7 +475,7 @@ CreateSaverWindow(ScreenPtr pScreen)
     pSaver = &pScreen->screensaver;
     if (pSaver->pWindow) {
         pSaver->pWindow = NullWindow;
-        FreeResource(pSaver->wid, RT_NONE);
+        FreeResource(pSaver->wid, X11_RESTYPE_NONE);
         if (pPriv) {
             UninstallSaverColormap(pScreen);
             pPriv->hasWindow = FALSE;
@@ -519,7 +519,7 @@ CreateSaverWindow(ScreenPtr pScreen)
         CursorPtr cursor;
         if (!pWin->optional)
             if (!MakeWindowOptional(pWin)) {
-                FreeResource(pWin->drawable.id, RT_NONE);
+                FreeResource(pWin->drawable.id, X11_RESTYPE_NONE);
                 return FALSE;
             }
         cursor = RefCursor(pAttr->pCursor);
@@ -571,7 +571,7 @@ DestroySaverWindow(ScreenPtr pScreen)
     pSaver = &pScreen->screensaver;
     if (pSaver->pWindow) {
         pSaver->pWindow = NullWindow;
-        FreeResource(pSaver->wid, RT_NONE);
+        FreeResource(pSaver->wid, X11_RESTYPE_NONE);
     }
     pPriv->hasWindow = FALSE;
     CheckScreenPrivate(pScreen);
@@ -1035,7 +1035,7 @@ ScreenSaverSetAttributes(ClientPtr client)
             }
             else {
                 ret = dixLookupResourceByType((void **) &pCursor, cursorID,
-                                              RT_CURSOR, client, DixUseAccess);
+                                              X11_RESTYPE_CURSOR, client, DixUseAccess);
                 if (ret != Success) {
                     client->errorValue = cursorID;
                     goto PatchUp;
@@ -1232,7 +1232,7 @@ ProcScreenSaverSuspend(ClientPtr client)
         if (suspend == TRUE)
             this->count++;
         else if (--this->count == 0)
-            FreeResource(this->clientResource, RT_NONE);
+            FreeResource(this->clientResource, X11_RESTYPE_NONE);
 
         return Success;
     }
diff --git a/Xext/security.c b/Xext/security.c
index 6a9c3d509..49e97a0ca 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -202,7 +202,7 @@ SecurityDeleteAuthorization(void *value, XID id)
             .authId = pAuth->id
         };
         WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
-        FreeResource(pEventClient->resource, RT_NONE);
+        FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
     }
 
     /* kill all clients using this auth */
@@ -308,7 +308,7 @@ SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, void *pval)
                                                    pAuth->secondsRemaining);
     }
     else {
-        FreeResource(pAuth->id, RT_NONE);
+        FreeResource(pAuth->id, X11_RESTYPE_NONE);
         return 0;
     }
 }                               /* SecurityAuthorizationExpired */
@@ -372,7 +372,7 @@ SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
          pEventClient; pEventClient = pEventClient->next) {
         if (SameClient(pEventClient, client)) {
             if (mask == 0)
-                FreeResource(pEventClient->resource, RT_NONE);
+                FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
             else
                 pEventClient->mask = mask;
             return Success;
@@ -584,7 +584,7 @@ ProcSecurityRevokeAuthorization(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    FreeResource(stuff->authId, RT_NONE);
+    FreeResource(stuff->authId, X11_RESTYPE_NONE);
     return Success;
 }                               /* ProcSecurityRevokeAuthorization */
 
diff --git a/Xext/shape.c b/Xext/shape.c
index 9d46cd3d6..0e86b8f83 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -786,7 +786,7 @@ ProcShapeSelectInput(ClientPtr client)
             if (!pHead ||
                 !AddResource(pWin->drawable.id, ShapeEventType,
                              (void *) pHead)) {
-                FreeResource(clientResource, RT_NONE);
+                FreeResource(clientResource, X11_RESTYPE_NONE);
                 return BadAlloc;
             }
             *pHead = 0;
diff --git a/Xext/shm.c b/Xext/shm.c
index e8a8dd460..b418f53a5 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -464,7 +464,7 @@ ProcShmDetach(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xShmDetachReq);
     VERIFY_SHMSEG(stuff->shmseg, shmdesc, client);
-    FreeResource(stuff->shmseg, RT_NONE);
+    FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
     return Success;
 }
 
@@ -1002,7 +1002,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
 
         if (pMap) {
             result = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid,
-                              RT_PIXMAP, pMap, RT_NONE, NULL, DixCreateAccess);
+                              RT_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
             if (result != Success) {
                 pDraw->pScreen->DestroyPixmap(pMap);
                 break;
@@ -1024,7 +1024,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
 
     if (result != Success) {
         while (j--)
-            FreeResource(newPix->info[j].id, RT_NONE);
+            FreeResource(newPix->info[j].id, X11_RESTYPE_NONE);
         free(newPix);
     }
     else
@@ -1117,7 +1117,7 @@ ProcShmCreatePixmap(ClientPtr client)
                                                    stuff->offset);
     if (pMap) {
         rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
-                      pMap, RT_NONE, NULL, DixCreateAccess);
+                      pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
         if (rc != Success) {
             pDraw->pScreen->DestroyPixmap(pMap);
             return rc;
@@ -1144,7 +1144,7 @@ ShmBusfaultNotify(void *context)
            (unsigned int) shmdesc->resource);
     busfault_unregister(shmdesc->busfault);
     shmdesc->busfault = NULL;
-    FreeResource (shmdesc->resource, RT_NONE);
+    FreeResource (shmdesc->resource, X11_RESTYPE_NONE);
 }
 
 static int
@@ -1326,7 +1326,7 @@ ProcShmCreateSegment(ClientPtr client)
     }
 
     if (WriteFdToClient(client, fd, TRUE) < 0) {
-        FreeResource(stuff->shmseg, RT_NONE);
+        FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
         close(fd);
         return BadAlloc;
     }
diff --git a/Xext/sleepuntil.c b/Xext/sleepuntil.c
index 334c2784a..3ff7a1d04 100644
--- a/Xext/sleepuntil.c
+++ b/Xext/sleepuntil.c
@@ -166,7 +166,7 @@ SertafiedBlockHandler(void *data, void *wt)
         pNext = pReq->next;
         if (CompareTimeStamps(pReq->revive, now) == LATER)
             break;
-        FreeResource(pReq->id, RT_NONE);
+        FreeResource(pReq->id, X11_RESTYPE_NONE);
 
         /* AttendClient() may have been called via the resource delete
          * function so a client may have input to be processed and so
@@ -195,7 +195,7 @@ SertafiedWakeupHandler(void *data, int i)
         pNext = pReq->next;
         if (CompareTimeStamps(pReq->revive, now) == LATER)
             break;
-        FreeResource(pReq->id, RT_NONE);
+        FreeResource(pReq->id, X11_RESTYPE_NONE);
     }
     if (!pPending) {
         RemoveBlockAndWakeupHandlers(SertafiedBlockHandler,
diff --git a/Xext/sync.c b/Xext/sync.c
index 7a814a479..950951e74 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -696,7 +696,7 @@ SyncAwaitTriggerFired(SyncTrigger * pTrigger)
     /* unblock the client */
     AttendClient(pAwaitUnion->header.client);
     /* delete the await */
-    FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
+    FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
 }
 
 static int64_t
@@ -751,7 +751,7 @@ SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
              * nothing, since it's already got them.
              */
             if (!wantevents) {
-                FreeResource(pClients->delete_id, RT_NONE);
+                FreeResource(pClients->delete_id, X11_RESTYPE_NONE);
             }
             return Success;
         }
@@ -934,7 +934,7 @@ SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL
 
     status = miSyncInitFenceFromFD(pDraw, pFence, fd, initially_triggered);
     if (status != Success) {
-        FreeResource(pFence->sync.id, RT_NONE);
+        FreeResource(pFence->sync.id, X11_RESTYPE_NONE);
         return status;
     }
 
@@ -992,7 +992,7 @@ SyncCreateSystemCounter(const char *name,
 
         psci = malloc(sizeof(SysCounterInfo));
         if (!psci) {
-            FreeResource(pCounter->sync.id, RT_NONE);
+            FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
             return pCounter;
         }
         pCounter->pSysCounterInfo = psci;
@@ -1015,7 +1015,7 @@ SyncDestroySystemCounter(void *pSysCounter)
 {
     SyncCounter *pCounter = (SyncCounter *) pSysCounter;
 
-    FreeResource(pCounter->sync.id, RT_NONE);
+    FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
 }
 
 static void
@@ -1128,7 +1128,7 @@ FreeAlarm(void *addr, XID id)
     /* delete event selections */
 
     while (pAlarm->pEventClients)
-        FreeResource(pAlarm->pEventClients->delete_id, RT_NONE);
+        FreeResource(pAlarm->pEventClients->delete_id, X11_RESTYPE_NONE);
 
     SyncDeleteTriggerFromSyncObject(&pAlarm->trigger);
 
@@ -1493,7 +1493,7 @@ ProcSyncDestroyCounter(ClientPtr client)
         client->errorValue = stuff->counter;
         return BadAccess;
     }
-    FreeResource(pCounter->sync.id, RT_NONE);
+    FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
     return Success;
 }
 
@@ -1594,7 +1594,7 @@ ProcSyncAwait(ClientPtr client)
             /*  this should take care of removing any triggers created by
              *  this request that have already been registered on sync objects
              */
-            FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
+            FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
             client->errorValue = pProtocolWaitConds->counter;
             return SyncErrorBase + XSyncBadCounter;
         }
@@ -1614,7 +1614,7 @@ ProcSyncAwait(ClientPtr client)
             /*  this should take care of removing any triggers created by
              *  this request that have already been registered on sync objects
              */
-            FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
+            FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
             return status;
         }
         /* this is not a mistake -- same function works for both cases */
@@ -1745,7 +1745,7 @@ ProcSyncCreateAlarm(ClientPtr client)
 
         if (!SyncCheckWarnIsCounter(pTrigger->pSync,
                                     WARN_INVALID_COUNTER_ALARM)) {
-            FreeResource(stuff->id, RT_NONE);
+            FreeResource(stuff->id, X11_RESTYPE_NONE);
             return BadAlloc;
         }
 
@@ -1876,7 +1876,7 @@ ProcSyncDestroyAlarm(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    FreeResource(stuff->alarm, RT_NONE);
+    FreeResource(stuff->alarm, X11_RESTYPE_NONE);
     return Success;
 }
 
@@ -1981,7 +1981,7 @@ ProcSyncDestroyFence(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    FreeResource(stuff->fid, RT_NONE);
+    FreeResource(stuff->fid, X11_RESTYPE_NONE);
     return Success;
 }
 
@@ -2059,7 +2059,7 @@ ProcSyncAwaitFence(ClientPtr client)
             /*  this should take care of removing any triggers created by
              *  this request that have already been registered on sync objects
              */
-            FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
+            FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
             client->errorValue = *pProtocolFences;
             return SyncErrorBase + XSyncBadFence;
         }
@@ -2078,7 +2078,7 @@ ProcSyncAwaitFence(ClientPtr client)
             /*  this should take care of removing any triggers created by
              *  this request that have already been registered on sync objects
              */
-            FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
+            FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
             return status;
         }
         /* this is not a mistake -- same function works for both cases */
diff --git a/Xext/xselinux_label.c b/Xext/xselinux_label.c
index dd14617b1..3bb597ee2 100644
--- a/Xext/xselinux_label.c
+++ b/Xext/xselinux_label.c
@@ -325,9 +325,9 @@ SELinuxTypeToClass(RESTYPE type)
             class = SECCLASS_X_DRAWABLE;
         else if (type == RT_GC)
             class = SECCLASS_X_GC;
-        else if (type == RT_FONT)
+        else if (type == X11_RESTYPE_FONT)
             class = SECCLASS_X_FONT;
-        else if (type == RT_CURSOR)
+        else if (type == X11_RESTYPE_CURSOR)
             class = SECCLASS_X_CURSOR;
         else if (type == RT_COLORMAP)
             class = SECCLASS_X_COLORMAP;
diff --git a/Xext/xtest.c b/Xext/xtest.c
index a938d813a..fe2847bb1 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -131,7 +131,7 @@ ProcXTestCompareCursor(ClientPtr client)
         pCursor = GetSpriteCursor(ptr);
     else {
         rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
-                                     RT_CURSOR, client, DixReadAccess);
+                                     X11_RESTYPE_CURSOR, client, DixReadAccess);
         if (rc != Success) {
             client->errorValue = stuff->cursor;
             return rc;
diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index c7338b766..a1fb6238b 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -290,7 +290,7 @@ ProcXvMCDestroyContext(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    FreeResource(stuff->context_id, RT_NONE);
+    FreeResource(stuff->context_id, X11_RESTYPE_NONE);
 
     return Success;
 }
@@ -368,7 +368,7 @@ ProcXvMCDestroySurface(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    FreeResource(stuff->surface_id, RT_NONE);
+    FreeResource(stuff->surface_id, X11_RESTYPE_NONE);
 
     return Success;
 }
@@ -496,7 +496,7 @@ ProcXvMCDestroySubpicture(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    FreeResource(stuff->subpicture_id, RT_NONE);
+    FreeResource(stuff->subpicture_id, X11_RESTYPE_NONE);
 
     return Success;
 }
diff --git a/Xi/closedev.c b/Xi/closedev.c
index f68b5231a..af60d7e99 100644
--- a/Xi/closedev.c
+++ b/Xi/closedev.c
@@ -102,7 +102,7 @@ DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
         next = grab->next;
         if ((grab->device == dev) &&
             (client->clientAsMask == CLIENT_BITS(grab->resource)))
-            FreeResource(grab->resource, RT_NONE);
+            FreeResource(grab->resource, X11_RESTYPE_NONE);
     }
 }
 
diff --git a/Xi/exevents.c b/Xi/exevents.c
index e8267d3ea..7ef0f2df6 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1538,7 +1538,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
             l = &ti->listeners[ti->num_listeners - 1];
             l->listener = g->resource;
             l->grab = g;
-            //l->resource_type = RT_NONE;
+            //l->resource_type = X11_RESTYPE_NONE;
 
             if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin)
                 l->type = TOUCH_LISTENER_POINTER_GRAB;
@@ -2504,7 +2504,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
         cursor = NullCursor;
     else {
         rc = dixLookupResourceByType((void **) &cursor, param->cursor,
-                                     RT_CURSOR, client, DixUseAccess);
+                                     X11_RESTYPE_CURSOR, client, DixUseAccess);
         if (rc != Success) {
             client->errorValue = param->cursor;
             return rc;
@@ -2603,7 +2603,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
         cursor = NullCursor;
     else {
         rc = dixLookupResourceByType((void **) &cursor, param->cursor,
-                                     RT_CURSOR, client, DixUseAccess);
+                                     X11_RESTYPE_CURSOR, client, DixUseAccess);
         if (rc != Success) {
             client->errorValue = param->cursor;
             return rc;
@@ -2691,7 +2691,7 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
                     if (i == EMASKSIZE) {
                         RecalculateDeviceDeliverableEvents(pWin);
                         if (ShouldFreeInputMasks(pWin, FALSE))
-                            FreeResource(others->resource, RT_NONE);
+                            FreeResource(others->resource, X11_RESTYPE_NONE);
                         return Success;
                     }
                 }
@@ -3118,7 +3118,7 @@ DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources)
             ic = inputMasks->inputClients;
             for (i = 0; i < EMASKSIZE; i++)
                 inputMasks->dontPropagateMask[i] = 0;
-            FreeResource(ic->resource, RT_NONE);
+            FreeResource(ic->resource, X11_RESTYPE_NONE);
         }
 }
 
@@ -3241,7 +3241,7 @@ DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask,
     }
     RecalculateDeviceDeliverableEvents(pWin);
     if (ShouldFreeInputMasks(pWin, FALSE))
-        FreeResource(inputMasks->inputClients->resource, RT_NONE);
+        FreeResource(inputMasks->inputClients->resource, X11_RESTYPE_NONE);
     return Success;
 }
 
diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c
index 809a81a0a..da6964453 100644
--- a/Xi/xibarriers.c
+++ b/Xi/xibarriers.c
@@ -831,7 +831,7 @@ XIDestroyPointerBarrier(ClientPtr client,
     if (CLIENT_ID(stuff->barrier) != client->index)
         return BadAccess;
 
-    FreeResource(stuff->barrier, RT_NONE);
+    FreeResource(stuff->barrier, X11_RESTYPE_NONE);
     return Success;
 }
 
diff --git a/Xi/xichangecursor.c b/Xi/xichangecursor.c
index bfa2e777c..9f2a616d9 100644
--- a/Xi/xichangecursor.c
+++ b/Xi/xichangecursor.c
@@ -99,7 +99,7 @@ ProcXIChangeCursor(ClientPtr client)
     }
     else {
         rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
-                                     RT_CURSOR, client, DixUseAccess);
+                                     X11_RESTYPE_CURSOR, client, DixUseAccess);
         if (rc != Success)
             return rc;
     }
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index 6f1eca2a1..900a3e113 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -175,7 +175,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
 
     if (stuff->cursor != None) {
         ret = dixLookupResourceByType(&tmp, stuff->cursor,
-                                      RT_CURSOR, client, DixUseAccess);
+                                      X11_RESTYPE_CURSOR, client, DixUseAccess);
         if (ret != Success) {
             client->errorValue = stuff->cursor;
             goto out;
diff --git a/composite/compalloc.c b/composite/compalloc.c
index acd215002..f97b6c688 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -217,7 +217,7 @@ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
     }
 
     if (!compCheckRedirect(pWin)) {
-        FreeResource(ccw->id, RT_NONE);
+        FreeResource(ccw->id, X11_RESTYPE_NONE);
         return BadAlloc;
     }
 
@@ -329,7 +329,7 @@ compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
 
     for (ccw = cw->clients; ccw; ccw = ccw->next)
         if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) {
-            FreeResource(ccw->id, RT_NONE);
+            FreeResource(ccw->id, X11_RESTYPE_NONE);
             return Success;
         }
     return BadValue;
@@ -477,7 +477,7 @@ compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
         return BadValue;
     for (ccw = csw->clients; ccw; ccw = ccw->next)
         if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) {
-            FreeResource(ccw->id, RT_NONE);
+            FreeResource(ccw->id, X11_RESTYPE_NONE);
             return Success;
         }
     return BadValue;
diff --git a/composite/compext.c b/composite/compext.c
index 31ebbbf67..1f8194f80 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -265,7 +265,7 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
     if (pScreen->NameWindowPixmap) {
         rc = pScreen->NameWindowPixmap(pWin, pPixmap, stuff->pixmap);
         if (rc != Success) {
-            FreeResource(stuff->pixmap, RT_NONE);
+            FreeResource(stuff->pixmap, X11_RESTYPE_NONE);
             return rc;
         }
     }
@@ -302,14 +302,14 @@ ProcCompositeGetOverlayWindow(ClientPtr client)
     cs = GetCompScreen(pScreen);
     if (cs->pOverlayWin == NULL)
         if (!compCreateOverlayWindow(pScreen)) {
-            FreeResource(pOc->resource, RT_NONE);
+            FreeResource(pOc->resource, X11_RESTYPE_NONE);
             return BadAlloc;
         }
 
     rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id,
-                  RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess);
+                  RT_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, NULL, DixGetAttrAccess);
     if (rc != Success) {
-        FreeResource(pOc->resource, RT_NONE);
+        FreeResource(pOc->resource, X11_RESTYPE_NONE);
         return rc;
     }
 
@@ -349,7 +349,7 @@ ProcCompositeReleaseOverlayWindow(ClientPtr client)
         return BadMatch;
 
     /* The delete function will free the client structure */
-    FreeResource(pOc->resource, RT_NONE);
+    FreeResource(pOc->resource, X11_RESTYPE_NONE);
 
     return Success;
 }
@@ -820,17 +820,17 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
         cs = GetCompScreen(pScreen);
         if (cs->pOverlayWin == NULL)
             if (!compCreateOverlayWindow(pScreen)) {
-                FreeResource(pOc->resource, RT_NONE);
+                FreeResource(pOc->resource, X11_RESTYPE_NONE);
                 free(overlayWin);
                 return BadAlloc;
             }
 
         rc = XaceHook(XACE_RESOURCE_ACCESS, client,
                       cs->pOverlayWin->drawable.id,
-                      RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL,
+                      RT_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, NULL,
                       DixGetAttrAccess);
         if (rc != Success) {
-            FreeResource(pOc->resource, RT_NONE);
+            FreeResource(pOc->resource, X11_RESTYPE_NONE);
             free(overlayWin);
             return rc;
         }
@@ -898,7 +898,7 @@ PanoramiXCompositeReleaseOverlayWindow(ClientPtr client)
             return BadMatch;
 
         /* The delete function will free the client structure */
-        FreeResource(pOc->resource, RT_NONE);
+        FreeResource(pOc->resource, X11_RESTYPE_NONE);
     }
 
     return Success;
diff --git a/composite/compoverlay.c b/composite/compoverlay.c
index eb2d86e0d..1e077b892 100644
--- a/composite/compoverlay.c
+++ b/composite/compoverlay.c
@@ -169,5 +169,5 @@ compDestroyOverlayWindow(ScreenPtr pScreen)
     CompScreenPtr cs = GetCompScreen(pScreen);
 
     cs->pOverlayWin = NullWindow;
-    FreeResource(cs->overlayWid, RT_NONE);
+    FreeResource(cs->overlayWid, X11_RESTYPE_NONE);
 }
diff --git a/composite/compwindow.c b/composite/compwindow.c
index c71a1fa7d..54afbdda0 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -610,9 +610,9 @@ compDestroyWindow(WindowPtr pWin)
 
     pScreen->DestroyWindow = cs->DestroyWindow;
     while ((cw = GetCompWindow(pWin)))
-        FreeResource(cw->clients->id, RT_NONE);
+        FreeResource(cw->clients->id, X11_RESTYPE_NONE);
     while ((csw = GetCompSubwindows(pWin)))
-        FreeResource(csw->clients->id, RT_NONE);
+        FreeResource(csw->clients->id, X11_RESTYPE_NONE);
 
     if (pWin->redirectDraw != RedirectDrawNone) {
         PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
diff --git a/damageext/damageext.c b/damageext/damageext.c
index 099278a36..fd6fcc87e 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -163,7 +163,7 @@ DamageExtDestroy(DamagePtr pDamage, void *closure)
 
     pDamageExt->pDamage = 0;
     if (pDamageExt->id)
-        FreeResource(pDamageExt->id, RT_NONE);
+        FreeResource(pDamageExt->id, X11_RESTYPE_NONE);
 }
 
 void
@@ -316,7 +316,7 @@ ProcDamageDestroy(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xDamageDestroyReq);
     VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess);
-    FreeResource(stuff->damage, RT_NONE);
+    FreeResource(stuff->damage, X11_RESTYPE_NONE);
     return Success;
 }
 
@@ -685,7 +685,7 @@ PanoramiXDamageCreate(ClientPtr client)
     }
 
     if (rc != Success)
-        FreeResource(stuff->damage, RT_NONE);
+        FreeResource(stuff->damage, X11_RESTYPE_NONE);
 
     return rc;
 }
diff --git a/dbe/dbe.c b/dbe/dbe.c
index 237dd0fa9..3cf0a3ef9 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -413,7 +413,7 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
         return dbeErrorBase + DbeBadBuffer;
     }
 
-    FreeResource(stuff->buffer, RT_NONE);
+    FreeResource(stuff->buffer, X11_RESTYPE_NONE);
 
     return Success;
 
@@ -1314,7 +1314,7 @@ DbeDestroyWindow(WindowPtr pWin)
              * NULL if there are no more buffer IDs associated with this
              * window.
              */
-            FreeResource(pDbeWindowPriv->IDs[0], RT_NONE);
+            FreeResource(pDbeWindowPriv->IDs[0], X11_RESTYPE_NONE);
             pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
         }
     }
diff --git a/dbe/midbe.c b/dbe/midbe.c
index 9684d45bd..c646bc0c7 100644
--- a/dbe/midbe.c
+++ b/dbe/midbe.c
@@ -177,7 +177,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
         if (rc != Success || !AddResource(bufId, dbeDrawableResType,
                                           pDbeWindowPriv->pBackBuffer)) {
             /* free the buffer and the drawable resource */
-            FreeResource(bufId, RT_NONE);
+            FreeResource(bufId, X11_RESTYPE_NONE);
             return (rc == Success) ? BadAlloc : rc;
         }
 
@@ -599,7 +599,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
             /* DbeWindowPrivDelete() will free the window private if there no
              * more buffer IDs associated with this window.
              */
-            FreeResource(pDbeWindowPriv->IDs[0], RT_NONE);
+            FreeResource(pDbeWindowPriv->IDs[0], X11_RESTYPE_NONE);
             pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
         }
 
diff --git a/dix/colormap.c b/dix/colormap.c
index 7a00d14d6..1a46d01ab 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -377,9 +377,9 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
      * Security creation/labeling check
      */
     i = XaceHook(XACE_RESOURCE_ACCESS, clients[client], mid, RT_COLORMAP,
-                 pmap, RT_NONE, NULL, DixCreateAccess);
+                 pmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
     if (i != Success) {
-        FreeResource(mid, RT_NONE);
+        FreeResource(mid, X11_RESTYPE_NONE);
         return i;
     }
 
@@ -387,7 +387,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
      * this is it.  In specific, if this is a Static colormap, this is the
      * time to fill in the colormap's values */
     if (!(*pScreen->CreateColormap) (pmap)) {
-        FreeResource(mid, RT_NONE);
+        FreeResource(mid, X11_RESTYPE_NONE);
         return BadAlloc;
     }
     pmap->flags &= ~BeingCreated;
diff --git a/dix/cursor.c b/dix/cursor.c
index 0d252b0f0..dcbcaaa77 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -276,8 +276,8 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
     pCurs->id = cid;
 
     /* security creation/labeling check */
-    rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR,
-                  pCurs, RT_NONE, NULL, DixCreateAccess);
+    rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, X11_RESTYPE_CURSOR,
+                  pCurs, X11_RESTYPE_NONE, NULL, DixCreateAccess);
     if (rc != Success)
         goto error;
 
@@ -334,13 +334,13 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
     CursorPtr pCurs;
     GlyphSharePtr pShare;
 
-    rc = dixLookupResourceByType((void **) &sourcefont, source, RT_FONT,
+    rc = dixLookupResourceByType((void **) &sourcefont, source, X11_RESTYPE_FONT,
                                  client, DixUseAccess);
     if (rc != Success) {
         client->errorValue = source;
         return rc;
     }
-    rc = dixLookupResourceByType((void **) &maskfont, mask, RT_FONT, client,
+    rc = dixLookupResourceByType((void **) &maskfont, mask, X11_RESTYPE_FONT, client,
                                  DixUseAccess);
     if (rc != Success && mask != None) {
         client->errorValue = mask;
@@ -456,8 +456,8 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
     pCurs->id = cid;
 
     /* security creation/labeling check */
-    rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR,
-                  pCurs, RT_NONE, NULL, DixCreateAccess);
+    rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, X11_RESTYPE_CURSOR,
+                  pCurs, X11_RESTYPE_NONE, NULL, DixCreateAccess);
     if (rc != Success)
         goto error;
 
@@ -500,7 +500,7 @@ CreateRootCursor(char *unused1, unsigned int unused2)
     if (err != Success)
         return NullCursor;
 
-    err = dixLookupResourceByType((void **) &cursorfont, fontID, RT_FONT,
+    err = dixLookupResourceByType((void **) &cursorfont, fontID, X11_RESTYPE_FONT,
                                   serverClient, DixReadAccess);
     if (err != Success)
         return NullCursor;
@@ -508,7 +508,7 @@ CreateRootCursor(char *unused1, unsigned int unused2)
                          &curs, serverClient, (XID) 0) != Success)
         return NullCursor;
 
-    if (!AddResource(FakeClientID(0), RT_CURSOR, (void *) curs))
+    if (!AddResource(FakeClientID(0), X11_RESTYPE_CURSOR, (void *) curs))
         return NullCursor;
 
     return curs;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index fb301ea0b..04a50259d 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -831,7 +831,7 @@ ProcDestroyWindow(ClientPtr client)
                              DixRemoveAccess);
         if (rc != Success)
             return rc;
-        FreeResource(stuff->id, RT_NONE);
+        FreeResource(stuff->id, X11_RESTYPE_NONE);
     }
     return Success;
 }
@@ -1324,10 +1324,10 @@ ProcCloseFont(ClientPtr client)
     REQUEST(xResourceReq);
 
     REQUEST_SIZE_MATCH(xResourceReq);
-    rc = dixLookupResourceByType((void **) &pFont, stuff->id, RT_FONT,
+    rc = dixLookupResourceByType((void **) &pFont, stuff->id, X11_RESTYPE_FONT,
                                  client, DixDestroyAccess);
     if (rc == Success) {
-        FreeResource(stuff->id, RT_NONE);
+        FreeResource(stuff->id, X11_RESTYPE_NONE);
         return Success;
     }
     else {
@@ -1513,7 +1513,7 @@ ProcCreatePixmap(ClientPtr client)
         pMap->drawable.id = stuff->pid;
         /* security creation/labeling check */
         rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
-                      pMap, RT_NONE, NULL, DixCreateAccess);
+                      pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
         if (rc != Success) {
             (*pDraw->pScreen->DestroyPixmap) (pMap);
             return rc;
@@ -1536,7 +1536,7 @@ ProcFreePixmap(ClientPtr client)
     rc = dixLookupResourceByType((void **) &pMap, stuff->id, RT_PIXMAP,
                                  client, DixDestroyAccess);
     if (rc == Success) {
-        FreeResource(stuff->id, RT_NONE);
+        FreeResource(stuff->id, X11_RESTYPE_NONE);
         return Success;
     }
     else {
@@ -1685,7 +1685,7 @@ ProcFreeGC(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    FreeResource(stuff->id, RT_NONE);
+    FreeResource(stuff->id, X11_RESTYPE_NONE);
     return Success;
 }
 
@@ -2473,7 +2473,7 @@ ProcFreeColormap(ClientPtr client)
     if (rc == Success) {
         /* Freeing a default colormap is a no-op */
         if (!(pmap->flags & IsDefault))
-            FreeResource(stuff->id, RT_NONE);
+            FreeResource(stuff->id, X11_RESTYPE_NONE);
         return Success;
     }
     else {
@@ -3068,7 +3068,7 @@ ProcCreateCursor(ClientPtr client)
 
     if (rc != Success)
         goto bail;
-    if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) {
+    if (!AddResource(stuff->cid, X11_RESTYPE_CURSOR, (void *) pCursor)) {
         rc = BadAlloc;
         goto bail;
     }
@@ -3098,7 +3098,7 @@ ProcCreateGlyphCursor(ClientPtr client)
                            &pCursor, client, stuff->cid);
     if (res != Success)
         return res;
-    if (AddResource(stuff->cid, RT_CURSOR, (void *) pCursor))
+    if (AddResource(stuff->cid, X11_RESTYPE_CURSOR, (void *) pCursor))
         return Success;
     return BadAlloc;
 }
@@ -3112,10 +3112,10 @@ ProcFreeCursor(ClientPtr client)
     REQUEST(xResourceReq);
 
     REQUEST_SIZE_MATCH(xResourceReq);
-    rc = dixLookupResourceByType((void **) &pCursor, stuff->id, RT_CURSOR,
+    rc = dixLookupResourceByType((void **) &pCursor, stuff->id, X11_RESTYPE_CURSOR,
                                  client, DixDestroyAccess);
     if (rc == Success) {
-        FreeResource(stuff->id, RT_NONE);
+        FreeResource(stuff->id, X11_RESTYPE_NONE);
         return Success;
     }
     else {
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 6d3c8e127..914ceb7a3 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -133,7 +133,7 @@ GetGlyphs(FontPtr font, unsigned long count, unsigned char *chars,
 }
 
 /*
- * adding RT_FONT prevents conflict with default cursor font
+ * adding RT_FONT / X11_RESTYPE_FONT prevents conflict with default cursor font
  */
 Bool
 SetDefaultFont(const char *defaultfontname)
@@ -147,7 +147,7 @@ SetDefaultFont(const char *defaultfontname)
                    (unsigned) strlen(defaultfontname), defaultfontname);
     if (err != Success)
         return FALSE;
-    err = dixLookupResourceByType((void **) &pf, fid, RT_FONT, serverClient,
+    err = dixLookupResourceByType((void **) &pf, fid, X11_RESTYPE_FONT, serverClient,
                                   DixReadAccess);
     if (err != Success)
         return FALSE;
@@ -355,7 +355,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
             }
         }
     }
-    if (!AddResource(c->fontid, RT_FONT, (void *) pfont)) {
+    if (!AddResource(c->fontid, X11_RESTYPE_FONT, (void *) pfont)) {
         err = AllocError;
         goto bail;
     }
@@ -408,7 +408,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname,
 
         cached = xfont2_find_cached_font_pattern(patternCache, pfontname, lenfname);
         if (cached && cached->info.cachable) {
-            if (!AddResource(fid, RT_FONT, (void *) cached))
+            if (!AddResource(fid, X11_RESTYPE_FONT, (void *) cached))
                 return BadAlloc;
             cached->refcnt++;
             return Success;
@@ -1157,7 +1157,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
             fid = ((Font) *(c->pElt + 4))       /* big-endian */
                 |((Font) *(c->pElt + 3)) << 8
                 | ((Font) *(c->pElt + 2)) << 16 | ((Font) *(c->pElt + 1)) << 24;
-            err = dixLookupResourceByType((void **) &pFont, fid, RT_FONT,
+            err = dixLookupResourceByType((void **) &pFont, fid, X11_RESTYPE_FONT,
                                           client, DixUseAccess);
             if (err != Success) {
                 /* restore pFont for step 4 (described below) */
@@ -1894,7 +1894,7 @@ find_old_font(XID id)
 {
     void *pFont;
 
-    dixLookupResourceByType(&pFont, id, RT_NONE, serverClient, DixReadAccess);
+    dixLookupResourceByType(&pFont, id, X11_RESTYPE_NONE, serverClient, DixReadAccess);
     return (FontPtr) pFont;
 }
 
@@ -1907,13 +1907,13 @@ get_new_font_client_id(void)
 static int
 store_font_Client_font(FontPtr pfont, Font id)
 {
-    return AddResource(id, RT_NONE, (void *) pfont);
+    return AddResource(id, X11_RESTYPE_NONE, (void *) pfont);
 }
 
 static void
 delete_font_client_id(Font id)
 {
-    FreeResource(id, RT_NONE);
+    FreeResource(id, X11_RESTYPE_NONE);
 }
 
 static int
diff --git a/dix/dixutils.c b/dix/dixutils.c
index 28f017fc2..2672d3e9d 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -207,7 +207,7 @@ dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access)
     GC *pGC;
 
     client->errorValue = id;    /* EITHER font or gc */
-    rc = dixLookupResourceByType((void **) pFont, id, RT_FONT, client,
+    rc = dixLookupResourceByType((void **) pFont, id, X11_RESTYPE_FONT, client,
                                  access);
     if (rc != BadFont)
         return rc;
diff --git a/dix/events.c b/dix/events.c
index 05bb98f02..2f42268cc 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4534,7 +4534,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
     check = (mask & ManagerMask);
     if (check) {
         rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id,
-                      RT_WINDOW, pWin, RT_NONE, NULL, DixManageAccess);
+                      RT_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixManageAccess);
         if (rc != Success)
             return rc;
     }
@@ -4559,7 +4559,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
             if (SameClient(others, client)) {
                 check = others->mask;
                 if (mask == 0) {
-                    FreeResource(others->resource, RT_NONE);
+                    FreeResource(others->resource, X11_RESTYPE_NONE);
                     return Success;
                 }
                 else
@@ -5065,7 +5065,7 @@ ProcChangeActivePointerGrab(ClientPtr client)
         newCursor = NullCursor;
     else {
         int rc = dixLookupResourceByType((void **) &newCursor, stuff->cursor,
-                                         RT_CURSOR, client, DixUseAccess);
+                                         X11_RESTYPE_CURSOR, client, DixUseAccess);
 
         if (rc != Success) {
             client->errorValue = stuff->cursor;
@@ -5182,7 +5182,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
     if (curs == None)
         cursor = NullCursor;
     else {
-        rc = dixLookupResourceByType((void **) &cursor, curs, RT_CURSOR,
+        rc = dixLookupResourceByType((void **) &cursor, curs, X11_RESTYPE_CURSOR,
                                      client, DixUseAccess);
         if (rc != Success) {
             client->errorValue = curs;
@@ -5719,7 +5719,7 @@ ProcGrabButton(ClientPtr client)
         cursor = NullCursor;
     else {
         rc = dixLookupResourceByType((void **) &cursor, stuff->cursor,
-                                     RT_CURSOR, client, DixUseAccess);
+                                     X11_RESTYPE_CURSOR, client, DixUseAccess);
         if (rc != Success) {
             client->errorValue = stuff->cursor;
             return rc;
@@ -5906,9 +5906,9 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
         if (pWin->dontPropagate)
             DontPropagateRefCnts[pWin->dontPropagate]--;
         while ((oc = wOtherClients(pWin)))
-            FreeResource(oc->resource, RT_NONE);
+            FreeResource(oc->resource, X11_RESTYPE_NONE);
         while ((passive = wPassiveGrabs(pWin)))
-            FreeResource(passive->resource, RT_NONE);
+            FreeResource(passive->resource, X11_RESTYPE_NONE);
     }
 
     DeleteWindowFromAnyExtEvents(pWin, freeResources);
@@ -5973,7 +5973,7 @@ ProcRecolorCursor(ClientPtr client)
     REQUEST(xRecolorCursorReq);
 
     REQUEST_SIZE_MATCH(xRecolorCursorReq);
-    rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, RT_CURSOR,
+    rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, X11_RESTYPE_CURSOR,
                                  client, DixWriteAccess);
     if (rc != Success) {
         client->errorValue = stuff->cursor;
diff --git a/dix/gc.c b/dix/gc.c
index f2369591b..3d41a5407 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -425,7 +425,7 @@ static const struct {
 } xidfields[] = {
     {GCTile, RT_PIXMAP, DixReadAccess},
     {GCStipple, RT_PIXMAP, DixReadAccess},
-    {GCFont, RT_FONT, DixUseAccess},
+    {GCFont, X11_RESTYPE_FONT, DixUseAccess},
     {GCClipMask, RT_PIXMAP, DixReadAccess},
 };
 
@@ -550,7 +550,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
 
     /* security creation/labeling check */
     *pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, RT_GC, pGC,
-                        RT_NONE, NULL, DixCreateAccess | DixSetAttrAccess);
+                        X11_RESTYPE_NONE, NULL, DixCreateAccess | DixSetAttrAccess);
     if (*pStatus != Success)
         goto out;
 
diff --git a/dix/gestures.c b/dix/gestures.c
index c6c96675d..18f7b0f0d 100644
--- a/dix/gestures.c
+++ b/dix/gestures.c
@@ -201,8 +201,8 @@ GestureAddGrabListener(DeviceIntPtr dev, GestureInfoPtr gi, GrabPtr grab)
         BUG_RETURN_MSG(1, "Unsupported grab type\n");
     }
 
-    /* grab listeners are always RT_NONE since we keep the grab pointer */
-    GestureAddListener(gi, grab->resource, RT_NONE, type, grab->window, grab);
+    /* grab listeners are always X11_RESTYPE_NONE since we keep the grab pointer */
+    GestureAddListener(gi, grab->resource, X11_RESTYPE_NONE, type, grab->window, grab);
 }
 
 /**
diff --git a/dix/grabs.c b/dix/grabs.c
index 96231a12c..199445fac 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -681,13 +681,13 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
 
     if (!ok) {
         for (i = 0; i < nadds; i++)
-            FreeResource(adds[i]->resource, RT_NONE);
+            FreeResource(adds[i]->resource, X11_RESTYPE_NONE);
         for (i = 0; i < nups; i++)
             free(details[i]);
     }
     else {
         for (i = 0; i < ndels; i++)
-            FreeResource(deletes[i]->resource, RT_NONE);
+            FreeResource(deletes[i]->resource, X11_RESTYPE_NONE);
         for (i = 0; i < nadds; i++) {
             grab = adds[i];
             grab->next = grab->window->optional->passiveGrabs;
diff --git a/dix/privates.c b/dix/privates.c
index 3df845531..91244edbc 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -564,12 +564,12 @@ dixPrivatesSize(DevPrivateType type)
 
 /* Table of devPrivates offsets */
 static const int offsets[] = {
-    -1,                         /* RT_NONE */
+    -1,                         /* RT_NONE / X11_RESTYPE_NONE */
     offsetof(WindowRec, devPrivates),   /* RT_WINDOW */
     offsetof(PixmapRec, devPrivates),   /* RT_PIXMAP */
     offsetof(GC, devPrivates),  /* RT_GC */
-    -1,                         /* RT_FONT */
-    offsetof(CursorRec, devPrivates),   /* RT_CURSOR */
+    -1,                         /* RT_FONT / X11_RESTYPE_FONT */
+    offsetof(CursorRec, devPrivates),   /* RT_CURSOR / X11_RESTYPE_CURSOR */
     offsetof(ColormapRec, devPrivates), /* RT_COLORMAP */
 };
 
diff --git a/dix/registry.c b/dix/registry.c
index a599d8c31..f770359ef 100644
--- a/dix/registry.c
+++ b/dix/registry.c
@@ -363,12 +363,12 @@ dixResetRegistry(void)
 
 #ifdef X_REGISTRY_RESOURCE
     /* Add built-in resources */
-    RegisterResourceName(RT_NONE, "NONE");
+    RegisterResourceName(X11_RESTYPE_NONE, "NONE");
     RegisterResourceName(RT_WINDOW, "WINDOW");
     RegisterResourceName(RT_PIXMAP, "PIXMAP");
     RegisterResourceName(RT_GC, "GC");
-    RegisterResourceName(RT_FONT, "FONT");
-    RegisterResourceName(RT_CURSOR, "CURSOR");
+    RegisterResourceName(X11_RESTYPE_FONT, "FONT");
+    RegisterResourceName(X11_RESTYPE_CURSOR, "CURSOR");
     RegisterResourceName(RT_COLORMAP, "COLORMAP");
     RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY");
     RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT");
diff --git a/dix/resource.c b/dix/resource.c
index 35015ca33..57e066290 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -432,7 +432,7 @@ FindGCSubRes(void *value, FindAllRes func, void *cdata)
 static struct ResourceType *resourceTypes;
 
 static const struct ResourceType predefTypes[] = {
-    [RT_NONE & (RC_LASTPREDEF - 1)] = {
+    [X11_RESTYPE_NONE & (RC_LASTPREDEF - 1)] = {
                                        .deleteFunc = (DeleteType) NoopDDA,
                                        .sizeFunc = GetDefaultBytes,
                                        .findSubResFunc = DefaultFindSubRes,
@@ -456,13 +456,13 @@ static const struct ResourceType predefTypes[] = {
                                      .findSubResFunc = FindGCSubRes,
                                      .errorValue = BadGC,
                                      },
-    [RT_FONT & (RC_LASTPREDEF - 1)] = {
+    [X11_RESTYPE_FONT & (RC_LASTPREDEF - 1)] = {
                                        .deleteFunc = CloseFont,
                                        .sizeFunc = GetDefaultBytes,
                                        .findSubResFunc = DefaultFindSubRes,
                                        .errorValue = BadFont,
                                        },
-    [RT_CURSOR & (RC_LASTPREDEF - 1)] = {
+    [X11_RESTYPE_CURSOR & (RC_LASTPREDEF - 1)] = {
                                          .deleteFunc = FreeCursor,
                                          .sizeFunc = GetDefaultBytes,
                                          .findSubResFunc = DefaultFindSubRes,
@@ -1224,7 +1224,7 @@ dixLookupResourceByType(void **result, XID id, RESTYPE rtype,
 
     if (client) {
         cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
-                       res->value, RT_NONE, NULL, mode);
+                       res->value, X11_RESTYPE_NONE, NULL, mode);
         if (cid == BadValue)
             return resourceTypes[rtype & TypeMask].errorValue;
         if (cid != Success)
@@ -1259,7 +1259,7 @@ dixLookupResourceByClass(void **result, XID id, RESTYPE rclass,
 
     if (client) {
         cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
-                       res->value, RT_NONE, NULL, mode);
+                       res->value, X11_RESTYPE_NONE, NULL, mode);
         if (cid != Success)
             return cid;
     }
diff --git a/dix/touch.c b/dix/touch.c
index ee581418a..441e36d0d 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -712,8 +712,8 @@ TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
         type = TOUCH_LISTENER_POINTER_GRAB;
     }
 
-    /* grab listeners are always RT_NONE since we keep the grab pointer */
-    TouchAddListener(ti, grab->resource, RT_NONE, grab->grabtype,
+    /* grab listeners are always X11_RESTYPE_NONE since we keep the grab pointer */
+    TouchAddListener(ti, grab->resource, X11_RESTYPE_NONE, grab->grabtype,
                      type, TOUCH_LISTENER_AWAITING_BEGIN, grab->window, grab);
 }
 
diff --git a/dix/window.c b/dix/window.c
index 27929de14..96af1253d 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -640,7 +640,7 @@ CreateRootWindow(ScreenPtr pScreen)
     /*  security creation/labeling check
      */
     if (XaceHook(XACE_RESOURCE_ACCESS, serverClient, pWin->drawable.id,
-                 RT_WINDOW, pWin, RT_NONE, NULL, DixCreateAccess))
+                 RT_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixCreateAccess))
         return FALSE;
 
     if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin))
@@ -1118,11 +1118,11 @@ DestroySubwindows(WindowPtr pWin, ClientPtr client)
     while (pWin->lastChild) {
         int rc = XaceHook(XACE_RESOURCE_ACCESS, client,
                           pWin->lastChild->drawable.id, RT_WINDOW,
-                          pWin->lastChild, RT_NONE, NULL, DixDestroyAccess);
+                          pWin->lastChild, X11_RESTYPE_NONE, NULL, DixDestroyAccess);
 
         if (rc != Success)
             return rc;
-        FreeResource(pWin->lastChild->drawable.id, RT_NONE);
+        FreeResource(pWin->lastChild->drawable.id, X11_RESTYPE_NONE);
     }
     return Success;
 }
@@ -1399,7 +1399,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
             }
             if (val == xTrue) {
                 rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id,
-                              RT_WINDOW, pWin, RT_NONE, NULL, DixGrabAccess);
+                              RT_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixGrabAccess);
                 if (rc != Success) {
                     error = rc;
                     client->errorValue = pWin->drawable.id;
@@ -1495,7 +1495,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
             }
             else {
                 rc = dixLookupResourceByType((void **) &pCursor, cursorID,
-                                             RT_CURSOR, client, DixUseAccess);
+                                             X11_RESTYPE_CURSOR, client, DixUseAccess);
                 if (rc != Success) {
                     error = rc;
                     client->errorValue = cursorID;
@@ -2666,7 +2666,7 @@ MapWindow(WindowPtr pWin, ClientPtr client)
 
     /* general check for permission to map window */
     if (XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW,
-                 pWin, RT_NONE, NULL, DixShowAccess) != Success)
+                 pWin, X11_RESTYPE_NONE, NULL, DixShowAccess) != Success)
         return Success;
 
     pScreen = pWin->drawable.pScreen;
@@ -3138,7 +3138,7 @@ dixSaveScreens(ClientPtr client, int on, int mode)
             }
             else if (HasSaverWindow(pScreen)) {
                 pScreen->screensaver.pWindow = NullWindow;
-                FreeResource(pScreen->screensaver.wid, RT_NONE);
+                FreeResource(pScreen->screensaver.wid, X11_RESTYPE_NONE);
             }
             break;
         case SCREEN_SAVER_CYCLE:
@@ -3266,7 +3266,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
                                  &cursor, serverClient, (XID) 0);
         if (cursor) {
             cursorID = FakeClientID(0);
-            if (AddResource(cursorID, RT_CURSOR, (void *) cursor)) {
+            if (AddResource(cursorID, X11_RESTYPE_CURSOR, (void *) cursor)) {
                 attributes[attri] = cursorID;
                 mask |= CWCursor;
             }
@@ -3289,7 +3289,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
                      wVisual(pScreen->root), &result);
 
     if (cursor)
-        FreeResource(cursorID, RT_NONE);
+        FreeResource(cursorID, X11_RESTYPE_NONE);
 
     if (!pWin)
         return FALSE;
diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml
index f33d90475..8c3c0fce4 100644
--- a/doc/Xserver-spec.xml
+++ b/doc/Xserver-spec.xml
@@ -440,7 +440,7 @@ To free a resource, use one of the following.
 FreeResource frees all resources matching the given id, regardless of
 type; the type's deleteFunc will be called on each matching resource,
 except that skipDeleteFuncType can be set to a single type for which
-the deleteFunc should not be called (otherwise pass RT_NONE).
+the deleteFunc should not be called (otherwise pass RT_NONE / X11_RESTYPE_NONE).
 FreeResourceByType frees a specific resource matching a given id
 and type; if skipFree is true, then the deleteFunc is not called.
 </para>
diff --git a/dri3/dri3_request.c b/dri3/dri3_request.c
index 7e728b0af..e45e3d9bb 100644
--- a/dri3/dri3_request.c
+++ b/dri3/dri3_request.c
@@ -239,7 +239,7 @@ proc_dri3_pixmap_from_buffer(ClientPtr client)
 
     /* security creation/labeling check */
     rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,
-                  pixmap, RT_NONE, NULL, DixCreateAccess);
+                  pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
 
     if (rc != Success) {
         (*drawable->pScreen->DestroyPixmap) (pixmap);
@@ -503,7 +503,7 @@ proc_dri3_pixmap_from_buffers(ClientPtr client)
 
     /* security creation/labeling check */
     rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,
-                  pixmap, RT_NONE, NULL, DixCreateAccess);
+                  pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
 
     if (rc != Success) {
         (*screen->DestroyPixmap) (pixmap);
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index a5069eb10..9ad99da8e 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1396,7 +1396,7 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
         return BadAlloc;
 
     err = XaceHook(XACE_RESOURCE_ACCESS, client, glxDrawableId, RT_PIXMAP,
-                   pPixmap, RT_NONE, NULL, DixCreateAccess);
+                   pPixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
     if (err != Success) {
         (*pGlxScreen->pScreen->DestroyPixmap) (pPixmap);
         return err;
diff --git a/glx/vndext.c b/glx/vndext.c
index 770aff6bb..21ba29269 100644
--- a/glx/vndext.c
+++ b/glx/vndext.c
@@ -114,7 +114,7 @@ GlxMappingInit(void)
 
     idResource = CreateNewResourceType(idResourceDeleteCallback,
                                        "GLXServerIDRes");
-    if (idResource == RT_NONE)
+    if (idResource == X11_RESTYPE_NONE)
     {
         GlxMappingReset();
         return FALSE;
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 7de31cb61..7fa6b98c1 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -369,7 +369,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet)
 
             if (oldPix) {
                 if (oldPix->drawable.id)
-                    FreeResource(oldPix->drawable.id, RT_NONE);
+                    FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE);
                 else
                     (*pScreen->DestroyPixmap) (oldPix);
             }
@@ -431,7 +431,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet)
 
         if (oldPix) {
             if (oldPix->drawable.id)
-                FreeResource(oldPix->drawable.id, RT_NONE);
+                FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE);
             else
                 (*pScreen->DestroyPixmap) (oldPix);
         }
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index 8cd92f296..e0c7c505d 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -271,7 +271,7 @@ ProcAppleWMSelectInput(register ClientPtr client)
             pHead = (WMEventPtr *)malloc(sizeof(WMEventPtr));
             if (!pHead ||
                 !AddResource(eventResource, EventType, (void *)pHead)) {
-                FreeResource(clientResource, RT_NONE);
+                FreeResource(clientResource, X11_RESTYPE_NONE);
                 return BadAlloc;
             }
             *pHead = 0;
diff --git a/include/resource.h b/include/resource.h
index 6caf846c4..4e3980153 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -71,19 +71,25 @@ typedef uint32_t RESTYPE;
 
 /* types for Resource routines */
 
+// prevent namespace clash with Windows
+#define X11_RESTYPE_NONE	((RESTYPE)0)
+#define X11_RESTYPE_FONT	((RESTYPE)4)
+#define X11_RESTYPE_CURSOR	((RESTYPE)5)
+
 #define RT_WINDOW	((RESTYPE)1|RC_DRAWABLE)
 #define RT_PIXMAP	((RESTYPE)2|RC_DRAWABLE)
 #define RT_GC		((RESTYPE)3)
 #undef RT_FONT
 #undef RT_CURSOR
-#define RT_FONT		((RESTYPE)4)
-#define RT_CURSOR	((RESTYPE)5)
+#define RT_FONT		X11_RESTYPE_FONT
+#define RT_CURSOR	X11_RESTYPE_CURSOR
 #define RT_COLORMAP	((RESTYPE)6)
 #define RT_CMAPENTRY	((RESTYPE)7)
 #define RT_OTHERCLIENT	((RESTYPE)8|RC_NEVERRETAIN)
 #define RT_PASSIVEGRAB	((RESTYPE)9|RC_NEVERRETAIN)
 #define RT_LASTPREDEF	((RESTYPE)9)
-#define RT_NONE		((RESTYPE)0)
+#define RT_NONE		X11_RESTYPE_NONE
+
 
 extern _X_EXPORT unsigned int ResourceClientBits(void);
 /* bits and fields within a resource id */
diff --git a/present/present_event.c b/present/present_event.c
index 849732dc8..b35609b23 100644
--- a/present/present_event.c
+++ b/present/present_event.c
@@ -52,7 +52,7 @@ present_free_events(WindowPtr window)
         return;
 
     while ((event = window_priv->events))
-        FreeResource(event->id, RT_NONE);
+        FreeResource(event->id, X11_RESTYPE_NONE);
 }
 
 static void
@@ -224,7 +224,7 @@ present_select_input(ClientPtr client, XID eid, WindowPtr window, CARD32 mask)
         if (mask)
             event->mask = mask;
         else
-            FreeResource(eid, RT_NONE);
+            FreeResource(eid, X11_RESTYPE_NONE);
         return Success;
     }
     if (ret != BadValue)
diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c
index 5d6914c62..8cb79b199 100644
--- a/randr/rrdispatch.c
+++ b/randr/rrdispatch.c
@@ -138,7 +138,7 @@ ProcRRSelectInput(ClientPtr client)
                 if (!pHead ||
                     !AddResource(pWin->drawable.id, RREventType,
                                  (void *) pHead)) {
-                    FreeResource(clientResource, RT_NONE);
+                    FreeResource(clientResource, X11_RESTYPE_NONE);
                     return BadAlloc;
                 }
                 *pHead = 0;
diff --git a/randr/rrlease.c b/randr/rrlease.c
index 48f02c5b8..4d92b4af9 100644
--- a/randr/rrlease.c
+++ b/randr/rrlease.c
@@ -151,7 +151,7 @@ RRLeaseTerminated(RRLeasePtr lease)
         RRLeaseChangeState(lease, RRLeaseTerminating, RRLeaseTerminating);
 
     if (lease->id != None)
-        FreeResource(lease->id, RT_NONE);
+        FreeResource(lease->id, X11_RESTYPE_NONE);
 
     xorg_list_del(&lease->list);
 }
@@ -368,7 +368,7 @@ ProcRRFreeLease(ClientPtr client)
         RRTerminateLease(lease);
     else
         /* Get rid of the resource database entry */
-        FreeResource(stuff->lid, RT_NONE);
+        FreeResource(stuff->lid, X11_RESTYPE_NONE);
 
     return Success;
 }
diff --git a/record/record.c b/record/record.c
index ca9254ce1..88fbf9c85 100644
--- a/record/record.c
+++ b/record/record.c
@@ -2457,7 +2457,7 @@ ProcRecordFreeContext(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xRecordFreeContextReq);
     VERIFY_CONTEXT(pContext, stuff->context, client);
-    FreeResource(stuff->context, RT_NONE);
+    FreeResource(stuff->context, X11_RESTYPE_NONE);
     return Success;
 }                               /* ProcRecordFreeContext */
 
diff --git a/render/animcur.c b/render/animcur.c
index eb8b817e2..e736e4c24 100644
--- a/render/animcur.c
+++ b/render/animcur.c
@@ -336,8 +336,8 @@ AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor,
 
     /* security creation/labeling check */
     if (ac->timer)
-        rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, pCursor,
-                      RT_NONE, NULL, DixCreateAccess);
+        rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, X11_RESTYPE_CURSOR, pCursor,
+                      X11_RESTYPE_NONE, NULL, DixCreateAccess);
 
     if (rc != Success) {
         TimerFree(ac->timer);
diff --git a/render/picture.c b/render/picture.c
index 495cc2955..6f139b520 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -640,7 +640,7 @@ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
             (formats[n].id, PictFormatType, (void *) (formats + n))) {
             int i;
             for (i = 0; i < n; i++)
-                FreeResource(formats[i].id, RT_NONE);
+                FreeResource(formats[i].id, X11_RESTYPE_NONE);
             free(formats);
             return FALSE;
         }
diff --git a/render/render.c b/render/render.c
index 8652efb34..af84a0345 100644
--- a/render/render.c
+++ b/render/render.c
@@ -649,7 +649,7 @@ ProcRenderFreePicture(ClientPtr client)
     REQUEST_SIZE_MATCH(xRenderFreePictureReq);
 
     VERIFY_PICTURE(pPicture, stuff->picture, client, DixDestroyAccess);
-    FreeResource(stuff->picture, RT_NONE);
+    FreeResource(stuff->picture, X11_RESTYPE_NONE);
     return Success;
 }
 
@@ -930,7 +930,7 @@ ProcRenderCreateGlyphSet(ClientPtr client)
         return BadAlloc;
     /* security creation/labeling check */
     rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->gsid, GlyphSetType,
-                  glyphSet, RT_NONE, NULL, DixCreateAccess);
+                  glyphSet, X11_RESTYPE_NONE, NULL, DixCreateAccess);
     if (rc != Success)
         return rc;
     if (!AddResource(stuff->gsid, GlyphSetType, (void *) glyphSet))
@@ -980,7 +980,7 @@ ProcRenderFreeGlyphSet(ClientPtr client)
         client->errorValue = stuff->glyphset;
         return rc;
     }
-    FreeResource(stuff->glyphset, RT_NONE);
+    FreeResource(stuff->glyphset, X11_RESTYPE_NONE);
     return Success;
 }
 
@@ -1635,7 +1635,7 @@ ProcRenderCreateCursor(ClientPtr client)
                          &pCursor, client, stuff->cid);
     if (rc != Success)
         goto bail;
-    if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) {
+    if (!AddResource(stuff->cid, X11_RESTYPE_CURSOR, (void *) pCursor)) {
         rc = BadAlloc;
         goto bail;
     }
@@ -1805,7 +1805,7 @@ ProcRenderCreateAnimCursor(ClientPtr client)
     elt = (xAnimCursorElt *) (stuff + 1);
     for (i = 0; i < ncursor; i++) {
         ret = dixLookupResourceByType((void **) (cursors + i), elt->cursor,
-                                      RT_CURSOR, client, DixReadAccess);
+                                      X11_RESTYPE_CURSOR, client, DixReadAccess);
         if (ret != Success) {
             free(cursors);
             return ret;
@@ -1819,7 +1819,7 @@ ProcRenderCreateAnimCursor(ClientPtr client)
     if (ret != Success)
         return ret;
 
-    if (AddResource(stuff->cid, RT_CURSOR, (void *) pCursor))
+    if (AddResource(stuff->cid, X11_RESTYPE_CURSOR, (void *) pCursor))
         return Success;
     return BadAlloc;
 }
@@ -1863,7 +1863,7 @@ ProcRenderCreateSolidFill(ClientPtr client)
         return error;
     /* security creation/labeling check */
     error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
-                     pPicture, RT_NONE, NULL, DixCreateAccess);
+                     pPicture, X11_RESTYPE_NONE, NULL, DixCreateAccess);
     if (error != Success)
         return error;
     if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
@@ -1902,7 +1902,7 @@ ProcRenderCreateLinearGradient(ClientPtr client)
         return error;
     /* security creation/labeling check */
     error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
-                     pPicture, RT_NONE, NULL, DixCreateAccess);
+                     pPicture, X11_RESTYPE_NONE, NULL, DixCreateAccess);
     if (error != Success)
         return error;
     if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
@@ -1942,7 +1942,7 @@ ProcRenderCreateRadialGradient(ClientPtr client)
         return error;
     /* security creation/labeling check */
     error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
-                     pPicture, RT_NONE, NULL, DixCreateAccess);
+                     pPicture, X11_RESTYPE_NONE, NULL, DixCreateAccess);
     if (error != Success)
         return error;
     if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
@@ -1981,7 +1981,7 @@ ProcRenderCreateConicalGradient(ClientPtr client)
         return error;
     /* security creation/labeling check */
     error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
-                     pPicture, RT_NONE, NULL, DixCreateAccess);
+                     pPicture, X11_RESTYPE_NONE, NULL, DixCreateAccess);
     if (error != Success)
         return error;
     if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 1c8d7b26d..7d5d70ad8 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -74,7 +74,7 @@ static void deleteCursorHideCountsForScreen(ScreenPtr pScreen);
     do {								\
 	int err;							\
 	err = dixLookupResourceByType((void **) &pCursor, cursor,	\
-				      RT_CURSOR, client, access);	\
+				      X11_RESTYPE_CURSOR, client, access);	\
 	if (err != Success) {						\
 	    client->errorValue = cursor;				\
 	    return err;							\
@@ -373,8 +373,8 @@ ProcXFixesGetCursorImage(ClientPtr client)
     pCursor = CursorForClient(client);
     if (!pCursor)
         return BadCursor;
-    rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR,
-                  pCursor, RT_NONE, NULL, DixReadAccess);
+    rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, X11_RESTYPE_CURSOR,
+                  pCursor, X11_RESTYPE_NONE, NULL, DixReadAccess);
     if (rc != Success)
         return rc;
     GetSpritePosition(PickPointer(client), &x, &y);
@@ -522,8 +522,8 @@ ProcXFixesGetCursorImageAndName(ClientPtr client)
     pCursor = CursorForClient(client);
     if (!pCursor)
         return BadCursor;
-    rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR,
-                  pCursor, RT_NONE, NULL, DixReadAccess | DixGetAttrAccess);
+    rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, X11_RESTYPE_CURSOR,
+                  pCursor, X11_RESTYPE_NONE, NULL, DixReadAccess | DixGetAttrAccess);
     if (rc != Success)
         return rc;
     GetSpritePosition(PickPointer(client), &x, &y);
@@ -597,7 +597,7 @@ typedef struct {
 } ReplaceCursorLookupRec, *ReplaceCursorLookupPtr;
 
 static const RESTYPE CursorRestypes[] = {
-    RT_WINDOW, RT_PASSIVEGRAB, RT_CURSOR
+    RT_WINDOW, RT_PASSIVEGRAB, X11_RESTYPE_CURSOR
 };
 
 static Bool
@@ -622,7 +622,7 @@ ReplaceCursorLookup(void *value, XID id, void *closure)
         pCursorRef = &pGrab->cursor;
         pCursor = *pCursorRef;
         break;
-    case RT_CURSOR:
+    case X11_RESTYPE_CURSOR:
         pCursorRef = 0;
         pCursor = (CursorPtr) value;
         cursor = id;
@@ -635,7 +635,7 @@ ReplaceCursorLookup(void *value, XID id, void *closure)
             if (pCursorRef)
                 *pCursorRef = curs;
             else
-                ChangeResourceValue(id, RT_CURSOR, curs);
+                ChangeResourceValue(id, X11_RESTYPE_CURSOR, curs);
             FreeCursor(pCursor, cursor);
         }
     }
diff --git a/xfixes/region.c b/xfixes/region.c
index 19a8930b6..81a0dfcd0 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -301,7 +301,7 @@ ProcXFixesDestroyRegion(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq);
     VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
-    FreeResource(stuff->region, RT_NONE);
+    FreeResource(stuff->region, X11_RESTYPE_NONE);
     return Success;
 }
 


More information about the xorg-commit mailing list