(submit/cleanup-damageext) 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 ba7a39d3ed
commit 6e8d19e7a7

View File

@ -467,12 +467,6 @@ ProcDamageAdd(ClientPtr client)
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) = {
/*************** Version 1 ******************/
ProcDamageQueryVersion,
@ -486,14 +480,12 @@ static int (*ProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
static int
ProcDamageDispatch(ClientPtr client)
{
REQUEST(xDamageReq);
DamageClientPtr pDamageClient = GetDamageClient(client);
REQUEST(xReq);
if (pDamageClient->major_version >= ARRAY_SIZE(version_requests))
if (stuff->data >= ARRAY_SIZE(ProcDamageVector))
return BadRequest;
if (stuff->damageReqType > version_requests[pDamageClient->major_version])
return BadRequest;
return (*ProcDamageVector[stuff->damageReqType]) (client);
return (*ProcDamageVector[stuff->data]) (client);
}
static int _X_COLD
@ -559,14 +551,12 @@ static int (*SProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
static int _X_COLD
SProcDamageDispatch(ClientPtr client)
{
REQUEST(xDamageReq);
DamageClientPtr pDamageClient = GetDamageClient(client);
REQUEST(xReq);
if (pDamageClient->major_version >= ARRAY_SIZE(version_requests))
if (stuff->data >= ARRAY_SIZE(ProcDamageVector))
return BadRequest;
if (stuff->damageReqType > version_requests[pDamageClient->major_version])
return BadRequest;
return (*SProcDamageVector[stuff->damageReqType]) (client);
return (*SProcDamageVector[stuff->data]) (client);
}
static int