Convert callers of LookupDrawable() to dixLookupDrawable().

This commit is contained in:
Eamon Walsh 2006-12-15 16:36:29 -05:00 committed by Eamon Walsh
parent 25d5e0a629
commit 10aabb729d
6 changed files with 80 additions and 70 deletions

View File

@ -441,6 +441,7 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId,
__GLcontextModes *modes;
__GLXdrawable *pGlxDraw;
__GLXpixmap *drawPixmap = NULL;
int rc;
/* This is the GLX 1.3 case - the client passes in a GLXWindow and
* we just return the __GLXdrawable. The first time a GLXPixmap
@ -466,8 +467,8 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId,
* GLXWindow with the same XID as an X Window, so we wont get any
* resource ID clashes. Effectively, the X Window is now also a
* GLXWindow. */
pDraw = (DrawablePtr) LookupDrawable(drawId, client);
if (pDraw) {
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) {
VisualID vid = wVisual((WindowPtr)pDraw);
@ -1199,12 +1200,12 @@ static int ValidateCreateDrawable(ClientPtr client,
ScreenPtr pScreen;
VisualPtr pVisual;
__GLXscreen *pGlxScreen;
int i;
int i, rc;
LEGAL_NEW_RESOURCE(glxDrawableId, client);
pDraw = (DrawablePtr) LookupDrawable(drawablId, client);
if (!pDraw || pDraw->type != type) {
rc = dixLookupDrawable(&pDraw, drawablId, client, 0, DixUnknownAccess);
if (rc != Success || pDraw->type != type) {
client->errorValue = drawablId;
return type == DRAWABLE_WINDOW ? BadWindow : BadPixmap;
}
@ -2034,10 +2035,11 @@ int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc;
XID drawable = req->drawable;
int barrier = req->barrier;
DrawablePtr pDraw = (DrawablePtr) LookupDrawable(drawable, client);
int screen;
DrawablePtr pDraw;
int screen, rc;
if (pDraw && (pDraw->type == DRAWABLE_WINDOW)) {
rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixUnknownAccess);
if (rc == Success && (pDraw->type == DRAWABLE_WINDOW)) {
screen = pDraw->pScreen->myNum;
if (__glXSwapBarrierFuncs &&
__glXSwapBarrierFuncs[screen].bindSwapBarrierFunc) {

View File

@ -1092,8 +1092,8 @@ int XETrapRequestVector(ClientPtr client)
pdata->hdr.client = client->index; /* stuff client index in hdr */
if (BitIsTrue(penv->cur.data_config_flags_data,XETrapWinXY))
{
window_ptr = (WindowPtr) LookupDrawable(stuff->id, client);
if (window_ptr == 0L)
if (Success != dixLookupDrawable(&window_ptr, stuff->id,
client, 0, DixUnknownAccess))
{ /* Failed...invalidate the X and Y coordinate data. */
pdata->hdr.win_x = -1L;
pdata->hdr.win_y = -1L;

View File

@ -786,15 +786,15 @@ ProcGetBufferInfo (client)
DrawablePtr pDrawable;
xMbufGetBufferInfoReply rep;
ScreenPtr pScreen;
int i, j, k;
int n;
int i, j, k, n, rc;
xMbufBufferInfo *pInfo;
int nInfo;
DepthPtr pDepth;
pDrawable = (DrawablePtr) LookupDrawable (stuff->drawable, client);
if (!pDrawable)
return BadDrawable;
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixUnknownAccess);
if (rc != Success)
return rc;
pScreen = pDrawable->pScreen;
nInfo = 0;
for (i = 0; i < pScreen->numDepths; i++)

View File

@ -780,16 +780,17 @@ ProcScreenSaverQueryInfo (client)
{
REQUEST(xScreenSaverQueryInfoReq);
xScreenSaverQueryInfoReply rep;
register int n;
register int n, rc;
ScreenSaverStuffPtr pSaver;
DrawablePtr pDraw;
CARD32 lastInput;
ScreenSaverScreenPrivatePtr pPriv;
REQUEST_SIZE_MATCH (xScreenSaverQueryInfoReq);
pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client);
if (!pDraw)
return BadDrawable;
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
if (rc != Success)
return rc;
pSaver = &savedScreenInfo[pDraw->pScreen->myNum];
pPriv = GetScreenPrivate (pDraw->pScreen);
@ -852,11 +853,13 @@ ProcScreenSaverSelectInput (client)
{
REQUEST(xScreenSaverSelectInputReq);
DrawablePtr pDraw;
int rc;
REQUEST_SIZE_MATCH (xScreenSaverSelectInputReq);
pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client);
if (!pDraw)
return BadDrawable;
rc = dixLookupDrawable (&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
if (rc != Success)
return rc;
if (!setEventMask (pDraw->pScreen, client, stuff->eventMask))
return BadAlloc;
return Success;
@ -871,9 +874,7 @@ ScreenSaverSetAttributes (ClientPtr client)
ScreenPtr pScreen;
ScreenSaverScreenPrivatePtr pPriv = 0;
ScreenSaverAttrPtr pAttr = 0;
int ret;
int len;
int class, bw, depth;
int ret, len, class, bw, depth;
unsigned long visual;
int idepth, ivisual;
Bool fOK;
@ -891,9 +892,10 @@ ScreenSaverSetAttributes (ClientPtr client)
ColormapPtr pCmap;
REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq);
pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client);
if (!pDraw)
return BadDrawable;
ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
if (ret != Success)
return ret;
pScreen = pDraw->pScreen;
pParent = WindowTable[pScreen->myNum];
@ -1246,11 +1248,13 @@ ScreenSaverUnsetAttributes (ClientPtr client)
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw;
ScreenSaverScreenPrivatePtr pPriv;
int rc;
REQUEST_SIZE_MATCH (xScreenSaverUnsetAttributesReq);
pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client);
if (!pDraw)
return BadDrawable;
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
if (rc != Success)
return rc;
pPriv = GetScreenPrivate (pDraw->pScreen);
if (pPriv && pPriv->attr && pPriv->attr->client == client)
{

View File

@ -1944,8 +1944,11 @@ ProcXpPutDocumentData(ClientPtr client)
if (stuff->drawable) {
if (pContext->state & DOC_RAW_STARTED)
return BadDrawable;
pDraw = (DrawablePtr)LookupDrawable(stuff->drawable, client);
if (!pDraw || pDraw->pScreen->myNum != pContext->screenNum)
result = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess);
if (result != Success)
return result;
if (pDraw->pScreen->myNum != pContext->screenNum)
return BadDrawable;
} else {
if (pContext->state & DOC_COOKED_STARTED)

View File

@ -430,9 +430,10 @@ int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
DrawablePtr pDraw;
__GLXpixmap *pGlxPixmap = NULL;
__glXWindow *pGlxWindow = NULL;
int rc;
pDraw = (DrawablePtr) LookupDrawable(req->drawable, client);
if (!pDraw) {
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixUnknownAccess);
if (rc != Success) {
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
__glXPixmapRes);
if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
@ -459,9 +460,10 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
DrawablePtr pDraw, pMember = NULL;
__GLXpixmap *pGlxPixmap = NULL;
__glXWindow *pGlxWindow = NULL;
int rc;
pDraw = (DrawablePtr) LookupDrawable(req->drawable, client);
if (!pDraw) {
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixUnknownAccess);
if (rc != Success) {
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
__glXPixmapRes);
if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
@ -479,8 +481,9 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
}
if (req->member != None) {
pMember = (DrawablePtr) LookupDrawable(req->member, client);
if (!pMember) {
rc = dixLookupDrawable(&pMember, req->member, client, 0,
DixUnknownAccess);
if (rc != Success) {
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->member,
__glXPixmapRes);
if (pGlxPixmap) pMember = pGlxPixmap->pDraw;
@ -734,7 +737,7 @@ static int MakeCurrent(__GLXclientState *cl,
#endif
int from_screen = 0;
int to_screen = 0;
int s;
int s, rc;
/*
** If one is None and the other isn't, it's a bad match.
@ -778,8 +781,8 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (drawId != None) {
pDraw = (DrawablePtr) LookupDrawable(drawId, client);
if (pDraw) {
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) {
/*
** Drawable is an X Window.
@ -885,8 +888,8 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (readId != None && readId != drawId ) {
pReadDraw = (DrawablePtr) LookupDrawable(readId, client);
if (pReadDraw) {
rc = dixLookupDrawable(&pReadDraw, readId, client, 0,DixUnknownAccess);
if (rc == Success) {
if (pReadDraw->type == DRAWABLE_WINDOW) {
/*
** Drawable is an X Window.
@ -1636,18 +1639,16 @@ static int CreateGLXPixmap(__GLXclientState *cl,
__GLXscreenInfo *pGlxScreen;
__GLXvisualConfig *pGlxVisual;
__GLXFBConfig *pFBConfig;
int i;
int s;
int i, s, rc;
int from_screen, to_screen;
#ifdef PANORAMIX
PanoramiXRes *pXinDraw = NULL;
#endif
pDraw = (DrawablePtr) LookupDrawable(pixmapId, client);
if (!pDraw || pDraw->type != DRAWABLE_PIXMAP) {
client->errorValue = pixmapId;
return BadPixmap;
}
rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP,
DixUnknownAccess);
if (rc != Success)
return rc;
/*
** Check if screen of visual matches screen of pixmap.
@ -1778,7 +1779,8 @@ static int CreateGLXPixmap(__GLXclientState *cl,
#ifdef PANORAMIX
if (pXinDraw) {
pRealDraw = (DrawablePtr) LookupDrawable(pXinDraw->info[s].id,client);
dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0,
DixUnknownAccess);
}
#endif
@ -1944,14 +1946,13 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
__glXWindow *pGlxWindow = NULL;
int from_screen = 0;
int to_screen = 0;
int s;
int s, rc;
/*
** Check that the GLX drawable is valid.
*/
pDraw = (DrawablePtr) LookupDrawable(drawId, client);
if (pDraw) {
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (rc == Success) {
from_screen = to_screen = pDraw->pScreen->myNum;
if (pDraw->type == DRAWABLE_WINDOW) {
@ -2099,12 +2100,13 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
__GLXpixmap *pGlxPixmap = NULL;
__GLXcontext *glxc = NULL;
__glXWindow *pGlxWindow = NULL;
int rc;
/*
** Check that the GLX drawable is valid.
*/
pDraw = (DrawablePtr) LookupDrawable(drawId, client);
if (pDraw) {
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (rc == Success) {
if (pDraw->type != DRAWABLE_WINDOW) {
/*
** Drawable is an X pixmap, which is not allowed.
@ -2892,16 +2894,15 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
__GLXFBConfig *pGlxFBConfig = NULL;
VisualPtr pVisual;
VisualID visId;
int i;
int i, rc;
/*
** Check if windowId is valid
*/
pDraw = (DrawablePtr) LookupDrawable(windowId, client);
if (!pDraw || pDraw->type != DRAWABLE_WINDOW) {
client->errorValue = windowId;
return BadWindow;
}
rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW,
DixUnknownAccess);
if (rc != Success)
return rc;
/*
** Check if screen of window matches screen of fbconfig.
@ -3274,7 +3275,7 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
GLXDrawable be_drawable = 0;
DrawablePtr pDraw = NULL;
Display *dpy;
int screen;
int screen, rc;
DMXScreenInfo *dmxScreen;
CARD32 *attribs = NULL;
int attribs_size;
@ -3283,8 +3284,8 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
#endif
if (drawId != None) {
pDraw = (DrawablePtr) LookupDrawable(drawId, client);
if (pDraw) {
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) {
WindowPtr pWin = (WindowPtr)pDraw;
be_drawable = 0;
@ -3435,7 +3436,7 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
GLXDrawable be_drawable = 0;
DrawablePtr pDraw = NULL;
Display *dpy;
int screen;
int screen, rc;
DMXScreenInfo *dmxScreen;
char *attrbuf;
#ifdef PANORAMIX
@ -3444,8 +3445,8 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
#endif
if (drawId != None) {
pDraw = (DrawablePtr) LookupDrawable(drawId, client);
if (pDraw) {
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) {
WindowPtr pWin = (WindowPtr)pDraw;
be_drawable = 0;