mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 10:14:52 +00:00
dix: ProcGetMotionEvents(): simplify writing out xTimecoord
The swapping is so trivial, we don't need several extra functions for that - just do it right where the header fields are swapped. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
dcf7890076
commit
731ace6c13
@@ -2477,7 +2477,7 @@ ProcGetMotionEvents(ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
xTimecoord *coords = (xTimecoord *) NULL;
|
||||
int i, count, xmin, xmax, ymin, ymax, rc;
|
||||
int count, xmin, xmax, ymin, ymax, rc;
|
||||
unsigned long nEvents;
|
||||
DeviceIntPtr mouse = PickPointer(client);
|
||||
TimeStamp start, stop;
|
||||
@@ -2513,7 +2513,7 @@ ProcGetMotionEvents(ClientPtr client)
|
||||
ymin = pWin->drawable.y - wBorderWidth(pWin);
|
||||
ymax = pWin->drawable.y + (int) pWin->drawable.height +
|
||||
wBorderWidth(pWin);
|
||||
for (i = 0; i < count; i++)
|
||||
for (int i = 0; i < count; i++)
|
||||
if ((xmin <= coords[i].x) && (coords[i].x < xmax) &&
|
||||
(ymin <= coords[i].y) && (coords[i].y < ymax)) {
|
||||
coords[nEvents].time = coords[i].time;
|
||||
@@ -2534,13 +2534,15 @@ ProcGetMotionEvents(ClientPtr client)
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.nEvents);
|
||||
for (int i = 0; i < nEvents; i++) {
|
||||
swapl(&coords[i].time);
|
||||
swaps(&coords[i].x);
|
||||
swaps(&coords[i].y);
|
||||
}
|
||||
}
|
||||
|
||||
WriteToClient(client, sizeof(xGetMotionEventsReply), &rep);
|
||||
if (nEvents) {
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) SwapTimeCoordWrite;
|
||||
WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord),
|
||||
(char *) coords);
|
||||
}
|
||||
WriteToClient(client, nEvents * sizeof(xTimecoord), coords);
|
||||
free(coords);
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -181,30 +181,6 @@ SGenericReply(ClientPtr pClient, int size, xGenericReply * pRep)
|
||||
WriteToClient(pClient, size, pRep);
|
||||
}
|
||||
|
||||
static void _X_COLD
|
||||
SwapTimecoord(xTimecoord * pCoord)
|
||||
{
|
||||
swapl(&pCoord->time);
|
||||
swaps(&pCoord->x);
|
||||
swaps(&pCoord->y);
|
||||
}
|
||||
|
||||
void _X_COLD
|
||||
SwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord * pRep)
|
||||
{
|
||||
int i, n;
|
||||
xTimecoord *pRepT;
|
||||
|
||||
n = size / sizeof(xTimecoord);
|
||||
pRepT = pRep;
|
||||
for (i = 0; i < n; i++) {
|
||||
SwapTimecoord(pRepT);
|
||||
pRepT++;
|
||||
}
|
||||
WriteToClient(pClient, size, pRep);
|
||||
|
||||
}
|
||||
|
||||
static void _X_COLD
|
||||
SwapCharInfo(xCharInfo * pInfo)
|
||||
{
|
||||
|
||||
@@ -44,10 +44,6 @@ extern void SGenericReply(ClientPtr /* pClient */ ,
|
||||
int /* size */ ,
|
||||
xGenericReply * /* pRep */ );
|
||||
|
||||
extern void SwapTimeCoordWrite(ClientPtr /* pClient */ ,
|
||||
int /* size */ ,
|
||||
xTimecoord * /* pRep */ );
|
||||
|
||||
extern void SErrorEvent(xError * /* from */ ,
|
||||
xError * /* to */ );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user