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 */ /* All we look at is the type field */
/* This is common to all replies */ /* This is common to all replies */
if (rep->RepType == X_XIPassiveGrabDevice) if (rep->RepType == X_XIListProperties)
SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep);
else if (rep->RepType == X_XIListProperties)
SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep); SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep);
else if (rep->RepType == X_XIGetProperty) else if (rep->RepType == X_XIGetProperty)
SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep); SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep);

View File

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

View File

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