From 85d4bd0dba6ac5adb73864396d260be92a23ea50 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 11 Mar 2024 11:01:02 +0100 Subject: [PATCH] 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 Part-of: --- Xext/panoramiXprocs.c | 2 +- Xext/saver.c | 12 +++++----- Xext/security.c | 6 ++--- Xext/shape.c | 2 +- Xext/shm.c | 8 +++---- Xext/xselinux_hooks.c | 6 ++--- Xext/xselinux_label.c | 4 ++-- composite/compext.c | 27 ++++++++++++---------- composite/compoverlay.c | 2 +- dbe/midbe.c | 2 +- dix/colormap.c | 22 +++++++++--------- dix/dispatch.c | 42 +++++++++++++++++----------------- dix/dixutils.c | 4 ++-- dix/events.c | 4 ++-- dix/gc.c | 10 ++++---- dix/grabs.c | 4 ++-- dix/privates.c | 22 +++++++++--------- dix/registry.c | 14 ++++++------ dix/resource.c | 30 ++++++++++++------------ dix/touch.c | 4 ++-- dix/window.c | 26 ++++++++++----------- dri3/dri3_request.c | 12 +++++----- glx/glxcmds.c | 4 ++-- glx/glxext.c | 2 +- hw/kdrive/src/kcmap.c | 2 +- hw/xfree86/common/xf86DGA.c | 6 ++--- hw/xfree86/common/xf86cmap.c | 2 +- hw/xnest/Color.c | 10 ++++---- hw/xnest/Window.c | 6 ++--- 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 | 24 ++++++++++++------- mi/micmap.c | 2 +- present/present_request.c | 2 +- render/picture.c | 8 +++---- xfixes/cursor.c | 12 ++++++---- xfixes/region.c | 6 ++--- 39 files changed, 186 insertions(+), 173 deletions(-) diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index 9c46e32917..3e3567590f 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 17d74772e5..29f280369a 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 49e97a0cad..cf5f4051af 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 0e86b8f833..792c20f71c 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 b418f53a50..3a5a4c7f2a 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 d0ddf22e6d..63fc18f93f 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 3bb597ee22..08159ff0b8 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 1f8194f803..cfdb7a2169 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 1e077b8927..18538ed98a 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 c646bc0c75..eb6057748d 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 1a46d01ab8..4276973b6b 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 aeb9d07173..b9daec5ca4 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 2672d3e9df..440b4d08cd 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 2f42268ccb..f5a719a85f 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 3d41a5407f..24444f49ad 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 199445fac9..bc8fd69bbb 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 91244edbcd..01686637c3 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 f770359ef6..e04a267275 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 57e066290c..f6fa422477 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 441e36d0de..a2d65eee65 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 96af1253d1..d30aff3502 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 e45e3d9bb9..27d3c73a7b 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 9ad99da8e7..651e8d39ba 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 c3f67a5ecc..585f64eda7 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 b8697ca63e..2e65bdde47 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 7fa6b98c15..9101417556 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 5011256718..152b5821a3 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 7a1d9333aa..bb829847e9 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 7b410c4a3b..932db760c6 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 65f9e63111..9ad0cc66fd 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 6e263dde61..7449ba1935 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 0df14c0f52..df69ba78b5 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 0305465276..4aca289301 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 4e39801533..a48735ba03 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 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 ((RESTYPE)1|RC_DRAWABLE) -#define RT_PIXMAP ((RESTYPE)2|RC_DRAWABLE) -#define RT_GC ((RESTYPE)3) +#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 0bbe4f70db..b4fbbe7125 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 ff1d71cc48..cc947b11bf 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 6f139b5203..45498b0932 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 7d5d70ad86..51c7b30105 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 81a0dfcd02..4595f8f2db 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;