XI: directly write out X_GetDeviceModifierMapping reply

Write out X_GetDeviceModifierMapping 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-04-01 11:19:05 +02:00
parent 7f36272a3d
commit 37c5d6bff2
3 changed files with 6 additions and 26 deletions

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_GetDeviceModifierMapping)
SRepXGetDeviceModifierMapping(client, len,
(xGetDeviceModifierMappingReply *) rep);
else if (rep->RepType == X_SetDeviceModifierMapping)
if (rep->RepType == X_SetDeviceModifierMapping)
SRepXSetDeviceModifierMapping(client, len,
(xSetDeviceModifierMappingReply *) rep);
else if (rep->RepType == X_GetDeviceButtonMapping)

View File

@ -92,26 +92,14 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
.length = max_keys_per_mod << 1
};
WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
WriteToClient(client, max_keys_per_mod * 8, modkeymap);
free(modkeymap);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XGetDeviceModifierMapping function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetDeviceModifierMapping(ClientPtr client, int size,
xGetDeviceModifierMappingReply * 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 ProcXGetDeviceModifierMapping(ClientPtr /* client */
);
void SRepXGetDeviceModifierMapping(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceModifierMappingReply * /* rep */
);
#endif /* GETMMAP_H */