From d14277ccbc1b31f4fd8cf3c7ba8431c75e745fac Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 1 Apr 2025 14:01:42 +0200 Subject: [PATCH] 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 a1f6392ed..0a9fe4934 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -421,10 +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_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 d3c90e166..3d8b99af3 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -872,7 +872,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); @@ -1044,19 +1049,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 561779f2e..58b949678 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);