From 3cded3300b1a91f89f9cb9ea0a62675ca81c79a3 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 1 Apr 2025 12:37:00 +0200 Subject: [PATCH] XI: directly write out X_GetDeviceProperty reply Write out the X_GetDeviceProperty 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/xiproperty.c | 22 ++++++++-------------- Xi/xiproperty.h | 4 ---- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index 0a9fe4934..a9e95c6a3 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_GetDeviceProperty) - SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep); - else if (rep->RepType == X_XIQueryPointer) + if (rep->RepType == X_XIQueryPointer) SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep); else if (rep->RepType == X_XIGetClientPointer) SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply *) rep); diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c index 3d8b99af3..43bd12e0f 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -981,7 +981,14 @@ ProcXGetDeviceProperty(ClientPtr client) if (stuff->delete && (rep.bytesAfter == 0)) send_property_event(dev, stuff->property, XIPropertyDeleted); - WriteReplyToClient(client, sizeof(xGenericReply), &rep); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.propertyType); + swapl(&rep.bytesAfter); + swapl(&rep.nItems); + } + WriteToClient(client, sizeof(xGenericReply), &rep); if (length) { switch (rep.format) { @@ -1049,19 +1056,6 @@ SProcXGetDeviceProperty(ClientPtr client) return (ProcXGetDeviceProperty(client)); } -void _X_COLD -SRepXGetDeviceProperty(ClientPtr client, int size, - xGetDevicePropertyReply * rep) -{ - swaps(&rep->sequenceNumber); - swapl(&rep->length); - swapl(&rep->propertyType); - swapl(&rep->bytesAfter); - swapl(&rep->nItems); - /* data will be swapped, see ProcXGetDeviceProperty */ - WriteToClient(client, size, rep); -} - /* XI2 Request/reply handling */ int ProcXIListProperties(ClientPtr client) diff --git a/Xi/xiproperty.h b/Xi/xiproperty.h index 58b949678..a24b66c5c 100644 --- a/Xi/xiproperty.h +++ b/Xi/xiproperty.h @@ -40,10 +40,6 @@ int SProcXChangeDeviceProperty(ClientPtr client); int SProcXDeleteDeviceProperty(ClientPtr client); int SProcXGetDeviceProperty(ClientPtr client); -/* reply swapping */ -void SRepXGetDeviceProperty(ClientPtr client, int size, - xGetDevicePropertyReply * rep); - /* XI2 request/reply handling */ int ProcXIListProperties(ClientPtr client); int ProcXIChangeProperty(ClientPtr client);