prevent name clash on Windows w/ RT_* defines

Windows' native headers using some our RT_* define's names for other things.
Since the naming isn't very nice anyways, introducing some new ones
(X11_RESTYPE_NONE, X11_RESTYPE_FONT, X11_RESTYPE_CURSOR) and define the old
ones as an alias to them, in case some out-of-tree code still uses them.

With thins change, we don't need to be so extremely careful about include
ordering and have explicit #undef's in order to prevent name clashes on
Win32 targets.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>
(cherry picked from commit 232cad9ec3)
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-03-04 15:08:32 +01:00 committed by Alan Coopersmith
parent 8d516ced55
commit ca361681f8
52 changed files with 183 additions and 177 deletions

View file

@ -163,7 +163,7 @@ ProcDPMSSelectInput(register ClientPtr client)
pHead = (DPMSEventPtr *)malloc(sizeof(DPMSEventPtr));
if (!pHead ||
!AddResource(eventResource, DPMSEventType, (void *)pHead)) {
FreeResource(clientResource, RT_NONE);
FreeResource(clientResource, X11_RESTYPE_NONE);
return BadAlloc;
}
*pHead = 0;

View file

@ -474,7 +474,7 @@ CreateSaverWindow(ScreenPtr pScreen)
pSaver = &pScreen->screensaver;
if (pSaver->pWindow) {
pSaver->pWindow = NullWindow;
FreeResource(pSaver->wid, RT_NONE);
FreeResource(pSaver->wid, X11_RESTYPE_NONE);
if (pPriv) {
UninstallSaverColormap(pScreen);
pPriv->hasWindow = FALSE;
@ -518,7 +518,7 @@ CreateSaverWindow(ScreenPtr pScreen)
CursorPtr cursor;
if (!pWin->optional)
if (!MakeWindowOptional(pWin)) {
FreeResource(pWin->drawable.id, RT_NONE);
FreeResource(pWin->drawable.id, X11_RESTYPE_NONE);
return FALSE;
}
cursor = RefCursor(pAttr->pCursor);
@ -570,7 +570,7 @@ DestroySaverWindow(ScreenPtr pScreen)
pSaver = &pScreen->screensaver;
if (pSaver->pWindow) {
pSaver->pWindow = NullWindow;
FreeResource(pSaver->wid, RT_NONE);
FreeResource(pSaver->wid, X11_RESTYPE_NONE);
}
pPriv->hasWindow = FALSE;
CheckScreenPrivate(pScreen);
@ -1034,7 +1034,7 @@ ScreenSaverSetAttributes(ClientPtr client)
}
else {
ret = dixLookupResourceByType((void **) &pCursor, cursorID,
RT_CURSOR, client, DixUseAccess);
X11_RESTYPE_CURSOR, client, DixUseAccess);
if (ret != Success) {
client->errorValue = cursorID;
goto PatchUp;
@ -1231,7 +1231,7 @@ ProcScreenSaverSuspend(ClientPtr client)
if (suspend == TRUE)
this->count++;
else if (--this->count == 0)
FreeResource(this->clientResource, RT_NONE);
FreeResource(this->clientResource, X11_RESTYPE_NONE);
return Success;
}

View file

@ -198,7 +198,7 @@ SecurityDeleteAuthorization(void *value, XID id)
.authId = pAuth->id
};
WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
FreeResource(pEventClient->resource, RT_NONE);
FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
}
/* kill all clients using this auth */
@ -304,7 +304,7 @@ SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, void *pval)
pAuth->secondsRemaining);
}
else {
FreeResource(pAuth->id, RT_NONE);
FreeResource(pAuth->id, X11_RESTYPE_NONE);
return 0;
}
} /* SecurityAuthorizationExpired */
@ -368,7 +368,7 @@ SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
pEventClient; pEventClient = pEventClient->next) {
if (SameClient(pEventClient, client)) {
if (mask == 0)
FreeResource(pEventClient->resource, RT_NONE);
FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
else
pEventClient->mask = mask;
return Success;
@ -580,7 +580,7 @@ ProcSecurityRevokeAuthorization(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->authId, RT_NONE);
FreeResource(stuff->authId, X11_RESTYPE_NONE);
return Success;
} /* ProcSecurityRevokeAuthorization */

View file

@ -783,7 +783,7 @@ ProcShapeSelectInput(ClientPtr client)
if (!pHead ||
!AddResource(pWin->drawable.id, ShapeEventType,
(void *) pHead)) {
FreeResource(clientResource, RT_NONE);
FreeResource(clientResource, X11_RESTYPE_NONE);
return BadAlloc;
}
*pHead = 0;

View file

@ -461,7 +461,7 @@ ProcShmDetach(ClientPtr client)
REQUEST_SIZE_MATCH(xShmDetachReq);
VERIFY_SHMSEG(stuff->shmseg, shmdesc, client);
FreeResource(stuff->shmseg, RT_NONE);
FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
return Success;
}
@ -999,7 +999,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
if (pMap) {
result = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid,
RT_PIXMAP, pMap, RT_NONE, NULL, DixCreateAccess);
RT_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (result != Success) {
pDraw->pScreen->DestroyPixmap(pMap);
break;
@ -1021,7 +1021,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
if (result != Success) {
while (j--)
FreeResource(newPix->info[j].id, RT_NONE);
FreeResource(newPix->info[j].id, X11_RESTYPE_NONE);
free(newPix);
}
else
@ -1114,7 +1114,7 @@ ProcShmCreatePixmap(ClientPtr client)
stuff->offset);
if (pMap) {
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
pMap, RT_NONE, NULL, DixCreateAccess);
pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success) {
pDraw->pScreen->DestroyPixmap(pMap);
return rc;
@ -1141,7 +1141,7 @@ ShmBusfaultNotify(void *context)
(unsigned int) shmdesc->resource);
busfault_unregister(shmdesc->busfault);
shmdesc->busfault = NULL;
FreeResource (shmdesc->resource, RT_NONE);
FreeResource (shmdesc->resource, X11_RESTYPE_NONE);
}
static int
@ -1323,7 +1323,7 @@ ProcShmCreateSegment(ClientPtr client)
}
if (WriteFdToClient(client, fd, TRUE) < 0) {
FreeResource(stuff->shmseg, RT_NONE);
FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
close(fd);
return BadAlloc;
}

View file

@ -166,7 +166,7 @@ SertafiedBlockHandler(void *data, void *wt)
pNext = pReq->next;
if (CompareTimeStamps(pReq->revive, now) == LATER)
break;
FreeResource(pReq->id, RT_NONE);
FreeResource(pReq->id, X11_RESTYPE_NONE);
/* AttendClient() may have been called via the resource delete
* function so a client may have input to be processed and so
@ -195,7 +195,7 @@ SertafiedWakeupHandler(void *data, int i)
pNext = pReq->next;
if (CompareTimeStamps(pReq->revive, now) == LATER)
break;
FreeResource(pReq->id, RT_NONE);
FreeResource(pReq->id, X11_RESTYPE_NONE);
}
if (!pPending) {
RemoveBlockAndWakeupHandlers(SertafiedBlockHandler,

View file

@ -693,7 +693,7 @@ SyncAwaitTriggerFired(SyncTrigger * pTrigger)
/* unblock the client */
AttendClient(pAwaitUnion->header.client);
/* delete the await */
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
}
static int64_t
@ -748,7 +748,7 @@ SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
* nothing, since it's already got them.
*/
if (!wantevents) {
FreeResource(pClients->delete_id, RT_NONE);
FreeResource(pClients->delete_id, X11_RESTYPE_NONE);
}
return Success;
}
@ -931,7 +931,7 @@ SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL
status = miSyncInitFenceFromFD(pDraw, pFence, fd, initially_triggered);
if (status != Success) {
FreeResource(pFence->sync.id, RT_NONE);
FreeResource(pFence->sync.id, X11_RESTYPE_NONE);
return status;
}
@ -989,7 +989,7 @@ SyncCreateSystemCounter(const char *name,
psci = malloc(sizeof(SysCounterInfo));
if (!psci) {
FreeResource(pCounter->sync.id, RT_NONE);
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
return pCounter;
}
pCounter->pSysCounterInfo = psci;
@ -1012,7 +1012,7 @@ SyncDestroySystemCounter(void *pSysCounter)
{
SyncCounter *pCounter = (SyncCounter *) pSysCounter;
FreeResource(pCounter->sync.id, RT_NONE);
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
}
static void
@ -1125,7 +1125,7 @@ FreeAlarm(void *addr, XID id)
/* delete event selections */
while (pAlarm->pEventClients)
FreeResource(pAlarm->pEventClients->delete_id, RT_NONE);
FreeResource(pAlarm->pEventClients->delete_id, X11_RESTYPE_NONE);
SyncDeleteTriggerFromSyncObject(&pAlarm->trigger);
@ -1490,7 +1490,7 @@ ProcSyncDestroyCounter(ClientPtr client)
client->errorValue = stuff->counter;
return BadAccess;
}
FreeResource(pCounter->sync.id, RT_NONE);
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
return Success;
}
@ -1591,7 +1591,7 @@ ProcSyncAwait(ClientPtr client)
/* this should take care of removing any triggers created by
* this request that have already been registered on sync objects
*/
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
client->errorValue = pProtocolWaitConds->counter;
return SyncErrorBase + XSyncBadCounter;
}
@ -1611,7 +1611,7 @@ ProcSyncAwait(ClientPtr client)
/* this should take care of removing any triggers created by
* this request that have already been registered on sync objects
*/
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
return status;
}
/* this is not a mistake -- same function works for both cases */
@ -1742,7 +1742,7 @@ ProcSyncCreateAlarm(ClientPtr client)
if (!SyncCheckWarnIsCounter(pTrigger->pSync,
WARN_INVALID_COUNTER_ALARM)) {
FreeResource(stuff->id, RT_NONE);
FreeResource(stuff->id, X11_RESTYPE_NONE);
return BadAlloc;
}
@ -1873,7 +1873,7 @@ ProcSyncDestroyAlarm(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->alarm, RT_NONE);
FreeResource(stuff->alarm, X11_RESTYPE_NONE);
return Success;
}
@ -1978,7 +1978,7 @@ ProcSyncDestroyFence(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->fid, RT_NONE);
FreeResource(stuff->fid, X11_RESTYPE_NONE);
return Success;
}
@ -2056,7 +2056,7 @@ ProcSyncAwaitFence(ClientPtr client)
/* this should take care of removing any triggers created by
* this request that have already been registered on sync objects
*/
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
client->errorValue = *pProtocolFences;
return SyncErrorBase + XSyncBadFence;
}
@ -2075,7 +2075,7 @@ ProcSyncAwaitFence(ClientPtr client)
/* this should take care of removing any triggers created by
* this request that have already been registered on sync objects
*/
FreeResource(pAwaitUnion->header.delete_id, RT_NONE);
FreeResource(pAwaitUnion->header.delete_id, X11_RESTYPE_NONE);
return status;
}
/* this is not a mistake -- same function works for both cases */

View file

@ -324,9 +324,9 @@ SELinuxTypeToClass(RESTYPE type)
class = SECCLASS_X_DRAWABLE;
else if (type == RT_GC)
class = SECCLASS_X_GC;
else if (type == RT_FONT)
else if (type == X11_RESTYPE_FONT)
class = SECCLASS_X_FONT;
else if (type == RT_CURSOR)
else if (type == X11_RESTYPE_CURSOR)
class = SECCLASS_X_CURSOR;
else if (type == RT_COLORMAP)
class = SECCLASS_X_COLORMAP;

View file

@ -129,7 +129,7 @@ ProcXTestCompareCursor(ClientPtr client)
pCursor = GetSpriteCursor(ptr);
else {
rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
RT_CURSOR, client, DixReadAccess);
X11_RESTYPE_CURSOR, client, DixReadAccess);
if (rc != Success) {
client->errorValue = stuff->cursor;
return rc;

View file

@ -290,7 +290,7 @@ ProcXvMCDestroyContext(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->context_id, RT_NONE);
FreeResource(stuff->context_id, X11_RESTYPE_NONE);
return Success;
}
@ -368,7 +368,7 @@ ProcXvMCDestroySurface(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->surface_id, RT_NONE);
FreeResource(stuff->surface_id, X11_RESTYPE_NONE);
return Success;
}
@ -496,7 +496,7 @@ ProcXvMCDestroySubpicture(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->subpicture_id, RT_NONE);
FreeResource(stuff->subpicture_id, X11_RESTYPE_NONE);
return Success;
}

View file

@ -102,7 +102,7 @@ DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
next = grab->next;
if ((grab->device == dev) &&
(client->clientAsMask == CLIENT_BITS(grab->resource)))
FreeResource(grab->resource, RT_NONE);
FreeResource(grab->resource, X11_RESTYPE_NONE);
}
}

View file

@ -1536,7 +1536,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
l = &ti->listeners[ti->num_listeners - 1];
l->listener = g->resource;
l->grab = g;
//l->resource_type = RT_NONE;
//l->resource_type = X11_RESTYPE_NONE;
if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin)
l->type = TOUCH_LISTENER_POINTER_GRAB;
@ -2502,7 +2502,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
cursor = NullCursor;
else {
rc = dixLookupResourceByType((void **) &cursor, param->cursor,
RT_CURSOR, client, DixUseAccess);
X11_RESTYPE_CURSOR, client, DixUseAccess);
if (rc != Success) {
client->errorValue = param->cursor;
return rc;
@ -2601,7 +2601,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
cursor = NullCursor;
else {
rc = dixLookupResourceByType((void **) &cursor, param->cursor,
RT_CURSOR, client, DixUseAccess);
X11_RESTYPE_CURSOR, client, DixUseAccess);
if (rc != Success) {
client->errorValue = param->cursor;
return rc;
@ -2689,7 +2689,7 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
if (i == EMASKSIZE) {
RecalculateDeviceDeliverableEvents(pWin);
if (ShouldFreeInputMasks(pWin, FALSE))
FreeResource(others->resource, RT_NONE);
FreeResource(others->resource, X11_RESTYPE_NONE);
return Success;
}
}
@ -3116,7 +3116,7 @@ DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources)
ic = inputMasks->inputClients;
for (i = 0; i < EMASKSIZE; i++)
inputMasks->dontPropagateMask[i] = 0;
FreeResource(ic->resource, RT_NONE);
FreeResource(ic->resource, X11_RESTYPE_NONE);
}
}
@ -3239,7 +3239,7 @@ DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask,
}
RecalculateDeviceDeliverableEvents(pWin);
if (ShouldFreeInputMasks(pWin, FALSE))
FreeResource(inputMasks->inputClients->resource, RT_NONE);
FreeResource(inputMasks->inputClients->resource, X11_RESTYPE_NONE);
return Success;
}

View file

@ -829,7 +829,7 @@ XIDestroyPointerBarrier(ClientPtr client,
if (CLIENT_ID(stuff->barrier) != client->index)
return BadAccess;
FreeResource(stuff->barrier, RT_NONE);
FreeResource(stuff->barrier, X11_RESTYPE_NONE);
return Success;
}

View file

@ -97,7 +97,7 @@ ProcXIChangeCursor(ClientPtr client)
}
else {
rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
RT_CURSOR, client, DixUseAccess);
X11_RESTYPE_CURSOR, client, DixUseAccess);
if (rc != Success)
return rc;
}

View file

@ -173,7 +173,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
if (stuff->cursor != None) {
ret = dixLookupResourceByType(&tmp, stuff->cursor,
RT_CURSOR, client, DixUseAccess);
X11_RESTYPE_CURSOR, client, DixUseAccess);
if (ret != Success) {
client->errorValue = stuff->cursor;
goto out;

View file

@ -217,7 +217,7 @@ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
}
if (!compCheckRedirect(pWin)) {
FreeResource(ccw->id, RT_NONE);
FreeResource(ccw->id, X11_RESTYPE_NONE);
return BadAlloc;
}
@ -329,7 +329,7 @@ compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
for (ccw = cw->clients; ccw; ccw = ccw->next)
if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) {
FreeResource(ccw->id, RT_NONE);
FreeResource(ccw->id, X11_RESTYPE_NONE);
return Success;
}
return BadValue;
@ -477,7 +477,7 @@ compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
return BadValue;
for (ccw = csw->clients; ccw; ccw = ccw->next)
if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) {
FreeResource(ccw->id, RT_NONE);
FreeResource(ccw->id, X11_RESTYPE_NONE);
return Success;
}
return BadValue;

View file

@ -265,7 +265,7 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
if (pScreen->NameWindowPixmap) {
rc = pScreen->NameWindowPixmap(pWin, pPixmap, stuff->pixmap);
if (rc != Success) {
FreeResource(stuff->pixmap, RT_NONE);
FreeResource(stuff->pixmap, X11_RESTYPE_NONE);
return rc;
}
}
@ -302,14 +302,14 @@ ProcCompositeGetOverlayWindow(ClientPtr client)
cs = GetCompScreen(pScreen);
if (cs->pOverlayWin == NULL)
if (!compCreateOverlayWindow(pScreen)) {
FreeResource(pOc->resource, RT_NONE);
FreeResource(pOc->resource, X11_RESTYPE_NONE);
return BadAlloc;
}
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id,
RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess);
RT_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, NULL, DixGetAttrAccess);
if (rc != Success) {
FreeResource(pOc->resource, RT_NONE);
FreeResource(pOc->resource, X11_RESTYPE_NONE);
return rc;
}
@ -349,7 +349,7 @@ ProcCompositeReleaseOverlayWindow(ClientPtr client)
return BadMatch;
/* The delete function will free the client structure */
FreeResource(pOc->resource, RT_NONE);
FreeResource(pOc->resource, X11_RESTYPE_NONE);
return Success;
}
@ -820,17 +820,17 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
cs = GetCompScreen(pScreen);
if (cs->pOverlayWin == NULL)
if (!compCreateOverlayWindow(pScreen)) {
FreeResource(pOc->resource, RT_NONE);
FreeResource(pOc->resource, X11_RESTYPE_NONE);
free(overlayWin);
return BadAlloc;
}
rc = XaceHook(XACE_RESOURCE_ACCESS, client,
cs->pOverlayWin->drawable.id,
RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL,
RT_WINDOW, cs->pOverlayWin, X11_RESTYPE_NONE, NULL,
DixGetAttrAccess);
if (rc != Success) {
FreeResource(pOc->resource, RT_NONE);
FreeResource(pOc->resource, X11_RESTYPE_NONE);
free(overlayWin);
return rc;
}
@ -898,7 +898,7 @@ PanoramiXCompositeReleaseOverlayWindow(ClientPtr client)
return BadMatch;
/* The delete function will free the client structure */
FreeResource(pOc->resource, RT_NONE);
FreeResource(pOc->resource, X11_RESTYPE_NONE);
}
return Success;

View file

@ -169,5 +169,5 @@ compDestroyOverlayWindow(ScreenPtr pScreen)
CompScreenPtr cs = GetCompScreen(pScreen);
cs->pOverlayWin = NullWindow;
FreeResource(cs->overlayWid, RT_NONE);
FreeResource(cs->overlayWid, X11_RESTYPE_NONE);
}

View file

@ -607,9 +607,9 @@ compDestroyWindow(WindowPtr pWin)
pScreen->DestroyWindow = cs->DestroyWindow;
while ((cw = GetCompWindow(pWin)))
FreeResource(cw->clients->id, RT_NONE);
FreeResource(cw->clients->id, X11_RESTYPE_NONE);
while ((csw = GetCompSubwindows(pWin)))
FreeResource(csw->clients->id, RT_NONE);
FreeResource(csw->clients->id, X11_RESTYPE_NONE);
if (pWin->redirectDraw != RedirectDrawNone) {
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);

View file

@ -161,7 +161,7 @@ DamageExtDestroy(DamagePtr pDamage, void *closure)
pDamageExt->pDamage = 0;
if (pDamageExt->id)
FreeResource(pDamageExt->id, RT_NONE);
FreeResource(pDamageExt->id, X11_RESTYPE_NONE);
}
void
@ -314,7 +314,7 @@ ProcDamageDestroy(ClientPtr client)
REQUEST_SIZE_MATCH(xDamageDestroyReq);
VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess);
FreeResource(stuff->damage, RT_NONE);
FreeResource(stuff->damage, X11_RESTYPE_NONE);
return Success;
}
@ -683,7 +683,7 @@ PanoramiXDamageCreate(ClientPtr client)
}
if (rc != Success)
FreeResource(stuff->damage, RT_NONE);
FreeResource(stuff->damage, X11_RESTYPE_NONE);
return rc;
}

View file

@ -410,7 +410,7 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
return dbeErrorBase + DbeBadBuffer;
}
FreeResource(stuff->buffer, RT_NONE);
FreeResource(stuff->buffer, X11_RESTYPE_NONE);
return Success;
@ -1311,7 +1311,7 @@ DbeDestroyWindow(WindowPtr pWin)
* NULL if there are no more buffer IDs associated with this
* window.
*/
FreeResource(pDbeWindowPriv->IDs[0], RT_NONE);
FreeResource(pDbeWindowPriv->IDs[0], X11_RESTYPE_NONE);
pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
}
}

View file

@ -177,7 +177,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
if (rc != Success || !AddResource(bufId, dbeDrawableResType,
pDbeWindowPriv->pBackBuffer)) {
/* free the buffer and the drawable resource */
FreeResource(bufId, RT_NONE);
FreeResource(bufId, X11_RESTYPE_NONE);
return (rc == Success) ? BadAlloc : rc;
}
@ -599,7 +599,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
/* DbeWindowPrivDelete() will free the window private if there no
* more buffer IDs associated with this window.
*/
FreeResource(pDbeWindowPriv->IDs[0], RT_NONE);
FreeResource(pDbeWindowPriv->IDs[0], X11_RESTYPE_NONE);
pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
}

View file

@ -377,9 +377,9 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
* Security creation/labeling check
*/
i = XaceHook(XACE_RESOURCE_ACCESS, clients[client], mid, RT_COLORMAP,
pmap, RT_NONE, NULL, DixCreateAccess);
pmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (i != Success) {
FreeResource(mid, RT_NONE);
FreeResource(mid, X11_RESTYPE_NONE);
return i;
}
@ -387,7 +387,7 @@ CreateColormap(Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
* this is it. In specific, if this is a Static colormap, this is the
* time to fill in the colormap's values */
if (!(*pScreen->CreateColormap) (pmap)) {
FreeResource(mid, RT_NONE);
FreeResource(mid, X11_RESTYPE_NONE);
return BadAlloc;
}
pmap->flags &= ~BeingCreated;

View file

@ -276,8 +276,8 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
pCurs->id = cid;
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR,
pCurs, RT_NONE, NULL, DixCreateAccess);
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, X11_RESTYPE_CURSOR,
pCurs, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success)
goto error;
@ -334,13 +334,13 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
CursorPtr pCurs;
GlyphSharePtr pShare;
rc = dixLookupResourceByType((void **) &sourcefont, source, RT_FONT,
rc = dixLookupResourceByType((void **) &sourcefont, source, X11_RESTYPE_FONT,
client, DixUseAccess);
if (rc != Success) {
client->errorValue = source;
return rc;
}
rc = dixLookupResourceByType((void **) &maskfont, mask, RT_FONT, client,
rc = dixLookupResourceByType((void **) &maskfont, mask, X11_RESTYPE_FONT, client,
DixUseAccess);
if (rc != Success && mask != None) {
client->errorValue = mask;
@ -456,8 +456,8 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
pCurs->id = cid;
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR,
pCurs, RT_NONE, NULL, DixCreateAccess);
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, X11_RESTYPE_CURSOR,
pCurs, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success)
goto error;
@ -500,7 +500,7 @@ CreateRootCursor(char *unused1, unsigned int unused2)
if (err != Success)
return NullCursor;
err = dixLookupResourceByType((void **) &cursorfont, fontID, RT_FONT,
err = dixLookupResourceByType((void **) &cursorfont, fontID, X11_RESTYPE_FONT,
serverClient, DixReadAccess);
if (err != Success)
return NullCursor;
@ -508,7 +508,7 @@ CreateRootCursor(char *unused1, unsigned int unused2)
&curs, serverClient, (XID) 0) != Success)
return NullCursor;
if (!AddResource(FakeClientID(0), RT_CURSOR, (void *) curs))
if (!AddResource(FakeClientID(0), X11_RESTYPE_CURSOR, (void *) curs))
return NullCursor;
return curs;

View file

@ -828,7 +828,7 @@ ProcDestroyWindow(ClientPtr client)
DixRemoveAccess);
if (rc != Success)
return rc;
FreeResource(stuff->id, RT_NONE);
FreeResource(stuff->id, X11_RESTYPE_NONE);
}
return Success;
}
@ -1321,10 +1321,10 @@ ProcCloseFont(ClientPtr client)
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupResourceByType((void **) &pFont, stuff->id, RT_FONT,
rc = dixLookupResourceByType((void **) &pFont, stuff->id, X11_RESTYPE_FONT,
client, DixDestroyAccess);
if (rc == Success) {
FreeResource(stuff->id, RT_NONE);
FreeResource(stuff->id, X11_RESTYPE_NONE);
return Success;
}
else {
@ -1510,7 +1510,7 @@ ProcCreatePixmap(ClientPtr client)
pMap->drawable.id = stuff->pid;
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
pMap, RT_NONE, NULL, DixCreateAccess);
pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success) {
(*pDraw->pScreen->DestroyPixmap) (pMap);
return rc;
@ -1533,7 +1533,7 @@ ProcFreePixmap(ClientPtr client)
rc = dixLookupResourceByType((void **) &pMap, stuff->id, RT_PIXMAP,
client, DixDestroyAccess);
if (rc == Success) {
FreeResource(stuff->id, RT_NONE);
FreeResource(stuff->id, X11_RESTYPE_NONE);
return Success;
}
else {
@ -1682,7 +1682,7 @@ ProcFreeGC(ClientPtr client)
if (rc != Success)
return rc;
FreeResource(stuff->id, RT_NONE);
FreeResource(stuff->id, X11_RESTYPE_NONE);
return Success;
}
@ -2470,7 +2470,7 @@ ProcFreeColormap(ClientPtr client)
if (rc == Success) {
/* Freeing a default colormap is a no-op */
if (!(pmap->flags & IsDefault))
FreeResource(stuff->id, RT_NONE);
FreeResource(stuff->id, X11_RESTYPE_NONE);
return Success;
}
else {
@ -3058,7 +3058,7 @@ ProcCreateCursor(ClientPtr client)
if (rc != Success)
goto bail;
if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) {
if (!AddResource(stuff->cid, X11_RESTYPE_CURSOR, (void *) pCursor)) {
rc = BadAlloc;
goto bail;
}
@ -3088,7 +3088,7 @@ ProcCreateGlyphCursor(ClientPtr client)
&pCursor, client, stuff->cid);
if (res != Success)
return res;
if (AddResource(stuff->cid, RT_CURSOR, (void *) pCursor))
if (AddResource(stuff->cid, X11_RESTYPE_CURSOR, (void *) pCursor))
return Success;
return BadAlloc;
}
@ -3102,10 +3102,10 @@ ProcFreeCursor(ClientPtr client)
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupResourceByType((void **) &pCursor, stuff->id, RT_CURSOR,
rc = dixLookupResourceByType((void **) &pCursor, stuff->id, X11_RESTYPE_CURSOR,
client, DixDestroyAccess);
if (rc == Success) {
FreeResource(stuff->id, RT_NONE);
FreeResource(stuff->id, X11_RESTYPE_NONE);
return Success;
}
else {

View file

@ -126,7 +126,7 @@ GetGlyphs(FontPtr font, unsigned long count, unsigned char *chars,
}
/*
* adding RT_FONT prevents conflict with default cursor font
* adding RT_FONT / X11_RESTYPE_FONT prevents conflict with default cursor font
*/
Bool
SetDefaultFont(const char *defaultfontname)
@ -140,7 +140,7 @@ SetDefaultFont(const char *defaultfontname)
(unsigned) strlen(defaultfontname), defaultfontname);
if (err != Success)
return FALSE;
err = dixLookupResourceByType((void **) &pf, fid, RT_FONT, serverClient,
err = dixLookupResourceByType((void **) &pf, fid, X11_RESTYPE_FONT, serverClient,
DixReadAccess);
if (err != Success)
return FALSE;
@ -348,7 +348,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
}
}
}
if (!AddResource(c->fontid, RT_FONT, (void *) pfont)) {
if (!AddResource(c->fontid, X11_RESTYPE_FONT, (void *) pfont)) {
err = AllocError;
goto bail;
}
@ -401,7 +401,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname,
cached = xfont2_find_cached_font_pattern(patternCache, pfontname, lenfname);
if (cached && cached->info.cachable) {
if (!AddResource(fid, RT_FONT, (void *) cached))
if (!AddResource(fid, X11_RESTYPE_FONT, (void *) cached))
return BadAlloc;
cached->refcnt++;
return Success;
@ -1150,7 +1150,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
fid = ((Font) *(c->pElt + 4)) /* big-endian */
|((Font) *(c->pElt + 3)) << 8
| ((Font) *(c->pElt + 2)) << 16 | ((Font) *(c->pElt + 1)) << 24;
err = dixLookupResourceByType((void **) &pFont, fid, RT_FONT,
err = dixLookupResourceByType((void **) &pFont, fid, X11_RESTYPE_FONT,
client, DixUseAccess);
if (err != Success) {
/* restore pFont for step 4 (described below) */
@ -1887,7 +1887,7 @@ find_old_font(XID id)
{
void *pFont;
dixLookupResourceByType(&pFont, id, RT_NONE, serverClient, DixReadAccess);
dixLookupResourceByType(&pFont, id, X11_RESTYPE_NONE, serverClient, DixReadAccess);
return (FontPtr) pFont;
}
@ -1900,13 +1900,13 @@ get_new_font_client_id(void)
static int
store_font_Client_font(FontPtr pfont, Font id)
{
return AddResource(id, RT_NONE, (void *) pfont);
return AddResource(id, X11_RESTYPE_NONE, (void *) pfont);
}
static void
delete_font_client_id(Font id)
{
FreeResource(id, RT_NONE);
FreeResource(id, X11_RESTYPE_NONE);
}
static int

View file

@ -246,7 +246,7 @@ dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access)
GC *pGC;
client->errorValue = id; /* EITHER font or gc */
rc = dixLookupResourceByType((void **) pFont, id, RT_FONT, client,
rc = dixLookupResourceByType((void **) pFont, id, X11_RESTYPE_FONT, client,
access);
if (rc != BadFont)
return rc;

View file

@ -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, RT_NONE, NULL, DixManageAccess);
RT_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixManageAccess);
if (rc != Success)
return rc;
}
@ -4556,7 +4556,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
if (SameClient(others, client)) {
check = others->mask;
if (mask == 0) {
FreeResource(others->resource, RT_NONE);
FreeResource(others->resource, X11_RESTYPE_NONE);
return Success;
}
else
@ -5062,7 +5062,7 @@ ProcChangeActivePointerGrab(ClientPtr client)
newCursor = NullCursor;
else {
int rc = dixLookupResourceByType((void **) &newCursor, stuff->cursor,
RT_CURSOR, client, DixUseAccess);
X11_RESTYPE_CURSOR, client, DixUseAccess);
if (rc != Success) {
client->errorValue = stuff->cursor;
@ -5179,7 +5179,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
if (curs == None)
cursor = NullCursor;
else {
rc = dixLookupResourceByType((void **) &cursor, curs, RT_CURSOR,
rc = dixLookupResourceByType((void **) &cursor, curs, X11_RESTYPE_CURSOR,
client, DixUseAccess);
if (rc != Success) {
client->errorValue = curs;
@ -5716,7 +5716,7 @@ ProcGrabButton(ClientPtr client)
cursor = NullCursor;
else {
rc = dixLookupResourceByType((void **) &cursor, stuff->cursor,
RT_CURSOR, client, DixUseAccess);
X11_RESTYPE_CURSOR, client, DixUseAccess);
if (rc != Success) {
client->errorValue = stuff->cursor;
return rc;
@ -5903,9 +5903,9 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
if (pWin->dontPropagate)
DontPropagateRefCnts[pWin->dontPropagate]--;
while ((oc = wOtherClients(pWin)))
FreeResource(oc->resource, RT_NONE);
FreeResource(oc->resource, X11_RESTYPE_NONE);
while ((passive = wPassiveGrabs(pWin)))
FreeResource(passive->resource, RT_NONE);
FreeResource(passive->resource, X11_RESTYPE_NONE);
}
DeleteWindowFromAnyExtEvents(pWin, freeResources);
@ -5970,7 +5970,7 @@ ProcRecolorCursor(ClientPtr client)
REQUEST(xRecolorCursorReq);
REQUEST_SIZE_MATCH(xRecolorCursorReq);
rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, RT_CURSOR,
rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, X11_RESTYPE_CURSOR,
client, DixWriteAccess);
if (rc != Success) {
client->errorValue = stuff->cursor;

View file

@ -423,7 +423,7 @@ static const struct {
} xidfields[] = {
{GCTile, RT_PIXMAP, DixReadAccess},
{GCStipple, RT_PIXMAP, DixReadAccess},
{GCFont, RT_FONT, DixUseAccess},
{GCFont, X11_RESTYPE_FONT, DixUseAccess},
{GCClipMask, RT_PIXMAP, DixReadAccess},
};
@ -548,7 +548,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
/* security creation/labeling check */
*pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, RT_GC, pGC,
RT_NONE, NULL, DixCreateAccess | DixSetAttrAccess);
X11_RESTYPE_NONE, NULL, DixCreateAccess | DixSetAttrAccess);
if (*pStatus != Success)
goto out;

View file

@ -200,8 +200,8 @@ GestureAddGrabListener(DeviceIntPtr dev, GestureInfoPtr gi, GrabPtr grab)
BUG_RETURN_MSG(1, "Unsupported grab type\n");
}
/* grab listeners are always RT_NONE since we keep the grab pointer */
GestureAddListener(gi, grab->resource, RT_NONE, type, grab->window, grab);
/* grab listeners are always X11_RESTYPE_NONE since we keep the grab pointer */
GestureAddListener(gi, grab->resource, X11_RESTYPE_NONE, type, grab->window, grab);
}
/**

View file

@ -677,13 +677,13 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
if (!ok) {
for (i = 0; i < nadds; i++)
FreeResource(adds[i]->resource, RT_NONE);
FreeResource(adds[i]->resource, X11_RESTYPE_NONE);
for (i = 0; i < nups; i++)
free(details[i]);
}
else {
for (i = 0; i < ndels; i++)
FreeResource(deletes[i]->resource, RT_NONE);
FreeResource(deletes[i]->resource, X11_RESTYPE_NONE);
for (i = 0; i < nadds; i++) {
grab = adds[i];
grab->next = grab->window->optional->passiveGrabs;

View file

@ -564,12 +564,12 @@ dixPrivatesSize(DevPrivateType type)
/* Table of devPrivates offsets */
static const int offsets[] = {
-1, /* RT_NONE */
-1, /* RT_NONE / X11_RESTYPE_NONE */
offsetof(WindowRec, devPrivates), /* RT_WINDOW */
offsetof(PixmapRec, devPrivates), /* RT_PIXMAP */
offsetof(GC, devPrivates), /* RT_GC */
-1, /* RT_FONT */
offsetof(CursorRec, devPrivates), /* RT_CURSOR */
-1, /* RT_FONT / X11_RESTYPE_FONT */
offsetof(CursorRec, devPrivates), /* RT_CURSOR / X11_RESTYPE_CURSOR */
offsetof(ColormapRec, devPrivates), /* RT_COLORMAP */
};

View file

@ -361,12 +361,12 @@ dixResetRegistry(void)
#ifdef X_REGISTRY_RESOURCE
/* Add built-in resources */
RegisterResourceName(RT_NONE, "NONE");
RegisterResourceName(X11_RESTYPE_NONE, "NONE");
RegisterResourceName(RT_WINDOW, "WINDOW");
RegisterResourceName(RT_PIXMAP, "PIXMAP");
RegisterResourceName(RT_GC, "GC");
RegisterResourceName(RT_FONT, "FONT");
RegisterResourceName(RT_CURSOR, "CURSOR");
RegisterResourceName(X11_RESTYPE_FONT, "FONT");
RegisterResourceName(X11_RESTYPE_CURSOR, "CURSOR");
RegisterResourceName(RT_COLORMAP, "COLORMAP");
RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY");
RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT");

View file

@ -429,7 +429,7 @@ FindGCSubRes(void *value, FindAllRes func, void *cdata)
static struct ResourceType *resourceTypes;
static const struct ResourceType predefTypes[] = {
[RT_NONE & (RC_LASTPREDEF - 1)] = {
[X11_RESTYPE_NONE & (RC_LASTPREDEF - 1)] = {
.deleteFunc = (DeleteType) NoopDDA,
.sizeFunc = GetDefaultBytes,
.findSubResFunc = DefaultFindSubRes,
@ -453,13 +453,13 @@ static const struct ResourceType predefTypes[] = {
.findSubResFunc = FindGCSubRes,
.errorValue = BadGC,
},
[RT_FONT & (RC_LASTPREDEF - 1)] = {
[X11_RESTYPE_FONT & (RC_LASTPREDEF - 1)] = {
.deleteFunc = CloseFont,
.sizeFunc = GetDefaultBytes,
.findSubResFunc = DefaultFindSubRes,
.errorValue = BadFont,
},
[RT_CURSOR & (RC_LASTPREDEF - 1)] = {
[X11_RESTYPE_CURSOR & (RC_LASTPREDEF - 1)] = {
.deleteFunc = FreeCursor,
.sizeFunc = GetDefaultBytes,
.findSubResFunc = DefaultFindSubRes,
@ -1221,7 +1221,7 @@ dixLookupResourceByType(void **result, XID id, RESTYPE rtype,
if (client) {
cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
res->value, RT_NONE, NULL, mode);
res->value, X11_RESTYPE_NONE, NULL, mode);
if (cid == BadValue)
return resourceTypes[rtype & TypeMask].errorValue;
if (cid != Success)
@ -1256,7 +1256,7 @@ dixLookupResourceByClass(void **result, XID id, RESTYPE rclass,
if (client) {
cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
res->value, RT_NONE, NULL, mode);
res->value, X11_RESTYPE_NONE, NULL, mode);
if (cid != Success)
return cid;
}

View file

@ -710,8 +710,8 @@ TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
type = TOUCH_LISTENER_POINTER_GRAB;
}
/* grab listeners are always RT_NONE since we keep the grab pointer */
TouchAddListener(ti, grab->resource, RT_NONE, grab->grabtype,
/* grab listeners are always X11_RESTYPE_NONE since we keep the grab pointer */
TouchAddListener(ti, grab->resource, X11_RESTYPE_NONE, grab->grabtype,
type, TOUCH_LISTENER_AWAITING_BEGIN, grab->window, grab);
}

View file

@ -637,7 +637,7 @@ CreateRootWindow(ScreenPtr pScreen)
/* security creation/labeling check
*/
if (XaceHook(XACE_RESOURCE_ACCESS, serverClient, pWin->drawable.id,
RT_WINDOW, pWin, RT_NONE, NULL, DixCreateAccess))
RT_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixCreateAccess))
return FALSE;
if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin))
@ -1115,11 +1115,11 @@ DestroySubwindows(WindowPtr pWin, ClientPtr client)
while (pWin->lastChild) {
int rc = XaceHook(XACE_RESOURCE_ACCESS, client,
pWin->lastChild->drawable.id, RT_WINDOW,
pWin->lastChild, RT_NONE, NULL, DixDestroyAccess);
pWin->lastChild, X11_RESTYPE_NONE, NULL, DixDestroyAccess);
if (rc != Success)
return rc;
FreeResource(pWin->lastChild->drawable.id, RT_NONE);
FreeResource(pWin->lastChild->drawable.id, X11_RESTYPE_NONE);
}
return Success;
}
@ -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, RT_NONE, NULL, DixGrabAccess);
RT_WINDOW, pWin, X11_RESTYPE_NONE, NULL, DixGrabAccess);
if (rc != Success) {
error = rc;
client->errorValue = pWin->drawable.id;
@ -1492,7 +1492,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
}
else {
rc = dixLookupResourceByType((void **) &pCursor, cursorID,
RT_CURSOR, client, DixUseAccess);
X11_RESTYPE_CURSOR, client, DixUseAccess);
if (rc != Success) {
error = rc;
client->errorValue = cursorID;
@ -2663,7 +2663,7 @@ MapWindow(WindowPtr pWin, ClientPtr client)
/* general check for permission to map window */
if (XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW,
pWin, RT_NONE, NULL, DixShowAccess) != Success)
pWin, X11_RESTYPE_NONE, NULL, DixShowAccess) != Success)
return Success;
pScreen = pWin->drawable.pScreen;
@ -3135,7 +3135,7 @@ dixSaveScreens(ClientPtr client, int on, int mode)
}
else if (HasSaverWindow(pScreen)) {
pScreen->screensaver.pWindow = NullWindow;
FreeResource(pScreen->screensaver.wid, RT_NONE);
FreeResource(pScreen->screensaver.wid, X11_RESTYPE_NONE);
}
break;
case SCREEN_SAVER_CYCLE:
@ -3263,7 +3263,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
&cursor, serverClient, (XID) 0);
if (cursor) {
cursorID = FakeClientID(0);
if (AddResource(cursorID, RT_CURSOR, (void *) cursor)) {
if (AddResource(cursorID, X11_RESTYPE_CURSOR, (void *) cursor)) {
attributes[attri] = cursorID;
mask |= CWCursor;
}
@ -3286,7 +3286,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
wVisual(pScreen->root), &result);
if (cursor)
FreeResource(cursorID, RT_NONE);
FreeResource(cursorID, X11_RESTYPE_NONE);
if (!pWin)
return FALSE;

View file

@ -440,7 +440,7 @@ To free a resource, use one of the following.
FreeResource frees all resources matching the given id, regardless of
type; the type's deleteFunc will be called on each matching resource,
except that skipDeleteFuncType can be set to a single type for which
the deleteFunc should not be called (otherwise pass RT_NONE).
the deleteFunc should not be called (otherwise pass RT_NONE / X11_RESTYPE_NONE).
FreeResourceByType frees a specific resource matching a given id
and type; if skipFree is true, then the deleteFunc is not called.
</para>

View file

@ -235,7 +235,7 @@ proc_dri3_pixmap_from_buffer(ClientPtr client)
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,
pixmap, RT_NONE, NULL, DixCreateAccess);
pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success) {
(*drawable->pScreen->DestroyPixmap) (pixmap);
@ -499,7 +499,7 @@ proc_dri3_pixmap_from_buffers(ClientPtr client)
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,
pixmap, RT_NONE, NULL, DixCreateAccess);
pixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success) {
(*screen->DestroyPixmap) (pixmap);

View file

@ -1394,7 +1394,7 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
return BadAlloc;
err = XaceHook(XACE_RESOURCE_ACCESS, client, glxDrawableId, RT_PIXMAP,
pPixmap, RT_NONE, NULL, DixCreateAccess);
pPixmap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (err != Success) {
(*pGlxScreen->pScreen->DestroyPixmap) (pPixmap);
return err;

View file

@ -114,7 +114,7 @@ GlxMappingInit(void)
idResource = CreateNewResourceType(idResourceDeleteCallback,
"GLXServerIDRes");
if (idResource == RT_NONE)
if (idResource == X11_RESTYPE_NONE)
{
GlxMappingReset();
return FALSE;

View file

@ -366,7 +366,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet)
if (oldPix) {
if (oldPix->drawable.id)
FreeResource(oldPix->drawable.id, RT_NONE);
FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE);
else
(*pScreen->DestroyPixmap) (oldPix);
}
@ -428,7 +428,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet)
if (oldPix) {
if (oldPix->drawable.id)
FreeResource(oldPix->drawable.id, RT_NONE);
FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE);
else
(*pScreen->DestroyPixmap) (oldPix);
}

View file

@ -271,7 +271,7 @@ ProcAppleWMSelectInput(register ClientPtr client)
pHead = (WMEventPtr *)malloc(sizeof(WMEventPtr));
if (!pHead ||
!AddResource(eventResource, EventType, (void *)pHead)) {
FreeResource(clientResource, RT_NONE);
FreeResource(clientResource, X11_RESTYPE_NONE);
return BadAlloc;
}
*pHead = 0;

View file

@ -71,19 +71,25 @@ typedef uint32_t RESTYPE;
/* types for Resource routines */
// prevent namespace clash with Windows
#define X11_RESTYPE_NONE ((RESTYPE)0)
#define X11_RESTYPE_FONT ((RESTYPE)4)
#define X11_RESTYPE_CURSOR ((RESTYPE)5)
#define RT_WINDOW ((RESTYPE)1|RC_DRAWABLE)
#define RT_PIXMAP ((RESTYPE)2|RC_DRAWABLE)
#define RT_GC ((RESTYPE)3)
#undef RT_FONT
#undef RT_CURSOR
#define RT_FONT ((RESTYPE)4)
#define RT_CURSOR ((RESTYPE)5)
#define RT_FONT X11_RESTYPE_FONT
#define RT_CURSOR X11_RESTYPE_CURSOR
#define RT_COLORMAP ((RESTYPE)6)
#define RT_CMAPENTRY ((RESTYPE)7)
#define RT_OTHERCLIENT ((RESTYPE)8|RC_NEVERRETAIN)
#define RT_PASSIVEGRAB ((RESTYPE)9|RC_NEVERRETAIN)
#define RT_LASTPREDEF ((RESTYPE)9)
#define RT_NONE ((RESTYPE)0)
#define RT_NONE X11_RESTYPE_NONE
extern _X_EXPORT unsigned int ResourceClientBits(void);
/* bits and fields within a resource id */

View file

@ -52,7 +52,7 @@ present_free_events(WindowPtr window)
return;
while ((event = window_priv->events))
FreeResource(event->id, RT_NONE);
FreeResource(event->id, X11_RESTYPE_NONE);
}
static void
@ -224,7 +224,7 @@ present_select_input(ClientPtr client, XID eid, WindowPtr window, CARD32 mask)
if (mask)
event->mask = mask;
else
FreeResource(eid, RT_NONE);
FreeResource(eid, X11_RESTYPE_NONE);
return Success;
}
if (ret != BadValue)

View file

@ -135,7 +135,7 @@ ProcRRSelectInput(ClientPtr client)
if (!pHead ||
!AddResource(pWin->drawable.id, RREventType,
(void *) pHead)) {
FreeResource(clientResource, RT_NONE);
FreeResource(clientResource, X11_RESTYPE_NONE);
return BadAlloc;
}
*pHead = 0;

View file

@ -147,7 +147,7 @@ RRLeaseTerminated(RRLeasePtr lease)
RRLeaseChangeState(lease, RRLeaseTerminating, RRLeaseTerminating);
if (lease->id != None)
FreeResource(lease->id, RT_NONE);
FreeResource(lease->id, X11_RESTYPE_NONE);
xorg_list_del(&lease->list);
}
@ -364,7 +364,7 @@ ProcRRFreeLease(ClientPtr client)
RRTerminateLease(lease);
else
/* Get rid of the resource database entry */
FreeResource(stuff->lid, RT_NONE);
FreeResource(stuff->lid, X11_RESTYPE_NONE);
return Success;
}

View file

@ -2456,7 +2456,7 @@ ProcRecordFreeContext(ClientPtr client)
REQUEST_SIZE_MATCH(xRecordFreeContextReq);
VERIFY_CONTEXT(pContext, stuff->context, client);
FreeResource(stuff->context, RT_NONE);
FreeResource(stuff->context, X11_RESTYPE_NONE);
return Success;
} /* ProcRecordFreeContext */

View file

@ -336,8 +336,8 @@ AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor,
/* security creation/labeling check */
if (ac->timer)
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, pCursor,
RT_NONE, NULL, DixCreateAccess);
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, X11_RESTYPE_CURSOR, pCursor,
X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success) {
TimerFree(ac->timer);

View file

@ -639,7 +639,7 @@ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
(formats[n].id, PictFormatType, (void *) (formats + n))) {
int i;
for (i = 0; i < n; i++)
FreeResource(formats[i].id, RT_NONE);
FreeResource(formats[i].id, X11_RESTYPE_NONE);
free(formats);
return FALSE;
}

View file

@ -646,7 +646,7 @@ ProcRenderFreePicture(ClientPtr client)
REQUEST_SIZE_MATCH(xRenderFreePictureReq);
VERIFY_PICTURE(pPicture, stuff->picture, client, DixDestroyAccess);
FreeResource(stuff->picture, RT_NONE);
FreeResource(stuff->picture, X11_RESTYPE_NONE);
return Success;
}
@ -927,7 +927,7 @@ ProcRenderCreateGlyphSet(ClientPtr client)
return BadAlloc;
/* security creation/labeling check */
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->gsid, GlyphSetType,
glyphSet, RT_NONE, NULL, DixCreateAccess);
glyphSet, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success)
return rc;
if (!AddResource(stuff->gsid, GlyphSetType, (void *) glyphSet))
@ -977,7 +977,7 @@ ProcRenderFreeGlyphSet(ClientPtr client)
client->errorValue = stuff->glyphset;
return rc;
}
FreeResource(stuff->glyphset, RT_NONE);
FreeResource(stuff->glyphset, X11_RESTYPE_NONE);
return Success;
}
@ -1632,7 +1632,7 @@ ProcRenderCreateCursor(ClientPtr client)
&pCursor, client, stuff->cid);
if (rc != Success)
goto bail;
if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) {
if (!AddResource(stuff->cid, X11_RESTYPE_CURSOR, (void *) pCursor)) {
rc = BadAlloc;
goto bail;
}
@ -1802,7 +1802,7 @@ ProcRenderCreateAnimCursor(ClientPtr client)
elt = (xAnimCursorElt *) (stuff + 1);
for (i = 0; i < ncursor; i++) {
ret = dixLookupResourceByType((void **) (cursors + i), elt->cursor,
RT_CURSOR, client, DixReadAccess);
X11_RESTYPE_CURSOR, client, DixReadAccess);
if (ret != Success) {
free(cursors);
return ret;
@ -1816,7 +1816,7 @@ ProcRenderCreateAnimCursor(ClientPtr client)
if (ret != Success)
return ret;
if (AddResource(stuff->cid, RT_CURSOR, (void *) pCursor))
if (AddResource(stuff->cid, X11_RESTYPE_CURSOR, (void *) pCursor))
return Success;
return BadAlloc;
}
@ -1860,7 +1860,7 @@ ProcRenderCreateSolidFill(ClientPtr client)
return error;
/* security creation/labeling check */
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
pPicture, RT_NONE, NULL, DixCreateAccess);
pPicture, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (error != Success)
return error;
if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
@ -1899,7 +1899,7 @@ ProcRenderCreateLinearGradient(ClientPtr client)
return error;
/* security creation/labeling check */
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
pPicture, RT_NONE, NULL, DixCreateAccess);
pPicture, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (error != Success)
return error;
if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
@ -1939,7 +1939,7 @@ ProcRenderCreateRadialGradient(ClientPtr client)
return error;
/* security creation/labeling check */
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
pPicture, RT_NONE, NULL, DixCreateAccess);
pPicture, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (error != Success)
return error;
if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
@ -1978,7 +1978,7 @@ ProcRenderCreateConicalGradient(ClientPtr client)
return error;
/* security creation/labeling check */
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
pPicture, RT_NONE, NULL, DixCreateAccess);
pPicture, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (error != Success)
return error;
if (!AddResource(stuff->pid, PictureType, (void *) pPicture))

View file

@ -72,7 +72,7 @@ static void deleteCursorHideCountsForScreen(ScreenPtr pScreen);
do { \
int err; \
err = dixLookupResourceByType((void **) &pCursor, cursor, \
RT_CURSOR, client, access); \
X11_RESTYPE_CURSOR, client, access); \
if (err != Success) { \
client->errorValue = cursor; \
return err; \
@ -371,8 +371,8 @@ ProcXFixesGetCursorImage(ClientPtr client)
pCursor = CursorForClient(client);
if (!pCursor)
return BadCursor;
rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR,
pCursor, RT_NONE, NULL, DixReadAccess);
rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, X11_RESTYPE_CURSOR,
pCursor, X11_RESTYPE_NONE, NULL, DixReadAccess);
if (rc != Success)
return rc;
GetSpritePosition(PickPointer(client), &x, &y);
@ -520,8 +520,8 @@ ProcXFixesGetCursorImageAndName(ClientPtr client)
pCursor = CursorForClient(client);
if (!pCursor)
return BadCursor;
rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR,
pCursor, RT_NONE, NULL, DixReadAccess | DixGetAttrAccess);
rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, X11_RESTYPE_CURSOR,
pCursor, X11_RESTYPE_NONE, NULL, DixReadAccess | DixGetAttrAccess);
if (rc != Success)
return rc;
GetSpritePosition(PickPointer(client), &x, &y);
@ -595,7 +595,7 @@ typedef struct {
} ReplaceCursorLookupRec, *ReplaceCursorLookupPtr;
static const RESTYPE CursorRestypes[] = {
RT_WINDOW, RT_PASSIVEGRAB, RT_CURSOR
RT_WINDOW, RT_PASSIVEGRAB, X11_RESTYPE_CURSOR
};
static Bool
@ -620,7 +620,7 @@ ReplaceCursorLookup(void *value, XID id, void *closure)
pCursorRef = &pGrab->cursor;
pCursor = *pCursorRef;
break;
case RT_CURSOR:
case X11_RESTYPE_CURSOR:
pCursorRef = 0;
pCursor = (CursorPtr) value;
cursor = id;
@ -633,7 +633,7 @@ ReplaceCursorLookup(void *value, XID id, void *closure)
if (pCursorRef)
*pCursorRef = curs;
else
ChangeResourceValue(id, RT_CURSOR, curs);
ChangeResourceValue(id, X11_RESTYPE_CURSOR, curs);
FreeCursor(pCursor, cursor);
}
}

View file

@ -299,7 +299,7 @@ ProcXFixesDestroyRegion(ClientPtr client)
REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
FreeResource(stuff->region, RT_NONE);
FreeResource(stuff->region, X11_RESTYPE_NONE);
return Success;
}