(!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);
|
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 PANORAMIX
|
||||||
|
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;
|
||||||
|
@ -641,17 +657,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) {
|
||||||
|
@ -715,6 +728,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 PANORAMIX
|
||||||
|
if (XFixesUseXinerama)
|
||||||
|
return PanoramiXFixesSetWindowShapeRegion(client, stuff);
|
||||||
|
#endif
|
||||||
|
return SingleXFixesSetWindowShapeRegion(client, stuff);
|
||||||
|
}
|
||||||
|
|
||||||
int _X_COLD
|
int _X_COLD
|
||||||
SProcXFixesSetWindowShapeRegion(ClientPtr client)
|
SProcXFixesSetWindowShapeRegion(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -729,15 +758,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 PANORAMIX
|
||||||
|
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);
|
||||||
|
|
||||||
|
@ -821,15 +866,12 @@ SProcXFixesExpandRegion(ClientPtr client)
|
||||||
#include "panoramiX.h"
|
#include "panoramiX.h"
|
||||||
#include "panoramiXsrv.h"
|
#include "panoramiXsrv.h"
|
||||||
|
|
||||||
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;
|
||||||
|
@ -838,7 +880,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;
|
||||||
}
|
}
|
||||||
|
@ -846,17 +888,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))) {
|
||||||
|
@ -874,8 +912,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);
|
||||||
|
@ -887,16 +924,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))) {
|
||||||
|
@ -914,8 +948,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);
|
||||||
|
|
|
@ -256,32 +256,18 @@ XFixesExtensionInit(void)
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
|
|
||||||
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
|
#endif
|
||||||
|
|
|
@ -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 PANORAMIX
|
#ifdef PANORAMIX
|
||||||
extern int (*PanoramiXSaveXFixesVector[XFixesNumberRequests]) (ClientPtr);
|
|
||||||
void PanoramiXFixesInit(void);
|
void PanoramiXFixesInit(void);
|
||||||
void PanoramiXFixesReset(void);
|
void PanoramiXFixesReset(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue