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);
|
||||
}
|
||||
|
||||
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 XINERAMA
|
||||
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;
|
||||
|
@ -613,17 +629,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) {
|
||||
|
@ -687,6 +700,22 @@ ProcXFixesSetWindowShapeRegion(ClientPtr client)
|
|||
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
|
||||
SProcXFixesSetWindowShapeRegion(ClientPtr client)
|
||||
{
|
||||
|
@ -699,15 +728,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 XINERAMA
|
||||
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);
|
||||
|
||||
|
@ -785,15 +830,12 @@ SProcXFixesExpandRegion(ClientPtr client)
|
|||
|
||||
#ifdef XINERAMA
|
||||
|
||||
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;
|
||||
|
@ -802,7 +844,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;
|
||||
}
|
||||
|
@ -810,17 +852,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))) {
|
||||
|
@ -838,8 +876,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);
|
||||
|
@ -851,16 +888,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))) {
|
||||
|
@ -878,8 +912,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);
|
||||
|
|
|
@ -257,32 +257,18 @@ XFixesExtensionInit(void)
|
|||
|
||||
#ifdef XINERAMA
|
||||
|
||||
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 /* XINERAMA */
|
||||
|
|
|
@ -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 XINERAMA
|
||||
extern int (*PanoramiXSaveXFixesVector[XFixesNumberRequests]) (ClientPtr);
|
||||
void PanoramiXFixesInit(void);
|
||||
void PanoramiXFixesReset(void);
|
||||
#endif /* XINERAMA */
|
||||
|
|
Loading…
Reference in New Issue