XI: directly write out X_GetDeviceButtonMapping reply

Write out the X_GetDeviceButtonMapping 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:45:58 +02:00
parent c37c82e3f2
commit f43b2fdc87
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 */ /* All we look at is the type field */
/* This is common to all replies */ /* This is common to all replies */
if (rep->RepType == X_GetDeviceButtonMapping) if (rep->RepType == X_SetDeviceButtonMapping)
SRepXGetDeviceButtonMapping(client, len,
(xGetDeviceButtonMappingReply *) rep);
else if (rep->RepType == X_SetDeviceButtonMapping)
SRepXSetDeviceButtonMapping(client, len, SRepXSetDeviceButtonMapping(client, len,
(xSetDeviceButtonMappingReply *) rep); (xSetDeviceButtonMappingReply *) rep);
else if (rep->RepType == X_QueryDeviceState) else if (rep->RepType == X_QueryDeviceState)

View File

@ -91,23 +91,11 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
.length = bytes_to_int32(b->numButtons), .length = bytes_to_int32(b->numButtons),
}; };
WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep); if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);
WriteToClient(client, rep.nElts, &b->map[1]); WriteToClient(client, rep.nElts, &b->map[1]);
return Success; return Success;
} }
/***********************************************************************
*
* This procedure writes the reply for the XGetDeviceButtonMapping function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetDeviceButtonMapping(ClientPtr client, int size,
xGetDeviceButtonMappingReply * 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 ProcXGetDeviceButtonMapping(ClientPtr /* client */ int ProcXGetDeviceButtonMapping(ClientPtr /* client */
); );
void SRepXGetDeviceButtonMapping(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceButtonMappingReply * /* rep */
);
#endif /* GETBMAP_H */ #endif /* GETBMAP_H */