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 */ /* because we need the parent */
result = dixLookupResourceByType((void **) &pWin, stuff->window, result = dixLookupResourceByType((void **) &pWin, stuff->window,
RT_WINDOW, client, DixWriteAccess); X11_RESTYPE_WINDOW, client, DixWriteAccess);
if (result != Success) if (result != Success)
return result; return result;

View File

@ -451,7 +451,7 @@ UninstallSaverColormap(ScreenPtr pScreen)
if (pPriv && pPriv->installedMap != None) { if (pPriv && pPriv->installedMap != None) {
rc = dixLookupResourceByType((void **) &pCmap, pPriv->installedMap, rc = dixLookupResourceByType((void **) &pCmap, pPriv->installedMap,
RT_COLORMAP, serverClient, X11_RESTYPE_COLORMAP, serverClient,
DixUninstallAccess); DixUninstallAccess);
if (rc == Success) if (rc == Success)
(*pCmap->pScreen->UninstallColormap) (pCmap); (*pCmap->pScreen->UninstallColormap) (pCmap);
@ -499,7 +499,7 @@ CreateSaverWindow(ScreenPtr pScreen)
if (!pWin) if (!pWin)
return FALSE; return FALSE;
if (!AddResource(pWin->drawable.id, RT_WINDOW, pWin)) if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW, pWin))
return FALSE; return FALSE;
mask = 0; mask = 0;
@ -547,7 +547,7 @@ CreateSaverWindow(ScreenPtr pScreen)
if (wantMap == None || IsMapInstalled(wantMap, pWin)) if (wantMap == None || IsMapInstalled(wantMap, pWin))
return TRUE; return TRUE;
result = dixLookupResourceByType((void **) &pCmap, wantMap, RT_COLORMAP, result = dixLookupResourceByType((void **) &pCmap, wantMap, X11_RESTYPE_COLORMAP,
serverClient, DixInstallAccess); serverClient, DixInstallAccess);
if (result != Success) if (result != Success)
return TRUE; return TRUE;
@ -900,7 +900,7 @@ ScreenSaverSetAttributes(ClientPtr client)
else { else {
ret = ret =
dixLookupResourceByType((void **) &pPixmap, pixID, dixLookupResourceByType((void **) &pPixmap, pixID,
RT_PIXMAP, client, DixReadAccess); X11_RESTYPE_PIXMAP, client, DixReadAccess);
if (ret == Success) { if (ret == Success) {
if ((pPixmap->drawable.depth != depth) || if ((pPixmap->drawable.depth != depth) ||
(pPixmap->drawable.pScreen != pScreen)) { (pPixmap->drawable.pScreen != pScreen)) {
@ -932,7 +932,7 @@ ScreenSaverSetAttributes(ClientPtr client)
else { else {
ret = ret =
dixLookupResourceByType((void **) &pPixmap, pixID, dixLookupResourceByType((void **) &pPixmap, pixID,
RT_PIXMAP, client, DixReadAccess); X11_RESTYPE_PIXMAP, client, DixReadAccess);
if (ret == Success) { if (ret == Success) {
if ((pPixmap->drawable.depth != depth) || if ((pPixmap->drawable.depth != depth) ||
(pPixmap->drawable.pScreen != pScreen)) { (pPixmap->drawable.pScreen != pScreen)) {
@ -1015,7 +1015,7 @@ ScreenSaverSetAttributes(ClientPtr client)
break; break;
case CWColormap: case CWColormap:
cmap = (Colormap) * pVlist; cmap = (Colormap) * pVlist;
ret = dixLookupResourceByType((void **) &pCmap, cmap, RT_COLORMAP, ret = dixLookupResourceByType((void **) &pCmap, cmap, X11_RESTYPE_COLORMAP,
client, DixUseAccess); client, DixUseAccess);
if (ret != Success) { if (ret != Success) {
client->errorValue = cmap; client->errorValue = cmap;

View File

@ -751,12 +751,12 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey); subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
/* disable background None for untrusted windows */ /* 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) if (subj->haveState && subj->trustLevel != XSecurityClientTrusted)
((WindowPtr) rec->res)->forcedBG = TRUE; ((WindowPtr) rec->res)->forcedBG = TRUE;
/* additional permissions for specific resource types */ /* additional permissions for specific resource types */
if (rec->rtype == RT_WINDOW) if (rec->rtype == X11_RESTYPE_WINDOW)
allowed |= SecurityWindowExtraMask; allowed |= SecurityWindowExtraMask;
/* special checks for server-owned resources */ /* special checks for server-owned resources */
@ -765,7 +765,7 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
/* additional operations allowed on root windows */ /* additional operations allowed on root windows */
allowed |= SecurityRootWindowExtraMask; allowed |= SecurityRootWindowExtraMask;
else if (rec->rtype == RT_COLORMAP) else if (rec->rtype == X11_RESTYPE_COLORMAP)
/* allow access to default colormaps */ /* allow access to default colormaps */
allowed = requested; allowed = requested;

View File

@ -365,7 +365,7 @@ ProcShapeMask(ClientPtr client)
srcRgn = 0; srcRgn = 0;
else { else {
rc = dixLookupResourceByType((void **) &pPixmap, stuff->src, rc = dixLookupResourceByType((void **) &pPixmap, stuff->src,
RT_PIXMAP, client, DixReadAccess); X11_RESTYPE_PIXMAP, client, DixReadAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
if (pPixmap->drawable.pScreen != pScreen || if (pPixmap->drawable.pScreen != pScreen ||

View File

@ -1002,7 +1002,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
if (pMap) { if (pMap) {
result = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, 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) { if (result != Success) {
pDraw->pScreen->DestroyPixmap(pMap); pDraw->pScreen->DestroyPixmap(pMap);
break; break;
@ -1011,7 +1011,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
shmdesc->refcnt++; shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = newPix->info[j].id; 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; result = BadAlloc;
break; break;
} }
@ -1116,7 +1116,7 @@ ProcShmCreatePixmap(ClientPtr client)
shmdesc->addr + shmdesc->addr +
stuff->offset); stuff->offset);
if (pMap) { 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); pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success) { if (rc != Success) {
pDraw->pScreen->DestroyPixmap(pMap); pDraw->pScreen->DestroyPixmap(pMap);
@ -1126,7 +1126,7 @@ ProcShmCreatePixmap(ClientPtr client)
shmdesc->refcnt++; shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = stuff->pid; pMap->drawable.id = stuff->pid;
if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap)) { if (AddResource(stuff->pid, X11_RESTYPE_PIXMAP, (void *) pMap)) {
return Success; return Success;
} }
} }

View File

@ -201,7 +201,7 @@ SELinuxLabelInitial(void)
/* Do the default colormap */ /* Do the default colormap */
dixLookupResourceByType(&unused, screenInfo.screens[i]->defColormap, 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; rec->status = rc;
/* Perform the background none check on windows */ /* 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); rc = SELinuxDoCheck(subj, obj, class, DixBlendAccess, &auditdata);
if (rc != Success) if (rc != Success)
((WindowPtr) rec->res)->forcedBG = TRUE; ((WindowPtr) rec->res)->forcedBG = TRUE;
@ -766,7 +766,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
SELinuxObjectRec *obj; SELinuxObjectRec *obj;
WindowPtr pWin; WindowPtr pWin;
if (rec->type != RT_WINDOW) if (rec->type != X11_RESTYPE_WINDOW)
return; return;
if (rec->state != ResourceStateAdding) if (rec->state != ResourceStateAdding)
return; return;

View File

@ -323,13 +323,13 @@ SELinuxTypeToClass(RESTYPE type)
if (type & RC_DRAWABLE) if (type & RC_DRAWABLE)
class = SECCLASS_X_DRAWABLE; class = SECCLASS_X_DRAWABLE;
else if (type == RT_GC) else if (type == X11_RESTYPE_GC)
class = SECCLASS_X_GC; class = SECCLASS_X_GC;
else if (type == X11_RESTYPE_FONT) else if (type == X11_RESTYPE_FONT)
class = SECCLASS_X_FONT; class = SECCLASS_X_FONT;
else if (type == X11_RESTYPE_CURSOR) else if (type == X11_RESTYPE_CURSOR)
class = SECCLASS_X_CURSOR; class = SECCLASS_X_CURSOR;
else if (type == RT_COLORMAP) else if (type == X11_RESTYPE_COLORMAP)
class = SECCLASS_X_COLORMAP; class = SECCLASS_X_COLORMAP;
else { else {
/* Need to do a string lookup */ /* Need to do a string lookup */

View File

@ -130,7 +130,7 @@ ProcCompositeQueryVersion(ClientPtr client)
do { \ do { \
int err; \ int err; \
err = dixLookupResourceByType((void **) &pWindow, wid, \ err = dixLookupResourceByType((void **) &pWindow, wid, \
RT_WINDOW, client, mode); \ X11_RESTYPE_WINDOW, client, mode);\
if (err != Success) { \ if (err != Success) { \
client->errorValue = wid; \ client->errorValue = wid; \
return err; \ return err; \
@ -252,14 +252,14 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
return BadMatch; return BadMatch;
/* security creation/labeling check */ /* 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,
pPixmap, RT_WINDOW, pWin, DixCreateAccess); pPixmap, X11_RESTYPE_WINDOW, pWin, DixCreateAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
++pPixmap->refcnt; ++pPixmap->refcnt;
if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pPixmap)) if (!AddResource(stuff->pixmap, X11_RESTYPE_PIXMAP, (void *) pPixmap))
return BadAlloc; return BadAlloc;
if (pScreen->NameWindowPixmap) { if (pScreen->NameWindowPixmap) {
@ -307,7 +307,8 @@ ProcCompositeGetOverlayWindow(ClientPtr client)
} }
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id, 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) { if (rc != Success) {
FreeResource(pOc->resource, X11_RESTYPE_NONE); FreeResource(pOc->resource, X11_RESTYPE_NONE);
return rc; return rc;
@ -515,7 +516,7 @@ GetCompositeWindowBytes(void *value, XID id, ResourceSizePtr size)
/* account for redirection */ /* account for redirection */
if (window->redirectDraw != RedirectDrawNone) if (window->redirectDraw != RedirectDrawNone)
{ {
SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP); SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(X11_RESTYPE_PIXMAP);
ResourceSizeRec pixmapSize = { 0, 0 }; ResourceSizeRec pixmapSize = { 0, 0 };
ScreenPtr screen = window->drawable.pScreen; ScreenPtr screen = window->drawable.pScreen;
PixmapPtr pixmap = screen->GetWindowPixmap(window); PixmapPtr pixmap = screen->GetWindowPixmap(window);
@ -556,8 +557,8 @@ CompositeExtensionInit(void)
if (!CompositeClientWindowType) if (!CompositeClientWindowType)
return; return;
coreGetWindowBytes = GetResourceTypeSizeFunc(RT_WINDOW); coreGetWindowBytes = GetResourceTypeSizeFunc(X11_RESTYPE_WINDOW);
SetResourceTypeSizeFunc(RT_WINDOW, GetCompositeWindowBytes); SetResourceTypeSizeFunc(X11_RESTYPE_WINDOW, GetCompositeWindowBytes);
CompositeClientSubwindowsType = CreateNewResourceType CompositeClientSubwindowsType = CreateNewResourceType
(FreeCompositeClientSubwindows, "CompositeClientSubwindows"); (FreeCompositeClientSubwindows, "CompositeClientSubwindows");
@ -728,7 +729,8 @@ PanoramiXCompositeNameWindowPixmap(ClientPtr client)
FOR_NSCREENS(i) { FOR_NSCREENS(i) {
rc = dixLookupResourceByType((void **) &pWin, win->info[i].id, rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
RT_WINDOW, client, DixGetAttrAccess); X11_RESTYPE_WINDOW, client,
DixGetAttrAccess);
if (rc != Success) { if (rc != Success) {
client->errorValue = stuff->window; client->errorValue = stuff->window;
free(newPix); free(newPix);
@ -752,7 +754,7 @@ PanoramiXCompositeNameWindowPixmap(ClientPtr client)
return BadMatch; 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; return BadAlloc;
++pPixmap->refcnt; ++pPixmap->refcnt;
@ -796,7 +798,8 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
FOR_NSCREENS_BACKWARD(i) { FOR_NSCREENS_BACKWARD(i) {
rc = dixLookupResourceByType((void **) &pWin, win->info[i].id, rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
RT_WINDOW, client, DixGetAttrAccess); X11_RESTYPE_WINDOW, client,
DixGetAttrAccess);
if (rc != Success) { if (rc != Success) {
client->errorValue = stuff->window; client->errorValue = stuff->window;
free(overlayWin); free(overlayWin);
@ -827,7 +830,7 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
rc = XaceHook(XACE_RESOURCE_ACCESS, client, rc = XaceHook(XACE_RESOURCE_ACCESS, client,
cs->pOverlayWin->drawable.id, cs->pOverlayWin->drawable.id,
RT_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, NULL, X11_RESTYPE_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, NULL,
DixGetAttrAccess); DixGetAttrAccess);
if (rc != Success) { if (rc != Success) {
FreeResource(pOc->resource, X11_RESTYPE_NONE); FreeResource(pOc->resource, X11_RESTYPE_NONE);

View File

@ -152,7 +152,7 @@ compCreateOverlayWindow(ScreenPtr pScreen)
if (pWin == NULL) if (pWin == NULL)
return FALSE; return FALSE;
if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin)) if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW, (void *) pWin))
return FALSE; return FALSE;
MapWindow(pWin, serverClient); MapWindow(pWin, serverClient);

View File

@ -171,7 +171,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
/* Security creation/labeling check. */ /* Security creation/labeling check. */
rc = XaceHook(XACE_RESOURCE_ACCESS, serverClient, bufId, rc = XaceHook(XACE_RESOURCE_ACCESS, serverClient, bufId,
dbeDrawableResType, pDbeWindowPriv->pBackBuffer, dbeDrawableResType, pDbeWindowPriv->pBackBuffer,
RT_WINDOW, pWin, DixCreateAccess); X11_RESTYPE_WINDOW, pWin, DixCreateAccess);
/* Make the back pixmap a DBE drawable resource. */ /* Make the back pixmap a DBE drawable resource. */
if (rc != Success || !AddResource(bufId, dbeDrawableResType, if (rc != Success || !AddResource(bufId, dbeDrawableResType,

View File

@ -370,13 +370,13 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
} }
pmap->flags |= BeingCreated; pmap->flags |= BeingCreated;
if (!AddResource(mid, RT_COLORMAP, (void *) pmap)) if (!AddResource(mid, X11_RESTYPE_COLORMAP, (void *) pmap))
return BadAlloc; return BadAlloc;
/* /*
* Security creation/labeling check * 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); pmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (i != Success) { if (i != Success) {
FreeResource(mid, X11_RESTYPE_NONE); FreeResource(mid, X11_RESTYPE_NONE);
@ -566,7 +566,7 @@ CopyColormapAndFree(Colormap mid, ColormapPtr pSrc, int client)
} }
if (pmap->class & DynamicClass) if (pmap->class & DynamicClass)
UpdateColors(pmap); UpdateColors(pmap);
/* XXX should worry about removing any RT_CMAPENTRY resource */ /* XXX should worry about removing any X11_RESTYPE_CMAPENTRY resource */
return Success; return Success;
} }
@ -1016,7 +1016,7 @@ AllocColor(ColormapPtr pmap,
ColormapPtr prootmap; ColormapPtr prootmap;
dixLookupResourceByType((void **) &prootmap, dixLookupResourceByType((void **) &prootmap,
pmap->pScreen->defColormap, RT_COLORMAP, pmap->pScreen->defColormap, X11_RESTYPE_COLORMAP,
clients[client], DixReadAccess); clients[client], DixReadAccess);
if (pmap->class == prootmap->class) if (pmap->class == prootmap->class)
@ -1034,7 +1034,7 @@ AllocColor(ColormapPtr pmap,
ColormapPtr prootmap; ColormapPtr prootmap;
dixLookupResourceByType((void **) &prootmap, dixLookupResourceByType((void **) &prootmap,
pmap->pScreen->defColormap, RT_COLORMAP, pmap->pScreen->defColormap, X11_RESTYPE_COLORMAP,
clients[client], DixReadAccess); clients[client], DixReadAccess);
if (pmap->class == prootmap->class) { if (pmap->class == prootmap->class) {
@ -1087,7 +1087,7 @@ AllocColor(ColormapPtr pmap,
} }
pcr->mid = pmap->mid; pcr->mid = pmap->mid;
pcr->client = client; pcr->client = client;
if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr)) if (!AddResource(FakeClientID(client), X11_RESTYPE_CMAPENTRY, (void *) pcr))
return BadAlloc; return BadAlloc;
} }
return Success; return Success;
@ -1472,7 +1472,7 @@ FreeClientPixels(void *value, XID fakeid)
colorResource *pcr = value; colorResource *pcr = value;
int rc; int rc;
rc = dixLookupResourceByType(&pmap, pcr->mid, RT_COLORMAP, serverClient, rc = dixLookupResourceByType(&pmap, pcr->mid, X11_RESTYPE_COLORMAP, serverClient,
DixRemoveAccess); DixRemoveAccess);
if (rc == Success) if (rc == Success)
FreePixels((ColormapPtr) pmap, pcr->client); FreePixels((ColormapPtr) pmap, pcr->client);
@ -1535,7 +1535,7 @@ AllocColorCells(int client, ColormapPtr pmap, int colors, int planes,
if ((ok == Success) && pcr) { if ((ok == Success) && pcr) {
pcr->mid = pmap->mid; pcr->mid = pmap->mid;
pcr->client = client; pcr->client = client;
if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr)) if (!AddResource(FakeClientID(client), X11_RESTYPE_CMAPENTRY, (void *) pcr))
ok = BadAlloc; ok = BadAlloc;
} }
else else
@ -1617,7 +1617,7 @@ AllocColorPlanes(int client, ColormapPtr pmap, int colors,
if ((ok == Success) && pcr) { if ((ok == Success) && pcr) {
pcr->mid = pmap->mid; pcr->mid = pmap->mid;
pcr->client = client; pcr->client = client;
if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr)) if (!AddResource(FakeClientID(client), X11_RESTYPE_CMAPENTRY, (void *) pcr))
ok = BadAlloc; ok = BadAlloc;
} }
else else
@ -2092,7 +2092,7 @@ FreeColors(ColormapPtr pmap, int client, int count, Pixel * pixels, Pixel mask)
clients[client]->errorValue = *pixels | mask; clients[client]->errorValue = *pixels | mask;
result = BadValue; result = BadValue;
} }
/* XXX should worry about removing any RT_CMAPENTRY resource */ /* XXX should worry about removing any X11_RESTYPE_CMAPENTRY resource */
return result; return result;
} }
@ -2539,7 +2539,7 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth)
cdata.visuals = visuals; cdata.visuals = visuals;
cdata.pScreen = pScreen; cdata.pScreen = pScreen;
FindClientResourcesByType(serverClient, RT_COLORMAP, FindClientResourcesByType(serverClient, X11_RESTYPE_COLORMAP,
_colormap_find_resource, &cdata); _colormap_find_resource, &cdata);
pScreen->visuals = visuals; pScreen->visuals = visuals;

View File

@ -769,7 +769,7 @@ ProcCreateWindow(ClientPtr client)
Mask mask = pWin->eventMask; Mask mask = pWin->eventMask;
pWin->eventMask = 0; /* subterfuge in case AddResource fails */ 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; return BadAlloc;
pWin->eventMask = mask; pWin->eventMask = mask;
} }
@ -1515,13 +1515,13 @@ ProcCreatePixmap(ClientPtr client)
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = stuff->pid; pMap->drawable.id = stuff->pid;
/* security creation/labeling check */ /* 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); pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success) { if (rc != Success) {
(*pDraw->pScreen->DestroyPixmap) (pMap); (*pDraw->pScreen->DestroyPixmap) (pMap);
return rc; return rc;
} }
if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap)) if (AddResource(stuff->pid, X11_RESTYPE_PIXMAP, (void *) pMap))
return Success; return Success;
} }
return BadAlloc; return BadAlloc;
@ -1536,7 +1536,7 @@ ProcFreePixmap(ClientPtr client)
REQUEST(xResourceReq); REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupResourceByType((void **) &pMap, stuff->id, RT_PIXMAP, rc = dixLookupResourceByType((void **) &pMap, stuff->id, X11_RESTYPE_PIXMAP,
client, DixDestroyAccess); client, DixDestroyAccess);
if (rc == Success) { if (rc == Success) {
FreeResource(stuff->id, X11_RESTYPE_NONE); FreeResource(stuff->id, X11_RESTYPE_NONE);
@ -1573,7 +1573,7 @@ ProcCreateGC(ClientPtr client)
stuff->gc, client); stuff->gc, client);
if (error != Success) if (error != Success)
return error; return error;
if (!AddResource(stuff->gc, RT_GC, (void *) pGC)) if (!AddResource(stuff->gc, X11_RESTYPE_GC, (void *) pGC))
return BadAlloc; return BadAlloc;
return Success; return Success;
} }
@ -2471,7 +2471,7 @@ ProcFreeColormap(ClientPtr client)
REQUEST(xResourceReq); REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupResourceByType((void **) &pmap, stuff->id, RT_COLORMAP, rc = dixLookupResourceByType((void **) &pmap, stuff->id, X11_RESTYPE_COLORMAP,
client, DixDestroyAccess); client, DixDestroyAccess);
if (rc == Success) { if (rc == Success) {
/* Freeing a default colormap is a no-op */ /* Freeing a default colormap is a no-op */
@ -2498,7 +2498,7 @@ ProcCopyColormapAndFree(ClientPtr client)
mid = stuff->mid; mid = stuff->mid;
LEGAL_NEW_RESOURCE(mid, client); LEGAL_NEW_RESOURCE(mid, client);
rc = dixLookupResourceByType((void **) &pSrcMap, stuff->srcCmap, rc = dixLookupResourceByType((void **) &pSrcMap, stuff->srcCmap,
RT_COLORMAP, client, X11_RESTYPE_COLORMAP, client,
DixReadAccess | DixRemoveAccess); DixReadAccess | DixRemoveAccess);
if (rc == Success) if (rc == Success)
return CopyColormapAndFree(mid, pSrcMap, client->index); return CopyColormapAndFree(mid, pSrcMap, client->index);
@ -2515,7 +2515,7 @@ ProcInstallColormap(ClientPtr client)
REQUEST(xResourceReq); REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP, rc = dixLookupResourceByType((void **) &pcmp, stuff->id, X11_RESTYPE_COLORMAP,
client, DixInstallAccess); client, DixInstallAccess);
if (rc != Success) if (rc != Success)
goto out; goto out;
@ -2544,7 +2544,7 @@ ProcUninstallColormap(ClientPtr client)
REQUEST(xResourceReq); REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP, rc = dixLookupResourceByType((void **) &pcmp, stuff->id, X11_RESTYPE_COLORMAP,
client, DixUninstallAccess); client, DixUninstallAccess);
if (rc != Success) if (rc != Success)
goto out; goto out;
@ -2612,7 +2612,7 @@ ProcAllocColor(ClientPtr client)
REQUEST(xAllocColorReq); REQUEST(xAllocColorReq);
REQUEST_SIZE_MATCH(xAllocColorReq); REQUEST_SIZE_MATCH(xAllocColorReq);
rc = dixLookupResourceByType((void **) &pmap, stuff->cmap, RT_COLORMAP, rc = dixLookupResourceByType((void **) &pmap, stuff->cmap, X11_RESTYPE_COLORMAP,
client, DixAddAccess); client, DixAddAccess);
if (rc == Success) { if (rc == Success) {
xAllocColorReply acr = { xAllocColorReply acr = {
@ -2649,7 +2649,7 @@ ProcAllocNamedColor(ClientPtr client)
REQUEST(xAllocNamedColorReq); REQUEST(xAllocNamedColorReq);
REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes); 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); client, DixAddAccess);
if (rc == Success) { if (rc == Success) {
xAllocNamedColorReply ancr = { xAllocNamedColorReply ancr = {
@ -2694,7 +2694,7 @@ ProcAllocColorCells(ClientPtr client)
REQUEST(xAllocColorCellsReq); REQUEST(xAllocColorCellsReq);
REQUEST_SIZE_MATCH(xAllocColorCellsReq); REQUEST_SIZE_MATCH(xAllocColorCellsReq);
rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP, rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, X11_RESTYPE_COLORMAP,
client, DixAddAccess); client, DixAddAccess);
if (rc == Success) { if (rc == Success) {
int npixels, nmasks; int npixels, nmasks;
@ -2755,7 +2755,7 @@ ProcAllocColorPlanes(ClientPtr client)
REQUEST(xAllocColorPlanesReq); REQUEST(xAllocColorPlanesReq);
REQUEST_SIZE_MATCH(xAllocColorPlanesReq); REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP, rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, X11_RESTYPE_COLORMAP,
client, DixAddAccess); client, DixAddAccess);
if (rc == Success) { if (rc == Success) {
xAllocColorPlanesReply acpr; xAllocColorPlanesReply acpr;
@ -2817,7 +2817,7 @@ ProcFreeColors(ClientPtr client)
REQUEST(xFreeColorsReq); REQUEST(xFreeColorsReq);
REQUEST_AT_LEAST_SIZE(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); client, DixRemoveAccess);
if (rc == Success) { if (rc == Success) {
int count; int count;
@ -2843,7 +2843,7 @@ ProcStoreColors(ClientPtr client)
REQUEST(xStoreColorsReq); REQUEST(xStoreColorsReq);
REQUEST_AT_LEAST_SIZE(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); client, DixWriteAccess);
if (rc == Success) { if (rc == Success) {
int count; int count;
@ -2869,7 +2869,7 @@ ProcStoreNamedColor(ClientPtr client)
REQUEST(xStoreNamedColorReq); REQUEST(xStoreNamedColorReq);
REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes); 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); client, DixWriteAccess);
if (rc == Success) { if (rc == Success) {
xColorItem def; xColorItem def;
@ -2901,7 +2901,7 @@ ProcQueryColors(ClientPtr client)
REQUEST(xQueryColorsReq); REQUEST(xQueryColorsReq);
REQUEST_AT_LEAST_SIZE(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); client, DixReadAccess);
if (rc == Success) { if (rc == Success) {
int count; int count;
@ -2948,7 +2948,7 @@ ProcLookupColor(ClientPtr client)
REQUEST(xLookupColorReq); REQUEST(xLookupColorReq);
REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes); 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); client, DixReadAccess);
if (rc == Success) { if (rc == Success) {
CARD16 exactRed, exactGreen, exactBlue; CARD16 exactRed, exactGreen, exactBlue;
@ -3002,7 +3002,7 @@ ProcCreateCursor(ClientPtr client)
REQUEST_SIZE_MATCH(xCreateCursorReq); REQUEST_SIZE_MATCH(xCreateCursorReq);
LEGAL_NEW_RESOURCE(stuff->cid, client); 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); client, DixReadAccess);
if (rc != Success) { if (rc != Success) {
client->errorValue = stuff->source; client->errorValue = stuff->source;
@ -3014,7 +3014,7 @@ ProcCreateCursor(ClientPtr client)
/* Find and validate cursor mask pixmap, if one is provided */ /* Find and validate cursor mask pixmap, if one is provided */
if (stuff->mask != None) { if (stuff->mask != None) {
rc = dixLookupResourceByType((void **) &msk, stuff->mask, RT_PIXMAP, rc = dixLookupResourceByType((void **) &msk, stuff->mask, X11_RESTYPE_PIXMAP,
client, DixReadAccess); client, DixReadAccess);
if (rc != Success) { if (rc != Success) {
client->errorValue = stuff->mask; client->errorValue = stuff->mask;
@ -4079,7 +4079,7 @@ RemoveGPUScreen(ScreenPtr pScreen)
/* this gets freed later in the resource list, but without /* this gets freed later in the resource list, but without
* the screen existing it causes crashes - so remove it here */ * the screen existing it causes crashes - so remove it here */
if (pScreen->defColormap) if (pScreen->defColormap)
FreeResource(pScreen->defColormap, RT_COLORMAP); FreeResource(pScreen->defColormap, X11_RESTYPE_COLORMAP);
free(pScreen); free(pScreen);
} }

View File

@ -197,7 +197,7 @@ dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
int int
dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access) 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 int
@ -211,7 +211,7 @@ dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access)
access); access);
if (rc != BadFont) if (rc != BadFont)
return rc; return rc;
rc = dixLookupResourceByType((void **) &pGC, id, RT_GC, client, access); rc = dixLookupResourceByType((void **) &pGC, id, X11_RESTYPE_GC, client, access);
if (rc == BadGC) if (rc == BadGC)
return BadFont; return BadFont;
if (rc == Success) if (rc == Success)

View File

@ -4534,7 +4534,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
check = (mask & ManagerMask); check = (mask & ManagerMask);
if (check) { if (check) {
rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, 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) if (rc != Success)
return rc; return rc;
} }
@ -4577,7 +4577,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
others->resource = FakeClientID(client->index); others->resource = FakeClientID(client->index);
others->next = pWin->optional->otherClients; others->next = pWin->optional->otherClients;
pWin->optional->otherClients = others; pWin->optional->otherClients = others;
if (!AddResource(others->resource, RT_OTHERCLIENT, (void *) pWin)) if (!AddResource(others->resource, X11_RESTYPE_OTHERCLIENT, (void *) pWin))
return BadAlloc; return BadAlloc;
} }
maskSet: maskSet:

View File

@ -423,10 +423,10 @@ static const struct {
RESTYPE type; RESTYPE type;
Mask access_mode; Mask access_mode;
} xidfields[] = { } xidfields[] = {
{GCTile, RT_PIXMAP, DixReadAccess}, {GCTile, X11_RESTYPE_PIXMAP, DixReadAccess},
{GCStipple, RT_PIXMAP, DixReadAccess}, {GCStipple, X11_RESTYPE_PIXMAP, DixReadAccess},
{GCFont, X11_RESTYPE_FONT, DixUseAccess}, {GCFont, X11_RESTYPE_FONT, DixUseAccess},
{GCClipMask, RT_PIXMAP, DixReadAccess}, {GCClipMask, X11_RESTYPE_PIXMAP, DixReadAccess},
}; };
int int
@ -549,7 +549,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
} }
/* security creation/labeling check */ /* 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); X11_RESTYPE_NONE, NULL, DixCreateAccess | DixSetAttrAccess);
if (*pStatus != Success) if (*pStatus != Success)
goto out; goto out;

View File

@ -567,7 +567,7 @@ AddPassiveGrabToList(ClientPtr client, GrabPtr pGrab)
pGrab->next = pGrab->window->optional->passiveGrabs; pGrab->next = pGrab->window->optional->passiveGrabs;
pGrab->window->optional->passiveGrabs = pGrab; 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 Success;
return BadAlloc; return BadAlloc;
} }
@ -664,7 +664,7 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
FreeGrab(pNewGrab); FreeGrab(pNewGrab);
ok = FALSE; ok = FALSE;
} }
else if (!AddResource(pNewGrab->resource, RT_PASSIVEGRAB, else if (!AddResource(pNewGrab->resource, X11_RESTYPE_PASSIVEGRAB,
(void *) pNewGrab)) (void *) pNewGrab))
ok = FALSE; ok = FALSE;
else else

View File

@ -257,7 +257,7 @@ fixupDefaultColormaps(FixupFunc fixup, unsigned bytes)
ColormapPtr cmap; ColormapPtr cmap;
dixLookupResourceByType((void **) &cmap, dixLookupResourceByType((void **) &cmap,
screenInfo.screens[s]->defColormap, RT_COLORMAP, screenInfo.screens[s]->defColormap, X11_RESTYPE_COLORMAP,
serverClient, DixCreateAccess); serverClient, DixCreateAccess);
if (cmap && if (cmap &&
!fixup(&cmap->devPrivates, screenInfo.screens[s]->screenSpecificPrivates[PRIVATE_COLORMAP].offset, bytes)) !fixup(&cmap->devPrivates, screenInfo.screens[s]->screenSpecificPrivates[PRIVATE_COLORMAP].offset, bytes))
@ -564,13 +564,13 @@ dixPrivatesSize(DevPrivateType type)
/* Table of devPrivates offsets */ /* Table of devPrivates offsets */
static const int offsets[] = { static const int offsets[] = {
-1, /* RT_NONE / X11_RESTYPE_NONE */ -1, /* X11_RESTYPE_NONE */
offsetof(WindowRec, devPrivates), /* RT_WINDOW */ offsetof(WindowRec, devPrivates), /* X11_RESTYPE_WINDOW */
offsetof(PixmapRec, devPrivates), /* RT_PIXMAP */ offsetof(PixmapRec, devPrivates), /* X11_RESTYPE_PIXMAP */
offsetof(GC, devPrivates), /* RT_GC */ offsetof(GC, devPrivates), /* X11_RESTYPE_GC */
-1, /* RT_FONT / X11_RESTYPE_FONT */ -1, /* X11_RESTYPE_FONT */
offsetof(CursorRec, devPrivates), /* RT_CURSOR / X11_RESTYPE_CURSOR */ offsetof(CursorRec, devPrivates), /* X11_RESTYPE_CURSOR */
offsetof(ColormapRec, devPrivates), /* RT_COLORMAP */ offsetof(ColormapRec, devPrivates), /* X11_RESTYPE_COLORMAP */
}; };
int int
@ -581,10 +581,10 @@ dixLookupPrivateOffset(RESTYPE type)
* points at pixmaps (thanks, DBE) * points at pixmaps (thanks, DBE)
*/ */
if (type & RC_DRAWABLE) { if (type & RC_DRAWABLE) {
if (type == RT_WINDOW) if (type == X11_RESTYPE_WINDOW)
return offsets[RT_WINDOW & TypeMask]; return offsets[X11_RESTYPE_WINDOW & TypeMask];
else else
return offsets[RT_PIXMAP & TypeMask]; return offsets[X11_RESTYPE_PIXMAP & TypeMask];
} }
type = type & TypeMask; type = type & TypeMask;
if (type < ARRAY_SIZE(offsets)) if (type < ARRAY_SIZE(offsets))

View File

@ -364,14 +364,14 @@ dixResetRegistry(void)
#ifdef X_REGISTRY_RESOURCE #ifdef X_REGISTRY_RESOURCE
/* Add built-in resources */ /* Add built-in resources */
RegisterResourceName(X11_RESTYPE_NONE, "NONE"); RegisterResourceName(X11_RESTYPE_NONE, "NONE");
RegisterResourceName(RT_WINDOW, "WINDOW"); RegisterResourceName(X11_RESTYPE_WINDOW, "WINDOW");
RegisterResourceName(RT_PIXMAP, "PIXMAP"); RegisterResourceName(X11_RESTYPE_PIXMAP, "PIXMAP");
RegisterResourceName(RT_GC, "GC"); RegisterResourceName(X11_RESTYPE_GC, "GC");
RegisterResourceName(X11_RESTYPE_FONT, "FONT"); RegisterResourceName(X11_RESTYPE_FONT, "FONT");
RegisterResourceName(X11_RESTYPE_CURSOR, "CURSOR"); RegisterResourceName(X11_RESTYPE_CURSOR, "CURSOR");
RegisterResourceName(RT_COLORMAP, "COLORMAP"); RegisterResourceName(X11_RESTYPE_COLORMAP, "COLORMAP");
RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY"); RegisterResourceName(X11_RESTYPE_CMAPENTRY, "COLORMAP ENTRY");
RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT"); RegisterResourceName(X11_RESTYPE_OTHERCLIENT, "OTHER CLIENT");
RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB"); RegisterResourceName(X11_RESTYPE_PASSIVEGRAB, "PASSIVE GRAB");
#endif #endif
} }

View File

@ -299,7 +299,7 @@ GetPixmapBytes(void *value, XID id, ResourceSizePtr size)
static void static void
GetWindowBytes(void *value, XID id, ResourceSizePtr size) GetWindowBytes(void *value, XID id, ResourceSizePtr size)
{ {
SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP); SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(X11_RESTYPE_PIXMAP);
ResourceSizeRec pixmapSize = { 0, 0, 0 }; ResourceSizeRec pixmapSize = { 0, 0, 0 };
WindowPtr window = value; WindowPtr window = value;
@ -348,12 +348,12 @@ FindWindowSubRes(void *value, FindAllRes func, void *cdata)
if (window->backgroundState == BackgroundPixmap) if (window->backgroundState == BackgroundPixmap)
{ {
PixmapPtr pixmap = window->background.pixmap; 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) if (window->border.pixmap && !window->borderIsPixel)
{ {
PixmapPtr pixmap = window->border.pixmap; 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 static void
GetGcBytes(void *value, XID id, ResourceSizePtr size) GetGcBytes(void *value, XID id, ResourceSizePtr size)
{ {
SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP); SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(X11_RESTYPE_PIXMAP);
ResourceSizeRec pixmapSize = { 0, 0, 0 }; ResourceSizeRec pixmapSize = { 0, 0, 0 };
GCPtr gc = value; GCPtr gc = value;
@ -420,12 +420,12 @@ FindGCSubRes(void *value, FindAllRes func, void *cdata)
if (gc->stipple) if (gc->stipple)
{ {
PixmapPtr pixmap = 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) if (gc->tile.pixmap && !gc->tileIsPixel)
{ {
PixmapPtr pixmap = gc->tile.pixmap; 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, .findSubResFunc = DefaultFindSubRes,
.errorValue = BadValue, .errorValue = BadValue,
}, },
[RT_WINDOW & (RC_LASTPREDEF - 1)] = { [X11_RESTYPE_WINDOW & (RC_LASTPREDEF - 1)] = {
.deleteFunc = DeleteWindow, .deleteFunc = DeleteWindow,
.sizeFunc = GetWindowBytes, .sizeFunc = GetWindowBytes,
.findSubResFunc = FindWindowSubRes, .findSubResFunc = FindWindowSubRes,
.errorValue = BadWindow, .errorValue = BadWindow,
}, },
[RT_PIXMAP & (RC_LASTPREDEF - 1)] = { [X11_RESTYPE_PIXMAP & (RC_LASTPREDEF - 1)] = {
.deleteFunc = dixDestroyPixmap, .deleteFunc = dixDestroyPixmap,
.sizeFunc = GetPixmapBytes, .sizeFunc = GetPixmapBytes,
.findSubResFunc = DefaultFindSubRes, .findSubResFunc = DefaultFindSubRes,
.errorValue = BadPixmap, .errorValue = BadPixmap,
}, },
[RT_GC & (RC_LASTPREDEF - 1)] = { [X11_RESTYPE_GC & (RC_LASTPREDEF - 1)] = {
.deleteFunc = FreeGC, .deleteFunc = FreeGC,
.sizeFunc = GetGcBytes, .sizeFunc = GetGcBytes,
.findSubResFunc = FindGCSubRes, .findSubResFunc = FindGCSubRes,
@ -468,25 +468,25 @@ static const struct ResourceType predefTypes[] = {
.findSubResFunc = DefaultFindSubRes, .findSubResFunc = DefaultFindSubRes,
.errorValue = BadCursor, .errorValue = BadCursor,
}, },
[RT_COLORMAP & (RC_LASTPREDEF - 1)] = { [X11_RESTYPE_COLORMAP & (RC_LASTPREDEF - 1)] = {
.deleteFunc = FreeColormap, .deleteFunc = FreeColormap,
.sizeFunc = GetDefaultBytes, .sizeFunc = GetDefaultBytes,
.findSubResFunc = DefaultFindSubRes, .findSubResFunc = DefaultFindSubRes,
.errorValue = BadColor, .errorValue = BadColor,
}, },
[RT_CMAPENTRY & (RC_LASTPREDEF - 1)] = { [X11_RESTYPE_CMAPENTRY & (RC_LASTPREDEF - 1)] = {
.deleteFunc = FreeClientPixels, .deleteFunc = FreeClientPixels,
.sizeFunc = GetDefaultBytes, .sizeFunc = GetDefaultBytes,
.findSubResFunc = DefaultFindSubRes, .findSubResFunc = DefaultFindSubRes,
.errorValue = BadColor, .errorValue = BadColor,
}, },
[RT_OTHERCLIENT & (RC_LASTPREDEF - 1)] = { [X11_RESTYPE_OTHERCLIENT & (RC_LASTPREDEF - 1)] = {
.deleteFunc = OtherClientGone, .deleteFunc = OtherClientGone,
.sizeFunc = GetDefaultBytes, .sizeFunc = GetDefaultBytes,
.findSubResFunc = DefaultFindSubRes, .findSubResFunc = DefaultFindSubRes,
.errorValue = BadValue, .errorValue = BadValue,
}, },
[RT_PASSIVEGRAB & (RC_LASTPREDEF - 1)] = { [X11_RESTYPE_PASSIVEGRAB & (RC_LASTPREDEF - 1)] = {
.deleteFunc = DeletePassiveGrab, .deleteFunc = DeletePassiveGrab,
.sizeFunc = GetDefaultBytes, .sizeFunc = GetDefaultBytes,
.findSubResFunc = DefaultFindSubRes, .findSubResFunc = DefaultFindSubRes,
@ -552,7 +552,7 @@ GetResourceTypeSizeFunc(RESTYPE type)
* Override the default function that calculates resource size. For * Override the default function that calculates resource size. For
* example, video driver knows better how to calculate pixmap memory * example, video driver knows better how to calculate pixmap memory
* usage and can therefore wrap or override size calculation for * usage and can therefore wrap or override size calculation for
* RT_PIXMAP. * X11_RESTYPE_PIXMAP.
* *
* @param[in] type Resource type used in size calculations. * @param[in] type Resource type used in size calculations.
* *
@ -646,7 +646,7 @@ InitClientResources(ClientPtr client)
int i, j; int i, j;
if (client == serverClient) { if (client == serverClient) {
lastResourceType = RT_LASTPREDEF; lastResourceType = X11_RESTYPE_LASTPREDEF;
lastResourceClass = RC_LASTPREDEF; lastResourceClass = RC_LASTPREDEF;
TypeMask = RC_LASTPREDEF - 1; TypeMask = RC_LASTPREDEF - 1;
free(resourceTypes); free(resourceTypes);

View File

@ -800,7 +800,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
/* window owner */ /* window owner */
if (IsMaster(dev) && (win->eventMask & core_filter)) { if (IsMaster(dev) && (win->eventMask & core_filter)) {
TouchEventHistoryAllocate(ti); 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_POINTER_REGULAR,
TOUCH_LISTENER_AWAITING_BEGIN, TOUCH_LISTENER_AWAITING_BEGIN,
win, NULL); win, NULL);
@ -813,7 +813,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
continue; continue;
TouchEventHistoryAllocate(ti); TouchEventHistoryAllocate(ti);
TouchAddListener(ti, oclients->resource, RT_OTHERCLIENT, CORE, TouchAddListener(ti, oclients->resource, X11_RESTYPE_OTHERCLIENT, CORE,
type, TOUCH_LISTENER_AWAITING_BEGIN, win, NULL); type, TOUCH_LISTENER_AWAITING_BEGIN, win, NULL);
return TRUE; return TRUE;
} }

View File

@ -396,7 +396,7 @@ PrintPassiveGrabs(void)
FreeLocalClientCreds(lcc); 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"); ErrorF("End list of registered passive grabs\n");
} }
@ -640,10 +640,10 @@ CreateRootWindow(ScreenPtr pScreen)
/* security creation/labeling check /* security creation/labeling check
*/ */
if (XaceHook(XACE_RESOURCE_ACCESS, serverClient, pWin->drawable.id, 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; return FALSE;
if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin)) if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW, (void *) pWin))
return FALSE; return FALSE;
if (disableBackingStore) if (disableBackingStore)
@ -868,8 +868,8 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
/* security creation/labeling check /* security creation/labeling check
*/ */
*error = XaceHook(XACE_RESOURCE_ACCESS, client, wid, RT_WINDOW, pWin, *error = XaceHook(XACE_RESOURCE_ACCESS, client, wid, X11_RESTYPE_WINDOW, pWin,
RT_WINDOW, pWin->parent, X11_RESTYPE_WINDOW, pWin->parent,
DixCreateAccess | DixSetAttrAccess); DixCreateAccess | DixSetAttrAccess);
if (*error != Success) { if (*error != Success) {
dixFreeObjectWithPrivates(pWin, PRIVATE_WINDOW); dixFreeObjectWithPrivates(pWin, PRIVATE_WINDOW);
@ -1043,7 +1043,7 @@ CrushTree(WindowPtr pWin)
event.u.destroyNotify.window = pChild->drawable.id; event.u.destroyNotify.window = pChild->drawable.id;
DeliverEvents(pChild, &event, 1, NullWindow); DeliverEvents(pChild, &event, 1, NullWindow);
} }
FreeResource(pChild->drawable.id, RT_WINDOW); FreeResource(pChild->drawable.id, X11_RESTYPE_WINDOW);
pSib = pChild->nextSib; pSib = pChild->nextSib;
pChild->viewable = FALSE; pChild->viewable = FALSE;
if (pChild->realized) { if (pChild->realized) {
@ -1117,7 +1117,7 @@ DestroySubwindows(WindowPtr pWin, ClientPtr client)
UnmapSubwindows(pWin); UnmapSubwindows(pWin);
while (pWin->lastChild) { while (pWin->lastChild) {
int rc = XaceHook(XACE_RESOURCE_ACCESS, client, 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); pWin->lastChild, X11_RESTYPE_NONE, NULL, DixDestroyAccess);
if (rc != Success) if (rc != Success)
@ -1219,7 +1219,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
} }
else { else {
rc = dixLookupResourceByType((void **) &pPixmap, pixID, rc = dixLookupResourceByType((void **) &pPixmap, pixID,
RT_PIXMAP, client, DixReadAccess); X11_RESTYPE_PIXMAP, client, DixReadAccess);
if (rc == Success) { if (rc == Success) {
if ((pPixmap->drawable.depth != pWin->drawable.depth) || if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
(pPixmap->drawable.pScreen != pScreen)) { (pPixmap->drawable.pScreen != pScreen)) {
@ -1272,7 +1272,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
pixID = pWin->parent->border.pixmap->drawable.id; pixID = pWin->parent->border.pixmap->drawable.id;
} }
} }
rc = dixLookupResourceByType((void **) &pPixmap, pixID, RT_PIXMAP, rc = dixLookupResourceByType((void **) &pPixmap, pixID, X11_RESTYPE_PIXMAP,
client, DixReadAccess); client, DixReadAccess);
if (rc == Success) { if (rc == Success) {
if ((pPixmap->drawable.depth != pWin->drawable.depth) || if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
@ -1399,7 +1399,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
} }
if (val == xTrue) { if (val == xTrue) {
rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, 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) { if (rc != Success) {
error = rc; error = rc;
client->errorValue = pWin->drawable.id; client->errorValue = pWin->drawable.id;
@ -1424,7 +1424,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
error = BadMatch; error = BadMatch;
goto PatchUp; goto PatchUp;
} }
rc = dixLookupResourceByType((void **) &pCmap, cmap, RT_COLORMAP, rc = dixLookupResourceByType((void **) &pCmap, cmap, X11_RESTYPE_COLORMAP,
client, DixUseAccess); client, DixUseAccess);
if (rc != Success) { if (rc != Success) {
error = rc; error = rc;
@ -2665,7 +2665,7 @@ MapWindow(WindowPtr pWin, ClientPtr client)
return Success; return Success;
/* general check for permission to map window */ /* 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) pWin, X11_RESTYPE_NONE, NULL, DixShowAccess) != Success)
return Success; return Success;
@ -3294,7 +3294,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
if (!pWin) if (!pWin)
return FALSE; return FALSE;
if (!AddResource(pWin->drawable.id, RT_WINDOW, if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW,
(void *) pScreen->screensaver.pWindow)) (void *) pScreen->screensaver.pWindow))
return FALSE; return FALSE;

View File

@ -238,14 +238,14 @@ proc_dri3_pixmap_from_buffer(ClientPtr client)
pixmap->drawable.id = stuff->pixmap; pixmap->drawable.id = stuff->pixmap;
/* security creation/labeling check */ /* 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); pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success) { if (rc != Success) {
(*drawable->pScreen->DestroyPixmap) (pixmap); (*drawable->pScreen->DestroyPixmap) (pixmap);
return rc; return rc;
} }
if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pixmap)) if (!AddResource(stuff->pixmap, X11_RESTYPE_PIXMAP, (void *) pixmap))
return BadAlloc; return BadAlloc;
return Success; return Success;
@ -266,7 +266,7 @@ proc_dri3_buffer_from_pixmap(ClientPtr client)
PixmapPtr pixmap; PixmapPtr pixmap;
REQUEST_SIZE_MATCH(xDRI3BufferFromPixmapReq); REQUEST_SIZE_MATCH(xDRI3BufferFromPixmapReq);
rc = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, RT_PIXMAP, rc = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, X11_RESTYPE_PIXMAP,
client, DixWriteAccess); client, DixWriteAccess);
if (rc != Success) { if (rc != Success) {
client->errorValue = stuff->pixmap; client->errorValue = stuff->pixmap;
@ -502,14 +502,14 @@ proc_dri3_pixmap_from_buffers(ClientPtr client)
pixmap->drawable.id = stuff->pixmap; pixmap->drawable.id = stuff->pixmap;
/* security creation/labeling check */ /* 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); pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success) { if (rc != Success) {
(*screen->DestroyPixmap) (pixmap); (*screen->DestroyPixmap) (pixmap);
return rc; return rc;
} }
if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pixmap)) if (!AddResource(stuff->pixmap, X11_RESTYPE_PIXMAP, (void *) pixmap))
return BadAlloc; return BadAlloc;
return Success; return Success;
@ -532,7 +532,7 @@ proc_dri3_buffers_from_pixmap(ClientPtr client)
PixmapPtr pixmap; PixmapPtr pixmap;
REQUEST_SIZE_MATCH(xDRI3BuffersFromPixmapReq); REQUEST_SIZE_MATCH(xDRI3BuffersFromPixmapReq);
rc = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, RT_PIXMAP, rc = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, X11_RESTYPE_PIXMAP,
client, DixWriteAccess); client, DixWriteAccess);
if (rc != Success) { if (rc != Success) {
client->errorValue = stuff->pixmap; client->errorValue = stuff->pixmap;

View File

@ -1395,7 +1395,7 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
if (!pPixmap) if (!pPixmap)
return BadAlloc; 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); pPixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (err != Success) { if (err != Success) {
(*pGlxScreen->pScreen->DestroyPixmap) (pPixmap); (*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 * resource so it and the DRI2 drawable will be reclaimed when the
* pbuffer is destroyed. */ * pbuffer is destroyed. */
pPixmap->drawable.id = glxDrawableId; pPixmap->drawable.id = glxDrawableId;
if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap)) if (!AddResource(pPixmap->drawable.id, X11_RESTYPE_PIXMAP, pPixmap))
return BadAlloc; return BadAlloc;
return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable, return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable,

View File

@ -308,7 +308,7 @@ GetGLXDrawableBytes(void *value, XID id, ResourceSizePtr size)
size->refCnt = 1; size->refCnt = 1;
if (draw->type == GLX_DRAWABLE_PIXMAP) { if (draw->type == GLX_DRAWABLE_PIXMAP) {
SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP); SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(X11_RESTYPE_PIXMAP);
ResourceSizeRec pixmapSize = { 0, }; ResourceSizeRec pixmapSize = { 0, };
pixmapSizeFunc((PixmapPtr)draw->pDraw, draw->pDraw->id, &pixmapSize); pixmapSizeFunc((PixmapPtr)draw->pDraw, draw->pDraw->id, &pixmapSize);
size->pixmapRefSize += pixmapSize.pixmapRefSize; size->pixmapRefSize += pixmapSize.pixmapRefSize;

View File

@ -169,7 +169,7 @@ KdUninstallColormap(ColormapPtr pCmap)
return; return;
/* install default */ /* install default */
dixLookupResourceByType((void **) &defMap, defMapID, RT_COLORMAP, dixLookupResourceByType((void **) &defMap, defMapID, X11_RESTYPE_COLORMAP,
serverClient, DixInstallAccess); serverClient, DixInstallAccess);
if (defMap) if (defMap)
(*pCmap->pScreen->InstallColormap) (defMap); (*pCmap->pScreen->InstallColormap) (defMap);

View File

@ -1459,7 +1459,7 @@ ProcXDGASetMode(ClientPtr client)
DGA_SETCLIENT(stuff->screen, client); DGA_SETCLIENT(stuff->screen, client);
if (pPix) { 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; pPix->drawable.id = (int) stuff->pid;
rep.flags = DGA_PIXMAP_AVAILABLE; rep.flags = DGA_PIXMAP_AVAILABLE;
} }
@ -1537,7 +1537,7 @@ ProcXDGAInstallColormap(ClientPtr client)
if (DGA_GETCLIENT(stuff->screen) != client) if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
rc = dixLookupResourceByType((void **) &cmap, stuff->cmap, RT_COLORMAP, rc = dixLookupResourceByType((void **) &cmap, stuff->cmap, X11_RESTYPE_COLORMAP,
client, DixInstallAccess); client, DixInstallAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
@ -1973,7 +1973,7 @@ ProcXF86DGAInstallColormap(ClientPtr client)
if (!DGAActive(stuff->screen)) if (!DGAActive(stuff->screen))
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP, rc = dixLookupResourceByType((void **) &pcmp, stuff->id, X11_RESTYPE_COLORMAP,
client, DixInstallAccess); client, DixInstallAccess);
if (rc == Success) { if (rc == Success) {
DGAInstallCmap(pcmp); DGAInstallCmap(pcmp);

View File

@ -219,7 +219,7 @@ xf86HandleColormaps(ScreenPtr pScreen,
/* get the default map */ /* get the default map */
dixLookupResourceByType((void **) &pDefMap, pScreen->defColormap, dixLookupResourceByType((void **) &pDefMap, pScreen->defColormap,
RT_COLORMAP, serverClient, DixInstallAccess); X11_RESTYPE_COLORMAP, serverClient, DixInstallAccess);
if (!CMapAllocateColormapPrivate(pDefMap)) { if (!CMapAllocateColormapPrivate(pDefMap)) {
CMapUnwrapScreen(pScreen); CMapUnwrapScreen(pScreen);

View File

@ -252,11 +252,11 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
if (visual == xnestDefaultVisual(pScreen)) if (visual == xnestDefaultVisual(pScreen))
dixLookupResourceByType((void **) &pCmap, wColormap(pWin), dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
RT_COLORMAP, serverClient, X11_RESTYPE_COLORMAP, serverClient,
DixUseAccess); DixUseAccess);
else else
dixLookupResourceByType((void **) &pCmap, dixLookupResourceByType((void **) &pCmap,
pScreen->defColormap, RT_COLORMAP, pScreen->defColormap, X11_RESTYPE_COLORMAP,
serverClient, DixUseAccess); serverClient, DixUseAccess);
XSetWindowColormap(xnestDisplay, XSetWindowColormap(xnestDisplay,
@ -308,7 +308,7 @@ xnestDirectInstallColormaps(ScreenPtr pScreen)
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
ColormapPtr pCmap; ColormapPtr pCmap;
dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], RT_COLORMAP, dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], X11_RESTYPE_COLORMAP,
serverClient, DixInstallAccess); serverClient, DixInstallAccess);
if (pCmap) if (pCmap)
XInstallColormap(xnestDisplay, xnestColormap(pCmap)); XInstallColormap(xnestDisplay, xnestColormap(pCmap));
@ -329,7 +329,7 @@ xnestDirectUninstallColormaps(ScreenPtr pScreen)
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
ColormapPtr pCmap; ColormapPtr pCmap;
dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], RT_COLORMAP, dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], X11_RESTYPE_COLORMAP,
serverClient, DixUninstallAccess); serverClient, DixUninstallAccess);
if (pCmap) if (pCmap)
XUninstallColormap(xnestDisplay, xnestColormap(pCmap)); XUninstallColormap(xnestDisplay, xnestColormap(pCmap));
@ -365,7 +365,7 @@ xnestUninstallColormap(ColormapPtr pCmap)
if (pCmap->mid != pCmap->pScreen->defColormap) { if (pCmap->mid != pCmap->pScreen->defColormap) {
dixLookupResourceByType((void **) &pCurCmap, dixLookupResourceByType((void **) &pCurCmap,
pCmap->pScreen->defColormap, pCmap->pScreen->defColormap,
RT_COLORMAP, X11_RESTYPE_COLORMAP,
serverClient, DixInstallAccess); serverClient, DixInstallAccess);
(*pCmap->pScreen->InstallColormap) (pCurCmap); (*pCmap->pScreen->InstallColormap) (pCurCmap);
} }

View File

@ -99,7 +99,7 @@ xnestCreateWindow(WindowPtr pWin)
mask |= CWColormap; mask |= CWColormap;
if (pWin->optional->colormap) { if (pWin->optional->colormap) {
dixLookupResourceByType((void **) &pCmap, wColormap(pWin), dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
RT_COLORMAP, serverClient, X11_RESTYPE_COLORMAP, serverClient,
DixUseAccess); DixUseAccess);
attributes.colormap = xnestColormap(pCmap); attributes.colormap = xnestColormap(pCmap);
} }
@ -112,7 +112,7 @@ xnestCreateWindow(WindowPtr pWin)
else { /* root windows have their own colormaps at creation time */ else { /* root windows have their own colormaps at creation time */
visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
dixLookupResourceByType((void **) &pCmap, wColormap(pWin), dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
RT_COLORMAP, serverClient, DixUseAccess); X11_RESTYPE_COLORMAP, serverClient, DixUseAccess);
mask |= CWColormap; mask |= CWColormap;
attributes.colormap = xnestColormap(pCmap); attributes.colormap = xnestColormap(pCmap);
} }
@ -334,7 +334,7 @@ xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
ColormapPtr pCmap; ColormapPtr pCmap;
dixLookupResourceByType((void **) &pCmap, wColormap(pWin), dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
RT_COLORMAP, serverClient, DixUseAccess); X11_RESTYPE_COLORMAP, serverClient, DixUseAccess);
attributes.colormap = xnestColormap(pCmap); attributes.colormap = xnestColormap(pCmap);

View File

@ -1592,7 +1592,7 @@ xwl_keyboard_search_window(ClientPtr client)
{ {
WindowPtr window = NullWindow; WindowPtr window = NullWindow;
FindClientResourcesByType(client, RT_WINDOW, find_toplevel_callback, &window); FindClientResourcesByType(client, X11_RESTYPE_WINDOW, find_toplevel_callback, &window);
return 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 = {}; struct xwl_output_randr_emu_prop prop = {};
xwl_output_randr_emu_prop(xwl_screen, client, &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); 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 */ /* Install the default cmap in place of the cmap to be uninstalled */
if (pmap->mid != pmap->pScreen->defColormap) { if (pmap->mid != pmap->pScreen->defColormap) {
dixLookupResourceByType((void *) &curpmap, pmap->pScreen->defColormap, dixLookupResourceByType((void *) &curpmap, pmap->pScreen->defColormap,
RT_COLORMAP, NullClient, DixUnknownAccess); X11_RESTYPE_COLORMAP, NullClient, DixUnknownAccess);
(*pmap->pScreen->InstallColormap) (curpmap); (*pmap->pScreen->InstallColormap) (curpmap);
} }
} }

View File

@ -717,7 +717,7 @@ winGetWindowID(WindowPtr pWin)
ClientPtr c = wClient(pWin); ClientPtr c = wClient(pWin);
/* */ /* */
FindClientResourcesByType(c, RT_WINDOW, winFindWindow, &wi); FindClientResourcesByType(c, X11_RESTYPE_WINDOW, winFindWindow, &wi);
#if ENABLE_DEBUG #if ENABLE_DEBUG
ErrorF("winGetWindowID - Window ID: %u\n", (unsigned int)wi.id); 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 // prevent namespace clash with Windows
#define X11_RESTYPE_NONE ((RESTYPE)0) #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_FONT ((RESTYPE)4)
#define X11_RESTYPE_CURSOR ((RESTYPE)5) #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_WINDOW X11_RESTYPE_WINDOW
#define RT_PIXMAP ((RESTYPE)2|RC_DRAWABLE) #define RT_PIXMAP X11_RESTYPE_PIXMAP
#define RT_GC ((RESTYPE)3) #define RT_GC X11_RESTYPE_GC
#undef RT_FONT #undef RT_FONT
#undef RT_CURSOR #undef RT_CURSOR
#define RT_FONT X11_RESTYPE_FONT #define RT_FONT X11_RESTYPE_FONT
#define RT_CURSOR X11_RESTYPE_CURSOR #define RT_CURSOR X11_RESTYPE_CURSOR
#define RT_COLORMAP ((RESTYPE)6) #define RT_COLORMAP X11_RESTYPE_COLORMAP
#define RT_CMAPENTRY ((RESTYPE)7) #define RT_CMAPENTRY X11_RESTYPE_CMAPENTRY
#define RT_OTHERCLIENT ((RESTYPE)8|RC_NEVERRETAIN) #define RT_OTHERCLIENT X11_RESTYPE_OTHERCLIENT
#define RT_PASSIVEGRAB ((RESTYPE)9|RC_NEVERRETAIN) #define RT_PASSIVEGRAB X11_RESTYPE_PASSIVEGRAB
#define RT_LASTPREDEF ((RESTYPE)9) #define RT_LASTPREDEF X11_RESTYPE_LASTPREDEF
#define RT_NONE X11_RESTYPE_NONE #define RT_NONE X11_RESTYPE_NONE

View File

@ -77,7 +77,7 @@ miUninstallColormap(ColormapPtr pmap)
if (pmap->mid != pmap->pScreen->defColormap) { if (pmap->mid != pmap->pScreen->defColormap) {
dixLookupResourceByType((void **) &curpmap, dixLookupResourceByType((void **) &curpmap,
pmap->pScreen->defColormap, pmap->pScreen->defColormap,
RT_COLORMAP, serverClient, DixUseAccess); X11_RESTYPE_COLORMAP, serverClient, DixUseAccess);
(*pmap->pScreen->InstallColormap) (curpmap); (*pmap->pScreen->InstallColormap) (curpmap);
} }
} }

View File

@ -120,7 +120,7 @@ proc_present_pixmap_common(ClientPtr client,
ret = dixLookupWindow(&window, req_window, client, DixWriteAccess); ret = dixLookupWindow(&window, req_window, client, DixWriteAccess);
if (ret != Success) if (ret != Success)
return ret; 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) if (ret != Success)
return ret; return ret;

View File

@ -422,7 +422,7 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format)
if (format->index.vid == pScreen->rootVisual) { if (format->index.vid == pScreen->rootVisual) {
dixLookupResourceByType((void **) &format->index.pColormap, dixLookupResourceByType((void **) &format->index.pColormap,
pScreen->defColormap, RT_COLORMAP, pScreen->defColormap, X11_RESTYPE_COLORMAP,
serverClient, DixGetAttrAccess); serverClient, DixGetAttrAccess);
} }
else { else {
@ -590,7 +590,7 @@ GetPictureBytes(void *value, XID id, ResourceSizePtr size)
size->pixmapRefSize = 0; size->pixmapRefSize = 0;
if (picture->pDrawable && (picture->pDrawable->type == DRAWABLE_PIXMAP)) if (picture->pDrawable && (picture->pDrawable->type == DRAWABLE_PIXMAP))
{ {
SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP); SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(X11_RESTYPE_PIXMAP);
ResourceSizeRec pixmapSize = { 0, 0, 0 }; ResourceSizeRec pixmapSize = { 0, 0, 0 };
PixmapPtr pixmap = (PixmapPtr)picture->pDrawable; PixmapPtr pixmap = (PixmapPtr)picture->pDrawable;
pixmapSizeFunc(pixmap, pixmap->drawable.id, &pixmapSize); pixmapSizeFunc(pixmap, pixmap->drawable.id, &pixmapSize);
@ -761,7 +761,7 @@ CreatePicture(Picture pid,
/* security creation/labeling check */ /* security creation/labeling check */
*error = XaceHook(XACE_RESOURCE_ACCESS, client, pid, PictureType, pPicture, *error = XaceHook(XACE_RESOURCE_ACCESS, client, pid, PictureType, pPicture,
RT_PIXMAP, pDrawable, DixCreateAccess | DixSetAttrAccess); X11_RESTYPE_PIXMAP, pDrawable, DixCreateAccess | DixSetAttrAccess);
if (*error != Success) if (*error != Success)
goto out; goto out;
@ -1028,7 +1028,7 @@ cpClipMask(void **result, XID id, ScreenPtr screen, ClientPtr client, Mask mode)
id = res->info[screen->myNum].id; id = res->info[screen->myNum].id;
} }
#endif #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) #define NEXT_VAL(_type) (vlist ? (_type) *vlist++ : (_type) ulist++->val)

View File

@ -597,7 +597,9 @@ typedef struct {
} ReplaceCursorLookupRec, *ReplaceCursorLookupPtr; } ReplaceCursorLookupRec, *ReplaceCursorLookupPtr;
static const RESTYPE CursorRestypes[] = { static const RESTYPE CursorRestypes[] = {
RT_WINDOW, RT_PASSIVEGRAB, X11_RESTYPE_CURSOR X11_RESTYPE_WINDOW,
X11_RESTYPE_PASSIVEGRAB,
X11_RESTYPE_CURSOR
}; };
static Bool static Bool
@ -610,14 +612,14 @@ ReplaceCursorLookup(void *value, XID id, void *closure)
XID cursor = 0; XID cursor = 0;
switch (rcl->type) { switch (rcl->type) {
case RT_WINDOW: case X11_RESTYPE_WINDOW:
pWin = (WindowPtr) value; pWin = (WindowPtr) value;
if (pWin->optional) { if (pWin->optional) {
pCursorRef = &pWin->optional->cursor; pCursorRef = &pWin->optional->cursor;
pCursor = *pCursorRef; pCursor = *pCursorRef;
} }
break; break;
case RT_PASSIVEGRAB: case X11_RESTYPE_PASSIVEGRAB:
pGrab = (GrabPtr) value; pGrab = (GrabPtr) value;
pCursorRef = &pGrab->cursor; pCursorRef = &pGrab->cursor;
pCursor = *pCursorRef; pCursor = *pCursorRef;
@ -856,7 +858,7 @@ ProcXFixesHideCursor(ClientPtr client)
REQUEST_SIZE_MATCH(xXFixesHideCursorReq); REQUEST_SIZE_MATCH(xXFixesHideCursorReq);
ret = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW, ret = dixLookupResourceByType((void **) &pWin, stuff->window, X11_RESTYPE_WINDOW,
client, DixGetAttrAccess); client, DixGetAttrAccess);
if (ret != Success) { if (ret != Success) {
client->errorValue = stuff->window; client->errorValue = stuff->window;
@ -920,7 +922,7 @@ ProcXFixesShowCursor(ClientPtr client)
REQUEST_SIZE_MATCH(xXFixesShowCursorReq); REQUEST_SIZE_MATCH(xXFixesShowCursorReq);
rc = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW, rc = dixLookupResourceByType((void **) &pWin, stuff->window, X11_RESTYPE_WINDOW,
client, DixGetAttrAccess); client, DixGetAttrAccess);
if (rc != Success) { if (rc != Success) {
client->errorValue = stuff->window; client->errorValue = stuff->window;

View File

@ -117,7 +117,7 @@ ProcXFixesCreateRegionFromBitmap(ClientPtr client)
REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq); REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq);
LEGAL_NEW_RESOURCE(stuff->region, client); 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); client, DixReadAccess);
if (rc != Success) { if (rc != Success) {
client->errorValue = stuff->bitmap; client->errorValue = stuff->bitmap;
@ -161,7 +161,7 @@ ProcXFixesCreateRegionFromWindow(ClientPtr client)
REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq); REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq);
LEGAL_NEW_RESOURCE(stuff->region, client); 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); client, DixGetAttrAccess);
if (rc != Success) { if (rc != Success) {
client->errorValue = stuff->window; client->errorValue = stuff->window;
@ -652,7 +652,7 @@ ProcXFixesSetWindowShapeRegion(ClientPtr client)
REQUEST(xXFixesSetWindowShapeRegionReq); REQUEST(xXFixesSetWindowShapeRegionReq);
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq); REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
rc = dixLookupResourceByType((void **) &pWin, stuff->dest, RT_WINDOW, rc = dixLookupResourceByType((void **) &pWin, stuff->dest, X11_RESTYPE_WINDOW,
client, DixSetAttrAccess); client, DixSetAttrAccess);
if (rc != Success) { if (rc != Success) {
client->errorValue = stuff->dest; client->errorValue = stuff->dest;