XI: directly write out X_ListDeviceProperties reply

Write out the X_ListDeviceProperties 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:01:42 +02:00
parent b573dfb6e4
commit d14277ccbc
3 changed files with 7 additions and 20 deletions

View File

@ -421,10 +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_ListDeviceProperties) if (rep->RepType == X_GetDeviceProperty)
SRepXListDeviceProperties(client, len,
(xListDevicePropertiesReply *) rep);
else if (rep->RepType == X_GetDeviceProperty)
SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep); SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
else if (rep->RepType == X_XIQueryPointer) else if (rep->RepType == X_XIQueryPointer)
SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep); SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep);

View File

@ -872,7 +872,12 @@ ProcXListDeviceProperties(ClientPtr client)
.nAtoms = natoms .nAtoms = natoms
}; };
WriteReplyToClient(client, sizeof(xListDevicePropertiesReply), &rep); if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.nAtoms);
}
WriteToClient(client, sizeof(xListDevicePropertiesReply), &rep);
if (natoms) { if (natoms) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms); WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
@ -1044,19 +1049,6 @@ SProcXGetDeviceProperty(ClientPtr client)
return (ProcXGetDeviceProperty(client)); return (ProcXGetDeviceProperty(client));
} }
/* Reply swapping */
void _X_COLD
SRepXListDeviceProperties(ClientPtr client, int size,
xListDevicePropertiesReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->nAtoms);
/* properties will be swapped later, see ProcXListDeviceProperties */
WriteToClient(client, size, rep);
}
void _X_COLD void _X_COLD
SRepXGetDeviceProperty(ClientPtr client, int size, SRepXGetDeviceProperty(ClientPtr client, int size,
xGetDevicePropertyReply * rep) xGetDevicePropertyReply * rep)

View File

@ -41,8 +41,6 @@ int SProcXDeleteDeviceProperty(ClientPtr client);
int SProcXGetDeviceProperty(ClientPtr client); int SProcXGetDeviceProperty(ClientPtr client);
/* reply swapping */ /* reply swapping */
void SRepXListDeviceProperties(ClientPtr client, int size,
xListDevicePropertiesReply * rep);
void SRepXGetDeviceProperty(ClientPtr client, int size, void SRepXGetDeviceProperty(ClientPtr client, int size,
xGetDevicePropertyReply * rep); xGetDevicePropertyReply * rep);