XI: directly write out X_XIPassiveGrabDevice reply

Write out the X_XIPassiveGrabDevice 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:52:50 +02:00
parent 7c5482d568
commit 957e04d2a3
3 changed files with 10 additions and 22 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_XIPassiveGrabDevice)
SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep);
else if (rep->RepType == X_XIListProperties)
if (rep->RepType == X_XIListProperties)
SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep);
else if (rep->RepType == X_XIGetProperty)
SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep);

View File

@ -92,7 +92,6 @@ ProcXIPassiveGrabDevice(ClientPtr client)
GrabParameters param;
void *tmp;
int mask_len;
uint32_t length;
REQUEST(xXIPassiveGrabDeviceReq);
REQUEST_FIXED_SIZE(xXIPassiveGrabDeviceReq,
@ -247,11 +246,15 @@ ProcXIPassiveGrabDevice(ClientPtr client)
}
}
/* save the value before SRepXIPassiveGrabDevice swaps it */
length = rep.length;
WriteReplyToClient(client, sizeof(rep), &rep);
if (rep.num_modifiers)
WriteToClient(client, length * 4, modifiers_failed);
uint32_t length = rep.length; /* save it before swapping */
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.num_modifiers);
}
WriteToClient(client, sizeof(rep), &rep);
WriteToClient(client, length * 4, modifiers_failed);
out:
free(modifiers_failed);
@ -259,17 +262,6 @@ ProcXIPassiveGrabDevice(ClientPtr client)
return ret;
}
void _X_COLD
SRepXIPassiveGrabDevice(ClientPtr client, int size,
xXIPassiveGrabDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->num_modifiers);
WriteToClient(client, size, rep);
}
int _X_COLD
SProcXIPassiveUngrabDevice(ClientPtr client)
{

View File

@ -32,8 +32,6 @@
int SProcXIPassiveUngrabDevice(ClientPtr client);
int ProcXIPassiveUngrabDevice(ClientPtr client);
void SRepXIPassiveGrabDevice(ClientPtr client, int size,
xXIPassiveGrabDeviceReply * rep);
int ProcXIPassiveGrabDevice(ClientPtr client);
int SProcXIPassiveGrabDevice(ClientPtr client);