XI: directly write out X_SetDeviceButtonMapping reply

Write out the X_SetDeviceButtonMapping 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:51:52 +02:00
parent f43b2fdc87
commit 13cc0cdf09
3 changed files with 14 additions and 37 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_SetDeviceButtonMapping)
SRepXSetDeviceButtonMapping(client, len,
(xSetDeviceButtonMappingReply *) rep);
else if (rep->RepType == X_QueryDeviceState)
if (rep->RepType == X_QueryDeviceState)
SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep);
else if (rep->RepType == X_SetDeviceValuators)
SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep);

View File

@ -85,41 +85,26 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
if (ret != Success)
return ret;
xSetDeviceButtonMappingReply rep = {
.repType = X_Reply,
.RepType = X_SetDeviceButtonMapping,
.sequenceNumber = client->sequence,
.length = 0,
.status = MappingSuccess
};
ret =
ApplyPointerMapping(dev, (CARD8 *) &stuff[1], stuff->map_length,
client);
if (ret == -1)
return BadValue;
else if (ret == MappingBusy)
rep.status = ret;
else if (ret != Success)
if ((ret != Success) && (ret != MappingBusy))
return ret;
WriteReplyToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep);
xSetDeviceButtonMappingReply rep = {
.repType = X_Reply,
.RepType = X_SetDeviceButtonMapping,
.sequenceNumber = client->sequence,
.status = (ret == Success ? MappingSuccess : MappingBusy),
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XSetDeviceButtonMapping function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXSetDeviceButtonMapping(ClientPtr client, int size,
xSetDeviceButtonMappingReply * 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 ProcXSetDeviceButtonMapping(ClientPtr /* client */
);
void SRepXSetDeviceButtonMapping(ClientPtr /* client */ ,
int /* size */ ,
xSetDeviceButtonMappingReply * /* rep */
);
#endif /* SETBMAP_H */