From d61c357891af518ecb2b044e44f052529417ffef Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 1 Apr 2025 14:10:41 +0200 Subject: [PATCH] XI: directly write out X_XIGetProperty reply Write out the X_XIGetProperty 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 | 21 ++++++++------------- Xi/xiproperty.h | 2 -- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index 11cd352af..70ede2a0e 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_XIGetProperty) - SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep); - else if (rep->RepType == X_XIGetSelectedEvents) + if (rep->RepType == X_XIGetSelectedEvents) SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep); else if (rep->RepType == X_XIGetFocus) SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep); diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c index a007633a2..76f48d1d1 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -1193,7 +1193,14 @@ ProcXIGetProperty(ClientPtr client) if (length && stuff->delete && (rep.bytes_after == 0)) send_property_event(dev, stuff->property, XIPropertyDeleted); - WriteReplyToClient(client, sizeof(xXIGetPropertyReply), &rep); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.type); + swapl(&rep.bytes_after); + swapl(&rep.num_items); + } + WriteToClient(client, sizeof(xXIGetPropertyReply), &rep); if (length) { switch (rep.format) { @@ -1274,15 +1281,3 @@ SProcXIGetProperty(ClientPtr client) swapl(&stuff->len); return (ProcXIGetProperty(client)); } - -void _X_COLD -SRepXIGetProperty(ClientPtr client, int size, xXIGetPropertyReply * rep) -{ - swaps(&rep->sequenceNumber); - swapl(&rep->length); - swapl(&rep->type); - swapl(&rep->bytes_after); - swapl(&rep->num_items); - /* data will be swapped, see ProcXIGetProperty */ - WriteToClient(client, size, rep); -} diff --git a/Xi/xiproperty.h b/Xi/xiproperty.h index 420f4f297..5edc28733 100644 --- a/Xi/xiproperty.h +++ b/Xi/xiproperty.h @@ -51,8 +51,6 @@ int SProcXIChangeProperty(ClientPtr client); int SProcXIDeleteProperty(ClientPtr client); int SProcXIGetProperty(ClientPtr client); -void SRepXIGetProperty(ClientPtr client, int size, xXIGetPropertyReply * rep); - void XIResetProperties(void); #endif /* XIPROPERTY_H */