dix: write out X_GetWindowAttributes 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
71139c015e
commit
f59ffc7c93
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -718,7 +718,7 @@ ReplySwapPtr ReplySwapVector[256] = {
|
|||
ReplyNotSwappd,
|
||||
ReplyNotSwappd,
|
||||
ReplyNotSwappd,
|
||||
(ReplySwapPtr) SGetWindowAttributesReply,
|
||||
ReplyNotSwappd,
|
||||
ReplyNotSwappd,
|
||||
ReplyNotSwappd, /* 5 */
|
||||
ReplyNotSwappd,
|
||||
|
|
80
dix/window.c
80
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
|
||||
|
|
|
@ -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 */ );
|
||||
|
|
Loading…
Reference in New Issue