XI: directly write out X_XIGrabDevice reply

Write out the X_XIGrabDevice reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-01 13:48:53 +02:00
parent 5bf2f662cc
commit 7c5482d568
3 changed files with 5 additions and 15 deletions

View File

@ -421,9 +421,7 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
{
/* All we look at is the type field */
/* This is common to all replies */
if (rep->RepType == X_XIGrabDevice)
SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep);
else if (rep->RepType == X_XIPassiveGrabDevice)
if (rep->RepType == X_XIPassiveGrabDevice)
SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep);
else if (rep->RepType == X_XIListProperties)
SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep);

View File

@ -126,11 +126,13 @@ ProcXIGrabDevice(ClientPtr client)
.repType = X_Reply,
.RepType = X_XIGrabDevice,
.sequenceNumber = client->sequence,
.length = 0,
.status = status
};
WriteReplyToClient(client, sizeof(rep), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(rep), &rep);
return ret;
}
@ -171,11 +173,3 @@ ProcXIUngrabDevice(ClientPtr client)
return Success;
}
void _X_COLD
SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -36,6 +36,4 @@ int SProcXIGrabDevice(ClientPtr client);
int ProcXIUngrabDevice(ClientPtr client);
int SProcXIUngrabDevice(ClientPtr client);
void SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep);
#endif /* XIGRABDEV_H */