From 883a5c230583756d02ff915e61e78a981344b46d Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 31 Mar 2025 20:16:42 +0200 Subject: [PATCH] (1886) 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 --- Xi/extinit.c | 4 +--- Xi/grabdev.c | 21 +++++---------------- Xi/grabdev.h | 5 ----- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index 3b6cb8c23..01c13c4d3 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -422,9 +422,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); diff --git a/Xi/grabdev.c b/Xi/grabdev.c index d1d2da60f..9feb68654 100644 --- a/Xi/grabdev.c +++ b/Xi/grabdev.c @@ -138,7 +138,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; } @@ -196,18 +200,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); -} diff --git a/Xi/grabdev.h b/Xi/grabdev.h index 72e0fd692..8dfcab70d 100644 --- a/Xi/grabdev.h +++ b/Xi/grabdev.h @@ -44,9 +44,4 @@ int CreateMaskFromList(ClientPtr /* client */ , int /* req */ ); -void SRepXGrabDevice(ClientPtr /* client */ , - int /* size */ , - xGrabDeviceReply * /* rep */ - ); - #endif /* GRABDEV_H */