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