diff --git a/dix/dispatch.c b/dix/dispatch.c index 01527fddd..cb82d890f 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -789,25 +789,6 @@ ProcChangeWindowAttributes(ClientPtr client) stuff->valueMask, (XID *) &stuff[1], client); } -int -ProcGetWindowAttributes(ClientPtr client) -{ - WindowPtr pWin; - - REQUEST(xResourceReq); - xGetWindowAttributesReply wa; - int rc; - - REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); - if (rc != Success) - return rc; - memset(&wa, 0, sizeof(xGetWindowAttributesReply)); - GetWindowAttributes(pWin, client, &wa); - WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa); - return Success; -} - int ProcDestroyWindow(ClientPtr client) { diff --git a/dix/swaprep.c b/dix/swaprep.c index 892d55b10..1cacbca38 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -183,24 +183,6 @@ SGenericReply(ClientPtr pClient, int size, xGenericReply * pRep) WriteToClient(pClient, size, pRep); } -/* Extra-large reply */ -void _X_COLD -SGetWindowAttributesReply(ClientPtr pClient, int size, - xGetWindowAttributesReply * pRep) -{ - swaps(&pRep->sequenceNumber); - swapl(&pRep->length); - swapl(&pRep->visualID); - swaps(&pRep->class); - swapl(&pRep->backingBitPlanes); - swapl(&pRep->backingPixel); - swapl(&pRep->colormap); - swapl(&pRep->allEventMasks); - swapl(&pRep->yourEventMask); - swaps(&pRep->doNotPropagateMask); - WriteToClient(pClient, size, pRep); -} - void _X_COLD SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply * pRep) { diff --git a/dix/tables.c b/dix/tables.c index faa391f61..d0ae6ed78 100644 --- a/dix/tables.c +++ b/dix/tables.c @@ -718,7 +718,7 @@ ReplySwapPtr ReplySwapVector[256] = { ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, - (ReplySwapPtr) SGetWindowAttributesReply, + ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 5 */ ReplyNotSwappd, diff --git a/dix/window.c b/dix/window.c index 3f09bc05f..66e8cf36c 100644 --- a/dix/window.c +++ b/dix/window.c @@ -100,6 +100,7 @@ Equipment Corporation. #include "dix/colormap_priv.h" #include "dix/cursor_priv.h" +#include "dix/dispatch.h" #include "dix/dix_priv.h" #include "dix/exevents_priv.h" #include "dix/input_priv.h" @@ -1582,42 +1583,55 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) return error; } -/***** - * GetWindowAttributes - * Notice that this is different than ChangeWindowAttributes - *****/ - -void -GetWindowAttributes(WindowPtr pWin, ClientPtr client, - xGetWindowAttributesReply * wa) +int +ProcGetWindowAttributes(ClientPtr client) { - wa->type = X_Reply; - wa->bitGravity = pWin->bitGravity; - wa->winGravity = pWin->winGravity; - wa->backingStore = pWin->backingStore; - wa->length = bytes_to_int32(sizeof(xGetWindowAttributesReply) - - sizeof(xGenericReply)); - wa->sequenceNumber = client->sequence; - wa->backingBitPlanes = wBackingBitPlanes(pWin); - wa->backingPixel = wBackingPixel(pWin); - wa->saveUnder = (BOOL) pWin->saveUnder; - wa->override = pWin->overrideRedirect; - if (!pWin->mapped) - wa->mapState = IsUnmapped; - else if (pWin->realized) - wa->mapState = IsViewable; - else - wa->mapState = IsUnviewable; + REQUEST(xResourceReq); + REQUEST_SIZE_MATCH(xResourceReq); - wa->colormap = wColormap(pWin); - wa->mapInstalled = (wa->colormap == None) ? xFalse - : IsMapInstalled(wa->colormap, pWin); + WindowPtr pWin; + int rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); + if (rc != Success) + return rc; - wa->yourEventMask = EventMaskForClient(pWin, client); - wa->allEventMasks = pWin->eventMask | wOtherEventMasks(pWin); - wa->doNotPropagateMask = wDontPropagateMask(pWin); - wa->class = pWin->drawable.class; - wa->visualID = wVisual(pWin); + xGetWindowAttributesReply rep = { + .type = X_Reply, + .bitGravity = pWin->bitGravity, + .winGravity = pWin->winGravity, + .backingStore = pWin->backingStore, + .length = bytes_to_int32(sizeof(xGetWindowAttributesReply) - + sizeof(xGenericReply)), + .sequenceNumber = client->sequence, + .backingBitPlanes = wBackingBitPlanes(pWin), + .backingPixel = wBackingPixel(pWin), + .saveUnder = (BOOL) pWin->saveUnder, + .override = pWin->overrideRedirect, + .mapState = (!pWin->mapped ? IsUnmapped : + (pWin->realized ? IsViewable : IsUnviewable)), + .colormap = wColormap(pWin), + .mapInstalled = (wColormap(pWin) == None) ? xFalse + : IsMapInstalled(wColormap(pWin), pWin), + .yourEventMask = EventMaskForClient(pWin, client), + .allEventMasks = pWin->eventMask | wOtherEventMasks(pWin), + .doNotPropagateMask = wDontPropagateMask(pWin), + .class = pWin->drawable.class, + .visualID = wVisual(pWin), + }; + + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.visualID); + swaps(&rep.class); + swapl(&rep.backingBitPlanes); + swapl(&rep.backingPixel); + swapl(&rep.colormap); + swapl(&rep.allEventMasks); + swapl(&rep.yourEventMask); + swaps(&rep.doNotPropagateMask); + } + WriteToClient(client, sizeof(rep), &rep); + return Success; } WindowPtr diff --git a/include/swaprep.h b/include/swaprep.h index 92032f6d1..cd2368990 100644 --- a/include/swaprep.h +++ b/include/swaprep.h @@ -42,11 +42,6 @@ extern void SGenericReply(ClientPtr /* pClient */ , int /* size */ , xGenericReply * /* pRep */ ); -extern void SGetWindowAttributesReply(ClientPtr /* pClient */ , - int /* size */ , - xGetWindowAttributesReply * - /* pRep */ ); - extern void SQueryTreeReply(ClientPtr /* pClient */ , int /* size */ , xQueryTreeReply * /* pRep */ );