XI: directly write out X_ChangeDeviceControl reply

Write out the X_ChangeDeviceControl 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 12:31:17 +02:00
parent ffb75fee3f
commit b573dfb6e4
3 changed files with 5 additions and 27 deletions

View File

@ -130,7 +130,6 @@ ProcXChangeDeviceControl(ClientPtr client)
.repType = X_Reply,
.RepType = X_ChangeDeviceControl,
.sequenceNumber = client->sequence,
.length = 0,
.status = Success,
};
@ -232,24 +231,11 @@ ProcXChangeDeviceControl(ClientPtr client)
SendEventToAllWindows(dev, DevicePresenceNotifyMask,
(xEvent *) &dpn, 1);
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xChangeDeviceControlReply), &rep);
}
return ret;
}
/***********************************************************************
*
* This procedure writes the reply for the xChangeDeviceControl function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXChangeDeviceControl(ClientPtr client, int size,
xChangeDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -36,9 +36,4 @@ int SProcXChangeDeviceControl(ClientPtr /* client */
int ProcXChangeDeviceControl(ClientPtr /* client */
);
void SRepXChangeDeviceControl(ClientPtr /* client */ ,
int /* size */ ,
xChangeDeviceControlReply * /* rep */
);
#endif /* CHGDCTL_H */

View File

@ -421,10 +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_ChangeDeviceControl)
SRepXChangeDeviceControl(client, len,
(xChangeDeviceControlReply *) rep);
else if (rep->RepType == X_ListDeviceProperties)
if (rep->RepType == X_ListDeviceProperties)
SRepXListDeviceProperties(client, len,
(xListDevicePropertiesReply *) rep);
else if (rep->RepType == X_GetDeviceProperty)