damage: hand in request struct into doDamageCreate() and PanoramiXDamageCreate()

Saves us a little bit of duplicate request checking.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-09 11:31:54 +02:00
parent 5b4696368a
commit 42548766f6

View File

@ -44,7 +44,7 @@ typedef struct {
static RESTYPE XRT_DAMAGE;
static int damageUseXinerama = 0;
static int PanoramiXDamageCreate(ClientPtr client);
static int PanoramiXDamageCreate(ClientPtr client, xDamageCreateReq *stuff);
#endif /* XINERAMA */
@ -259,14 +259,12 @@ DamageExtCreate(DrawablePtr pDrawable, DamageReportLevel level,
}
static DamageExtPtr
doDamageCreate(ClientPtr client, int *rc)
doDamageCreate(ClientPtr client, int *rc, xDamageCreateReq *stuff)
{
DrawablePtr pDrawable;
DamageExtPtr pDamageExt;
DamageReportLevel level;
REQUEST(xDamageCreateReq);
*rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixGetAttrAccess | DixReadAccess);
if (*rc != Success)
@ -308,11 +306,11 @@ ProcDamageCreate(ClientPtr client)
#ifdef XINERAMA
if (damageUseXinerama)
return PanoramiXDamageCreate(client);
return PanoramiXDamageCreate(client, stuff);
#endif
LEGAL_NEW_RESOURCE(stuff->damage, client);
doDamageCreate(client, &rc);
doDamageCreate(client, &rc, stuff);
return rc;
}
@ -628,15 +626,12 @@ PanoramiXDamageExtDestroy(DamagePtr pDamage, void *closure)
}
static int
PanoramiXDamageCreate(ClientPtr client)
PanoramiXDamageCreate(ClientPtr client, xDamageCreateReq *stuff)
{
PanoramiXDamageRes *damage;
PanoramiXRes *draw;
int i, rc;
REQUEST(xDamageCreateReq);
REQUEST_SIZE_MATCH(xDamageCreateReq);
LEGAL_NEW_RESOURCE(stuff->damage, client);
rc = dixLookupResourceByClass((void **)&draw, stuff->drawable, XRC_DRAWABLE,
client, DixGetAttrAccess | DixReadAccess);
@ -649,7 +644,7 @@ PanoramiXDamageCreate(ClientPtr client)
if (!AddResource(stuff->damage, XRT_DAMAGE, damage))
return BadAlloc;
damage->ext = doDamageCreate(client, &rc);
damage->ext = doDamageCreate(client, &rc, stuff);
if (rc == Success && draw->type == XRT_WINDOW) {
FOR_NSCREENS_FORWARD(i) {
DrawablePtr pDrawable;