XI: directly write out X_GetDeviceMotionEvents reply
Write out X_GetDeviceMotionEvents the 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:
parent
52456a6e27
commit
d4bd6bad8d
|
@ -421,10 +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_GetDeviceMotionEvents)
|
if (rep->RepType == X_GrabDevice)
|
||||||
SRepXGetDeviceMotionEvents(client, len,
|
|
||||||
(xGetDeviceMotionEventsReply *) rep);
|
|
||||||
else if (rep->RepType == X_GrabDevice)
|
|
||||||
SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
|
SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
|
||||||
else if (rep->RepType == X_GetDeviceFocus)
|
else if (rep->RepType == X_GetDeviceFocus)
|
||||||
SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep);
|
SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep);
|
||||||
|
|
|
@ -113,48 +113,32 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
|
||||||
|
|
||||||
TimeStamp start = ClientTimeToServerTime(stuff->start);
|
TimeStamp start = ClientTimeToServerTime(stuff->start);
|
||||||
TimeStamp stop = ClientTimeToServerTime(stuff->stop);
|
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;
|
int length = 0;
|
||||||
INT32 *coords = NULL;
|
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) {
|
if (client->swapped) {
|
||||||
SwapLongs((CARD32*) coords, rep.length);
|
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);
|
WriteToClient(client, length, coords);
|
||||||
free(coords);
|
free(coords);
|
||||||
return Success;
|
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);
|
|
||||||
}
|
|
||||||
|
|
|
@ -36,9 +36,4 @@ int SProcXGetDeviceMotionEvents(ClientPtr /* client */
|
||||||
int ProcXGetDeviceMotionEvents(ClientPtr /* client */
|
int ProcXGetDeviceMotionEvents(ClientPtr /* client */
|
||||||
);
|
);
|
||||||
|
|
||||||
void SRepXGetDeviceMotionEvents(ClientPtr /* client */ ,
|
|
||||||
int /* size */ ,
|
|
||||||
xGetDeviceMotionEventsReply * /* rep */
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif /* GTMOTION_H */
|
#endif /* GTMOTION_H */
|
||||||
|
|
Loading…
Reference in New Issue