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@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-03-11 11:01:02 +01:00 committed by Alan Coopersmith
parent 1ca48d0a48
commit 85d4bd0dba
39 changed files with 186 additions and 173 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 ||

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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 */

View File

@ -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);

View File

@ -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);

View File

@ -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,

View File

@ -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;

View File

@ -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);
}

View File

@ -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)

View File

@ -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:

View File

@ -423,10 +423,10 @@ static const struct {
RESTYPE type;
Mask access_mode;
} xidfields[] = {
{GCTile, RT_PIXMAP, DixReadAccess},
{GCStipple, RT_PIXMAP, DixReadAccess},
{GCTile, X11_RESTYPE_PIXMAP, DixReadAccess},
{GCStipple, X11_RESTYPE_PIXMAP, DixReadAccess},
{GCFont, X11_RESTYPE_FONT, DixUseAccess},
{GCClipMask, RT_PIXMAP, DixReadAccess},
{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;

View File

@ -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

View File

@ -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))

View File

@ -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
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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;