(!1614) xfixes: 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
fd889145a0
commit
eb0baa881c
|
@ -593,17 +593,33 @@ SProcXFixesFetchRegion(ClientPtr client)
|
|||
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
||||
}
|
||||
|
||||
static int
|
||||
PanoramiXFixesSetGCClipRegion(ClientPtr client, xXFixesSetGCClipRegionReq *stuff);
|
||||
|
||||
static int
|
||||
SingleXFixesSetGCClipRegion(ClientPtr client, xXFixesSetGCClipRegionReq *stuff);
|
||||
|
||||
int
|
||||
ProcXFixesSetGCClipRegion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXFixesSetGCClipRegionReq);
|
||||
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
|
||||
|
||||
#ifdef PANORAMIX
|
||||
if (XFixesUseXinerama)
|
||||
return PanoramiXFixesSetGCClipRegion(client, stuff);
|
||||
#endif
|
||||
return SingleXFixesSetGCClipRegion(client, stuff);
|
||||
}
|
||||
|
||||
static int
|
||||
SingleXFixesSetGCClipRegion(ClientPtr client, xXFixesSetGCClipRegionReq *stuff)
|
||||
{
|
||||
GCPtr pGC;
|
||||
RegionPtr pRegion;
|
||||
ChangeGCVal vals[2];
|
||||
int rc;
|
||||
|
||||
REQUEST(xXFixesSetGCClipRegionReq);
|
||||
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
|
||||
|
||||
rc = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
@ -641,17 +657,14 @@ SProcXFixesSetGCClipRegion(ClientPtr client)
|
|||
|
||||
typedef RegionPtr (*CreateDftPtr) (WindowPtr pWin);
|
||||
|
||||
int
|
||||
ProcXFixesSetWindowShapeRegion(ClientPtr client)
|
||||
static int
|
||||
SingleXFixesSetWindowShapeRegion(ClientPtr client, xXFixesSetWindowShapeRegionReq *stuff)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
RegionPtr pRegion;
|
||||
RegionPtr *pDestRegion;
|
||||
int rc;
|
||||
|
||||
REQUEST(xXFixesSetWindowShapeRegionReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
|
||||
rc = dixLookupResourceByType((void **) &pWin, stuff->dest, X11_RESTYPE_WINDOW,
|
||||
client, DixSetAttrAccess);
|
||||
if (rc != Success) {
|
||||
|
@ -715,6 +728,22 @@ ProcXFixesSetWindowShapeRegion(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
PanoramiXFixesSetWindowShapeRegion(ClientPtr client, xXFixesSetWindowShapeRegionReq *stuff);
|
||||
|
||||
int
|
||||
ProcXFixesSetWindowShapeRegion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXFixesSetWindowShapeRegionReq);
|
||||
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
|
||||
|
||||
#ifdef PANORAMIX
|
||||
if (XFixesUseXinerama)
|
||||
return PanoramiXFixesSetWindowShapeRegion(client, stuff);
|
||||
#endif
|
||||
return SingleXFixesSetWindowShapeRegion(client, stuff);
|
||||
}
|
||||
|
||||
int _X_COLD
|
||||
SProcXFixesSetWindowShapeRegion(ClientPtr client)
|
||||
{
|
||||
|
@ -729,15 +758,31 @@ SProcXFixesSetWindowShapeRegion(ClientPtr client)
|
|||
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
||||
}
|
||||
|
||||
static int
|
||||
SingleXFixesSetPictureClipRegion(ClientPtr client, xXFixesSetPictureClipRegionReq *stuff);
|
||||
|
||||
static int
|
||||
PanoramiXFixesSetPictureClipRegion(ClientPtr client, xXFixesSetPictureClipRegionReq *stuff);
|
||||
|
||||
int
|
||||
ProcXFixesSetPictureClipRegion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXFixesSetPictureClipRegionReq);
|
||||
REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
|
||||
|
||||
#ifdef PANORAMIX
|
||||
if (XFixesUseXinerama)
|
||||
return PanoramiXFixesSetPictureClipRegion(client, stuff);
|
||||
#endif
|
||||
return SingleXFixesSetPictureClipRegion(client, stuff);
|
||||
}
|
||||
|
||||
static int
|
||||
SingleXFixesSetPictureClipRegion(ClientPtr client, xXFixesSetPictureClipRegionReq *stuff)
|
||||
{
|
||||
PicturePtr pPicture;
|
||||
RegionPtr pRegion;
|
||||
|
||||
REQUEST(xXFixesSetPictureClipRegionReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
|
||||
VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
|
||||
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
|
||||
|
||||
|
@ -821,15 +866,12 @@ SProcXFixesExpandRegion(ClientPtr client)
|
|||
#include "panoramiX.h"
|
||||
#include "panoramiXsrv.h"
|
||||
|
||||
int
|
||||
PanoramiXFixesSetGCClipRegion(ClientPtr client)
|
||||
static int
|
||||
PanoramiXFixesSetGCClipRegion(ClientPtr client, xXFixesSetGCClipRegionReq *stuff)
|
||||
{
|
||||
REQUEST(xXFixesSetGCClipRegionReq);
|
||||
int result = Success, j;
|
||||
PanoramiXRes *gc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
|
||||
|
||||
if ((result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
|
||||
client, DixWriteAccess))) {
|
||||
client->errorValue = stuff->gc;
|
||||
|
@ -838,7 +880,7 @@ PanoramiXFixesSetGCClipRegion(ClientPtr client)
|
|||
|
||||
FOR_NSCREENS_BACKWARD(j) {
|
||||
stuff->gc = gc->info[j].id;
|
||||
result = (*PanoramiXSaveXFixesVector[X_XFixesSetGCClipRegion]) (client);
|
||||
result = SingleXFixesSetGCClipRegion(client, stuff);
|
||||
if (result != Success)
|
||||
break;
|
||||
}
|
||||
|
@ -846,17 +888,13 @@ PanoramiXFixesSetGCClipRegion(ClientPtr client)
|
|||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
PanoramiXFixesSetWindowShapeRegion(ClientPtr client)
|
||||
static int
|
||||
PanoramiXFixesSetWindowShapeRegion(ClientPtr client, xXFixesSetWindowShapeRegionReq *stuff)
|
||||
{
|
||||
int result = Success, j;
|
||||
PanoramiXRes *win;
|
||||
RegionPtr reg = NULL;
|
||||
|
||||
REQUEST(xXFixesSetWindowShapeRegionReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
|
||||
|
||||
if ((result = dixLookupResourceByType((void **) &win, stuff->dest,
|
||||
XRT_WINDOW, client,
|
||||
DixWriteAccess))) {
|
||||
|
@ -874,8 +912,7 @@ PanoramiXFixesSetWindowShapeRegion(ClientPtr client)
|
|||
if (reg)
|
||||
RegionTranslate(reg, -screen->x, -screen->y);
|
||||
|
||||
result =
|
||||
(*PanoramiXSaveXFixesVector[X_XFixesSetWindowShapeRegion]) (client);
|
||||
result = SingleXFixesSetWindowShapeRegion(client, stuff);
|
||||
|
||||
if (reg)
|
||||
RegionTranslate(reg, screen->x, screen->y);
|
||||
|
@ -887,16 +924,13 @@ PanoramiXFixesSetWindowShapeRegion(ClientPtr client)
|
|||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
PanoramiXFixesSetPictureClipRegion(ClientPtr client)
|
||||
static int
|
||||
PanoramiXFixesSetPictureClipRegion(ClientPtr client, xXFixesSetPictureClipRegionReq *stuff)
|
||||
{
|
||||
REQUEST(xXFixesSetPictureClipRegionReq);
|
||||
int result = Success, j;
|
||||
PanoramiXRes *pict;
|
||||
RegionPtr reg = NULL;
|
||||
|
||||
REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
|
||||
|
||||
if ((result = dixLookupResourceByType((void **) &pict, stuff->picture,
|
||||
XRT_PICTURE, client,
|
||||
DixWriteAccess))) {
|
||||
|
@ -914,8 +948,7 @@ PanoramiXFixesSetPictureClipRegion(ClientPtr client)
|
|||
if (reg)
|
||||
RegionTranslate(reg, -screen->x, -screen->y);
|
||||
|
||||
result =
|
||||
(*PanoramiXSaveXFixesVector[X_XFixesSetPictureClipRegion]) (client);
|
||||
result = SingleXFixesSetPictureClipRegion(client, stuff);
|
||||
|
||||
if (reg)
|
||||
RegionTranslate(reg, screen->x, screen->y);
|
||||
|
|
|
@ -256,32 +256,18 @@ XFixesExtensionInit(void)
|
|||
|
||||
#ifdef PANORAMIX
|
||||
|
||||
int (*PanoramiXSaveXFixesVector[XFixesNumberRequests]) (ClientPtr);
|
||||
int XFixesUseXinerama = 0;
|
||||
|
||||
void
|
||||
PanoramiXFixesInit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < XFixesNumberRequests; i++)
|
||||
PanoramiXSaveXFixesVector[i] = ProcXFixesVector[i];
|
||||
/*
|
||||
* Stuff in Xinerama aware request processing hooks
|
||||
*/
|
||||
ProcXFixesVector[X_XFixesSetGCClipRegion] = PanoramiXFixesSetGCClipRegion;
|
||||
ProcXFixesVector[X_XFixesSetWindowShapeRegion] =
|
||||
PanoramiXFixesSetWindowShapeRegion;
|
||||
ProcXFixesVector[X_XFixesSetPictureClipRegion] =
|
||||
PanoramiXFixesSetPictureClipRegion;
|
||||
XFixesUseXinerama = 1;
|
||||
}
|
||||
|
||||
void
|
||||
PanoramiXFixesReset(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < XFixesNumberRequests; i++)
|
||||
ProcXFixesVector[i] = PanoramiXSaveXFixesVector[i];
|
||||
XFixesUseXinerama = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include "xfixes.h"
|
||||
|
||||
extern int XFixesEventBase;
|
||||
extern int XFixesUseXinerama;
|
||||
|
||||
typedef struct _XFixesClient {
|
||||
CARD32 major_version;
|
||||
|
@ -252,15 +253,6 @@ int
|
|||
int
|
||||
SProcXFixesExpandRegion(ClientPtr client);
|
||||
|
||||
int
|
||||
PanoramiXFixesSetGCClipRegion(ClientPtr client);
|
||||
|
||||
int
|
||||
PanoramiXFixesSetWindowShapeRegion(ClientPtr client);
|
||||
|
||||
int
|
||||
PanoramiXFixesSetPictureClipRegion(ClientPtr client);
|
||||
|
||||
/* Cursor Visibility (Version 4) */
|
||||
|
||||
int
|
||||
|
@ -311,7 +303,6 @@ Bool
|
|||
|
||||
/* Xinerama */
|
||||
#ifdef PANORAMIX
|
||||
extern int (*PanoramiXSaveXFixesVector[XFixesNumberRequests]) (ClientPtr);
|
||||
void PanoramiXFixesInit(void);
|
||||
void PanoramiXFixesReset(void);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue