XI: directly write out X_XIGetFocus reply

Write out the X_XIGetFocus 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 14:15:42 +02:00
parent bd8e1dc6b8
commit a4d8e1a231
3 changed files with 7 additions and 16 deletions

View File

@ -421,11 +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_XIGetFocus)
SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep);
else {
FatalError("XINPUT confused sending swapped reply");
}
FatalError("XINPUT confused sending swapped reply");
}
/************************************************************************

View File

@ -114,15 +114,11 @@ ProcXIGetFocus(ClientPtr client)
else
rep.focus = dev->focus->win->drawable.id;
WriteReplyToClient(client, sizeof(xXIGetFocusReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.focus);
}
WriteToClient(client, sizeof(xXIGetFocusReply), &rep);
return Success;
}
void
SRepXIGetFocus(ClientPtr client, int len, xXIGetFocusReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swapl(&rep->focus);
WriteToClient(client, len, rep);
}

View File

@ -36,5 +36,4 @@ int ProcXISetFocus(ClientPtr client);
int SProcXIGetFocus(ClientPtr client);
int ProcXIGetFocus(ClientPtr client);
void SRepXIGetFocus(ClientPtr client, int len, xXIGetFocusReply * rep);
#endif /* XISETDEVFOCUS_H */