composite: Fix resource lookups
This commit is contained in:
parent
e7785e8af3
commit
4a27618565
|
@ -136,21 +136,30 @@ ProcCompositeQueryVersion (ClientPtr client)
|
||||||
return(client->noClientException);
|
return(client->noClientException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define VERIFY_WINDOW(pWindow, wid, client, mode) \
|
||||||
|
do { \
|
||||||
|
int err; \
|
||||||
|
err = dixLookupResourceByType((pointer *) &pWindow, wid, \
|
||||||
|
RT_WINDOW, client, mode); \
|
||||||
|
if (err == BadValue) { \
|
||||||
|
client->errorValue = wid; \
|
||||||
|
return BadWindow; \
|
||||||
|
} else if (err != Success) { \
|
||||||
|
client->errorValue = wid; \
|
||||||
|
return err; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcCompositeRedirectWindow (ClientPtr client)
|
ProcCompositeRedirectWindow (ClientPtr client)
|
||||||
{
|
{
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
int rc;
|
|
||||||
REQUEST(xCompositeRedirectWindowReq);
|
REQUEST(xCompositeRedirectWindowReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
||||||
rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
|
VERIFY_WINDOW(pWin, stuff->window, client,
|
||||||
DixSetAttrAccess|DixManageAccess|DixBlendAccess);
|
DixSetAttrAccess|DixManageAccess|DixBlendAccess);
|
||||||
if (rc != Success)
|
|
||||||
{
|
|
||||||
client->errorValue = stuff->window;
|
|
||||||
return (rc == BadValue) ? BadWindow : rc;
|
|
||||||
}
|
|
||||||
return compRedirectWindow (client, pWin, stuff->update);
|
return compRedirectWindow (client, pWin, stuff->update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,17 +167,12 @@ static int
|
||||||
ProcCompositeRedirectSubwindows (ClientPtr client)
|
ProcCompositeRedirectSubwindows (ClientPtr client)
|
||||||
{
|
{
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
int rc;
|
|
||||||
REQUEST(xCompositeRedirectSubwindowsReq);
|
REQUEST(xCompositeRedirectSubwindowsReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
||||||
rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
|
VERIFY_WINDOW(pWin, stuff->window, client,
|
||||||
DixSetAttrAccess|DixManageAccess|DixBlendAccess);
|
DixSetAttrAccess|DixManageAccess|DixBlendAccess);
|
||||||
if (rc != Success)
|
|
||||||
{
|
|
||||||
client->errorValue = stuff->window;
|
|
||||||
return (rc == BadValue) ? BadWindow : rc;
|
|
||||||
}
|
|
||||||
return compRedirectSubwindows (client, pWin, stuff->update);
|
return compRedirectSubwindows (client, pWin, stuff->update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,12 +183,9 @@ ProcCompositeUnredirectWindow (ClientPtr client)
|
||||||
REQUEST(xCompositeUnredirectWindowReq);
|
REQUEST(xCompositeUnredirectWindowReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
||||||
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
|
VERIFY_WINDOW(pWin, stuff->window, client,
|
||||||
if (!pWin)
|
DixSetAttrAccess|DixManageAccess|DixBlendAccess);
|
||||||
{
|
|
||||||
client->errorValue = stuff->window;
|
|
||||||
return BadWindow;
|
|
||||||
}
|
|
||||||
return compUnredirectWindow (client, pWin, stuff->update);
|
return compUnredirectWindow (client, pWin, stuff->update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,12 +196,9 @@ ProcCompositeUnredirectSubwindows (ClientPtr client)
|
||||||
REQUEST(xCompositeUnredirectSubwindowsReq);
|
REQUEST(xCompositeUnredirectSubwindowsReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
||||||
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
|
VERIFY_WINDOW(pWin, stuff->window, client,
|
||||||
if (!pWin)
|
DixSetAttrAccess|DixManageAccess|DixBlendAccess);
|
||||||
{
|
|
||||||
client->errorValue = stuff->window;
|
|
||||||
return BadWindow;
|
|
||||||
}
|
|
||||||
return compUnredirectSubwindows (client, pWin, stuff->update);
|
return compUnredirectSubwindows (client, pWin, stuff->update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,18 +208,10 @@ ProcCompositeCreateRegionFromBorderClip (ClientPtr client)
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
CompWindowPtr cw;
|
CompWindowPtr cw;
|
||||||
RegionPtr pBorderClip, pRegion;
|
RegionPtr pBorderClip, pRegion;
|
||||||
int rc;
|
|
||||||
REQUEST(xCompositeCreateRegionFromBorderClipReq);
|
REQUEST(xCompositeCreateRegionFromBorderClipReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
|
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
|
||||||
rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
|
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
DixGetAttrAccess);
|
|
||||||
if (rc != Success)
|
|
||||||
{
|
|
||||||
client->errorValue = stuff->window;
|
|
||||||
return (rc == BadValue) ? BadWindow : rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
LEGAL_NEW_RESOURCE (stuff->region, client);
|
LEGAL_NEW_RESOURCE (stuff->region, client);
|
||||||
|
|
||||||
cw = GetCompWindow (pWin);
|
cw = GetCompWindow (pWin);
|
||||||
|
@ -250,13 +240,7 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
|
||||||
REQUEST(xCompositeNameWindowPixmapReq);
|
REQUEST(xCompositeNameWindowPixmapReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
||||||
rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
|
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
DixGetAttrAccess);
|
|
||||||
if (rc != Success)
|
|
||||||
{
|
|
||||||
client->errorValue = stuff->window;
|
|
||||||
return (rc == BadValue) ? BadWindow : rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pWin->viewable)
|
if (!pWin->viewable)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
|
@ -298,13 +282,7 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
|
REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
|
||||||
rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
|
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
DixGetAttrAccess);
|
|
||||||
if (rc != Success)
|
|
||||||
{
|
|
||||||
client->errorValue = stuff->window;
|
|
||||||
return (rc == BadValue) ? BadWindow : rc;
|
|
||||||
}
|
|
||||||
pScreen = pWin->drawable.pScreen;
|
pScreen = pWin->drawable.pScreen;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -360,12 +338,7 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client)
|
||||||
CompOverlayClientPtr pOc;
|
CompOverlayClientPtr pOc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
|
REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
|
||||||
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
|
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
if (!pWin)
|
|
||||||
{
|
|
||||||
client->errorValue = stuff->window;
|
|
||||||
return BadWindow;
|
|
||||||
}
|
|
||||||
pScreen = pWin->drawable.pScreen;
|
pScreen = pWin->drawable.pScreen;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -296,10 +296,12 @@ compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
|
||||||
* for all colormaps.
|
* for all colormaps.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < numInstalledCmaps; i++) {
|
for (i = 0; i < numInstalledCmaps; i++) {
|
||||||
int j;
|
int j, rc;
|
||||||
|
|
||||||
installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP);
|
rc = dixLookupResourceByType((pointer *)&installedCmap,
|
||||||
if (!installedCmap)
|
installedCmaps[i], RT_COLORMAP,
|
||||||
|
serverClient, DixReadAccess);
|
||||||
|
if (rc != Success)
|
||||||
continue;
|
continue;
|
||||||
j = installedCmap->pVisual - pScreen->visuals;
|
j = installedCmap->pVisual - pScreen->visuals;
|
||||||
installedCmap->pVisual = &visuals[j];
|
installedCmap->pVisual = &visuals[j];
|
||||||
|
|
Loading…
Reference in New Issue