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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-01 12:37:00 +02:00
parent d14277ccbc
commit 3cded3300b
3 changed files with 9 additions and 21 deletions

View File

@ -421,9 +421,7 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
{ {
/* All we look at is the type field */ /* All we look at is the type field */
/* This is common to all replies */ /* This is common to all replies */
if (rep->RepType == X_GetDeviceProperty) if (rep->RepType == X_XIQueryPointer)
SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
else if (rep->RepType == X_XIQueryPointer)
SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep); SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep);
else if (rep->RepType == X_XIGetClientPointer) else if (rep->RepType == X_XIGetClientPointer)
SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply *) rep); SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply *) rep);

View File

@ -981,7 +981,14 @@ ProcXGetDeviceProperty(ClientPtr client)
if (stuff->delete && (rep.bytesAfter == 0)) if (stuff->delete && (rep.bytesAfter == 0))
send_property_event(dev, stuff->property, XIPropertyDeleted); 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) { if (length) {
switch (rep.format) { switch (rep.format) {
@ -1049,19 +1056,6 @@ SProcXGetDeviceProperty(ClientPtr client)
return (ProcXGetDeviceProperty(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 */ /* XI2 Request/reply handling */
int int
ProcXIListProperties(ClientPtr client) ProcXIListProperties(ClientPtr client)

View File

@ -40,10 +40,6 @@ int SProcXChangeDeviceProperty(ClientPtr client);
int SProcXDeleteDeviceProperty(ClientPtr client); int SProcXDeleteDeviceProperty(ClientPtr client);
int SProcXGetDeviceProperty(ClientPtr client); int SProcXGetDeviceProperty(ClientPtr client);
/* reply swapping */
void SRepXGetDeviceProperty(ClientPtr client, int size,
xGetDevicePropertyReply * rep);
/* XI2 request/reply handling */ /* XI2 request/reply handling */
int ProcXIListProperties(ClientPtr client); int ProcXIListProperties(ClientPtr client);
int ProcXIChangeProperty(ClientPtr client); int ProcXIChangeProperty(ClientPtr client);