XI: directly write out X_GrabDevice reply

Write out X_GrabDevice 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-03-31 20:16:42 +02:00
parent d4bd6bad8d
commit 96e6a517c9
3 changed files with 6 additions and 24 deletions

View File

@ -421,9 +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_GrabDevice)
SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
else if (rep->RepType == X_GetDeviceFocus)
if (rep->RepType == X_GetDeviceFocus)
SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep);
else if (rep->RepType == X_GetFeedbackControl)
SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep);

View File

@ -137,7 +137,11 @@ ProcXGrabDevice(ClientPtr client)
if (rc != Success)
return rc;
WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xGrabDeviceReply), &rep);
return Success;
}
@ -195,18 +199,3 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
}
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XGrabDevice function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -44,9 +44,4 @@ int CreateMaskFromList(ClientPtr /* client */ ,
int /* req */
);
void SRepXGrabDevice(ClientPtr /* client */ ,
int /* size */ ,
xGrabDeviceReply * /* rep */
);
#endif /* GRABDEV_H */