Xext: shape: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros

Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2024-07-03 02:45:34 +02:00
committed by Enrico Weigelt
parent e482321d03
commit b39baf6a07

View File

@@ -225,7 +225,7 @@ CreateClipShape(WindowPtr pWin)
static int static int
ProcShapeQueryVersion(ClientPtr client) ProcShapeQueryVersion(ClientPtr client)
{ {
REQUEST_SIZE_MATCH(xShapeQueryVersionReq); X_REQUEST_HEAD_STRUCT(xShapeQueryVersionReq);
xShapeQueryVersionReply reply = { xShapeQueryVersionReply reply = {
.majorVersion = SERVER_SHAPE_MAJOR_VERSION, .majorVersion = SERVER_SHAPE_MAJOR_VERSION,
@@ -308,15 +308,11 @@ ShapeRectangles(ClientPtr client, xShapeRectanglesReq *stuff)
static int static int
ProcShapeRectangles(ClientPtr client) ProcShapeRectangles(ClientPtr client)
{ {
REQUEST(xShapeRectanglesReq); X_REQUEST_HEAD_AT_LEAST(xShapeRectanglesReq);
REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq); X_REQUEST_FIELD_CARD32(dest);
X_REQUEST_FIELD_CARD16(xOff);
if (client->swapped) { X_REQUEST_FIELD_CARD16(yOff);
swapl(&stuff->dest); X_REQUEST_REST_CARD16();
swaps(&stuff->xOff);
swaps(&stuff->yOff);
SwapRestS(stuff);
}
#ifdef XINERAMA #ifdef XINERAMA
if (noPanoramiXExtension) if (noPanoramiXExtension)
@@ -413,15 +409,11 @@ ShapeMask(ClientPtr client, xShapeMaskReq *stuff)
static int static int
ProcShapeMask(ClientPtr client) ProcShapeMask(ClientPtr client)
{ {
REQUEST(xShapeMaskReq); X_REQUEST_HEAD_STRUCT(xShapeMaskReq);
REQUEST_SIZE_MATCH(xShapeMaskReq); X_REQUEST_FIELD_CARD32(dest);
X_REQUEST_FIELD_CARD16(xOff);
if (client->swapped) { X_REQUEST_FIELD_CARD16(yOff);
swapl(&stuff->dest); X_REQUEST_FIELD_CARD32(src);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
swapl(&stuff->src);
}
#ifdef XINERAMA #ifdef XINERAMA
if (noPanoramiXExtension) if (noPanoramiXExtension)
@@ -549,15 +541,11 @@ ShapeCombine(ClientPtr client, xShapeCombineReq *stuff)
static int static int
ProcShapeCombine(ClientPtr client) ProcShapeCombine(ClientPtr client)
{ {
REQUEST(xShapeCombineReq); X_REQUEST_HEAD_AT_LEAST(xShapeCombineReq);
REQUEST_AT_LEAST_SIZE(xShapeCombineReq); X_REQUEST_FIELD_CARD32(dest);
X_REQUEST_FIELD_CARD16(xOff);
if (client->swapped) { X_REQUEST_FIELD_CARD16(yOff);
swapl(&stuff->dest); X_REQUEST_FIELD_CARD32(src);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
swapl(&stuff->src);
}
#ifdef XINERAMA #ifdef XINERAMA
if (noPanoramiXExtension) if (noPanoramiXExtension)
@@ -626,14 +614,10 @@ ShapeOffset(ClientPtr client, xShapeOffsetReq *stuff)
static int static int
ProcShapeOffset(ClientPtr client) ProcShapeOffset(ClientPtr client)
{ {
REQUEST(xShapeOffsetReq); X_REQUEST_HEAD_AT_LEAST(xShapeOffsetReq);
REQUEST_AT_LEAST_SIZE(xShapeOffsetReq); X_REQUEST_FIELD_CARD32(dest);
X_REQUEST_FIELD_CARD16(yOff);
if (client->swapped) { X_REQUEST_FIELD_CARD16(yOff);
swapl(&stuff->dest);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
}
#ifdef XINERAMA #ifdef XINERAMA
PanoramiXRes *win; PanoramiXRes *win;
@@ -663,11 +647,8 @@ ProcShapeOffset(ClientPtr client)
static int static int
ProcShapeQueryExtents(ClientPtr client) ProcShapeQueryExtents(ClientPtr client)
{ {
REQUEST(xShapeQueryExtentsReq); X_REQUEST_HEAD_STRUCT(xShapeQueryExtentsReq);
REQUEST_SIZE_MATCH(xShapeQueryExtentsReq); X_REQUEST_FIELD_CARD32(window);
if (client->swapped)
swapl(&stuff->window);
WindowPtr pWin; WindowPtr pWin;
int rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); int rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
@@ -732,7 +713,9 @@ ProcShapeQueryExtents(ClientPtr client)
static int static int
ProcShapeSelectInput(ClientPtr client) ProcShapeSelectInput(ClientPtr client)
{ {
REQUEST(xShapeSelectInputReq); X_REQUEST_HEAD_STRUCT(xShapeSelectInputReq);
X_REQUEST_FIELD_CARD32(window);
WindowPtr pWin; WindowPtr pWin;
ShapeEventPtr pNewShapeEvent; ShapeEventPtr pNewShapeEvent;
int rc; int rc;
@@ -855,15 +838,12 @@ SendShapeNotify(WindowPtr pWin, int which)
static int static int
ProcShapeInputSelected(ClientPtr client) ProcShapeInputSelected(ClientPtr client)
{ {
REQUEST(xShapeInputSelectedReq); X_REQUEST_HEAD_STRUCT(xShapeInputSelectedReq);
X_REQUEST_FIELD_CARD32(window);
WindowPtr pWin; WindowPtr pWin;
int enabled, rc; int enabled, rc;
REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
if (client->swapped)
swapl(&stuff->window);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
@@ -889,16 +869,13 @@ ProcShapeInputSelected(ClientPtr client)
static int static int
ProcShapeGetRectangles(ClientPtr client) ProcShapeGetRectangles(ClientPtr client)
{ {
REQUEST(xShapeGetRectanglesReq); X_REQUEST_HEAD_STRUCT(xShapeGetRectanglesReq);
X_REQUEST_FIELD_CARD32(window);
WindowPtr pWin; WindowPtr pWin;
int nrects, rc; int nrects, rc;
RegionPtr region; RegionPtr region;
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
if (client->swapped)
swapl(&stuff->window);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;