Xext: shape: clean up Xinerama dispatch

Simplify the dispatching by moving the branching between Xinerama
vs. single screen into the actual request handlers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1598>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-03 01:40:52 +02:00 committed by Marge Bot
parent 6825f89cd2
commit a57db845bb

View File

@ -225,24 +225,16 @@ ProcShapeQueryVersion(ClientPtr client)
return Success;
}
/*****************
* ProcShapeRectangles
*
*****************/
static int
ProcShapeRectangles(ClientPtr client)
ShapeRectangles(ClientPtr client, xShapeRectanglesReq *stuff)
{
WindowPtr pWin;
REQUEST(xShapeRectanglesReq);
xRectangle *prects;
int nrects, ctype, rc;
RegionPtr srcRgn;
RegionPtr *destRgn;
CreateDftPtr createDefault;
REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
UpdateCurrentTime();
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
@ -297,16 +289,19 @@ ProcShapeRectangles(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
static int
ProcPanoramiXShapeRectangles(ClientPtr client)
ProcShapeRectangles(ClientPtr client)
{
REQUEST(xShapeRectanglesReq);
REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
#ifdef XINERAMA
if (noPanoramiXExtension)
return ShapeRectangles(client, stuff);
PanoramiXRes *win;
int j, result;
REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
client, DixWriteAccess);
if (result != Success)
@ -314,32 +309,27 @@ ProcPanoramiXShapeRectangles(ClientPtr client)
FOR_NSCREENS(j) {
stuff->dest = win->info[j].id;
result = ProcShapeRectangles(client);
result = ShapeRectangles(client, stuff);
if (result != Success)
break;
}
return result;
#else
return ShapeRectangles(client);
#endif
}
#endif /* XINERAMA */
/**************
* ProcShapeMask
**************/
static int
ProcShapeMask(ClientPtr client)
ShapeMask(ClientPtr client, xShapeMaskReq *stuff)
{
WindowPtr pWin;
ScreenPtr pScreen;
REQUEST(xShapeMaskReq);
RegionPtr srcRgn;
RegionPtr *destRgn;
PixmapPtr pPixmap;
CreateDftPtr createDefault;
int rc;
REQUEST_SIZE_MATCH(xShapeMaskReq);
UpdateCurrentTime();
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
@ -395,16 +385,19 @@ ProcShapeMask(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
static int
ProcPanoramiXShapeMask(ClientPtr client)
ProcShapeMask(ClientPtr client)
{
REQUEST(xShapeMaskReq);
REQUEST_SIZE_MATCH(xShapeMaskReq);
#ifdef XINERAMA
if (noPanoramiXExtension)
return ShapeMask(client, stuff);
PanoramiXRes *win, *pmap;
int j, result;
REQUEST_SIZE_MATCH(xShapeMaskReq);
result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
client, DixWriteAccess);
if (result != Success)
@ -423,24 +416,20 @@ ProcPanoramiXShapeMask(ClientPtr client)
stuff->dest = win->info[j].id;
if (pmap)
stuff->src = pmap->info[j].id;
result = ProcShapeMask(client);
result = ShapeMask(client, stuff);
if (result != Success)
break;
}
return result;
#else
return ShapeMask(client, stuff);
#endif
}
#endif /* XINERAMA */
/************
* ProcShapeCombine
************/
static int
ProcShapeCombine(ClientPtr client)
ShapeCombine(ClientPtr client, xShapeCombineReq *stuff)
{
WindowPtr pSrcWin, pDestWin;
REQUEST(xShapeCombineReq);
RegionPtr srcRgn;
RegionPtr *destRgn;
CreateDftPtr createDefault;
@ -448,7 +437,6 @@ ProcShapeCombine(ClientPtr client)
RegionPtr tmp;
int rc;
REQUEST_SIZE_MATCH(xShapeCombineReq);
UpdateCurrentTime();
rc = dixLookupWindow(&pDestWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
@ -523,16 +511,19 @@ ProcShapeCombine(ClientPtr client)
stuff->xOff, stuff->yOff, createDefault);
}
#ifdef XINERAMA
static int
ProcPanoramiXShapeCombine(ClientPtr client)
ProcShapeCombine(ClientPtr client)
{
REQUEST(xShapeCombineReq);
REQUEST_AT_LEAST_SIZE(xShapeCombineReq);
#ifdef XINERAMA
if (noPanoramiXExtension)
return ShapeCombine(client, stuff);
PanoramiXRes *win, *win2;
int j, result;
REQUEST_AT_LEAST_SIZE(xShapeCombineReq);
result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
client, DixWriteAccess);
if (result != Success)
@ -546,28 +537,23 @@ ProcPanoramiXShapeCombine(ClientPtr client)
FOR_NSCREENS(j) {
stuff->dest = win->info[j].id;
stuff->src = win2->info[j].id;
result = ProcShapeCombine(client);
result = ShapeCombine(client, stuff);
if (result != Success)
break;
}
return result;
#else
return ShapeCombine(client, stuff);
#endif
}
#endif /* XINERAMA */
/*************
* ProcShapeOffset
*************/
static int
ProcShapeOffset(ClientPtr client)
ShapeOffset(ClientPtr client, xShapeOffsetReq *stuff)
{
WindowPtr pWin;
REQUEST(xShapeOffsetReq);
RegionPtr srcRgn;
int rc;
REQUEST_SIZE_MATCH(xShapeOffsetReq);
UpdateCurrentTime();
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
@ -594,15 +580,18 @@ ProcShapeOffset(ClientPtr client)
return Success;
}
#ifdef XINERAMA
static int
ProcPanoramiXShapeOffset(ClientPtr client)
ProcShapeOffset(ClientPtr client)
{
REQUEST(xShapeOffsetReq);
REQUEST_AT_LEAST_SIZE(xShapeOffsetReq);
#ifdef XINERAMA
PanoramiXRes *win;
int j, result;
REQUEST_AT_LEAST_SIZE(xShapeOffsetReq);
if (noPanoramiXExtension)
return ShapeOffset(client, stuff);
result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
client, DixWriteAccess);
@ -611,13 +600,15 @@ ProcPanoramiXShapeOffset(ClientPtr client)
FOR_NSCREENS(j) {
stuff->dest = win->info[j].id;
result = ProcShapeOffset(client);
result = ShapeOffset(client, stuff);
if (result != Success)
break;
}
return result;
#else
return ShapeOffset(client, stuff);
#endif
}
#endif /* XINERAMA */
static int
ProcShapeQueryExtents(ClientPtr client)
@ -1035,33 +1026,13 @@ ProcShapeDispatch(ClientPtr client)
case X_ShapeQueryVersion:
return ProcShapeQueryVersion(client);
case X_ShapeRectangles:
#ifdef XINERAMA
if (!noPanoramiXExtension)
return ProcPanoramiXShapeRectangles(client);
else
#endif /* XINERAMA */
return ProcShapeRectangles(client);
return ProcShapeRectangles(client);
case X_ShapeMask:
#ifdef XINERAMA
if (!noPanoramiXExtension)
return ProcPanoramiXShapeMask(client);
else
#endif /* XINERAMA */
return ProcShapeMask(client);
return ProcShapeMask(client);
case X_ShapeCombine:
#ifdef XINERAMA
if (!noPanoramiXExtension)
return ProcPanoramiXShapeCombine(client);
else
#endif /* XINERAMA */
return ProcShapeCombine(client);
return ProcShapeCombine(client);
case X_ShapeOffset:
#ifdef XINERAMA
if (!noPanoramiXExtension)
return ProcPanoramiXShapeOffset(client);
else
#endif /* XINERAMA */
return ProcShapeOffset(client);
return ProcShapeOffset(client);
case X_ShapeQueryExtents:
return ProcShapeQueryExtents(client);
case X_ShapeSelectInput: