diff --git a/Xi/extinit.c b/Xi/extinit.c index 70ede2a0e..d2b70b603 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_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"); diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c index 43b78cee1..cac9b4606 100644 --- a/Xi/xiselectev.c +++ b/Xi/xiselectev.c @@ -347,7 +347,6 @@ ProcXIGetSelectedEvents(ClientPtr client) InputClientsPtr others = NULL; xXIEventMask *evmask = NULL; DeviceIntPtr dev; - uint32_t length; REQUEST(xXIGetSelectedEventsReq); REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq); @@ -374,10 +373,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)); @@ -417,23 +414,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); -} diff --git a/Xi/xiselectev.h b/Xi/xiselectev.h index 56681d398..f0f0d1c16 100644 --- a/Xi/xiselectev.h +++ b/Xi/xiselectev.h @@ -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_ */