XI: directly write out X_SetDeviceModifierMapping reply

Write out X_SetDeviceModifierMapping 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:38:58 +02:00
parent 37c5d6bff2
commit c37c82e3f2
3 changed files with 9 additions and 33 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_SetDeviceModifierMapping)
SRepXSetDeviceModifierMapping(client, len,
(xSetDeviceModifierMappingReply *) rep);
else if (rep->RepType == X_GetDeviceButtonMapping)
if (rep->RepType == X_GetDeviceButtonMapping)
SRepXGetDeviceButtonMapping(client, len,
(xGetDeviceButtonMappingReply *) rep);
else if (rep->RepType == X_SetDeviceButtonMapping)

View File

@ -91,35 +91,19 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
if (ret == Success)
ret = MappingSuccess;
if (ret != MappingSuccess && ret != MappingBusy && ret != MappingFailed)
return ret;
xSetDeviceModifierMappingReply rep = {
.repType = X_Reply,
.RepType = X_SetDeviceModifierMapping,
.sequenceNumber = client->sequence,
.length = 0
.success = ret,
};
if (ret == MappingSuccess || ret == MappingBusy || ret == MappingFailed) {
rep.success = ret;
WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply),
&rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xSetDeviceModifierMappingReply), &rep);
return Success;
}
return ret;
}
/***********************************************************************
*
* This procedure writes the reply for the XSetDeviceModifierMapping function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXSetDeviceModifierMapping(ClientPtr client, int size,
xSetDeviceModifierMappingReply * 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 ProcXSetDeviceModifierMapping(ClientPtr /* client */
);
void SRepXSetDeviceModifierMapping(ClientPtr /* client */ ,
int /* size */ ,
xSetDeviceModifierMappingReply * /* rep */
);
#endif /* SETMMAP_H */