From b5a887f4079bf64e057a28ed3ab6181099485d51 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 1 Apr 2025 14:01:42 +0200 Subject: [PATCH] (1886) XI: directly write out X_ListDeviceProperties reply Write out the X_ListDeviceProperties 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 | 5 +---- Xi/xiproperty.c | 20 ++++++-------------- Xi/xiproperty.h | 2 -- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index 296078f0d5..80aae7a391 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -422,10 +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_ListDeviceProperties) - SRepXListDeviceProperties(client, len, - (xListDevicePropertiesReply *) rep); - else if (rep->RepType == X_GetDeviceProperty) + if (rep->RepType == X_GetDeviceProperty) SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep); else if (rep->RepType == X_XIQueryPointer) SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep); diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c index 305e1d0abb..b08b70cba4 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -874,7 +874,12 @@ ProcXListDeviceProperties(ClientPtr client) .nAtoms = natoms }; - WriteReplyToClient(client, sizeof(xListDevicePropertiesReply), &rep); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swaps(&rep.nAtoms); + } + WriteToClient(client, sizeof(xListDevicePropertiesReply), &rep); if (natoms) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms); @@ -1046,19 +1051,6 @@ SProcXGetDeviceProperty(ClientPtr client) return (ProcXGetDeviceProperty(client)); } -/* Reply swapping */ - -void _X_COLD -SRepXListDeviceProperties(ClientPtr client, int size, - xListDevicePropertiesReply * rep) -{ - swaps(&rep->sequenceNumber); - swapl(&rep->length); - swaps(&rep->nAtoms); - /* properties will be swapped later, see ProcXListDeviceProperties */ - WriteToClient(client, size, rep); -} - void _X_COLD SRepXGetDeviceProperty(ClientPtr client, int size, xGetDevicePropertyReply * rep) diff --git a/Xi/xiproperty.h b/Xi/xiproperty.h index 561779f2eb..58b9496780 100644 --- a/Xi/xiproperty.h +++ b/Xi/xiproperty.h @@ -41,8 +41,6 @@ int SProcXDeleteDeviceProperty(ClientPtr client); int SProcXGetDeviceProperty(ClientPtr client); /* reply swapping */ -void SRepXListDeviceProperties(ClientPtr client, int size, - xListDevicePropertiesReply * rep); void SRepXGetDeviceProperty(ClientPtr client, int size, xGetDevicePropertyReply * rep);