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