From 83936985d9c3613cb8a7c00bbaf9dd6b25de5cbc Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 11 Mar 2024 11:01:02 +0100 Subject: [PATCH] rename remaining RT_* defines to X11_RESTYPE_* Since we already had to rename some of them, in order to fix name clashes on win32, it's now time to rename all the remaining ones. The old ones are still present as define's to the new ones, just for backwards compatibility. Signed-off-by: Enrico Weigelt, metux IT consult Part-of: (cherry picked from commit 85d4bd0dba6ac5adb73864396d260be92a23ea50) --- Xext/panoramiXprocs.c | 2 +- Xext/saver.c | 12 +++++----- Xext/security.c | 6 ++--- Xext/shape.c | 2 +- Xext/shm.c | 8 +++---- Xext/xselinux_hooks.c | 6 ++--- Xext/xselinux_label.c | 4 ++-- composite/compext.c | 27 ++++++++++++---------- composite/compoverlay.c | 2 +- dbe/midbe.c | 2 +- dix/colormap.c | 22 +++++++++--------- dix/dispatch.c | 42 +++++++++++++++++----------------- dix/dixutils.c | 4 ++-- dix/events.c | 4 ++-- dix/gc.c | 10 ++++---- dix/grabs.c | 4 ++-- dix/privates.c | 22 +++++++++--------- dix/registry.c | 14 ++++++------ dix/resource.c | 30 ++++++++++++------------ dix/touch.c | 4 ++-- dix/window.c | 26 ++++++++++----------- dri3/dri3_request.c | 12 +++++----- glx/glxcmds.c | 4 ++-- glx/glxext.c | 2 +- hw/kdrive/src/kcmap.c | 2 +- hw/xfree86/common/xf86DGA.c | 6 ++--- hw/xfree86/common/xf86cmap.c | 2 +- hw/xnest/Color.c | 10 ++++---- hw/xnest/Window.c | 6 ++--- hw/xwayland/xwayland-input.c | 2 +- hw/xwayland/xwayland-output.c | 2 +- hw/xwin/wincmap.c | 2 +- hw/xwin/winmultiwindowwindow.c | 2 +- include/resource.h | 24 ++++++++++++------- mi/micmap.c | 2 +- present/present_request.c | 2 +- render/picture.c | 8 +++---- xfixes/cursor.c | 12 ++++++---- xfixes/region.c | 6 ++--- 39 files changed, 186 insertions(+), 173 deletions(-) diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index 32424fcbd..e283fbb6c 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -475,7 +475,7 @@ PanoramiXConfigureWindow(ClientPtr client) /* because we need the parent */ result = dixLookupResourceByType((void **) &pWin, stuff->window, - RT_WINDOW, client, DixWriteAccess); + X11_RESTYPE_WINDOW, client, DixWriteAccess); if (result != Success) return result; diff --git a/Xext/saver.c b/Xext/saver.c index 3b3d555e8..0a74cf3a5 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -450,7 +450,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); @@ -498,7 +498,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; @@ -546,7 +546,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; @@ -899,7 +899,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)) { @@ -931,7 +931,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)) { @@ -1014,7 +1014,7 @@ ScreenSaverSetAttributes(ClientPtr client) break; case CWColormap: cmap = (Colormap) * pVlist; - ret = dixLookupResourceByType((void **) &pCmap, cmap, RT_COLORMAP, + ret = dixLookupResourceByType((void **) &pCmap, cmap, X11_RESTYPE_COLORMAP, client, DixUseAccess); if (ret != Success) { client->errorValue = cmap; diff --git a/Xext/security.c b/Xext/security.c index 0a33ed6bf..fb803f996 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -747,12 +747,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 */ @@ -761,7 +761,7 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata) /* additional operations allowed on root windows */ allowed |= SecurityRootWindowExtraMask; - else if (rec->rtype == RT_COLORMAP) + else if (rec->rtype == X11_RESTYPE_COLORMAP) /* allow access to default colormaps */ allowed = requested; diff --git a/Xext/shape.c b/Xext/shape.c index a7b1f8b9c..96b62f713 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -362,7 +362,7 @@ ProcShapeMask(ClientPtr client) srcRgn = 0; else { rc = dixLookupResourceByType((void **) &pPixmap, stuff->src, - RT_PIXMAP, client, DixReadAccess); + X11_RESTYPE_PIXMAP, client, DixReadAccess); if (rc != Success) return rc; if (pPixmap->drawable.pScreen != pScreen || diff --git a/Xext/shm.c b/Xext/shm.c index e5fea98a8..f34502774 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -999,7 +999,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; @@ -1008,7 +1008,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; } @@ -1113,7 +1113,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); @@ -1123,7 +1123,7 @@ ProcShmCreatePixmap(ClientPtr client) shmdesc->refcnt++; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = stuff->pid; - if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap)) { + if (AddResource(stuff->pid, X11_RESTYPE_PIXMAP, (void *) pMap)) { return Success; } } diff --git a/Xext/xselinux_hooks.c b/Xext/xselinux_hooks.c index 52a71cf4f..f7b5267ac 100644 --- a/Xext/xselinux_hooks.c +++ b/Xext/xselinux_hooks.c @@ -200,7 +200,7 @@ SELinuxLabelInitial(void) /* Do the default colormap */ dixLookupResourceByType(&unused, screenInfo.screens[i]->defColormap, - RT_COLORMAP, serverClient, DixCreateAccess); + X11_RESTYPE_COLORMAP, serverClient, DixCreateAccess); } } @@ -663,7 +663,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; @@ -765,7 +765,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata) SELinuxObjectRec *obj; WindowPtr pWin; - if (rec->type != RT_WINDOW) + if (rec->type != X11_RESTYPE_WINDOW) return; if (rec->state != ResourceStateAdding) return; diff --git a/Xext/xselinux_label.c b/Xext/xselinux_label.c index d1d70838d..900b68ede 100644 --- a/Xext/xselinux_label.c +++ b/Xext/xselinux_label.c @@ -322,13 +322,13 @@ SELinuxTypeToClass(RESTYPE type) if (type & RC_DRAWABLE) class = SECCLASS_X_DRAWABLE; - else if (type == RT_GC) + else if (type == X11_RESTYPE_GC) class = SECCLASS_X_GC; else if (type == X11_RESTYPE_FONT) class = SECCLASS_X_FONT; else if (type == X11_RESTYPE_CURSOR) class = SECCLASS_X_CURSOR; - else if (type == RT_COLORMAP) + else if (type == X11_RESTYPE_COLORMAP) class = SECCLASS_X_COLORMAP; else { /* Need to do a string lookup */ diff --git a/composite/compext.c b/composite/compext.c index 1f8194f80..cfdb7a216 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -130,7 +130,7 @@ ProcCompositeQueryVersion(ClientPtr client) do { \ int err; \ err = dixLookupResourceByType((void **) &pWindow, wid, \ - RT_WINDOW, client, mode); \ + X11_RESTYPE_WINDOW, client, mode);\ if (err != Success) { \ client->errorValue = wid; \ return err; \ @@ -252,14 +252,14 @@ ProcCompositeNameWindowPixmap(ClientPtr client) return BadMatch; /* security creation/labeling check */ - rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP, - pPixmap, RT_WINDOW, pWin, DixCreateAccess); + rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, X11_RESTYPE_PIXMAP, + pPixmap, X11_RESTYPE_WINDOW, pWin, DixCreateAccess); if (rc != Success) return rc; ++pPixmap->refcnt; - if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pPixmap)) + if (!AddResource(stuff->pixmap, X11_RESTYPE_PIXMAP, (void *) pPixmap)) return BadAlloc; if (pScreen->NameWindowPixmap) { @@ -307,7 +307,8 @@ ProcCompositeGetOverlayWindow(ClientPtr client) } rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id, - RT_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, NULL, DixGetAttrAccess); + X11_RESTYPE_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, + NULL, DixGetAttrAccess); if (rc != Success) { FreeResource(pOc->resource, X11_RESTYPE_NONE); return rc; @@ -515,7 +516,7 @@ GetCompositeWindowBytes(void *value, XID id, ResourceSizePtr size) /* account for redirection */ if (window->redirectDraw != RedirectDrawNone) { - SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP); + SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(X11_RESTYPE_PIXMAP); ResourceSizeRec pixmapSize = { 0, 0 }; ScreenPtr screen = window->drawable.pScreen; PixmapPtr pixmap = screen->GetWindowPixmap(window); @@ -556,8 +557,8 @@ CompositeExtensionInit(void) if (!CompositeClientWindowType) return; - coreGetWindowBytes = GetResourceTypeSizeFunc(RT_WINDOW); - SetResourceTypeSizeFunc(RT_WINDOW, GetCompositeWindowBytes); + coreGetWindowBytes = GetResourceTypeSizeFunc(X11_RESTYPE_WINDOW); + SetResourceTypeSizeFunc(X11_RESTYPE_WINDOW, GetCompositeWindowBytes); CompositeClientSubwindowsType = CreateNewResourceType (FreeCompositeClientSubwindows, "CompositeClientSubwindows"); @@ -728,7 +729,8 @@ PanoramiXCompositeNameWindowPixmap(ClientPtr client) FOR_NSCREENS(i) { rc = dixLookupResourceByType((void **) &pWin, win->info[i].id, - RT_WINDOW, client, DixGetAttrAccess); + X11_RESTYPE_WINDOW, client, + DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->window; free(newPix); @@ -752,7 +754,7 @@ PanoramiXCompositeNameWindowPixmap(ClientPtr client) return BadMatch; } - if (!AddResource(newPix->info[i].id, RT_PIXMAP, (void *) pPixmap)) + if (!AddResource(newPix->info[i].id, X11_RESTYPE_PIXMAP, (void *) pPixmap)) return BadAlloc; ++pPixmap->refcnt; @@ -796,7 +798,8 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client) FOR_NSCREENS_BACKWARD(i) { rc = dixLookupResourceByType((void **) &pWin, win->info[i].id, - RT_WINDOW, client, DixGetAttrAccess); + X11_RESTYPE_WINDOW, client, + DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->window; free(overlayWin); @@ -827,7 +830,7 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client) rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id, - RT_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, NULL, + X11_RESTYPE_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, NULL, DixGetAttrAccess); if (rc != Success) { FreeResource(pOc->resource, X11_RESTYPE_NONE); diff --git a/composite/compoverlay.c b/composite/compoverlay.c index 1e077b892..18538ed98 100644 --- a/composite/compoverlay.c +++ b/composite/compoverlay.c @@ -152,7 +152,7 @@ compCreateOverlayWindow(ScreenPtr pScreen) if (pWin == NULL) return FALSE; - if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin)) + if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW, (void *) pWin)) return FALSE; MapWindow(pWin, serverClient); diff --git a/dbe/midbe.c b/dbe/midbe.c index c646bc0c7..eb6057748 100644 --- a/dbe/midbe.c +++ b/dbe/midbe.c @@ -171,7 +171,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) /* Security creation/labeling check. */ rc = XaceHook(XACE_RESOURCE_ACCESS, serverClient, bufId, dbeDrawableResType, pDbeWindowPriv->pBackBuffer, - RT_WINDOW, pWin, DixCreateAccess); + X11_RESTYPE_WINDOW, pWin, DixCreateAccess); /* Make the back pixmap a DBE drawable resource. */ if (rc != Success || !AddResource(bufId, dbeDrawableResType, diff --git a/dix/colormap.c b/dix/colormap.c index 1a46d01ab..4276973b6 100644 --- a/dix/colormap.c +++ b/dix/colormap.c @@ -370,13 +370,13 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, } pmap->flags |= BeingCreated; - if (!AddResource(mid, RT_COLORMAP, (void *) pmap)) + if (!AddResource(mid, X11_RESTYPE_COLORMAP, (void *) pmap)) return BadAlloc; /* * Security creation/labeling check */ - i = XaceHook(XACE_RESOURCE_ACCESS, clients[client], mid, RT_COLORMAP, + i = XaceHook(XACE_RESOURCE_ACCESS, clients[client], mid, X11_RESTYPE_COLORMAP, pmap, X11_RESTYPE_NONE, NULL, DixCreateAccess); if (i != Success) { FreeResource(mid, X11_RESTYPE_NONE); @@ -566,7 +566,7 @@ CopyColormapAndFree(Colormap mid, ColormapPtr pSrc, int client) } if (pmap->class & DynamicClass) UpdateColors(pmap); - /* XXX should worry about removing any RT_CMAPENTRY resource */ + /* XXX should worry about removing any X11_RESTYPE_CMAPENTRY resource */ return Success; } @@ -1016,7 +1016,7 @@ AllocColor(ColormapPtr pmap, ColormapPtr prootmap; dixLookupResourceByType((void **) &prootmap, - pmap->pScreen->defColormap, RT_COLORMAP, + pmap->pScreen->defColormap, X11_RESTYPE_COLORMAP, clients[client], DixReadAccess); if (pmap->class == prootmap->class) @@ -1034,7 +1034,7 @@ AllocColor(ColormapPtr pmap, ColormapPtr prootmap; dixLookupResourceByType((void **) &prootmap, - pmap->pScreen->defColormap, RT_COLORMAP, + pmap->pScreen->defColormap, X11_RESTYPE_COLORMAP, clients[client], DixReadAccess); if (pmap->class == prootmap->class) { @@ -1087,7 +1087,7 @@ AllocColor(ColormapPtr pmap, } pcr->mid = pmap->mid; pcr->client = client; - if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr)) + if (!AddResource(FakeClientID(client), X11_RESTYPE_CMAPENTRY, (void *) pcr)) return BadAlloc; } return Success; @@ -1472,7 +1472,7 @@ FreeClientPixels(void *value, XID fakeid) colorResource *pcr = value; int rc; - rc = dixLookupResourceByType(&pmap, pcr->mid, RT_COLORMAP, serverClient, + rc = dixLookupResourceByType(&pmap, pcr->mid, X11_RESTYPE_COLORMAP, serverClient, DixRemoveAccess); if (rc == Success) FreePixels((ColormapPtr) pmap, pcr->client); @@ -1535,7 +1535,7 @@ AllocColorCells(int client, ColormapPtr pmap, int colors, int planes, if ((ok == Success) && pcr) { pcr->mid = pmap->mid; pcr->client = client; - if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr)) + if (!AddResource(FakeClientID(client), X11_RESTYPE_CMAPENTRY, (void *) pcr)) ok = BadAlloc; } else @@ -1617,7 +1617,7 @@ AllocColorPlanes(int client, ColormapPtr pmap, int colors, if ((ok == Success) && pcr) { pcr->mid = pmap->mid; pcr->client = client; - if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *) pcr)) + if (!AddResource(FakeClientID(client), X11_RESTYPE_CMAPENTRY, (void *) pcr)) ok = BadAlloc; } else @@ -2092,7 +2092,7 @@ FreeColors(ColormapPtr pmap, int client, int count, Pixel * pixels, Pixel mask) clients[client]->errorValue = *pixels | mask; result = BadValue; } - /* XXX should worry about removing any RT_CMAPENTRY resource */ + /* XXX should worry about removing any X11_RESTYPE_CMAPENTRY resource */ return result; } @@ -2539,7 +2539,7 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth) cdata.visuals = visuals; cdata.pScreen = pScreen; - FindClientResourcesByType(serverClient, RT_COLORMAP, + FindClientResourcesByType(serverClient, X11_RESTYPE_COLORMAP, _colormap_find_resource, &cdata); pScreen->visuals = visuals; diff --git a/dix/dispatch.c b/dix/dispatch.c index 1d34f1db7..1643ef82f 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -766,7 +766,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; } @@ -1512,13 +1512,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; @@ -1533,7 +1533,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); @@ -1570,7 +1570,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; } @@ -2468,7 +2468,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 */ @@ -2495,7 +2495,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); @@ -2512,7 +2512,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; @@ -2541,7 +2541,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; @@ -2609,7 +2609,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 = { @@ -2646,7 +2646,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 = { @@ -2691,7 +2691,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; @@ -2752,7 +2752,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; @@ -2814,7 +2814,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; @@ -2840,7 +2840,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; @@ -2866,7 +2866,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; @@ -2894,7 +2894,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; @@ -2941,7 +2941,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; @@ -2992,7 +2992,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; @@ -3004,7 +3004,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; @@ -4069,7 +4069,7 @@ RemoveGPUScreen(ScreenPtr pScreen) /* this gets freed later in the resource list, but without * the screen existing it causes crashes - so remove it here */ if (pScreen->defColormap) - FreeResource(pScreen->defColormap, RT_COLORMAP); + FreeResource(pScreen->defColormap, X11_RESTYPE_COLORMAP); free(pScreen); } diff --git a/dix/dixutils.c b/dix/dixutils.c index b2cd01fa2..fab893a45 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -236,7 +236,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 @@ -250,7 +250,7 @@ dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access) access); if (rc != BadFont) return rc; - rc = dixLookupResourceByType((void **) &pGC, id, RT_GC, client, access); + rc = dixLookupResourceByType((void **) &pGC, id, X11_RESTYPE_GC, client, access); if (rc == BadGC) return BadFont; if (rc == Success) diff --git a/dix/events.c b/dix/events.c index 8ce0e73c0..8c7943bbe 100644 --- a/dix/events.c +++ b/dix/events.c @@ -4531,7 +4531,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; } @@ -4574,7 +4574,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask) others->resource = FakeClientID(client->index); others->next = pWin->optional->otherClients; pWin->optional->otherClients = others; - if (!AddResource(others->resource, RT_OTHERCLIENT, (void *) pWin)) + if (!AddResource(others->resource, X11_RESTYPE_OTHERCLIENT, (void *) pWin)) return BadAlloc; } maskSet: diff --git a/dix/gc.c b/dix/gc.c index 8e3745793..d005d0c1b 100644 --- a/dix/gc.c +++ b/dix/gc.c @@ -421,10 +421,10 @@ static const struct { RESTYPE type; Mask access_mode; } xidfields[] = { - {GCTile, RT_PIXMAP, DixReadAccess}, - {GCStipple, RT_PIXMAP, DixReadAccess}, - {GCFont, X11_RESTYPE_FONT, DixUseAccess}, - {GCClipMask, RT_PIXMAP, DixReadAccess}, + {GCTile, X11_RESTYPE_PIXMAP, DixReadAccess}, + {GCStipple, X11_RESTYPE_PIXMAP, DixReadAccess}, + {GCFont, X11_RESTYPE_FONT, DixUseAccess}, + {GCClipMask, X11_RESTYPE_PIXMAP, DixReadAccess}, }; int @@ -547,7 +547,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus, } /* security creation/labeling check */ - *pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, RT_GC, pGC, + *pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, X11_RESTYPE_GC, pGC, X11_RESTYPE_NONE, NULL, DixCreateAccess | DixSetAttrAccess); if (*pStatus != Success) goto out; diff --git a/dix/grabs.c b/dix/grabs.c index f2b3cf19d..58de639e8 100644 --- a/dix/grabs.c +++ b/dix/grabs.c @@ -563,7 +563,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; } @@ -660,7 +660,7 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab) FreeGrab(pNewGrab); ok = FALSE; } - else if (!AddResource(pNewGrab->resource, RT_PASSIVEGRAB, + else if (!AddResource(pNewGrab->resource, X11_RESTYPE_PASSIVEGRAB, (void *) pNewGrab)) ok = FALSE; else diff --git a/dix/privates.c b/dix/privates.c index 91244edbc..01686637c 100644 --- a/dix/privates.c +++ b/dix/privates.c @@ -257,7 +257,7 @@ fixupDefaultColormaps(FixupFunc fixup, unsigned bytes) ColormapPtr cmap; dixLookupResourceByType((void **) &cmap, - screenInfo.screens[s]->defColormap, RT_COLORMAP, + screenInfo.screens[s]->defColormap, X11_RESTYPE_COLORMAP, serverClient, DixCreateAccess); if (cmap && !fixup(&cmap->devPrivates, screenInfo.screens[s]->screenSpecificPrivates[PRIVATE_COLORMAP].offset, bytes)) @@ -564,13 +564,13 @@ dixPrivatesSize(DevPrivateType type) /* Table of devPrivates offsets */ static const int offsets[] = { - -1, /* RT_NONE / X11_RESTYPE_NONE */ - offsetof(WindowRec, devPrivates), /* RT_WINDOW */ - offsetof(PixmapRec, devPrivates), /* RT_PIXMAP */ - offsetof(GC, devPrivates), /* RT_GC */ - -1, /* RT_FONT / X11_RESTYPE_FONT */ - offsetof(CursorRec, devPrivates), /* RT_CURSOR / X11_RESTYPE_CURSOR */ - offsetof(ColormapRec, devPrivates), /* RT_COLORMAP */ + -1, /* X11_RESTYPE_NONE */ + offsetof(WindowRec, devPrivates), /* X11_RESTYPE_WINDOW */ + offsetof(PixmapRec, devPrivates), /* X11_RESTYPE_PIXMAP */ + offsetof(GC, devPrivates), /* X11_RESTYPE_GC */ + -1, /* X11_RESTYPE_FONT */ + offsetof(CursorRec, devPrivates), /* X11_RESTYPE_CURSOR */ + offsetof(ColormapRec, devPrivates), /* X11_RESTYPE_COLORMAP */ }; int @@ -581,10 +581,10 @@ dixLookupPrivateOffset(RESTYPE type) * points at pixmaps (thanks, DBE) */ if (type & RC_DRAWABLE) { - if (type == RT_WINDOW) - return offsets[RT_WINDOW & TypeMask]; + if (type == X11_RESTYPE_WINDOW) + return offsets[X11_RESTYPE_WINDOW & TypeMask]; else - return offsets[RT_PIXMAP & TypeMask]; + return offsets[X11_RESTYPE_PIXMAP & TypeMask]; } type = type & TypeMask; if (type < ARRAY_SIZE(offsets)) diff --git a/dix/registry.c b/dix/registry.c index 81b7eca52..dc2c11c71 100644 --- a/dix/registry.c +++ b/dix/registry.c @@ -362,14 +362,14 @@ dixResetRegistry(void) #ifdef X_REGISTRY_RESOURCE /* Add built-in resources */ RegisterResourceName(X11_RESTYPE_NONE, "NONE"); - RegisterResourceName(RT_WINDOW, "WINDOW"); - RegisterResourceName(RT_PIXMAP, "PIXMAP"); - RegisterResourceName(RT_GC, "GC"); + RegisterResourceName(X11_RESTYPE_WINDOW, "WINDOW"); + RegisterResourceName(X11_RESTYPE_PIXMAP, "PIXMAP"); + RegisterResourceName(X11_RESTYPE_GC, "GC"); RegisterResourceName(X11_RESTYPE_FONT, "FONT"); RegisterResourceName(X11_RESTYPE_CURSOR, "CURSOR"); - RegisterResourceName(RT_COLORMAP, "COLORMAP"); - RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY"); - RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT"); - RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB"); + RegisterResourceName(X11_RESTYPE_COLORMAP, "COLORMAP"); + RegisterResourceName(X11_RESTYPE_CMAPENTRY, "COLORMAP ENTRY"); + RegisterResourceName(X11_RESTYPE_OTHERCLIENT, "OTHER CLIENT"); + RegisterResourceName(X11_RESTYPE_PASSIVEGRAB, "PASSIVE GRAB"); #endif } diff --git a/dix/resource.c b/dix/resource.c index 2ce5e3788..e7c8b1e03 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -296,7 +296,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; @@ -345,12 +345,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); } } @@ -369,7 +369,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; @@ -417,12 +417,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); } } @@ -435,19 +435,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, @@ -465,25 +465,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, @@ -549,7 +549,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. * @@ -643,7 +643,7 @@ InitClientResources(ClientPtr client) int i, j; if (client == serverClient) { - lastResourceType = RT_LASTPREDEF; + lastResourceType = X11_RESTYPE_LASTPREDEF; lastResourceClass = RC_LASTPREDEF; TypeMask = RC_LASTPREDEF - 1; free(resourceTypes); diff --git a/dix/touch.c b/dix/touch.c index 790fea79d..4cae45b65 100644 --- a/dix/touch.c +++ b/dix/touch.c @@ -798,7 +798,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); @@ -811,7 +811,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, continue; TouchEventHistoryAllocate(ti); - TouchAddListener(ti, oclients->resource, RT_OTHERCLIENT, CORE, + TouchAddListener(ti, oclients->resource, X11_RESTYPE_OTHERCLIENT, CORE, type, TOUCH_LISTENER_AWAITING_BEGIN, win, NULL); return TRUE; } diff --git a/dix/window.c b/dix/window.c index e18231ff2..c2e2b072b 100644 --- a/dix/window.c +++ b/dix/window.c @@ -393,7 +393,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"); } @@ -637,10 +637,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) @@ -865,8 +865,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); @@ -1040,7 +1040,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) { @@ -1114,7 +1114,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) @@ -1216,7 +1216,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)) { @@ -1269,7 +1269,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) || @@ -1396,7 +1396,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; @@ -1421,7 +1421,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; @@ -2662,7 +2662,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; @@ -3291,7 +3291,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind) if (!pWin) return FALSE; - if (!AddResource(pWin->drawable.id, RT_WINDOW, + if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW, (void *) pScreen->screensaver.pWindow)) return FALSE; diff --git a/dri3/dri3_request.c b/dri3/dri3_request.c index e1cfa4b7b..adf71d5e3 100644 --- a/dri3/dri3_request.c +++ b/dri3/dri3_request.c @@ -234,14 +234,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; @@ -262,7 +262,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; @@ -498,14 +498,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; @@ -528,7 +528,7 @@ proc_dri3_buffers_from_pixmap(ClientPtr client) PixmapPtr pixmap; REQUEST_SIZE_MATCH(xDRI3BuffersFromPixmapReq); - rc = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, RT_PIXMAP, + rc = dixLookupResourceByType((void **) &pixmap, stuff->pixmap, X11_RESTYPE_PIXMAP, client, DixWriteAccess); if (rc != Success) { client->errorValue = stuff->pixmap; diff --git a/glx/glxcmds.c b/glx/glxcmds.c index 650f8b08e..c2e0d3b33 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -1393,7 +1393,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); @@ -1404,7 +1404,7 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId, * resource so it and the DRI2 drawable will be reclaimed when the * pbuffer is destroyed. */ pPixmap->drawable.id = glxDrawableId; - if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap)) + if (!AddResource(pPixmap->drawable.id, X11_RESTYPE_PIXMAP, pPixmap)) return BadAlloc; return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable, diff --git a/glx/glxext.c b/glx/glxext.c index 99f866104..b7d6d1196 100644 --- a/glx/glxext.c +++ b/glx/glxext.c @@ -309,7 +309,7 @@ GetGLXDrawableBytes(void *value, XID id, ResourceSizePtr size) size->refCnt = 1; if (draw->type == GLX_DRAWABLE_PIXMAP) { - SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP); + SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(X11_RESTYPE_PIXMAP); ResourceSizeRec pixmapSize = { 0, }; pixmapSizeFunc((PixmapPtr)draw->pDraw, draw->pDraw->id, &pixmapSize); size->pixmapRefSize += pixmapSize.pixmapRefSize; diff --git a/hw/kdrive/src/kcmap.c b/hw/kdrive/src/kcmap.c index b8697ca63..2e65bdde4 100644 --- a/hw/kdrive/src/kcmap.c +++ b/hw/kdrive/src/kcmap.c @@ -169,7 +169,7 @@ KdUninstallColormap(ColormapPtr pCmap) return; /* install default */ - dixLookupResourceByType((void **) &defMap, defMapID, RT_COLORMAP, + dixLookupResourceByType((void **) &defMap, defMapID, X11_RESTYPE_COLORMAP, serverClient, DixInstallAccess); if (defMap) (*pCmap->pScreen->InstallColormap) (defMap); diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 73d50b9c7..50e07b989 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -1456,7 +1456,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; } @@ -1534,7 +1534,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; @@ -1970,7 +1970,7 @@ ProcXF86DGAInstallColormap(ClientPtr client) if (!DGAActive(stuff->screen)) return DGAErrorBase + XF86DGADirectNotActivated; - rc = dixLookupResourceByType((void **) &pcmp, stuff->id, RT_COLORMAP, + rc = dixLookupResourceByType((void **) &pcmp, stuff->id, X11_RESTYPE_COLORMAP, client, DixInstallAccess); if (rc == Success) { DGAInstallCmap(pcmp); diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c index 8588c9fba..6a6171b78 100644 --- a/hw/xfree86/common/xf86cmap.c +++ b/hw/xfree86/common/xf86cmap.c @@ -218,7 +218,7 @@ xf86HandleColormaps(ScreenPtr pScreen, /* get the default map */ dixLookupResourceByType((void **) &pDefMap, pScreen->defColormap, - RT_COLORMAP, serverClient, DixInstallAccess); + X11_RESTYPE_COLORMAP, serverClient, DixInstallAccess); if (!CMapAllocateColormapPrivate(pDefMap)) { CMapUnwrapScreen(pScreen); diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c index 7a1d9333a..bb829847e 100644 --- a/hw/xnest/Color.c +++ b/hw/xnest/Color.c @@ -252,11 +252,11 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen) if (visual == xnestDefaultVisual(pScreen)) dixLookupResourceByType((void **) &pCmap, wColormap(pWin), - RT_COLORMAP, serverClient, + X11_RESTYPE_COLORMAP, serverClient, DixUseAccess); else dixLookupResourceByType((void **) &pCmap, - pScreen->defColormap, RT_COLORMAP, + pScreen->defColormap, X11_RESTYPE_COLORMAP, serverClient, DixUseAccess); XSetWindowColormap(xnestDisplay, @@ -308,7 +308,7 @@ xnestDirectInstallColormaps(ScreenPtr pScreen) for (i = 0; i < n; i++) { ColormapPtr pCmap; - dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], RT_COLORMAP, + dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], X11_RESTYPE_COLORMAP, serverClient, DixInstallAccess); if (pCmap) XInstallColormap(xnestDisplay, xnestColormap(pCmap)); @@ -329,7 +329,7 @@ xnestDirectUninstallColormaps(ScreenPtr pScreen) for (i = 0; i < n; i++) { ColormapPtr pCmap; - dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], RT_COLORMAP, + dixLookupResourceByType((void **) &pCmap, pCmapIDs[i], X11_RESTYPE_COLORMAP, serverClient, DixUninstallAccess); if (pCmap) XUninstallColormap(xnestDisplay, xnestColormap(pCmap)); @@ -365,7 +365,7 @@ xnestUninstallColormap(ColormapPtr pCmap) if (pCmap->mid != pCmap->pScreen->defColormap) { dixLookupResourceByType((void **) &pCurCmap, pCmap->pScreen->defColormap, - RT_COLORMAP, + X11_RESTYPE_COLORMAP, serverClient, DixInstallAccess); (*pCmap->pScreen->InstallColormap) (pCurCmap); } diff --git a/hw/xnest/Window.c b/hw/xnest/Window.c index 7b410c4a3..932db760c 100644 --- a/hw/xnest/Window.c +++ b/hw/xnest/Window.c @@ -99,7 +99,7 @@ xnestCreateWindow(WindowPtr pWin) mask |= CWColormap; if (pWin->optional->colormap) { dixLookupResourceByType((void **) &pCmap, wColormap(pWin), - RT_COLORMAP, serverClient, + X11_RESTYPE_COLORMAP, serverClient, DixUseAccess); attributes.colormap = xnestColormap(pCmap); } @@ -112,7 +112,7 @@ xnestCreateWindow(WindowPtr pWin) else { /* root windows have their own colormaps at creation time */ visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); dixLookupResourceByType((void **) &pCmap, wColormap(pWin), - RT_COLORMAP, serverClient, DixUseAccess); + X11_RESTYPE_COLORMAP, serverClient, DixUseAccess); mask |= CWColormap; attributes.colormap = xnestColormap(pCmap); } @@ -334,7 +334,7 @@ xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask) ColormapPtr pCmap; dixLookupResourceByType((void **) &pCmap, wColormap(pWin), - RT_COLORMAP, serverClient, DixUseAccess); + X11_RESTYPE_COLORMAP, serverClient, DixUseAccess); attributes.colormap = xnestColormap(pCmap); diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index 7447de102..c2dba5f56 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -1590,7 +1590,7 @@ xwl_keyboard_search_window(ClientPtr client) { WindowPtr window = NullWindow; - FindClientResourcesByType(client, RT_WINDOW, find_toplevel_callback, &window); + FindClientResourcesByType(client, X11_RESTYPE_WINDOW, find_toplevel_callback, &window); return window; } diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index f77ba8278..b82300240 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -475,7 +475,7 @@ xwl_output_set_randr_emu_props(struct xwl_screen *xwl_screen, ClientPtr client) struct xwl_output_randr_emu_prop prop = {}; xwl_output_randr_emu_prop(xwl_screen, client, &prop); - FindClientResourcesByType(client, RT_WINDOW, + FindClientResourcesByType(client, X11_RESTYPE_WINDOW, xwl_output_set_randr_emu_prop_callback, &prop); } diff --git a/hw/xwin/wincmap.c b/hw/xwin/wincmap.c index 0df14c0f5..df69ba78b 100644 --- a/hw/xwin/wincmap.c +++ b/hw/xwin/wincmap.c @@ -178,7 +178,7 @@ winUninstallColormap(ColormapPtr pmap) /* Install the default cmap in place of the cmap to be uninstalled */ if (pmap->mid != pmap->pScreen->defColormap) { dixLookupResourceByType((void *) &curpmap, pmap->pScreen->defColormap, - RT_COLORMAP, NullClient, DixUnknownAccess); + X11_RESTYPE_COLORMAP, NullClient, DixUnknownAccess); (*pmap->pScreen->InstallColormap) (curpmap); } } diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index 030546527..4aca28930 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -717,7 +717,7 @@ winGetWindowID(WindowPtr pWin) ClientPtr c = wClient(pWin); /* */ - FindClientResourcesByType(c, RT_WINDOW, winFindWindow, &wi); + FindClientResourcesByType(c, X11_RESTYPE_WINDOW, winFindWindow, &wi); #if ENABLE_DEBUG ErrorF("winGetWindowID - Window ID: %u\n", (unsigned int)wi.id); diff --git a/include/resource.h b/include/resource.h index 4e3980153..a48735ba0 100644 --- a/include/resource.h +++ b/include/resource.h @@ -73,21 +73,29 @@ typedef uint32_t RESTYPE; // prevent namespace clash with Windows #define X11_RESTYPE_NONE ((RESTYPE)0) +#define X11_RESTYPE_WINDOW ((RESTYPE)1|RC_DRAWABLE) +#define X11_RESTYPE_PIXMAP ((RESTYPE)2|RC_DRAWABLE) +#define X11_RESTYPE_GC ((RESTYPE)3) #define X11_RESTYPE_FONT ((RESTYPE)4) #define X11_RESTYPE_CURSOR ((RESTYPE)5) +#define X11_RESTYPE_COLORMAP ((RESTYPE)6) +#define X11_RESTYPE_CMAPENTRY ((RESTYPE)7) +#define X11_RESTYPE_OTHERCLIENT ((RESTYPE)8|RC_NEVERRETAIN) +#define X11_RESTYPE_PASSIVEGRAB ((RESTYPE)9|RC_NEVERRETAIN) +#define X11_RESTYPE_LASTPREDEF ((RESTYPE)9) -#define RT_WINDOW ((RESTYPE)1|RC_DRAWABLE) -#define RT_PIXMAP ((RESTYPE)2|RC_DRAWABLE) -#define RT_GC ((RESTYPE)3) +#define RT_WINDOW X11_RESTYPE_WINDOW +#define RT_PIXMAP X11_RESTYPE_PIXMAP +#define RT_GC X11_RESTYPE_GC #undef RT_FONT #undef RT_CURSOR #define RT_FONT X11_RESTYPE_FONT #define RT_CURSOR X11_RESTYPE_CURSOR -#define RT_COLORMAP ((RESTYPE)6) -#define RT_CMAPENTRY ((RESTYPE)7) -#define RT_OTHERCLIENT ((RESTYPE)8|RC_NEVERRETAIN) -#define RT_PASSIVEGRAB ((RESTYPE)9|RC_NEVERRETAIN) -#define RT_LASTPREDEF ((RESTYPE)9) +#define RT_COLORMAP X11_RESTYPE_COLORMAP +#define RT_CMAPENTRY X11_RESTYPE_CMAPENTRY +#define RT_OTHERCLIENT X11_RESTYPE_OTHERCLIENT +#define RT_PASSIVEGRAB X11_RESTYPE_PASSIVEGRAB +#define RT_LASTPREDEF X11_RESTYPE_LASTPREDEF #define RT_NONE X11_RESTYPE_NONE diff --git a/mi/micmap.c b/mi/micmap.c index 0bbe4f70d..b4fbbe712 100644 --- a/mi/micmap.c +++ b/mi/micmap.c @@ -77,7 +77,7 @@ miUninstallColormap(ColormapPtr pmap) if (pmap->mid != pmap->pScreen->defColormap) { dixLookupResourceByType((void **) &curpmap, pmap->pScreen->defColormap, - RT_COLORMAP, serverClient, DixUseAccess); + X11_RESTYPE_COLORMAP, serverClient, DixUseAccess); (*pmap->pScreen->InstallColormap) (curpmap); } } diff --git a/present/present_request.c b/present/present_request.c index a9c6ffe66..8e5f37017 100644 --- a/present/present_request.c +++ b/present/present_request.c @@ -117,7 +117,7 @@ proc_present_pixmap_common(ClientPtr client, ret = dixLookupWindow(&window, req_window, client, DixWriteAccess); if (ret != Success) return ret; - ret = dixLookupResourceByType((void **) &pixmap, req_pixmap, RT_PIXMAP, client, DixReadAccess); + ret = dixLookupResourceByType((void **) &pixmap, req_pixmap, X11_RESTYPE_PIXMAP, client, DixReadAccess); if (ret != Success) return ret; diff --git a/render/picture.c b/render/picture.c index 633341795..43428d45a 100644 --- a/render/picture.c +++ b/render/picture.c @@ -421,7 +421,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 { @@ -589,7 +589,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); @@ -760,7 +760,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; @@ -1027,7 +1027,7 @@ cpClipMask(void **result, XID id, ScreenPtr screen, ClientPtr client, Mask mode) id = res->info[screen->myNum].id; } #endif - return dixLookupResourceByType(result, id, RT_PIXMAP, client, mode); + return dixLookupResourceByType(result, id, X11_RESTYPE_PIXMAP, client, mode); } #define NEXT_VAL(_type) (vlist ? (_type) *vlist++ : (_type) ulist++->val) diff --git a/xfixes/cursor.c b/xfixes/cursor.c index 79eff6085..769bb1c9e 100644 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -595,7 +595,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 @@ -608,14 +610,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; @@ -854,7 +856,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; @@ -918,7 +920,7 @@ ProcXFixesShowCursor(ClientPtr client) REQUEST_SIZE_MATCH(xXFixesShowCursorReq); - rc = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW, + rc = dixLookupResourceByType((void **) &pWin, stuff->window, X11_RESTYPE_WINDOW, client, DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->window; diff --git a/xfixes/region.c b/xfixes/region.c index eb3971d77..1927a013e 100644 --- a/xfixes/region.c +++ b/xfixes/region.c @@ -115,7 +115,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; @@ -159,7 +159,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; @@ -650,7 +650,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;