dix: write out X_QueryTree reply directly
No need for using a complex callback machinery, if we just move the little pieces of byte-swapping directly into the request handler. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
f59ffc7c93
commit
9541233f8d
|
@ -1027,7 +1027,6 @@ ProcGetGeometry(ClientPtr client)
|
|||
int
|
||||
ProcQueryTree(ClientPtr client)
|
||||
{
|
||||
xQueryTreeReply reply;
|
||||
int rc, numChildren = 0;
|
||||
WindowPtr pChild, pWin, pHead;
|
||||
Window *childIDs = (Window *) NULL;
|
||||
|
@ -1039,12 +1038,6 @@ ProcQueryTree(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
reply = (xQueryTreeReply) {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.root = pWin->drawable.pScreen->root->drawable.id,
|
||||
.parent = (pWin->parent) ? pWin->parent->drawable.id : (Window) None
|
||||
};
|
||||
pHead = RealChildHead(pWin);
|
||||
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
|
||||
numChildren++;
|
||||
|
@ -1059,17 +1052,26 @@ ProcQueryTree(ClientPtr client)
|
|||
childIDs[curChild++] = pChild->drawable.id;
|
||||
}
|
||||
|
||||
reply.nChildren = numChildren;
|
||||
reply.length = bytes_to_int32(numChildren * sizeof(Window));
|
||||
xQueryTreeReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.root = pWin->drawable.pScreen->root->drawable.id,
|
||||
.parent = (pWin->parent) ? pWin->parent->drawable.id : (Window) None,
|
||||
.nChildren = numChildren,
|
||||
.length = bytes_to_int32(numChildren * sizeof(Window)),
|
||||
};
|
||||
|
||||
WriteReplyToClient(client, sizeof(xQueryTreeReply), &reply);
|
||||
if (numChildren) {
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||
WriteSwappedDataToClient(client, numChildren * sizeof(Window),
|
||||
childIDs);
|
||||
free(childIDs);
|
||||
if (client->swapped) {
|
||||
SwapLongs(childIDs, rep.length);
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.root);
|
||||
swapl(&rep.parent);
|
||||
swaps(&rep.nChildren);
|
||||
}
|
||||
|
||||
WriteToClient(client, sizeof(rep), &rep);
|
||||
WriteToClient(client, numChildren * sizeof(Window), childIDs);
|
||||
free(childIDs);
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
|
@ -183,17 +183,6 @@ SGenericReply(ClientPtr pClient, int size, xGenericReply * pRep)
|
|||
WriteToClient(pClient, size, pRep);
|
||||
}
|
||||
|
||||
void _X_COLD
|
||||
SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply * pRep)
|
||||
{
|
||||
swaps(&pRep->sequenceNumber);
|
||||
swapl(&pRep->length);
|
||||
swapl(&pRep->root);
|
||||
swapl(&pRep->parent);
|
||||
swaps(&pRep->nChildren);
|
||||
WriteToClient(pClient, size, pRep);
|
||||
}
|
||||
|
||||
void _X_COLD
|
||||
SInternAtomReply(ClientPtr pClient, int size, xInternAtomReply * pRep)
|
||||
{
|
||||
|
|
|
@ -730,7 +730,7 @@ ReplySwapPtr ReplySwapVector[256] = {
|
|||
ReplyNotSwappd,
|
||||
ReplyNotSwappd,
|
||||
ReplyNotSwappd,
|
||||
(ReplySwapPtr) SQueryTreeReply, /* 15 */
|
||||
ReplyNotSwappd, /* 15 */
|
||||
(ReplySwapPtr) SInternAtomReply,
|
||||
(ReplySwapPtr) SGetAtomNameReply,
|
||||
ReplyNotSwappd,
|
||||
|
|
|
@ -42,10 +42,6 @@ extern void SGenericReply(ClientPtr /* pClient */ ,
|
|||
int /* size */ ,
|
||||
xGenericReply * /* pRep */ );
|
||||
|
||||
extern void SQueryTreeReply(ClientPtr /* pClient */ ,
|
||||
int /* size */ ,
|
||||
xQueryTreeReply * /* pRep */ );
|
||||
|
||||
extern void SInternAtomReply(ClientPtr /* pClient */ ,
|
||||
int /* size */ ,
|
||||
xInternAtomReply * /* pRep */ );
|
||||
|
|
Loading…
Reference in New Issue