XI: directly write out X_OpenDevice reply

Write out X_OpenDevice the 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-03-31 14:54:23 +02:00
parent 4c27b09c53
commit baac2944f6
3 changed files with 8 additions and 24 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_OpenDevice)
SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep);
else if (rep->RepType == X_SetDeviceMode)
if (rep->RepType == X_SetDeviceMode)
SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep);
else if (rep->RepType == X_GetSelectedExtensionEvents)
SRepXGetSelectedExtensionEvents(client, len,

View File

@ -137,22 +137,13 @@ ProcXOpenDevice(ClientPtr client)
.length = bytes_to_int32(j * sizeof(xInputClassInfo)),
.num_classes = j
};
WriteReplyToClient(client, sizeof(xOpenDeviceReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xOpenDeviceReply), &rep);
WriteToClient(client, j * sizeof(xInputClassInfo), evbase);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XOpenDevice function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXOpenDevice(ClientPtr /* client */
);
void SRepXOpenDevice(ClientPtr /* client */ ,
int /* size */ ,
xOpenDeviceReply * /* rep */
);
#endif /* OPENDEV_H */