composite: untwist Xinerama handling
The current way of switching between Xinerama and single-screen handlers is quite complicated and needs call vector tables that are changed on the fly, which in turn makes dispatching more complicated. Reworking this into a simple and straight code flow, where individual request procs just look at a flag to decide whether to call the Xinerama or single screen version. This isn't just much easier to understand (and debug), but also removes the need or the call vectors, thus allowing further simplification of the dispatcher. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
ec4443f070
commit
0bf08776c8
|
@ -54,6 +54,8 @@
|
|||
static CARD8 CompositeReqCode;
|
||||
static DevPrivateKeyRec CompositeClientPrivateKeyRec;
|
||||
|
||||
static int compositeUseXinerama = 0;
|
||||
|
||||
#define CompositeClientPrivateKey (&CompositeClientPrivateKeyRec)
|
||||
RESTYPE CompositeClientWindowType;
|
||||
RESTYPE CompositeClientSubwindowsType;
|
||||
|
@ -139,13 +141,10 @@ ProcCompositeQueryVersion(ClientPtr client)
|
|||
} while (0)
|
||||
|
||||
static int
|
||||
ProcCompositeRedirectWindow(ClientPtr client)
|
||||
SingleCompositeRedirectWindow(ClientPtr client, xCompositeRedirectWindowReq *stuff)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
|
||||
REQUEST(xCompositeRedirectWindowReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
||||
VERIFY_WINDOW(pWin, stuff->window, client,
|
||||
DixSetAttrAccess | DixManageAccess | DixBlendAccess);
|
||||
|
||||
|
@ -153,13 +152,10 @@ ProcCompositeRedirectWindow(ClientPtr client)
|
|||
}
|
||||
|
||||
static int
|
||||
ProcCompositeRedirectSubwindows(ClientPtr client)
|
||||
SingleRedirectSubwindows(ClientPtr client, xCompositeRedirectSubwindowsReq *stuff)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
|
||||
REQUEST(xCompositeRedirectSubwindowsReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
||||
VERIFY_WINDOW(pWin, stuff->window, client,
|
||||
DixSetAttrAccess | DixManageAccess | DixBlendAccess);
|
||||
|
||||
|
@ -167,13 +163,10 @@ ProcCompositeRedirectSubwindows(ClientPtr client)
|
|||
}
|
||||
|
||||
static int
|
||||
ProcCompositeUnredirectWindow(ClientPtr client)
|
||||
SingleCompositeUnredirectWindow(ClientPtr client, xCompositeUnredirectWindowReq *stuff)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
|
||||
REQUEST(xCompositeUnredirectWindowReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
||||
VERIFY_WINDOW(pWin, stuff->window, client,
|
||||
DixSetAttrAccess | DixManageAccess | DixBlendAccess);
|
||||
|
||||
|
@ -181,13 +174,10 @@ ProcCompositeUnredirectWindow(ClientPtr client)
|
|||
}
|
||||
|
||||
static int
|
||||
ProcCompositeUnredirectSubwindows(ClientPtr client)
|
||||
SingleCompositeUnredirectSubwindows(ClientPtr client, xCompositeUnredirectSubwindowsReq* stuff)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
|
||||
REQUEST(xCompositeUnredirectSubwindowsReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
||||
VERIFY_WINDOW(pWin, stuff->window, client,
|
||||
DixSetAttrAccess | DixManageAccess | DixBlendAccess);
|
||||
|
||||
|
@ -224,7 +214,7 @@ ProcCompositeCreateRegionFromBorderClip(ClientPtr client)
|
|||
}
|
||||
|
||||
static int
|
||||
ProcCompositeNameWindowPixmap(ClientPtr client)
|
||||
SingleCompositeNameWindowPixmap(ClientPtr client, xCompositeNameWindowPixmapReq *stuff)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
CompWindowPtr cw;
|
||||
|
@ -232,9 +222,6 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
|
|||
ScreenPtr pScreen;
|
||||
int rc;
|
||||
|
||||
REQUEST(xCompositeNameWindowPixmapReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
||||
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
|
||||
|
||||
pScreen = pWin->drawable.pScreen;
|
||||
|
@ -275,9 +262,8 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
|
|||
}
|
||||
|
||||
static int
|
||||
ProcCompositeGetOverlayWindow(ClientPtr client)
|
||||
SingleCompositeGetOverlayWindow(ClientPtr client, xCompositeGetOverlayWindowReq *stuff)
|
||||
{
|
||||
REQUEST(xCompositeGetOverlayWindowReq);
|
||||
xCompositeGetOverlayWindowReply rep;
|
||||
WindowPtr pWin;
|
||||
ScreenPtr pScreen;
|
||||
|
@ -285,7 +271,6 @@ ProcCompositeGetOverlayWindow(ClientPtr client)
|
|||
CompOverlayClientPtr pOc;
|
||||
int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
|
||||
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
|
||||
pScreen = pWin->drawable.pScreen;
|
||||
|
||||
|
@ -333,13 +318,11 @@ ProcCompositeGetOverlayWindow(ClientPtr client)
|
|||
}
|
||||
|
||||
static int
|
||||
ProcCompositeReleaseOverlayWindow(ClientPtr client)
|
||||
SingleCompositeReleaseOverlayWindow(ClientPtr client, xCompositeReleaseOverlayWindowReq *stuff)
|
||||
{
|
||||
REQUEST(xCompositeReleaseOverlayWindowReq);
|
||||
WindowPtr pWin;
|
||||
CompOverlayClientPtr pOc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
|
||||
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
|
||||
|
||||
/*
|
||||
|
@ -356,6 +339,14 @@ ProcCompositeReleaseOverlayWindow(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
static int ProcCompositeRedirectWindow(ClientPtr client);
|
||||
static int ProcCompositeRedirectSubwindows(ClientPtr client);
|
||||
static int ProcCompositeUnredirectWindow(ClientPtr client);
|
||||
static int ProcCompositeReleaseOverlayWindow(ClientPtr client);
|
||||
static int ProcCompositeUnredirectSubwindows(ClientPtr client);
|
||||
static int ProcCompositeNameWindowPixmap(ClientPtr client);
|
||||
static int ProcCompositeGetOverlayWindow(ClientPtr client);
|
||||
|
||||
static int (*ProcCompositeVector[CompositeNumberRequests]) (ClientPtr) = {
|
||||
ProcCompositeQueryVersion,
|
||||
ProcCompositeRedirectWindow,
|
||||
|
@ -572,20 +563,19 @@ CompositeExtensionInit(void)
|
|||
noCompositeExtension = FALSE;
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
|
||||
int (*PanoramiXSaveCompositeVector[CompositeNumberRequests]) (ClientPtr);
|
||||
|
||||
static int
|
||||
PanoramiXCompositeRedirectWindow(ClientPtr client)
|
||||
ProcCompositeRedirectWindow(ClientPtr client)
|
||||
{
|
||||
PanoramiXRes *win;
|
||||
int rc = 0, j;
|
||||
|
||||
REQUEST(xCompositeRedirectWindowReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
||||
|
||||
#ifdef XINERAMA
|
||||
if (!compositeUseXinerama)
|
||||
return SingleCompositeRedirectWindow(client, stuff);
|
||||
|
||||
PanoramiXRes *win;
|
||||
int rc = 0, j;
|
||||
|
||||
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
||||
client, DixUnknownAccess))) {
|
||||
client->errorValue = stuff->window;
|
||||
|
@ -594,24 +584,30 @@ PanoramiXCompositeRedirectWindow(ClientPtr client)
|
|||
|
||||
FOR_NSCREENS_FORWARD(j) {
|
||||
stuff->window = win->info[j].id;
|
||||
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
||||
rc = SingleCompositeRedirectWindow(client, stuff);
|
||||
if (rc != Success)
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
#else
|
||||
return SingleCompositeRedirectWindow(client, stuff);
|
||||
#endif /* XINERAMA */
|
||||
}
|
||||
|
||||
static int
|
||||
PanoramiXCompositeRedirectSubwindows(ClientPtr client)
|
||||
ProcCompositeRedirectSubwindows(ClientPtr client)
|
||||
{
|
||||
PanoramiXRes *win;
|
||||
int rc = 0, j;
|
||||
|
||||
REQUEST(xCompositeRedirectSubwindowsReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
||||
|
||||
#ifdef XINERAMA
|
||||
if (!compositeUseXinerama)
|
||||
return SingleRedirectSubwindows(client, stuff);
|
||||
|
||||
PanoramiXRes *win;
|
||||
int rc = 0, j;
|
||||
|
||||
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
||||
client, DixUnknownAccess))) {
|
||||
client->errorValue = stuff->window;
|
||||
|
@ -620,50 +616,62 @@ PanoramiXCompositeRedirectSubwindows(ClientPtr client)
|
|||
|
||||
FOR_NSCREENS_FORWARD(j) {
|
||||
stuff->window = win->info[j].id;
|
||||
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
||||
rc = SingleRedirectSubwindows(client, stuff);
|
||||
if (rc != Success)
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
#else
|
||||
return SingleRedirectSubwindows(client, stuff);
|
||||
#endif /* XINERAMA */
|
||||
}
|
||||
|
||||
static int
|
||||
PanoramiXCompositeUnredirectWindow(ClientPtr client)
|
||||
ProcCompositeUnredirectWindow(ClientPtr client)
|
||||
{
|
||||
PanoramiXRes *win;
|
||||
int rc = 0, j;
|
||||
|
||||
REQUEST(xCompositeUnredirectWindowReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
||||
|
||||
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
||||
client, DixUnknownAccess))) {
|
||||
client->errorValue = stuff->window;
|
||||
return rc;
|
||||
}
|
||||
#ifdef XINERAMA
|
||||
if (!compositeUseXinerama)
|
||||
return SingleCompositeUnredirectWindow(client, stuff);
|
||||
|
||||
FOR_NSCREENS_FORWARD(j) {
|
||||
stuff->window = win->info[j].id;
|
||||
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
||||
if (rc != Success)
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int
|
||||
PanoramiXCompositeUnredirectSubwindows(ClientPtr client)
|
||||
{
|
||||
PanoramiXRes *win;
|
||||
int rc = 0, j;
|
||||
|
||||
REQUEST(xCompositeUnredirectSubwindowsReq);
|
||||
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
||||
client, DixUnknownAccess))) {
|
||||
client->errorValue = stuff->window;
|
||||
return rc;
|
||||
}
|
||||
|
||||
FOR_NSCREENS_FORWARD(j) {
|
||||
stuff->window = win->info[j].id;
|
||||
rc = SingleCompositeUnredirectWindow(client, stuff);
|
||||
if (rc != Success)
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
#else
|
||||
return SingleCompositeUnredirectWindow(client, stuff);
|
||||
#endif /* XINERAMA */
|
||||
}
|
||||
|
||||
static int
|
||||
ProcCompositeUnredirectSubwindows(ClientPtr client)
|
||||
{
|
||||
REQUEST(xCompositeUnredirectSubwindowsReq);
|
||||
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
||||
|
||||
#ifdef XINERAMA
|
||||
if (!compositeUseXinerama)
|
||||
return SingleCompositeUnredirectSubwindows(client, stuff);
|
||||
|
||||
PanoramiXRes *win;
|
||||
int rc = 0, j;
|
||||
|
||||
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
||||
client, DixUnknownAccess))) {
|
||||
client->errorValue = stuff->window;
|
||||
|
@ -672,17 +680,27 @@ PanoramiXCompositeUnredirectSubwindows(ClientPtr client)
|
|||
|
||||
FOR_NSCREENS_FORWARD(j) {
|
||||
stuff->window = win->info[j].id;
|
||||
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
||||
rc = SingleCompositeUnredirectSubwindows(client, stuff);
|
||||
if (rc != Success)
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
#else
|
||||
return SingleCompositeUnredirectSubwindows(client, stuff);
|
||||
#endif /* XINERAMA */
|
||||
}
|
||||
|
||||
static int
|
||||
PanoramiXCompositeNameWindowPixmap(ClientPtr client)
|
||||
ProcCompositeNameWindowPixmap(ClientPtr client)
|
||||
{
|
||||
REQUEST(xCompositeNameWindowPixmapReq);
|
||||
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
||||
|
||||
#ifdef XINERAMA
|
||||
if (!compositeUseXinerama)
|
||||
return SingleCompositeNameWindowPixmap(client, stuff);
|
||||
|
||||
WindowPtr pWin;
|
||||
CompWindowPtr cw;
|
||||
PixmapPtr pPixmap;
|
||||
|
@ -690,10 +708,6 @@ PanoramiXCompositeNameWindowPixmap(ClientPtr client)
|
|||
PanoramiXRes *win, *newPix;
|
||||
int i;
|
||||
|
||||
REQUEST(xCompositeNameWindowPixmapReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
||||
|
||||
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
||||
client, DixUnknownAccess))) {
|
||||
client->errorValue = stuff->window;
|
||||
|
@ -746,12 +760,21 @@ PanoramiXCompositeNameWindowPixmap(ClientPtr client)
|
|||
return BadAlloc;
|
||||
|
||||
return Success;
|
||||
#else
|
||||
return SingleCompositeNameWindowPixmap(client, stuff);
|
||||
#endif /* XINERAMA */
|
||||
}
|
||||
|
||||
static int
|
||||
PanoramiXCompositeGetOverlayWindow(ClientPtr client)
|
||||
ProcCompositeGetOverlayWindow(ClientPtr client)
|
||||
{
|
||||
REQUEST(xCompositeGetOverlayWindowReq);
|
||||
REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
|
||||
|
||||
#ifdef XINERAMA
|
||||
if (!compositeUseXinerama)
|
||||
return SingleCompositeGetOverlayWindow(client, stuff);
|
||||
|
||||
xCompositeGetOverlayWindowReply rep;
|
||||
WindowPtr pWin;
|
||||
ScreenPtr pScreen;
|
||||
|
@ -761,8 +784,6 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
|
|||
PanoramiXRes *win, *overlayWin = NULL;
|
||||
int i;
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
|
||||
|
||||
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
||||
client, DixUnknownAccess))) {
|
||||
client->errorValue = stuff->window;
|
||||
|
@ -845,21 +866,27 @@ PanoramiXCompositeGetOverlayWindow(ClientPtr client)
|
|||
swapl(&rep.overlayWin);
|
||||
}
|
||||
WriteToClient(client, sz_xCompositeGetOverlayWindowReply, &rep);
|
||||
|
||||
return Success;
|
||||
#else
|
||||
return SingleCompositeGetOverlayWindow(client, stuff);
|
||||
#endif /* XINERAMA */
|
||||
}
|
||||
|
||||
static int
|
||||
PanoramiXCompositeReleaseOverlayWindow(ClientPtr client)
|
||||
ProcCompositeReleaseOverlayWindow(ClientPtr client)
|
||||
{
|
||||
REQUEST(xCompositeReleaseOverlayWindowReq);
|
||||
REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
|
||||
|
||||
#ifdef XINERAMA
|
||||
if (!compositeUseXinerama)
|
||||
return SingleCompositeReleaseOverlayWindow(client, stuff);
|
||||
|
||||
WindowPtr pWin;
|
||||
CompOverlayClientPtr pOc;
|
||||
PanoramiXRes *win;
|
||||
int i, rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
|
||||
|
||||
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
||||
client, DixUnknownAccess))) {
|
||||
client->errorValue = stuff->window;
|
||||
|
@ -887,41 +914,21 @@ PanoramiXCompositeReleaseOverlayWindow(ClientPtr client)
|
|||
}
|
||||
|
||||
return Success;
|
||||
#else
|
||||
return SingleCompositeReleaseOverlayWindow(client, stuff);
|
||||
#endif /* XINERAMA */
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
void
|
||||
PanoramiXCompositeInit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CompositeNumberRequests; i++)
|
||||
PanoramiXSaveCompositeVector[i] = ProcCompositeVector[i];
|
||||
/*
|
||||
* Stuff in Xinerama aware request processing hooks
|
||||
*/
|
||||
ProcCompositeVector[X_CompositeRedirectWindow] =
|
||||
PanoramiXCompositeRedirectWindow;
|
||||
ProcCompositeVector[X_CompositeRedirectSubwindows] =
|
||||
PanoramiXCompositeRedirectSubwindows;
|
||||
ProcCompositeVector[X_CompositeUnredirectWindow] =
|
||||
PanoramiXCompositeUnredirectWindow;
|
||||
ProcCompositeVector[X_CompositeUnredirectSubwindows] =
|
||||
PanoramiXCompositeUnredirectSubwindows;
|
||||
ProcCompositeVector[X_CompositeNameWindowPixmap] =
|
||||
PanoramiXCompositeNameWindowPixmap;
|
||||
ProcCompositeVector[X_CompositeGetOverlayWindow] =
|
||||
PanoramiXCompositeGetOverlayWindow;
|
||||
ProcCompositeVector[X_CompositeReleaseOverlayWindow] =
|
||||
PanoramiXCompositeReleaseOverlayWindow;
|
||||
compositeUseXinerama = 1;
|
||||
}
|
||||
|
||||
void
|
||||
PanoramiXCompositeReset(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CompositeNumberRequests; i++)
|
||||
ProcCompositeVector[i] = PanoramiXSaveCompositeVector[i];
|
||||
compositeUseXinerama = 0;
|
||||
}
|
||||
|
||||
#endif /* XINERAMA */
|
||||
|
|
Loading…
Reference in New Issue