From a4d8e1a231458c5e316351d3e718ca1019676eae Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 1 Apr 2025 14:15:42 +0200 Subject: [PATCH] XI: directly write out X_XIGetFocus reply Write out the X_XIGetFocus 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 | 6 +----- Xi/xisetdevfocus.c | 16 ++++++---------- Xi/xisetdevfocus.h | 1 - 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index d2b70b603..c7876ebf3 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -421,11 +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_XIGetFocus) - SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep); - else { - FatalError("XINPUT confused sending swapped reply"); - } + FatalError("XINPUT confused sending swapped reply"); } /************************************************************************ diff --git a/Xi/xisetdevfocus.c b/Xi/xisetdevfocus.c index 0a9ea528a..f8316ae29 100644 --- a/Xi/xisetdevfocus.c +++ b/Xi/xisetdevfocus.c @@ -114,15 +114,11 @@ ProcXIGetFocus(ClientPtr client) else rep.focus = dev->focus->win->drawable.id; - WriteReplyToClient(client, sizeof(xXIGetFocusReply), &rep); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.focus); + } + WriteToClient(client, sizeof(xXIGetFocusReply), &rep); return Success; } - -void -SRepXIGetFocus(ClientPtr client, int len, xXIGetFocusReply * rep) -{ - swaps(&rep->sequenceNumber); - swapl(&rep->length); - swapl(&rep->focus); - WriteToClient(client, len, rep); -} diff --git a/Xi/xisetdevfocus.h b/Xi/xisetdevfocus.h index 0865a72d4..68dbe0ee5 100644 --- a/Xi/xisetdevfocus.h +++ b/Xi/xisetdevfocus.h @@ -36,5 +36,4 @@ int ProcXISetFocus(ClientPtr client); int SProcXIGetFocus(ClientPtr client); int ProcXIGetFocus(ClientPtr client); -void SRepXIGetFocus(ClientPtr client, int len, xXIGetFocusReply * rep); #endif /* XISETDEVFOCUS_H */