XI: directly write out X_XIGetProperty reply

Write out the X_XIGetProperty 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 14:10:41 +02:00
parent 77cfdf5dbf
commit d61c357891
3 changed files with 9 additions and 18 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_XIGetProperty)
SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep);
else if (rep->RepType == X_XIGetSelectedEvents)
if (rep->RepType == X_XIGetSelectedEvents)
SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep);
else if (rep->RepType == X_XIGetFocus)
SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep);

View File

@ -1193,7 +1193,14 @@ ProcXIGetProperty(ClientPtr client)
if (length && stuff->delete && (rep.bytes_after == 0))
send_property_event(dev, stuff->property, XIPropertyDeleted);
WriteReplyToClient(client, sizeof(xXIGetPropertyReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.type);
swapl(&rep.bytes_after);
swapl(&rep.num_items);
}
WriteToClient(client, sizeof(xXIGetPropertyReply), &rep);
if (length) {
switch (rep.format) {
@ -1274,15 +1281,3 @@ SProcXIGetProperty(ClientPtr client)
swapl(&stuff->len);
return (ProcXIGetProperty(client));
}
void _X_COLD
SRepXIGetProperty(ClientPtr client, int size, xXIGetPropertyReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swapl(&rep->type);
swapl(&rep->bytes_after);
swapl(&rep->num_items);
/* data will be swapped, see ProcXIGetProperty */
WriteToClient(client, size, rep);
}

View File

@ -51,8 +51,6 @@ int SProcXIChangeProperty(ClientPtr client);
int SProcXIDeleteProperty(ClientPtr client);
int SProcXIGetProperty(ClientPtr client);
void SRepXIGetProperty(ClientPtr client, int size, xXIGetPropertyReply * rep);
void XIResetProperties(void);
#endif /* XIPROPERTY_H */