From 7c5482d5687d1f10bb376a1fd8ab0cdfb044d67a Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 1 Apr 2025 13:48:53 +0200 Subject: [PATCH] XI: directly write out X_XIGrabDevice reply Write out the X_XIGrabDevice 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/xigrabdev.c | 14 ++++---------- Xi/xigrabdev.h | 2 -- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index 19ad68bec..cf6d1950e 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_XIGrabDevice) - SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep); - else if (rep->RepType == X_XIPassiveGrabDevice) + if (rep->RepType == X_XIPassiveGrabDevice) SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep); else if (rep->RepType == X_XIListProperties) SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep); diff --git a/Xi/xigrabdev.c b/Xi/xigrabdev.c index fca8b1f44..3494c41cc 100644 --- a/Xi/xigrabdev.c +++ b/Xi/xigrabdev.c @@ -126,11 +126,13 @@ ProcXIGrabDevice(ClientPtr client) .repType = X_Reply, .RepType = X_XIGrabDevice, .sequenceNumber = client->sequence, - .length = 0, .status = status }; - WriteReplyToClient(client, sizeof(rep), &rep); + if (client->swapped) { + swaps(&rep.sequenceNumber); + } + WriteToClient(client, sizeof(rep), &rep); return ret; } @@ -171,11 +173,3 @@ ProcXIUngrabDevice(ClientPtr client) return Success; } - -void _X_COLD -SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep) -{ - swaps(&rep->sequenceNumber); - swapl(&rep->length); - WriteToClient(client, size, rep); -} diff --git a/Xi/xigrabdev.h b/Xi/xigrabdev.h index e5aa702c5..3deacffed 100644 --- a/Xi/xigrabdev.h +++ b/Xi/xigrabdev.h @@ -36,6 +36,4 @@ int SProcXIGrabDevice(ClientPtr client); int ProcXIUngrabDevice(ClientPtr client); int SProcXIUngrabDevice(ClientPtr client); -void SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep); - #endif /* XIGRABDEV_H */