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
f57131165a
commit
4bfa7ba6f0
|
@ -567,17 +567,33 @@ SProcXFixesFetchRegion(ClientPtr client)
|
||||||
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
PanoramiXFixesSetGCClipRegion(ClientPtr client, xXFixesSetGCClipRegionReq *stuff);
|
||||||
|
|
||||||
|
static int
|
||||||
|
SingleXFixesSetGCClipRegion(ClientPtr client, xXFixesSetGCClipRegionReq *stuff);
|
||||||
|
|
||||||
int
|
int
|
||||||
ProcXFixesSetGCClipRegion(ClientPtr client)
|
ProcXFixesSetGCClipRegion(ClientPtr client)
|
||||||
|
{
|
||||||
|
REQUEST(xXFixesSetGCClipRegionReq);
|
||||||
|
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
|
||||||
|
|
||||||
|
#ifdef XINERAMA
|
||||||
|
if (XFixesUseXinerama)
|
||||||
|
return PanoramiXFixesSetGCClipRegion(client, stuff);
|
||||||
|
#endif
|
||||||
|
return SingleXFixesSetGCClipRegion(client, stuff);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
SingleXFixesSetGCClipRegion(ClientPtr client, xXFixesSetGCClipRegionReq *stuff)
|
||||||
{
|
{
|
||||||
GCPtr pGC;
|
GCPtr pGC;
|
||||||
RegionPtr pRegion;
|
RegionPtr pRegion;
|
||||||
ChangeGCVal vals[2];
|
ChangeGCVal vals[2];
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xXFixesSetGCClipRegionReq);
|
|
||||||
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
|
|
||||||
|
|
||||||
rc = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
|
rc = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -613,17 +629,14 @@ SProcXFixesSetGCClipRegion(ClientPtr client)
|
||||||
|
|
||||||
typedef RegionPtr (*CreateDftPtr) (WindowPtr pWin);
|
typedef RegionPtr (*CreateDftPtr) (WindowPtr pWin);
|
||||||
|
|
||||||
int
|
static int
|
||||||
ProcXFixesSetWindowShapeRegion(ClientPtr client)
|
SingleXFixesSetWindowShapeRegion(ClientPtr client, xXFixesSetWindowShapeRegionReq *stuff)
|
||||||
{
|
{
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
RegionPtr pRegion;
|
RegionPtr pRegion;
|
||||||
RegionPtr *pDestRegion;
|
RegionPtr *pDestRegion;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xXFixesSetWindowShapeRegionReq);
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
|
|
||||||
rc = dixLookupResourceByType((void **) &pWin, stuff->dest, X11_RESTYPE_WINDOW,
|
rc = dixLookupResourceByType((void **) &pWin, stuff->dest, X11_RESTYPE_WINDOW,
|
||||||
client, DixSetAttrAccess);
|
client, DixSetAttrAccess);
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
|
@ -687,6 +700,22 @@ ProcXFixesSetWindowShapeRegion(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
PanoramiXFixesSetWindowShapeRegion(ClientPtr client, xXFixesSetWindowShapeRegionReq *stuff);
|
||||||
|
|
||||||
|
int
|
||||||
|
ProcXFixesSetWindowShapeRegion(ClientPtr client)
|
||||||
|
{
|
||||||
|
REQUEST(xXFixesSetWindowShapeRegionReq);
|
||||||
|
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
|
||||||
|
|
||||||
|
#ifdef XINERAMA
|
||||||
|
if (XFixesUseXinerama)
|
||||||
|
return PanoramiXFixesSetWindowShapeRegion(client, stuff);
|
||||||
|
#endif
|
||||||
|
return SingleXFixesSetWindowShapeRegion(client, stuff);
|
||||||
|
}
|
||||||
|
|
||||||
int _X_COLD
|
int _X_COLD
|
||||||
SProcXFixesSetWindowShapeRegion(ClientPtr client)
|
SProcXFixesSetWindowShapeRegion(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -699,15 +728,31 @@ SProcXFixesSetWindowShapeRegion(ClientPtr client)
|
||||||
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
SingleXFixesSetPictureClipRegion(ClientPtr client, xXFixesSetPictureClipRegionReq *stuff);
|
||||||
|
|
||||||
|
static int
|
||||||
|
PanoramiXFixesSetPictureClipRegion(ClientPtr client, xXFixesSetPictureClipRegionReq *stuff);
|
||||||
|
|
||||||
int
|
int
|
||||||
ProcXFixesSetPictureClipRegion(ClientPtr client)
|
ProcXFixesSetPictureClipRegion(ClientPtr client)
|
||||||
|
{
|
||||||
|
REQUEST(xXFixesSetPictureClipRegionReq);
|
||||||
|
REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
|
||||||
|
|
||||||
|
#ifdef XINERAMA
|
||||||
|
if (XFixesUseXinerama)
|
||||||
|
return PanoramiXFixesSetPictureClipRegion(client, stuff);
|
||||||
|
#endif
|
||||||
|
return SingleXFixesSetPictureClipRegion(client, stuff);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
SingleXFixesSetPictureClipRegion(ClientPtr client, xXFixesSetPictureClipRegionReq *stuff)
|
||||||
{
|
{
|
||||||
PicturePtr pPicture;
|
PicturePtr pPicture;
|
||||||
RegionPtr pRegion;
|
RegionPtr pRegion;
|
||||||
|
|
||||||
REQUEST(xXFixesSetPictureClipRegionReq);
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
|
|
||||||
VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
|
VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
|
||||||
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
|
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
|
||||||
|
|
||||||
|
@ -785,15 +830,12 @@ SProcXFixesExpandRegion(ClientPtr client)
|
||||||
|
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
|
|
||||||
int
|
static int
|
||||||
PanoramiXFixesSetGCClipRegion(ClientPtr client)
|
PanoramiXFixesSetGCClipRegion(ClientPtr client, xXFixesSetGCClipRegionReq *stuff)
|
||||||
{
|
{
|
||||||
REQUEST(xXFixesSetGCClipRegionReq);
|
|
||||||
int result = Success, j;
|
int result = Success, j;
|
||||||
PanoramiXRes *gc;
|
PanoramiXRes *gc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
|
|
||||||
|
|
||||||
if ((result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
|
if ((result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
|
||||||
client, DixWriteAccess))) {
|
client, DixWriteAccess))) {
|
||||||
client->errorValue = stuff->gc;
|
client->errorValue = stuff->gc;
|
||||||
|
@ -802,7 +844,7 @@ PanoramiXFixesSetGCClipRegion(ClientPtr client)
|
||||||
|
|
||||||
FOR_NSCREENS_BACKWARD(j) {
|
FOR_NSCREENS_BACKWARD(j) {
|
||||||
stuff->gc = gc->info[j].id;
|
stuff->gc = gc->info[j].id;
|
||||||
result = (*PanoramiXSaveXFixesVector[X_XFixesSetGCClipRegion]) (client);
|
result = SingleXFixesSetGCClipRegion(client, stuff);
|
||||||
if (result != Success)
|
if (result != Success)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -810,17 +852,13 @@ PanoramiXFixesSetGCClipRegion(ClientPtr client)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
PanoramiXFixesSetWindowShapeRegion(ClientPtr client)
|
PanoramiXFixesSetWindowShapeRegion(ClientPtr client, xXFixesSetWindowShapeRegionReq *stuff)
|
||||||
{
|
{
|
||||||
int result = Success, j;
|
int result = Success, j;
|
||||||
PanoramiXRes *win;
|
PanoramiXRes *win;
|
||||||
RegionPtr reg = NULL;
|
RegionPtr reg = NULL;
|
||||||
|
|
||||||
REQUEST(xXFixesSetWindowShapeRegionReq);
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
|
|
||||||
|
|
||||||
if ((result = dixLookupResourceByType((void **) &win, stuff->dest,
|
if ((result = dixLookupResourceByType((void **) &win, stuff->dest,
|
||||||
XRT_WINDOW, client,
|
XRT_WINDOW, client,
|
||||||
DixWriteAccess))) {
|
DixWriteAccess))) {
|
||||||
|
@ -838,8 +876,7 @@ PanoramiXFixesSetWindowShapeRegion(ClientPtr client)
|
||||||
if (reg)
|
if (reg)
|
||||||
RegionTranslate(reg, -screen->x, -screen->y);
|
RegionTranslate(reg, -screen->x, -screen->y);
|
||||||
|
|
||||||
result =
|
result = SingleXFixesSetWindowShapeRegion(client, stuff);
|
||||||
(*PanoramiXSaveXFixesVector[X_XFixesSetWindowShapeRegion]) (client);
|
|
||||||
|
|
||||||
if (reg)
|
if (reg)
|
||||||
RegionTranslate(reg, screen->x, screen->y);
|
RegionTranslate(reg, screen->x, screen->y);
|
||||||
|
@ -851,16 +888,13 @@ PanoramiXFixesSetWindowShapeRegion(ClientPtr client)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
PanoramiXFixesSetPictureClipRegion(ClientPtr client)
|
PanoramiXFixesSetPictureClipRegion(ClientPtr client, xXFixesSetPictureClipRegionReq *stuff)
|
||||||
{
|
{
|
||||||
REQUEST(xXFixesSetPictureClipRegionReq);
|
|
||||||
int result = Success, j;
|
int result = Success, j;
|
||||||
PanoramiXRes *pict;
|
PanoramiXRes *pict;
|
||||||
RegionPtr reg = NULL;
|
RegionPtr reg = NULL;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
|
|
||||||
|
|
||||||
if ((result = dixLookupResourceByType((void **) &pict, stuff->picture,
|
if ((result = dixLookupResourceByType((void **) &pict, stuff->picture,
|
||||||
XRT_PICTURE, client,
|
XRT_PICTURE, client,
|
||||||
DixWriteAccess))) {
|
DixWriteAccess))) {
|
||||||
|
@ -878,8 +912,7 @@ PanoramiXFixesSetPictureClipRegion(ClientPtr client)
|
||||||
if (reg)
|
if (reg)
|
||||||
RegionTranslate(reg, -screen->x, -screen->y);
|
RegionTranslate(reg, -screen->x, -screen->y);
|
||||||
|
|
||||||
result =
|
result = SingleXFixesSetPictureClipRegion(client, stuff);
|
||||||
(*PanoramiXSaveXFixesVector[X_XFixesSetPictureClipRegion]) (client);
|
|
||||||
|
|
||||||
if (reg)
|
if (reg)
|
||||||
RegionTranslate(reg, screen->x, screen->y);
|
RegionTranslate(reg, screen->x, screen->y);
|
||||||
|
|
|
@ -257,32 +257,18 @@ XFixesExtensionInit(void)
|
||||||
|
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
|
|
||||||
int (*PanoramiXSaveXFixesVector[XFixesNumberRequests]) (ClientPtr);
|
int XFixesUseXinerama = 0;
|
||||||
|
|
||||||
void
|
void
|
||||||
PanoramiXFixesInit(void)
|
PanoramiXFixesInit(void)
|
||||||
{
|
{
|
||||||
int i;
|
XFixesUseXinerama = 1;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PanoramiXFixesReset(void)
|
PanoramiXFixesReset(void)
|
||||||
{
|
{
|
||||||
int i;
|
XFixesUseXinerama = 0;
|
||||||
|
|
||||||
for (i = 0; i < XFixesNumberRequests; i++)
|
|
||||||
ProcXFixesVector[i] = PanoramiXSaveXFixesVector[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* XINERAMA */
|
#endif /* XINERAMA */
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
#include "xfixes.h"
|
#include "xfixes.h"
|
||||||
|
|
||||||
extern int XFixesEventBase;
|
extern int XFixesEventBase;
|
||||||
|
extern int XFixesUseXinerama;
|
||||||
|
|
||||||
typedef struct _XFixesClient {
|
typedef struct _XFixesClient {
|
||||||
CARD32 major_version;
|
CARD32 major_version;
|
||||||
|
@ -252,15 +253,6 @@ int
|
||||||
int
|
int
|
||||||
SProcXFixesExpandRegion(ClientPtr client);
|
SProcXFixesExpandRegion(ClientPtr client);
|
||||||
|
|
||||||
int
|
|
||||||
PanoramiXFixesSetGCClipRegion(ClientPtr client);
|
|
||||||
|
|
||||||
int
|
|
||||||
PanoramiXFixesSetWindowShapeRegion(ClientPtr client);
|
|
||||||
|
|
||||||
int
|
|
||||||
PanoramiXFixesSetPictureClipRegion(ClientPtr client);
|
|
||||||
|
|
||||||
/* Cursor Visibility (Version 4) */
|
/* Cursor Visibility (Version 4) */
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -311,7 +303,6 @@ Bool
|
||||||
|
|
||||||
/* Xinerama */
|
/* Xinerama */
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
extern int (*PanoramiXSaveXFixesVector[XFixesNumberRequests]) (ClientPtr);
|
|
||||||
void PanoramiXFixesInit(void);
|
void PanoramiXFixesInit(void);
|
||||||
void PanoramiXFixesReset(void);
|
void PanoramiXFixesReset(void);
|
||||||
#endif /* XINERAMA */
|
#endif /* XINERAMA */
|
||||||
|
|
Loading…
Reference in New Issue