diff --git a/Xi/extinit.c b/Xi/extinit.c index 5587f0cfb..5f9924db0 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -421,10 +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_GetDeviceMotionEvents) - SRepXGetDeviceMotionEvents(client, len, - (xGetDeviceMotionEventsReply *) rep); - else if (rep->RepType == X_GrabDevice) + if (rep->RepType == X_GrabDevice) SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep); else if (rep->RepType == X_GetDeviceFocus) SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep); diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c index 2d6bd56fe..5e4d39bdc 100644 --- a/Xi/gtmotion.c +++ b/Xi/gtmotion.c @@ -113,48 +113,32 @@ ProcXGetDeviceMotionEvents(ClientPtr client) TimeStamp start = ClientTimeToServerTime(stuff->start); TimeStamp stop = ClientTimeToServerTime(stuff->stop); - if (CompareTimeStamps(start, stop) == LATER || - CompareTimeStamps(start, currentTime) == LATER) { - WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); - return Success; - } - if (CompareTimeStamps(stop, currentTime) == LATER) - stop = currentTime; - int length = 0; INT32 *coords = NULL; - if (v->numMotionEvents) { - rep.nEvents = GetMotionHistory(dev, (xTimecoord **) &coords, /* XXX */ - start.milliseconds, stop.milliseconds, - (ScreenPtr) NULL, FALSE); - length = rep.nEvents * (sizeof(Time) + (v->numAxes * sizeof(INT32))); - } - rep.length = bytes_to_int32(length); + if (CompareTimeStamps(start, stop) != LATER && + CompareTimeStamps(start, currentTime) != LATER) { + if (CompareTimeStamps(stop, currentTime) == LATER) + stop = currentTime; + if (v->numMotionEvents) { + const int size = sizeof(Time) + (v->numAxes * sizeof(INT32)); + rep.nEvents = GetMotionHistory(dev, (xTimecoord **) &coords, /* XXX */ + start.milliseconds, stop.milliseconds, + (ScreenPtr) NULL, FALSE); + length = rep.nEvents * size; + rep.length = bytes_to_int32(length); + } + } if (client->swapped) { SwapLongs((CARD32*) coords, rep.length); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.nEvents); } - WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); + WriteToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); WriteToClient(client, length, coords); free(coords); return Success; } - -/*********************************************************************** - * - * This procedure writes the reply for the XGetDeviceMotionEvents function, - * if the client and server have a different byte ordering. - * - */ - -void _X_COLD -SRepXGetDeviceMotionEvents(ClientPtr client, int size, - xGetDeviceMotionEventsReply * rep) -{ - swaps(&rep->sequenceNumber); - swapl(&rep->length); - swapl(&rep->nEvents); - WriteToClient(client, size, rep); -} diff --git a/Xi/gtmotion.h b/Xi/gtmotion.h index f62bf578c..70e75b85a 100644 --- a/Xi/gtmotion.h +++ b/Xi/gtmotion.h @@ -36,9 +36,4 @@ int SProcXGetDeviceMotionEvents(ClientPtr /* client */ int ProcXGetDeviceMotionEvents(ClientPtr /* client */ ); -void SRepXGetDeviceMotionEvents(ClientPtr /* client */ , - int /* size */ , - xGetDeviceMotionEventsReply * /* rep */ - ); - #endif /* GTMOTION_H */