Return an appropriately-typed error from dixLookupResourceByType.

Rather than always returning BadValue, associate an error status like
BadWindow with a resource type like RT_WINDOW, and return the
appropriate one for the requested type.

This patch only touches the core protocol resource types. Others still
return BadValue and need to be mapped appropriately.

dixLookupResourceByType can now return BadImplementation, if the caller
asked for a resource type that has not been allocated in the server.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Jamey Sharp 2010-04-24 23:26:40 -07:00
commit e291c56182
21 changed files with 124 additions and 93 deletions

View file

@ -119,7 +119,7 @@ ProcXFixesCreateRegionFromBitmap (ClientPtr client)
if (rc != Success)
{
client->errorValue = stuff->bitmap;
return (rc == BadValue) ? BadPixmap : rc;
return rc;
}
if (pPixmap->drawable.depth != 1)
return BadMatch;
@ -164,7 +164,7 @@ ProcXFixesCreateRegionFromWindow (ClientPtr client)
if (rc != Success)
{
client->errorValue = stuff->window;
return (rc == BadValue) ? BadWindow : rc;
return rc;
}
switch (stuff->kind) {
case WindowRegionBounding:
@ -675,7 +675,7 @@ ProcXFixesSetWindowShapeRegion (ClientPtr client)
if (rc != Success)
{
client->errorValue = stuff->dest;
return (rc == BadValue) ? BadWindow : rc;
return rc;
}
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixWriteAccess);
pScreen = pWin->drawable.pScreen;