XI: directly write out X_GetDeviceControl reply

Write out the X_GetDeviceControl 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:01:01 +02:00
parent 3ff2fd4d32
commit ffb75fee3f
3 changed files with 6 additions and 24 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_GetDeviceControl) if (rep->RepType == X_ChangeDeviceControl)
SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep);
else if (rep->RepType == X_ChangeDeviceControl)
SRepXChangeDeviceControl(client, len, SRepXChangeDeviceControl(client, len,
(xChangeDeviceControlReply *) rep); (xChangeDeviceControlReply *) rep);
else if (rep->RepType == X_ListDeviceProperties) else if (rep->RepType == X_ListDeviceProperties)

View File

@ -143,21 +143,6 @@ CopySwapDeviceEnable(ClientPtr client, DeviceIntPtr dev, char *buf)
} }
} }
/***********************************************************************
*
* This procedure writes the reply for the xGetDeviceControl function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
/*********************************************************************** /***********************************************************************
* *
* Get the state of the specified device control. * Get the state of the specified device control.
@ -224,7 +209,11 @@ ProcXGetDeviceControl(ClientPtr client)
.length = bytes_to_int32(total_length), .length = bytes_to_int32(total_length),
}; };
WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep); if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xGetDeviceControlReply), &rep);
WriteToClient(client, total_length, savbuf); WriteToClient(client, total_length, savbuf);
free(savbuf); free(savbuf);
return Success; return Success;

View File

@ -36,9 +36,4 @@ int SProcXGetDeviceControl(ClientPtr /* client */
int ProcXGetDeviceControl(ClientPtr /* client */ int ProcXGetDeviceControl(ClientPtr /* client */
); );
void SRepXGetDeviceControl(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceControlReply * /* rep */
);
#endif /* GETDCTL_H */ #endif /* GETDCTL_H */