damage: don't block requests when version not requested yet

The original intention was negotiating versions before any further requests
can be processed, so requests that might become incompatible in future versions
still can be dispatched correctly. But practically that's never been the case:
there's just one major version, and it's unlikely that a new *major* version
(that might be incompatible with the current one, using same request codes for
different things) will come in the forseeable future.

So this extra logic isn't practically needed and just complicates dispatching.
Dropping it clears the road for further simplification of the dispatcher.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-09 10:53:49 +02:00
parent 5e56e15191
commit 579ece670b

View File

@ -306,7 +306,7 @@ ProcDamageCreate(ClientPtr client)
REQUEST(xDamageCreateReq); REQUEST(xDamageCreateReq);
REQUEST_SIZE_MATCH(xDamageCreateReq); REQUEST_SIZE_MATCH(xDamageCreateReq);
#ifdef PANORAMIX #ifdef XINERAMA
if (damageUseXinerama) if (damageUseXinerama)
return PanoramiXDamageCreate(client); return PanoramiXDamageCreate(client);
#endif #endif
@ -468,12 +468,6 @@ ProcDamageAdd(ClientPtr client)
return Success; return Success;
} }
/* Major version controls available requests */
static const int version_requests[] = {
X_DamageQueryVersion, /* before client sends QueryVersion */
X_DamageAdd, /* Version 1 */
};
static int (*ProcDamageVector[XDamageNumberRequests]) (ClientPtr) = { static int (*ProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
/*************** Version 1 ******************/ /*************** Version 1 ******************/
ProcDamageQueryVersion, ProcDamageQueryVersion,
@ -487,14 +481,12 @@ static int (*ProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
static int static int
ProcDamageDispatch(ClientPtr client) ProcDamageDispatch(ClientPtr client)
{ {
REQUEST(xDamageReq); REQUEST(xReq);
DamageClientPtr pDamageClient = GetDamageClient(client);
if (pDamageClient->major_version >= ARRAY_SIZE(version_requests)) if (stuff->data >= ARRAY_SIZE(ProcDamageVector))
return BadRequest; return BadRequest;
if (stuff->damageReqType > version_requests[pDamageClient->major_version])
return BadRequest; return (*ProcDamageVector[stuff->data]) (client);
return (*ProcDamageVector[stuff->damageReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -560,14 +552,12 @@ static int (*SProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
static int _X_COLD static int _X_COLD
SProcDamageDispatch(ClientPtr client) SProcDamageDispatch(ClientPtr client)
{ {
REQUEST(xDamageReq); REQUEST(xReq);
DamageClientPtr pDamageClient = GetDamageClient(client);
if (pDamageClient->major_version >= ARRAY_SIZE(version_requests)) if (stuff->data >= ARRAY_SIZE(ProcDamageVector))
return BadRequest; return BadRequest;
if (stuff->damageReqType > version_requests[pDamageClient->major_version])
return BadRequest; return (*SProcDamageVector[stuff->data]) (client);
return (*SProcDamageVector[stuff->damageReqType]) (client);
} }
static int static int