From 96e6a517c941abff74df7babcc45c2db46deb6a2 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 31 Mar 2025 20:16:42 +0200 Subject: [PATCH] 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 5f9924db0..70de20021 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -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); diff --git a/Xi/grabdev.c b/Xi/grabdev.c index 2c2a39c72..fe988832b 100644 --- a/Xi/grabdev.c +++ b/Xi/grabdev.c @@ -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); -} 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 */