[PATCH 3/4] dix: Simplify arguments to dixLookupDrawable
Adam Jackson
ajax at redhat.com
Fri Mar 4 13:05:20 PST 2011
The mask argument was almost always 0 or (equivalently) M_ANY. Drop the
mask, and fix up the scant few callers who needed anything stronger.
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
Xext/panoramiXprocs.c | 13 ++++++-------
Xext/saver.c | 12 ++++--------
Xext/shm.c | 14 +++++---------
Xext/sync.c | 2 +-
Xext/xselinux_ext.c | 2 +-
Xext/xvdisp.c | 4 ++--
damageext/damageext.c | 4 ++--
dbe/dbe.c | 2 +-
dix/dispatch.c | 19 ++++++++-----------
dix/dixfonts.c | 4 ++--
dix/dixutils.c | 17 +++++++----------
glx/glxcmds.c | 6 +++---
hw/dmx/glxProxy/glxcmds.c | 37 ++++++++++++++++++-------------------
hw/kdrive/ephyr/ephyrdriext.c | 12 +++---------
hw/kdrive/ephyr/ephyrglxext.c | 7 ++-----
hw/xfree86/dri/xf86dri.c | 9 +++------
hw/xfree86/dri2/dri2ext.c | 4 +---
hw/xquartz/xpr/appledri.c | 12 ++++--------
include/dix.h | 3 +--
include/pixmap.h | 9 ---------
randr/rrscreen.c | 6 ++++--
render/render.c | 4 ++--
22 files changed, 80 insertions(+), 122 deletions(-)
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index d843168..3851cfb 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -537,7 +537,7 @@ int PanoramiXGetGeometry(ClientPtr client)
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -1049,7 +1049,7 @@ int PanoramiXCopyArea(ClientPtr client)
int pitch, rc;
FOR_NSCREENS(j) {
- rc = dixLookupDrawable(drawables+j, src->info[j].id, client, 0,
+ rc = dixLookupDrawable(drawables+j, src->info[j].id, client,
DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -1104,7 +1104,7 @@ int PanoramiXCopyArea(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
if (stuff->dstDrawable != stuff->srcDrawable) {
- rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
+ rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client,
DixReadAccess);
if (rc != Success)
return rc;
@@ -1208,7 +1208,7 @@ int PanoramiXCopyPlane(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess);
if (stuff->dstDrawable != stuff->srcDrawable) {
- rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
+ rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client,
DixReadAccess);
if (rc != Success)
return rc;
@@ -1809,8 +1809,7 @@ int PanoramiXGetImage(ClientPtr client)
if(draw->type == XRT_PIXMAP)
return (*SavedProcVector[X_GetImage])(client);
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, DixReadAccess);
if (rc != Success)
return rc;
@@ -1847,7 +1846,7 @@ int PanoramiXGetImage(ClientPtr client)
drawables[0] = pDraw;
for(i = 1; i < PanoramiXNumScreens; i++) {
- rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0,
+ rc = dixLookupDrawable(drawables+i, draw->info[i].id, client,
DixGetAttrAccess);
if (rc != Success)
return rc;
diff --git a/Xext/saver.c b/Xext/saver.c
index 1888603..5fe9f35 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -697,8 +697,7 @@ ProcScreenSaverQueryInfo (ClientPtr client)
ScreenSaverScreenPrivatePtr pPriv;
REQUEST_SIZE_MATCH (xScreenSaverQueryInfoReq);
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, DixGetAttrAccess);
if (rc != Success)
return rc;
rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen,
@@ -769,8 +768,7 @@ ProcScreenSaverSelectInput (ClientPtr client)
int rc;
REQUEST_SIZE_MATCH (xScreenSaverSelectInputReq);
- rc = dixLookupDrawable (&pDraw, stuff->drawable, client, 0,
- DixGetAttrAccess);
+ rc = dixLookupDrawable (&pDraw, stuff->drawable, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -811,8 +809,7 @@ ScreenSaverSetAttributes (ClientPtr client)
ColormapPtr pCmap;
REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq);
- ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixGetAttrAccess);
+ ret = dixLookupDrawable(&pDraw, stuff->drawable, client, DixGetAttrAccess);
if (ret != Success)
return ret;
pScreen = pDraw->pScreen;
@@ -1174,8 +1171,7 @@ ScreenSaverUnsetAttributes (ClientPtr client)
int rc;
REQUEST_SIZE_MATCH (xScreenSaverUnsetAttributesReq);
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, DixGetAttrAccess);
if (rc != Success)
return rc;
pPriv = GetScreenPrivate (pDraw->pScreen);
diff --git a/Xext/shm.c b/Xext/shm.c
index 23afe6b..e357552 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -643,8 +643,7 @@ ProcShmGetImage(ClientPtr client)
client->errorValue = stuff->format;
return BadValue;
}
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, DixReadAccess);
if (rc != Success)
return rc;
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
@@ -808,8 +807,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
if (draw->type == XRT_PIXMAP)
return ProcShmGetImage(client);
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, DixReadAccess);
if (rc != Success)
return rc;
@@ -849,7 +847,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
drawables[0] = pDraw;
for(i = 1; i < PanoramiXNumScreens; i++) {
- rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0,
+ rc = dixLookupDrawable(drawables+i, draw->info[i].id, client,
DixReadAccess);
if (rc != Success)
{
@@ -927,8 +925,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
if (!sharedPixmaps)
return BadImplementation;
LEGAL_NEW_RESOURCE(stuff->pid, client);
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
- DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -1052,8 +1049,7 @@ ProcShmCreatePixmap(ClientPtr client)
if (!sharedPixmaps)
return BadImplementation;
LEGAL_NEW_RESOURCE(stuff->pid, client);
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
- DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, DixGetAttrAccess);
if (rc != Success)
return rc;
diff --git a/Xext/sync.c b/Xext/sync.c
index 36dd278..0da5c0f 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -1964,7 +1964,7 @@ ProcSyncCreateFence(ClientPtr client)
REQUEST_SIZE_MATCH(xSyncCreateFenceReq);
- rc = dixLookupDrawable(&pDraw, stuff->d, client, M_ANY, DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->d, client, DixGetAttrAccess);
if (rc != Success)
return rc;
diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c
index 374571c..38ec8a0 100644
--- a/Xext/xselinux_ext.c
+++ b/Xext/xselinux_ext.c
@@ -231,7 +231,7 @@ ProcSELinuxGetDrawableContext(ClientPtr client)
REQUEST(SELinuxGetContextReq);
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
- rc = dixLookupDrawable(&pDraw, stuff->id, client, 0, DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
return rc;
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index deddebd..6643bba 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -683,7 +683,7 @@ ProcXvSelectVideoNotify(ClientPtr client)
REQUEST(xvSelectVideoNotifyReq);
REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReceiveAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, DixReceiveAccess);
if (rc != Success)
return rc;
@@ -779,7 +779,7 @@ ProcXvStopVideo(ClientPtr client)
return status;
}
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, DixWriteAccess);
if (rc != Success)
return rc;
diff --git a/damageext/damageext.c b/damageext/damageext.c
index 754383d..9203523 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -172,7 +172,7 @@ ProcDamageCreate (ClientPtr client)
REQUEST_SIZE_MATCH(xDamageCreateReq);
LEGAL_NEW_RESOURCE(stuff->damage, client);
- rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client,
DixGetAttrAccess|DixReadAccess);
if (rc != Success)
return rc;
@@ -284,7 +284,7 @@ ProcDamageAdd (ClientPtr client)
REQUEST_SIZE_MATCH(xDamageAddReq);
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
- rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client,
DixWriteAccess);
if (rc != Success)
return rc;
diff --git a/dbe/dbe.c b/dbe/dbe.c
index 77b616b..b795472 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -680,7 +680,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
for (i = 0; i < stuff->n; i++)
{
- rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0,
+ rc = dixLookupDrawable(pDrawables+i, drawables[i], client,
DixGetAttrAccess);
if (rc != Success) {
free(pDrawables);
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 601b14a..321bb92 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -905,7 +905,7 @@ GetGeometry(ClientPtr client, xGetGeometryReply *rep)
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -1366,8 +1366,7 @@ ProcCreatePixmap(ClientPtr client)
client->errorValue = stuff->pid;
LEGAL_NEW_RESOURCE(stuff->pid, client);
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
- DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -1458,8 +1457,7 @@ ProcCreateGC(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xCreateGCReq);
client->errorValue = stuff->gc;
LEGAL_NEW_RESOURCE(stuff->gc, client);
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -1629,8 +1627,8 @@ ProcCopyArea(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
if (stuff->dstDrawable != stuff->srcDrawable)
{
- rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client,
+ DixReadAccess);
if (rc != Success)
return rc;
if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth))
@@ -1670,7 +1668,7 @@ ProcCopyPlane(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess);
if (stuff->dstDrawable != stuff->srcDrawable)
{
- rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
+ rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client,
DixReadAccess);
if (rc != Success)
return rc;
@@ -2012,7 +2010,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
client->errorValue = format;
return BadValue;
}
- rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixReadAccess);
+ rc = dixLookupDrawable(&pDraw, drawable, client, DixReadAccess);
if (rc != Success)
return rc;
@@ -3047,8 +3045,7 @@ ProcQueryBestSize (ClientPtr client)
return BadValue;
}
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
- DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, DixGetAttrAccess);
if (rc != Success)
return rc;
if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW)
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index d8f1529..0d26bbe 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1197,7 +1197,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
if (ClientIsAsleep(client) && c->pDraw)
{
DrawablePtr pDraw;
- dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess);
+ dixLookupDrawable(&pDraw, c->did, client, DixWriteAccess);
if (c->pDraw != pDraw) {
/* Our drawable has disappeared. Treat like client died... ask
the FPE code to clean up after client and avoid further
@@ -1475,7 +1475,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
if (ClientIsAsleep(client) && c->pDraw)
{
DrawablePtr pDraw;
- dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess);
+ dixLookupDrawable(&pDraw, c->did, client, DixWriteAccess);
if (c->pDraw != pDraw) {
/* Our drawable has disappeared. Treat like client died... ask
the FPE code to clean up after client. */
diff --git a/dix/dixutils.c b/dix/dixutils.c
index 104363b..41a38d7 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -188,15 +188,12 @@ CompareISOLatin1Lowered(unsigned char *s1, int s1len,
/*
* dixLookupWindow and dixLookupDrawable:
* Look up the window/drawable taking into account the client doing the
- * lookup, the type of drawable desired, and the type of access desired.
- * Return Success with *pDraw set if the window/drawable exists and the client
- * is allowed access, else return an error code with *pDraw set to NULL. The
- * access mask values are defined in resource.h. The type mask values are
- * defined in pixmap.h, with zero equivalent to M_DRAWABLE.
+ * lookup, and the type of access desired. Return Success with *pDraw set if
+ * the drawable exists and the client is allowed access, else return an error
+ * code with *pDraw set to NULL. The access mask values are in resource.h.
*/
int
-dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client,
- Mask type, Mask access)
+dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client, Mask access)
{
DrawablePtr pTmp;
int rc;
@@ -213,8 +210,6 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client,
return BadDrawable;
if (rc != Success)
return rc;
- if (!((1 << pTmp->type) & (type ? type : M_DRAWABLE)))
- return BadMatch;
*pDraw = pTmp;
return Success;
@@ -224,7 +219,9 @@ int
dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
{
int rc;
- rc = dixLookupDrawable((DrawablePtr*)pWin, id, client, M_WINDOW, access);
+ rc = dixLookupDrawable((DrawablePtr*)pWin, id, client, access);
+ if (*pWin && (*pWin)->drawable.type != DRAWABLE_WINDOW)
+ return BadWindow;
return (rc == BadDrawable) ? BadWindow : rc;
}
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 9b4bc9e..8013256 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -514,7 +514,7 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
* matches the context screen and that the context fbconfig is
* compatible with the window visual. */
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, drawId, client, DixGetAttrAccess);
if (rc != Success || pDraw->type != DRAWABLE_WINDOW) {
client->errorValue = drawId;
*error = __glXError(GLXBadDrawable);
@@ -1198,7 +1198,7 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config
LEGAL_NEW_RESOURCE(glxDrawableId, client);
- err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess);
+ err = dixLookupDrawable(&pDraw, drawableId, client, DixAddAccess);
if (err != Success) {
client->errorValue = drawableId;
return err;
@@ -1553,7 +1553,7 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err))
return err;
- err = dixLookupDrawable(&pDraw, req->window, client, 0, DixAddAccess);
+ err = dixLookupDrawable(&pDraw, req->window, client, DixAddAccess);
if (err != Success || pDraw->type != DRAWABLE_WINDOW) {
client->errorValue = req->window;
return BadWindow;
diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index f79264e..66c2fb2 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -419,7 +419,7 @@ int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
__glXWindow *pGlxWindow = NULL;
int rc;
- rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, req->drawable, client, DixGetAttrAccess);
if (rc != Success) {
dixLookupResourceByType((pointer*) &pGlxPixmap, req->drawable,
__glXPixmapRes, NullClient, DixUnknownAccess);
@@ -449,7 +449,7 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
__glXWindow *pGlxWindow = NULL;
int rc;
- rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess);
+ rc = dixLookupDrawable(&pDraw, req->drawable, client, DixManageAccess);
if (rc != Success) {
dixLookupResourceByType((pointer*) &pGlxPixmap, req->drawable,
__glXPixmapRes, NullClient, DixUnknownAccess);
@@ -468,8 +468,7 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
}
if (req->member != None) {
- rc = dixLookupDrawable(&pMember, req->member, client, 0,
- DixGetAttrAccess);
+ rc = dixLookupDrawable(&pMember, req->member, client, DixGetAttrAccess);
if (rc != Success) {
dixLookupResourceByType((pointer*) &pGlxPixmap, req->member,
__glXPixmapRes, NullClient,
@@ -772,7 +771,7 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
+ rc = dixLookupDrawable(&pDraw, drawId, client, DixWriteAccess);
if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) {
/*
@@ -884,7 +883,7 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (readId != None && readId != drawId ) {
- rc = dixLookupDrawable(&pReadDraw, readId, client, 0, DixReadAccess);
+ rc = dixLookupDrawable(&pReadDraw, readId, client, DixReadAccess);
if (rc == Success) {
if (pReadDraw->type == DRAWABLE_WINDOW) {
/*
@@ -1647,10 +1646,11 @@ static int CreateGLXPixmap(__GLXclientState *cl,
PanoramiXRes *pXinDraw = NULL;
#endif
- rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP,
- DixAddAccess);
+ rc = dixLookupDrawable(&pDraw, pixmapId, client, DixAddAccess);
if (rc != Success)
return rc;
+ if (pDraw->type != DRAWABLE_PIXMAP)
+ return BadPixmap;
/*
** Check if screen of visual matches screen of pixmap.
@@ -1783,7 +1783,7 @@ static int CreateGLXPixmap(__GLXclientState *cl,
#ifdef PANORAMIX
if (pXinDraw) {
- dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0,
+ dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client,
DixAddAccess);
}
#endif
@@ -1956,7 +1956,7 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
/*
** Check that the GLX drawable is valid.
*/
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
+ rc = dixLookupDrawable(&pDraw, drawId, client, DixWriteAccess);
if (rc == Success) {
from_screen = to_screen = pDraw->pScreen->myNum;
@@ -2112,7 +2112,7 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
/*
** Check that the GLX drawable is valid.
*/
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
+ rc = dixLookupDrawable(&pDraw, drawId, client, DixWriteAccess);
if (rc == Success) {
if (pDraw->type != DRAWABLE_WINDOW) {
/*
@@ -2895,7 +2895,7 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
GLXFBConfigID fbconfigId = req->fbconfig;
XID windowId = req->window;
XID glxwindowId = req->glxwindow;
- DrawablePtr pDraw;
+ WindowPtr pWin;
ScreenPtr pScreen;
__glXWindow *pGlxWindow;
__GLXFBConfig *pGlxFBConfig = NULL;
@@ -2907,15 +2907,14 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
/*
** Check if windowId is valid
*/
- rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW,
- DixAddAccess);
+ rc = dixLookupWindow(&pWin, windowId, client, DixAddAccess);
if (rc != Success)
return rc;
/*
** Check if screen of window matches screen of fbconfig.
*/
- pScreen = pDraw->pScreen;
+ pScreen = pWin->drawable.pScreen;
if (screen != pScreen->myNum) {
return BadMatch;
}
@@ -2955,7 +2954,7 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
** Check if color buffer depth of fbconfig matches depth
** of window.
*/
- if (pVisual->nplanes != pDraw->depth) {
+ if (pVisual->nplanes != pWin->drawable.depth) {
return BadMatch;
}
} else
@@ -2987,7 +2986,7 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
return BadAlloc;
}
- pGlxWindow->pDraw = pDraw;
+ pGlxWindow->pDraw = &pWin->drawable;
pGlxWindow->type = GLX_GLXWINDOW_TYPE;
pGlxWindow->idExists = True;
pGlxWindow->refcnt = 0;
@@ -3302,7 +3301,7 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
#endif
if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, drawId, client, DixGetAttrAccess);
if (rc == Success && pDraw->type == DRAWABLE_WINDOW) {
WindowPtr pWin = (WindowPtr)pDraw;
be_drawable = 0;
@@ -3460,7 +3459,7 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
DMXScreenInfo *dmxScreen;
if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixSetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, drawId, client, DixSetAttrAccess);
if (rc == Success && pDraw->type == DRAWABLE_WINDOW) {
be_drawable = 0;
screen = pDraw->pScreen->myNum;
diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index 6945f5b..477c0ce 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -965,8 +965,7 @@ ProcXF86DRICreateDrawable (ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rc = dixLookupDrawable (&drawable, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&drawable, stuff->drawable, client, DixReadAccess);
if (rc != Success)
return rc;
if (drawable->type != DRAWABLE_WINDOW) {
@@ -1024,11 +1023,7 @@ ProcXF86DRIDestroyDrawable (register ClientPtr client)
return BadValue;
}
- rc = dixLookupDrawable(&drawable,
- stuff->drawable,
- client,
- 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&drawable, stuff->drawable, client, DixReadAccess);
if (rc != Success)
return rc;
if (drawable->type != DRAWABLE_WINDOW) {
@@ -1076,8 +1071,7 @@ ProcXF86DRIGetDrawableInfo (register ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&drawable, stuff->drawable, client, DixReadAccess);
if (rc != Success || !drawable) {
EPHYR_LOG_ERROR ("could not get drawable\n") ;
return rc;
diff --git a/hw/kdrive/ephyr/ephyrglxext.c b/hw/kdrive/ephyr/ephyrglxext.c
index dfc43e1..fe62fbf 100644
--- a/hw/kdrive/ephyr/ephyrglxext.c
+++ b/hw/kdrive/ephyr/ephyrglxext.c
@@ -522,11 +522,8 @@ ephyrGLXMakeCurrentReal (__GLXclientState *a_cl, GLbyte *a_pc, Bool a_do_swap)
int rc=0;
EPHYR_LOG ("enter\n") ;
- rc = dixLookupDrawable (&drawable,
- req->drawable,
- a_cl->client,
- 0,
- DixReadAccess);
+ rc = dixLookupDrawable (&drawable, req->drawable, a_cl->client,
+ DixReadAccess);
EPHYR_RETURN_VAL_IF_FAIL (drawable, BadValue) ;
EPHYR_RETURN_VAL_IF_FAIL (drawable->pScreen, BadValue) ;
EPHYR_LOG ("screen nummber requested:%d\n",
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index 20baa24..991363d 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -344,8 +344,7 @@ ProcXF86DRICreateDrawable(
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, DixReadAccess);
if (rc != Success)
return rc;
@@ -373,8 +372,7 @@ ProcXF86DRIDestroyDrawable(
return BadValue;
}
- rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, DixReadAccess);
if (rc != Success)
return rc;
@@ -409,8 +407,7 @@ ProcXF86DRIGetDrawableInfo(
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, DixReadAccess);
if (rc != Success)
return rc;
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 4e48e65..4eda498 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -55,9 +55,7 @@ static Bool
validDrawable(ClientPtr client, XID drawable, Mask access_mode,
DrawablePtr *pDrawable, int *status)
{
- *status = dixLookupDrawable(pDrawable, drawable, client,
- M_DRAWABLE_WINDOW | M_DRAWABLE_PIXMAP,
- access_mode);
+ *status = dixLookupDrawable(pDrawable, drawable, client, access_mode);
if (*status != Success) {
client->errorValue = drawable;
return FALSE;
diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c
index ff70a38..8819562 100644
--- a/hw/xquartz/xpr/appledri.c
+++ b/hw/xquartz/xpr/appledri.c
@@ -198,8 +198,7 @@ ProcAppleDRICreateSurface(
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, DixReadAccess);
if (rc != Success)
return rc;
@@ -231,8 +230,7 @@ ProcAppleDRIDestroySurface(
DrawablePtr pDrawable;
REQUEST_SIZE_MATCH(xAppleDRIDestroySurfaceReq);
- rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, DixReadAccess);
if (rc != Success)
return rc;
@@ -258,8 +256,7 @@ ProcAppleDRICreatePixmap(ClientPtr client)
REQUEST_SIZE_MATCH(xAppleDRICreatePixmapReq);
- rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, DixReadAccess);
if(rc != Success)
return rc;
@@ -305,8 +302,7 @@ ProcAppleDRIDestroyPixmap(ClientPtr client)
REQUEST(xAppleDRIDestroyPixmapReq);
REQUEST_SIZE_MATCH(xAppleDRIDestroyPixmapReq);
- rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
- DixReadAccess);
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, DixReadAccess);
if(rc != Success)
return rc;
diff --git a/include/dix.h b/include/dix.h
index c201e3a..7409941 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -88,7 +88,7 @@ SOFTWARE.
#define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, mode)\
{\
- int rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\
+ int rc = dixLookupDrawable(&(pDraw), drawID, client, mode);\
if (rc != Success)\
return rc;\
rc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\
@@ -190,7 +190,6 @@ extern _X_EXPORT int dixLookupDrawable(
DrawablePtr *result,
XID id,
ClientPtr client,
- Mask type_mask,
Mask access_mode);
extern _X_EXPORT int dixLookupGC(
diff --git a/include/pixmap.h b/include/pixmap.h
index 014a111..b29c256 100644
--- a/include/pixmap.h
+++ b/include/pixmap.h
@@ -56,15 +56,6 @@ SOFTWARE.
#define DRAWABLE_PIXMAP 1
#define UNDRAWABLE_WINDOW 2
-/* corresponding type masks for dixLookupDrawable() */
-#define M_DRAWABLE_WINDOW (1<<0)
-#define M_DRAWABLE_PIXMAP (1<<1)
-#define M_UNDRAWABLE_WINDOW (1<<2)
-#define M_ANY (-1)
-#define M_WINDOW (M_DRAWABLE_WINDOW|M_UNDRAWABLE_WINDOW)
-#define M_DRAWABLE (M_DRAWABLE_WINDOW|M_DRAWABLE_PIXMAP)
-#define M_UNDRAWABLE (M_UNDRAWABLE_WINDOW)
-
/* flags to PaintWindow() */
#define PW_BACKGROUND 0
#define PW_BORDER 1
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 1bc1a9e..8bb14a1 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -775,9 +775,11 @@ ProcRRSetScreenConfig (ClientPtr client)
has_rate = FALSE;
}
- rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
- if (rc != Success)
+ rc = dixLookupDrawable(&pDraw, stuff->drawable, client, DixWriteAccess);
+ if (rc != Success) {
+ client->errorValue = stuff->drawable;
return rc;
+ }
pScreen = pDraw->pScreen;
diff --git a/render/render.c b/render/render.c
index 7029558..68197e7 100644
--- a/render/render.c
+++ b/render/render.c
@@ -609,7 +609,7 @@ ProcRenderCreatePicture (ClientPtr client)
REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq);
LEGAL_NEW_RESOURCE(stuff->pid, client);
- rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client,
DixReadAccess|DixAddAccess);
if (rc != Success)
return rc;
@@ -1739,7 +1739,7 @@ ProcRenderQueryFilters (ClientPtr client)
char *names;
REQUEST_SIZE_MATCH(xRenderQueryFiltersReq);
- rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client,
DixGetAttrAccess);
if (rc != Success)
return rc;
--
1.7.3.5
More information about the xorg-devel
mailing list