mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
(1886) XI: directly write out X_XIGetSelectedEvents reply
Write out the X_XIGetSelectedEvents 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:
@@ -422,9 +422,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_XIGetSelectedEvents)
|
||||
SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep);
|
||||
else if (rep->RepType == X_XIGetFocus)
|
||||
if (rep->RepType == X_XIGetFocus)
|
||||
SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep);
|
||||
else {
|
||||
FatalError("XINPUT confused sending swapped reply");
|
||||
|
||||
@@ -346,7 +346,6 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||
InputClientsPtr others = NULL;
|
||||
xXIEventMask *evmask = NULL;
|
||||
DeviceIntPtr dev;
|
||||
uint32_t length;
|
||||
|
||||
REQUEST(xXIGetSelectedEventsReq);
|
||||
REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq);
|
||||
@@ -373,10 +372,8 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||
}
|
||||
}
|
||||
|
||||
if (!others) {
|
||||
WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &rep);
|
||||
return Success;
|
||||
}
|
||||
if (!others)
|
||||
goto finish;
|
||||
|
||||
buffer =
|
||||
calloc(MAXDEVICES, sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE));
|
||||
@@ -416,23 +413,17 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||
}
|
||||
}
|
||||
|
||||
/* save the value before SRepXIGetSelectedEvents swaps it */
|
||||
length = rep.length;
|
||||
WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &rep);
|
||||
finish: ;
|
||||
uint32_t length = rep.length; /* save before swapping it */
|
||||
|
||||
if (rep.num_masks)
|
||||
WriteToClient(client, length * 4, buffer);
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swaps(&rep.num_masks);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXIGetSelectedEventsReply), &rep);
|
||||
WriteToClient(client, length * 4, buffer);
|
||||
|
||||
free(buffer);
|
||||
return Success;
|
||||
}
|
||||
|
||||
void
|
||||
SRepXIGetSelectedEvents(ClientPtr client,
|
||||
int len, xXIGetSelectedEventsReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
swapl(&rep->length);
|
||||
swaps(&rep->num_masks);
|
||||
WriteToClient(client, len, rep);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,5 @@ int SProcXISelectEvents(ClientPtr client);
|
||||
int ProcXISelectEvents(ClientPtr client);
|
||||
int SProcXIGetSelectedEvents(ClientPtr client);
|
||||
int ProcXIGetSelectedEvents(ClientPtr client);
|
||||
void SRepXIGetSelectedEvents(ClientPtr client,
|
||||
int len, xXIGetSelectedEventsReply * rep);
|
||||
|
||||
#endif /* _XISELECTEVENTS_H_ */
|
||||
|
||||
Reference in New Issue
Block a user