[PATCH resend] CreateRootWindow: Set root windows' drawable.x/y to -pScreen->x/y.

Jamey Sharp jamey at minilop.net
Sun Sep 18 19:36:46 PDT 2011


A window's DrawableRec's x and y fields contain the offsets to be
applied to protocol-visible window-relative coordinates in order to make
those coordinates screen-relative instead. When Xinerama is active,
coordinates relative to the root window need to be adjusted for each
screen by the position of that screen in the logical root coordinate
space, so (-pScreen->x) and (-pScreen->y) are the natural values for
the root drawable's x and y offsets.

This eliminates special cases throughout the Xinerama layer that needed
to adjust coordinates as specified by clients if they were used relative
to a root window.

While this deletes Xinerama-layer code that modified request buffers
(aside from XID rewrites), some GC ops implementations also modify the
request buffer. (miPolyFill is an example.) Since Xinerama submits the
same request buffer once for each screen, it needs to undo the changes
made by these ops, even though it doesn't make its own modifications any
more. So I've preserved all Xinerama code that unconditionally saved and
restored parts of the request buffer. If the save/restore code was
conditional on whether the drawable was a root window, then it was safe
to delete.

Signed-off-by: Jamey Sharp <jamey at minilop.net>
---
I tested this patch when I originally posted it last year using a pair
of xf86-video-dummy screens and x11vnc. After rebasing, I've re-tested
using two xf86-video-nested screens. It works great and deletes a bunch
of code. I'd really appreciate review. If you can test in a multi-head
setup and offer a Tested-by, that will probably make Keith happier...

Note that this is based on some other patches I have out for review
right now:

        xnest: Delete unused nClipRects GC-private field. (reviewed)
        Quit wrapping ChangeClip, CopyClip, and DestroyClip in GCFuncs.
        Make GC clientClip always be a region.

It can be rebased without those, but since they touch the same code some
simple merge conflicts come up.

Besides rebasing, there's one change since the last version: now I only
set the root windows' origins if Xinerama is active. For some reason we
allow screen origins to be set even without Xinerama, though they aren't
meaningful then.

 Xext/panoramiX.c      |  181 +-------------------------
 Xext/panoramiX.h      |    1 -
 Xext/panoramiXprocs.c |  354 ++++---------------------------------------------
 Xext/panoramiXsrv.h   |    3 +-
 Xext/shm.c            |   38 ++----
 Xext/xvdisp.c         |   28 ----
 Xi/xiquerypointer.c   |    5 -
 dix/window.c          |    6 +
 render/render.c       |  134 -------------------
 9 files changed, 47 insertions(+), 703 deletions(-)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 23a6d05..3138d40 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -109,41 +109,13 @@ static void PanoramiXResetProc(ExtensionEntry*);
 
 int (* SavedProcVector[256]) (ClientPtr client) = { NULL, };
 
-static DevPrivateKeyRec PanoramiXGCKeyRec;
-#define PanoramiXGCKey (&PanoramiXGCKeyRec)
 static DevPrivateKeyRec PanoramiXScreenKeyRec;
 #define PanoramiXScreenKey (&PanoramiXScreenKeyRec)
 
 typedef struct {
-  DDXPointRec clipOrg;
-  DDXPointRec patOrg;
-  GCFuncs *wrapFuncs;
-} PanoramiXGCRec, *PanoramiXGCPtr;
-
-typedef struct {
-  CreateGCProcPtr	CreateGC;
   CloseScreenProcPtr	CloseScreen;
 } PanoramiXScreenRec, *PanoramiXScreenPtr;
 
-static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
-static void XineramaChangeGC(GCPtr, unsigned long);
-static void XineramaCopyGC(GCPtr, unsigned long, GCPtr);
-static void XineramaDestroyGC(GCPtr);
-
-static GCFuncs XineramaGCFuncs = {
-    XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC,
-};
-
-#define Xinerama_GC_FUNC_PROLOGUE(pGC)\
-    PanoramiXGCPtr  pGCPriv = (PanoramiXGCPtr) \
-	dixLookupPrivate(&(pGC)->devPrivates, PanoramiXGCKey); \
-    (pGC)->funcs = pGCPriv->wrapFuncs;
-
-#define Xinerama_GC_FUNC_EPILOGUE(pGC)\
-    pGCPriv->wrapFuncs = (pGC)->funcs;\
-    (pGC)->funcs = &XineramaGCFuncs;
-
-
 static Bool
 XineramaCloseScreen (int i, ScreenPtr pScreen)
 {
@@ -151,7 +123,6 @@ XineramaCloseScreen (int i, ScreenPtr pScreen)
 	dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
 
     pScreen->CloseScreen = pScreenPriv->CloseScreen;
-    pScreen->CreateGC = pScreenPriv->CreateGC;
 
     if (pScreen->myNum == 0)
 	RegionUninit(&PanoramiXScreenRegion);
@@ -161,140 +132,6 @@ XineramaCloseScreen (int i, ScreenPtr pScreen)
     return (*pScreen->CloseScreen) (i, pScreen);
 }
 
-static Bool
-XineramaCreateGC(GCPtr pGC)
-{
-    ScreenPtr pScreen = pGC->pScreen;
-    PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr)
-	dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
-    Bool ret;
-
-    pScreen->CreateGC = pScreenPriv->CreateGC;
-    if((ret = (*pScreen->CreateGC)(pGC))) {
-	PanoramiXGCPtr pGCPriv = (PanoramiXGCPtr)
-	    dixLookupPrivate(&pGC->devPrivates, PanoramiXGCKey);
-
-	pGCPriv->wrapFuncs = pGC->funcs;
-        pGC->funcs = &XineramaGCFuncs;
-
-	pGCPriv->clipOrg.x = pGC->clipOrg.x; 
-	pGCPriv->clipOrg.y = pGC->clipOrg.y;
-	pGCPriv->patOrg.x = pGC->patOrg.x;
-	pGCPriv->patOrg.y = pGC->patOrg.y;
-    }
-    pScreen->CreateGC = XineramaCreateGC;
-
-    return ret;
-}
-
-static void
-XineramaValidateGC(
-   GCPtr         pGC,
-   unsigned long changes,
-   DrawablePtr   pDraw 
-){
-    Xinerama_GC_FUNC_PROLOGUE (pGC);
-
-    if((pDraw->type == DRAWABLE_WINDOW) && !(((WindowPtr)pDraw)->parent)) {
-	/* the root window */
-	int x_off = pGC->pScreen->x;
-	int y_off = pGC->pScreen->y;
-	int new_val;
-
-	new_val = pGCPriv->clipOrg.x - x_off;
-	if(pGC->clipOrg.x != new_val) {
-	    pGC->clipOrg.x = new_val;
-	    changes |= GCClipXOrigin;
-	}
-	new_val = pGCPriv->clipOrg.y - y_off;
-	if(pGC->clipOrg.y != new_val) {
-	    pGC->clipOrg.y = new_val;
-	    changes |= GCClipYOrigin;
-	}
-	new_val = pGCPriv->patOrg.x - x_off;
-	if(pGC->patOrg.x != new_val) {
-	    pGC->patOrg.x = new_val;
-	    changes |= GCTileStipXOrigin;
-	}
-	new_val = pGCPriv->patOrg.y - y_off;
-	if(pGC->patOrg.y != new_val) {
-	    pGC->patOrg.y = new_val;
-	    changes |= GCTileStipYOrigin;
-	}
-    } else {
-	if(pGC->clipOrg.x != pGCPriv->clipOrg.x) {
-	    pGC->clipOrg.x = pGCPriv->clipOrg.x;
-	    changes |= GCClipXOrigin;
-	}
-	if(pGC->clipOrg.y != pGCPriv->clipOrg.y) {
-	    pGC->clipOrg.y = pGCPriv->clipOrg.y;
-	    changes |= GCClipYOrigin;
-	}
-	if(pGC->patOrg.x != pGCPriv->patOrg.x) {
-	    pGC->patOrg.x = pGCPriv->patOrg.x;
-	    changes |= GCTileStipXOrigin;
-	}
-	if(pGC->patOrg.y != pGCPriv->patOrg.y) {
-	    pGC->patOrg.y = pGCPriv->patOrg.y;
-	    changes |= GCTileStipYOrigin;
-	}
-    }
-  
-    (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
-    Xinerama_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-XineramaDestroyGC(GCPtr pGC)
-{
-    Xinerama_GC_FUNC_PROLOGUE (pGC);
-    (*pGC->funcs->DestroyGC)(pGC);
-    Xinerama_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-XineramaChangeGC (
-    GCPtr	    pGC,
-    unsigned long   mask
-){
-    Xinerama_GC_FUNC_PROLOGUE (pGC);
-
-    if(mask & GCTileStipXOrigin)
-	pGCPriv->patOrg.x = pGC->patOrg.x;
-    if(mask & GCTileStipYOrigin)
-	pGCPriv->patOrg.y = pGC->patOrg.y;
-    if(mask & GCClipXOrigin)
-	pGCPriv->clipOrg.x = pGC->clipOrg.x; 
-    if(mask & GCClipYOrigin)
-	pGCPriv->clipOrg.y = pGC->clipOrg.y;
-
-    (*pGC->funcs->ChangeGC) (pGC, mask);
-    Xinerama_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-XineramaCopyGC (
-    GCPtr	    pGCSrc, 
-    unsigned long   mask,
-    GCPtr	    pGCDst
-){
-    PanoramiXGCPtr pSrcPriv = (PanoramiXGCPtr)
-	dixLookupPrivate(&pGCSrc->devPrivates, PanoramiXGCKey);
-    Xinerama_GC_FUNC_PROLOGUE (pGCDst);
-
-    if(mask & GCTileStipXOrigin)
-        pGCPriv->patOrg.x = pSrcPriv->patOrg.x;
-    if(mask & GCTileStipYOrigin)
-        pGCPriv->patOrg.y = pSrcPriv->patOrg.y;
-    if(mask & GCClipXOrigin)
-        pGCPriv->clipOrg.x = pSrcPriv->clipOrg.x;
-    if(mask & GCClipYOrigin)
-        pGCPriv->clipOrg.y = pSrcPriv->clipOrg.y;
-
-    (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
-    Xinerama_GC_FUNC_EPILOGUE (pGCDst);
-}
-
 int
 XineramaDeleteResource(pointer data, XID id)
 {
@@ -422,11 +259,6 @@ void PanoramiXExtensionInit(int argc, char *argv[])
 	return;
     }
 
-    if (!dixRegisterPrivateKey(&PanoramiXGCKeyRec, PRIVATE_GC, sizeof(PanoramiXGCRec))) {
-	noPanoramiXExtension = TRUE;
-	return;
-    }
-
     PanoramiXNumScreens = screenInfo.numScreens;
     if (PanoramiXNumScreens == 1) {		/* Only 1 screen 	*/
 	noPanoramiXExtension = TRUE;
@@ -456,10 +288,8 @@ void PanoramiXExtensionInit(int argc, char *argv[])
 		return;
 	   }
 	
-	   pScreenPriv->CreateGC = pScreen->CreateGC;
 	   pScreenPriv->CloseScreen = pScreen->CloseScreen;
 	
-	   pScreen->CreateGC = XineramaCreateGC;
 	   pScreen->CloseScreen = XineramaCloseScreen;
 	}
 
@@ -1121,8 +951,7 @@ XineramaGetImageData(
     unsigned int format,
     unsigned long planemask,
     char *data,
-    int pitch,
-    Bool isRoot
+    int pitch
 ){
     RegionRec SrcRegion, ScreenRegion, GrabRegion;
     BoxRec SrcBox, *pbox;
@@ -1133,12 +962,8 @@ XineramaGetImageData(
     size = 0;
 
     /* find box in logical screen space */
-    SrcBox.x1 = left;
-    SrcBox.y1 = top;
-    if(!isRoot) {
-	SrcBox.x1 += pDraw->x + screenInfo.screens[0]->x;
-	SrcBox.y1 += pDraw->y + screenInfo.screens[0]->y;
-    }
+    SrcBox.x1 = left + pDraw->x + screenInfo.screens[0]->x;
+    SrcBox.y1 = top + pDraw->y + screenInfo.screens[0]->y;
     SrcBox.x2 = SrcBox.x1 + width;
     SrcBox.y2 = SrcBox.y1 + height;
     
diff --git a/Xext/panoramiX.h b/Xext/panoramiX.h
index 71651e5..fcfac0e 100644
--- a/Xext/panoramiX.h
+++ b/Xext/panoramiX.h
@@ -76,5 +76,4 @@ typedef struct {
 
 #define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared)
 
-#define IS_ROOT_DRAWABLE(d) (((d)->type == XRT_WINDOW) && (d)->u.win.root)
 #endif /* _PANORAMIX_H_ */
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 9ea4611..9bd63f6 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -61,9 +61,7 @@ int PanoramiXCreateWindow(ClientPtr client)
     REQUEST(xCreateWindowReq);
     int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
     int result, len, j;
-    int orig_x, orig_y;
     XID orig_visual, tmp;
-    Bool parentIsRoot;
 
     REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
     
@@ -125,17 +123,9 @@ int PanoramiXCreateWindow(ClientPtr client)
     if (stuff->class == InputOnly)
 	stuff->visual = CopyFromParent;
     orig_visual = stuff->visual;
-    orig_x = stuff->x;
-    orig_y = stuff->y;
-    parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) ||
-                   (stuff->parent == screenInfo.screens[0]->screensaver.wid);
     FOR_NSCREENS_BACKWARD(j) {
         stuff->wid = newWin->info[j].id;
         stuff->parent = parent->info[j].id;
-	if (parentIsRoot) {
-	    stuff->x = orig_x - screenInfo.screens[j]->x;
-	    stuff->y = orig_y - screenInfo.screens[j]->y;
-	}
 	if (backPix)
 	    *((CARD32 *) &stuff[1] + pback_offset) = backPix->info[j].id;
 	if (bordPix)
@@ -308,8 +298,6 @@ int PanoramiXReparentWindow(ClientPtr client)
 {
     PanoramiXRes *win, *parent;
     int         result, j;
-    int		x, y;
-    Bool	parentIsRoot;
     REQUEST(xReparentWindowReq);
 
     REQUEST_SIZE_MATCH(xReparentWindowReq);
@@ -324,17 +312,9 @@ int PanoramiXReparentWindow(ClientPtr client)
     if (result != Success)
 	return result;
 
-    x = stuff->x;
-    y = stuff->y;
-    parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) ||
-                   (stuff->parent == screenInfo.screens[0]->screensaver.wid);
     FOR_NSCREENS_BACKWARD(j) {
 	stuff->window = win->info[j].id;
 	stuff->parent = parent->info[j].id;
-	if(parentIsRoot) {
-	    stuff->x = x - screenInfo.screens[j]->x;
-	    stuff->y = y - screenInfo.screens[j]->y;
-	}
 	result = (*SavedProcVector[X_ReparentWindow])(client);
         if(result != Success) break;
     }
@@ -439,10 +419,7 @@ int PanoramiXConfigureWindow(ClientPtr client)
 {
     PanoramiXRes *win;
     PanoramiXRes *sib = NULL;
-    WindowPtr   pWin;
-    int         result, j, len, sib_offset = 0, x = 0, y = 0;
-    int		x_offset = -1;
-    int		y_offset = -1;
+    int         result, j, len, sib_offset = 0;
     REQUEST(xConfigureWindowReq);
 
     REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
@@ -451,12 +428,6 @@ int PanoramiXConfigureWindow(ClientPtr client)
     if (Ones(stuff->mask) != len)
         return BadLength;
 
-    /* because we need the parent */
-    result = dixLookupResourceByType((pointer *)&pWin, stuff->window,
-				     RT_WINDOW, client, DixWriteAccess);
-    if (result != Success)
-	return result;
-
     result = dixLookupResourceByType((pointer *)&win, stuff->window,
 				     XRT_WINDOW, client, DixWriteAccess);
     if (result != Success)
@@ -473,29 +444,12 @@ int PanoramiXConfigureWindow(ClientPtr client)
 	}
     }
 
-    if(pWin->parent && ((pWin->parent == screenInfo.screens[0]->root) ||
-                        (pWin->parent->drawable.id == screenInfo.screens[0]->screensaver.wid)))
-    {
-	if ((Mask)stuff->mask & CWX) {
-	    x_offset = 0;
-	    x = *((CARD32 *)&stuff[1]);
-	}
-	if ((Mask)stuff->mask & CWY) {
-	    y_offset = (x_offset == -1) ? 0 : 1;
-	    y = *((CARD32 *) &stuff[1] + y_offset);
-	}
-    }
-
     /* have to go forward or you get expose events before 
 	ConfigureNotify events */
     FOR_NSCREENS_FORWARD(j) {
 	stuff->window = win->info[j].id;
 	if(sib)
 	    *((CARD32 *) &stuff[1] + sib_offset) = sib->info[j].id;
-	if(x_offset >= 0)
-	    *((CARD32 *) &stuff[1] + x_offset) = x - screenInfo.screens[j]->x;
-	if(y_offset >= 0)
-	    *((CARD32 *) &stuff[1] + y_offset) = y - screenInfo.screens[j]->y;
 	result = (*SavedProcVector[X_ConfigureWindow])(client);
         if(result != Success) break;
     }
@@ -594,15 +548,8 @@ int PanoramiXTranslateCoords(ClientPtr client)
     rep.sameScreen = xTrue;
     rep.child = None;
 
-    if((pWin == screenInfo.screens[0]->root) ||
-       (pWin->drawable.id == screenInfo.screens[0]->screensaver.wid))
-    { 
-	x = stuff->srcX - screenInfo.screens[0]->x;
-	y = stuff->srcY - screenInfo.screens[0]->y;
-    } else {
-	x = pWin->drawable.x + stuff->srcX;
-	y = pWin->drawable.y + stuff->srcY;
-    }
+    x = pWin->drawable.x + stuff->srcX;
+    y = pWin->drawable.y + stuff->srcY;
     pWin = pDst->firstChild;
     while (pWin) {
 	    BoxRec  box;
@@ -631,12 +578,6 @@ int PanoramiXTranslateCoords(ClientPtr client)
     }
     rep.dstX = x - pDst->drawable.x;
     rep.dstY = y - pDst->drawable.y;
-    if((pDst == screenInfo.screens[0]->root) ||
-       (pDst->drawable.id == screenInfo.screens[0]->screensaver.wid))
-    {
-	rep.dstX += screenInfo.screens[0]->x;
-	rep.dstY += screenInfo.screens[0]->y;
-    }
 
     WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
     return Success;
@@ -957,8 +898,7 @@ int PanoramiXFreeGC(ClientPtr client)
 int PanoramiXClearToBackground(ClientPtr client)
 {
     PanoramiXRes *win;
-    int         result, j, x, y;
-    Bool	isRoot;
+    int         result, j;
     REQUEST(xClearAreaReq);
 
     REQUEST_SIZE_MATCH(xClearAreaReq);
@@ -968,15 +908,8 @@ int PanoramiXClearToBackground(ClientPtr client)
     if (result != Success)
 	return result;
 
-    x = stuff->x;
-    y = stuff->y;
-    isRoot = win->u.win.root;
     FOR_NSCREENS_BACKWARD(j) {
 	stuff->window = win->info[j].id;
-	if(isRoot) {
-	    stuff->x = x - screenInfo.screens[j]->x;
-	    stuff->y = y - screenInfo.screens[j]->y;
-	}
 	result = (*SavedProcVector[X_ClearArea])(client);
 	if(result != Success) break;
     }
@@ -997,10 +930,8 @@ int PanoramiXClearToBackground(ClientPtr client)
 
 int PanoramiXCopyArea(ClientPtr client)
 {
-    int			j, result, srcx, srcy, dstx, dsty;
+    int			j, result;
     PanoramiXRes	*gc, *src, *dst;
-    Bool		srcIsRoot = FALSE;
-    Bool		dstIsRoot = FALSE;
     Bool		srcShared, dstShared;
     REQUEST(xCopyAreaReq);
 
@@ -1028,13 +959,6 @@ int PanoramiXCopyArea(ClientPtr client)
     if (result != Success)
 	return result;
 
-    if((dst->type == XRT_WINDOW) && dst->u.win.root)
-	dstIsRoot = TRUE;
-    if((src->type == XRT_WINDOW) && src->u.win.root)
-	srcIsRoot = TRUE;
-
-    srcx = stuff->srcX; srcy = stuff->srcY;
-    dstx = stuff->dstX; dsty = stuff->dstY;
     if((dst->type == XRT_PIXMAP) && (src->type == XRT_WINDOW)) {
 	DrawablePtr drawables[MAXSCREENS];
 	DrawablePtr pDst;
@@ -1053,9 +977,8 @@ int PanoramiXCopyArea(ClientPtr client)
 	if(!(data = calloc(1, stuff->height * pitch)))
 	    return BadAlloc;
 
-	XineramaGetImageData(drawables, srcx, srcy, 
-		stuff->width, stuff->height, ZPixmap, ~0, data, pitch, 
-		srcIsRoot);
+	XineramaGetImageData(drawables, stuff->srcX, stuff->srcY,
+		stuff->width, stuff->height, ZPixmap, ~0, data, pitch);
 
 	FOR_NSCREENS_BACKWARD(j) {
 	    stuff->gc = gc->info[j].id;
@@ -1066,7 +989,7 @@ int PanoramiXCopyArea(ClientPtr client)
 		return BadMatch;
 	    }
 
-	    (*pGC->ops->PutImage) (pDst, pGC, pDst->depth, dstx, dsty, 
+	    (*pGC->ops->PutImage) (pDst, pGC, pDst->depth, stuff->dstX, stuff->dstY,
 				   stuff->width, stuff->height, 
 				   0, ZPixmap, data);
 
@@ -1086,14 +1009,6 @@ int PanoramiXCopyArea(ClientPtr client)
 	    stuff->dstDrawable = dst->info[j].id;
 	    stuff->srcDrawable = src->info[j].id;
 	    stuff->gc          = gc->info[j].id;
- 	    if (srcIsRoot) {	
-		stuff->srcX = srcx - screenInfo.screens[j]->x;
-		stuff->srcY = srcy - screenInfo.screens[j]->y;
-	    }
- 	    if (dstIsRoot) {	
-		stuff->dstX = dstx - screenInfo.screens[j]->x;
-		stuff->dstY = dsty - screenInfo.screens[j]->y;
-	    }
 
 	    VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
 
@@ -1116,10 +1031,6 @@ int PanoramiXCopyArea(ClientPtr client)
 				stuff->width, stuff->height, 
 				stuff->dstX, stuff->dstY);
 	    if(pGC->graphicsExposures && pRgn) {
-	       if(srcIsRoot) {
-		   RegionTranslate(pRgn,
-			    screenInfo.screens[j]->x, screenInfo.screens[j]->y);
-	       }
 	       RegionAppend(&totalReg, pRgn);
 	       RegionDestroy(pRgn);
 	    }
@@ -1143,10 +1054,8 @@ int PanoramiXCopyArea(ClientPtr client)
 
 int PanoramiXCopyPlane(ClientPtr client)
 {
-    int			j, srcx, srcy, dstx, dsty, rc;
+    int			j, rc;
     PanoramiXRes	*gc, *src, *dst;
-    Bool		srcIsRoot = FALSE;
-    Bool		dstIsRoot = FALSE;
     Bool		srcShared, dstShared;
     DrawablePtr 	psrcDraw, pdstDraw = NULL;
     GCPtr 		pGC = NULL;
@@ -1177,28 +1086,12 @@ int PanoramiXCopyPlane(ClientPtr client)
     if (rc != Success)
 	return rc;
 
-    if((dst->type == XRT_WINDOW) && dst->u.win.root)
-	dstIsRoot = TRUE;
-    if((src->type == XRT_WINDOW) && src->u.win.root)
-	srcIsRoot = TRUE;
-
-    srcx = stuff->srcX; srcy = stuff->srcY;
-    dstx = stuff->dstX; dsty = stuff->dstY;
- 
     RegionNull(&totalReg);
     FOR_NSCREENS_BACKWARD(j) {
 	RegionPtr pRgn;
 	stuff->dstDrawable = dst->info[j].id;
 	stuff->srcDrawable = src->info[j].id;
 	stuff->gc          = gc->info[j].id;
-	if (srcIsRoot) {	
-	    stuff->srcX = srcx - screenInfo.screens[j]->x;
-	    stuff->srcY = srcy - screenInfo.screens[j]->y;
-	}
-	if (dstIsRoot) {	
-	    stuff->dstX = dstx - screenInfo.screens[j]->x;
-	    stuff->dstY = dsty - screenInfo.screens[j]->y;
-	}
 
 	VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess);
 	if (stuff->dstDrawable != stuff->srcDrawable) {
@@ -1250,7 +1143,6 @@ int PanoramiXPolyPoint(ClientPtr client)
     PanoramiXRes *gc, *draw;
     int 	  result, npoint, j;
     xPoint 	  *origPts;
-    Bool	  isRoot;
     REQUEST(xPolyPointReq);
 
     REQUEST_AT_LEAST_SIZE(xPolyPointReq);
@@ -1268,7 +1160,6 @@ int PanoramiXPolyPoint(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
     npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
     if (npoint > 0) {
         origPts = malloc(npoint * sizeof(xPoint));
@@ -1277,22 +1168,6 @@ int PanoramiXPolyPoint(ClientPtr client)
 
             if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint));
 
-            if (isRoot) {
-                int x_off = screenInfo.screens[j]->x;
-                int y_off = screenInfo.screens[j]->y;
-
-		if(x_off || y_off) {
-                    xPoint *pnts = (xPoint*)&stuff[1];
-		    int i = (stuff->coordMode==CoordModePrevious) ? 1 : npoint;
-
-		    while(i--) {
-			pnts->x -= x_off;
-			pnts->y -= y_off;
-			pnts++;
-                    }
-		}
-            }
-
 	    stuff->drawable = draw->info[j].id;
 	    stuff->gc = gc->info[j].id;
 	    result = (* SavedProcVector[X_PolyPoint])(client);
@@ -1310,7 +1185,6 @@ int PanoramiXPolyLine(ClientPtr client)
     PanoramiXRes *gc, *draw;
     int 	  result, npoint, j;
     xPoint 	  *origPts;
-    Bool	  isRoot;
     REQUEST(xPolyLineReq);
 
     REQUEST_AT_LEAST_SIZE(xPolyLineReq);
@@ -1328,7 +1202,6 @@ int PanoramiXPolyLine(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = IS_ROOT_DRAWABLE(draw);
     npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
     if (npoint > 0){
         origPts = malloc(npoint * sizeof(xPoint));
@@ -1337,22 +1210,6 @@ int PanoramiXPolyLine(ClientPtr client)
 
             if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint));
 
-            if (isRoot) {
-                int x_off = screenInfo.screens[j]->x;
-                int y_off = screenInfo.screens[j]->y;
-
-		if(x_off || y_off) {
-		    xPoint *pnts = (xPoint*)&stuff[1];
-		    int i = (stuff->coordMode==CoordModePrevious) ? 1 : npoint;
-
-		    while(i--) {
-			pnts->x -= x_off;
-			pnts->y -= y_off;
-			pnts++;
-		    }
-		}
-            }
-
 	    stuff->drawable = draw->info[j].id;
 	    stuff->gc = gc->info[j].id;
 	    result = (* SavedProcVector[X_PolyLine])(client);
@@ -1367,10 +1224,9 @@ int PanoramiXPolyLine(ClientPtr client)
 
 int PanoramiXPolySegment(ClientPtr client)
 {
-    int		  result, nsegs, i, j;
+    int		  result, nsegs, j;
     PanoramiXRes *gc, *draw;
     xSegment 	  *origSegs;
-    Bool	  isRoot;
     REQUEST(xPolySegmentReq);
 
     REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
@@ -1388,8 +1244,6 @@ int PanoramiXPolySegment(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = IS_ROOT_DRAWABLE(draw);
-
     nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
     if(nsegs & 4) return BadLength;
     nsegs >>= 3;
@@ -1400,22 +1254,6 @@ int PanoramiXPolySegment(ClientPtr client)
 
             if(j) memcpy(&stuff[1], origSegs, nsegs * sizeof(xSegment));
 
-            if (isRoot) {
-                int x_off = screenInfo.screens[j]->x;
-                int y_off = screenInfo.screens[j]->y;
-
-		if(x_off || y_off) {
-		    xSegment *segs = (xSegment*)&stuff[1];
-
-		    for (i = nsegs; i--; segs++) {
-			segs->x1 -= x_off;
-			segs->x2 -= x_off;
-			segs->y1 -= y_off;
-			segs->y2 -= y_off;
-		    }
-		}
-            }
-
 	    stuff->drawable = draw->info[j].id;
 	    stuff->gc = gc->info[j].id;
 	    result = (* SavedProcVector[X_PolySegment])(client);
@@ -1430,9 +1268,8 @@ int PanoramiXPolySegment(ClientPtr client)
 
 int PanoramiXPolyRectangle(ClientPtr client)
 {
-    int 	  result, nrects, i, j;
+    int 	  result, nrects, j;
     PanoramiXRes *gc, *draw;
-    Bool	  isRoot;
     xRectangle 	  *origRecs;
     REQUEST(xPolyRectangleReq);
 
@@ -1451,8 +1288,6 @@ int PanoramiXPolyRectangle(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = IS_ROOT_DRAWABLE(draw);
-
     nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
     if(nrects & 4) return BadLength;
     nrects >>= 3;
@@ -1463,21 +1298,6 @@ int PanoramiXPolyRectangle(ClientPtr client)
 
             if(j) memcpy(&stuff[1], origRecs, nrects * sizeof(xRectangle));
 
-	    if (isRoot) {
-		int x_off = screenInfo.screens[j]->x;
-		int y_off = screenInfo.screens[j]->y;
-
-
-		if(x_off || y_off) {
-	    	    xRectangle *rects = (xRectangle *) &stuff[1];
-
-		    for (i = nrects; i--; rects++) {
-			rects->x -= x_off;
-			rects->y -= y_off;
-		    }
-		}
-	    } 
-
 	    stuff->drawable = draw->info[j].id;
 	    stuff->gc = gc->info[j].id;
 	    result = (* SavedProcVector[X_PolyRectangle])(client);
@@ -1492,9 +1312,8 @@ int PanoramiXPolyRectangle(ClientPtr client)
 
 int PanoramiXPolyArc(ClientPtr client)
 {
-    int 	  result, narcs, i, j;
+    int 	  result, narcs, j;
     PanoramiXRes *gc, *draw;
-    Bool	  isRoot;
     xArc	  *origArcs;
     REQUEST(xPolyArcReq);
 
@@ -1513,8 +1332,6 @@ int PanoramiXPolyArc(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = IS_ROOT_DRAWABLE(draw);
-
     narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
     if(narcs % sizeof(xArc)) return BadLength;
     narcs /= sizeof(xArc);
@@ -1525,19 +1342,6 @@ int PanoramiXPolyArc(ClientPtr client)
 
             if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc));
 
-	    if (isRoot) {
-		int x_off = screenInfo.screens[j]->x;
-		int y_off = screenInfo.screens[j]->y;
-	
-		if(x_off || y_off) {
-		    xArc *arcs = (xArc *) &stuff[1];
-
-		    for (i = narcs; i--; arcs++) {
-			arcs->x -= x_off;
-			arcs->y -= y_off;
-		    }
-		}
-            }
 	    stuff->drawable = draw->info[j].id;
 	    stuff->gc = gc->info[j].id;
 	    result = (* SavedProcVector[X_PolyArc])(client);
@@ -1554,7 +1358,6 @@ int PanoramiXFillPoly(ClientPtr client)
 {
     int 	  result, count, j;
     PanoramiXRes *gc, *draw;
-    Bool	  isRoot;
     DDXPointPtr	  locPts;
     REQUEST(xFillPolyReq);
 
@@ -1573,8 +1376,6 @@ int PanoramiXFillPoly(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = IS_ROOT_DRAWABLE(draw);
-
     count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
     if (count > 0){
 	locPts = malloc(count * sizeof(DDXPointRec));
@@ -1583,22 +1384,6 @@ int PanoramiXFillPoly(ClientPtr client)
 
 	    if(j) memcpy(&stuff[1], locPts, count * sizeof(DDXPointRec));
 
-	    if (isRoot) {
-		int x_off = screenInfo.screens[j]->x;
-		int y_off = screenInfo.screens[j]->y;
-
-		if(x_off || y_off) {
-		    DDXPointPtr pnts = (DDXPointPtr)&stuff[1];
-		    int i = (stuff->coordMode==CoordModePrevious) ? 1 : count;
-
-		    while(i--) {
-			pnts->x -= x_off;
-			pnts->y -= y_off;
-			pnts++;
-		    }
-		}
-	    }
-
 	    stuff->drawable = draw->info[j].id;
 	    stuff->gc = gc->info[j].id;
 	    result = (* SavedProcVector[X_FillPoly])(client);
@@ -1613,9 +1398,8 @@ int PanoramiXFillPoly(ClientPtr client)
 
 int PanoramiXPolyFillRectangle(ClientPtr client)
 {
-    int 	  result, things, i, j;
+    int 	  result, things, j;
     PanoramiXRes *gc, *draw;
-    Bool	  isRoot;
     xRectangle	  *origRects;
     REQUEST(xPolyFillRectangleReq);
 
@@ -1634,8 +1418,6 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = IS_ROOT_DRAWABLE(draw);
-
     things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
     if(things & 4) return BadLength;
     things >>= 3;
@@ -1646,20 +1428,6 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
 
 	    if(j) memcpy(&stuff[1], origRects, things * sizeof(xRectangle));
 
-	    if (isRoot) {
-		int x_off = screenInfo.screens[j]->x;
-		int y_off = screenInfo.screens[j]->y;
-
-		if(x_off || y_off) {
-		    xRectangle *rects = (xRectangle *) &stuff[1];
-
-		    for (i = things; i--; rects++) {
-			rects->x -= x_off;
-			rects->y -= y_off;
-		    }
-		}
-	    }
-
 	    stuff->drawable = draw->info[j].id;
 	    stuff->gc = gc->info[j].id;
 	    result = (* SavedProcVector[X_PolyFillRectangle])(client);
@@ -1675,8 +1443,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
 int PanoramiXPolyFillArc(ClientPtr client)
 {
     PanoramiXRes *gc, *draw;
-    Bool	  isRoot;
-    int 	  result, narcs, i, j;
+    int 	  result, narcs, j;
     xArc	  *origArcs;
     REQUEST(xPolyFillArcReq);
 
@@ -1695,8 +1462,6 @@ int PanoramiXPolyFillArc(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = IS_ROOT_DRAWABLE(draw);
-
     narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
     if (narcs % sizeof(xArc)) return BadLength;
     narcs /= sizeof(xArc);
@@ -1707,20 +1472,6 @@ int PanoramiXPolyFillArc(ClientPtr client)
 
 	    if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc));
 
-	    if (isRoot) {
-		int x_off = screenInfo.screens[j]->x;
-		int y_off = screenInfo.screens[j]->y;
-
-		if(x_off || y_off) {
-		    xArc *arcs = (xArc *) &stuff[1];
-
-		    for (i = narcs; i--; arcs++) {
-			arcs->x -= x_off;
-			arcs->y -= y_off;
-		    }
-		}
-	    }
-
 	    stuff->drawable = draw->info[j].id;
 	    stuff->gc = gc->info[j].id;
 	    result = (* SavedProcVector[X_PolyFillArc])(client);
@@ -1736,8 +1487,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
 int PanoramiXPutImage(ClientPtr client)
 {
     PanoramiXRes *gc, *draw;
-    Bool	  isRoot;
-    int		  j, result, orig_x, orig_y;
+    int		  j, result;
     REQUEST(xPutImageReq);
 
     REQUEST_AT_LEAST_SIZE(xPutImageReq);
@@ -1755,15 +1505,7 @@ int PanoramiXPutImage(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = IS_ROOT_DRAWABLE(draw);
-
-    orig_x = stuff->dstX;
-    orig_y = stuff->dstY;
     FOR_NSCREENS_BACKWARD(j){
-	if (isRoot) {
-	  stuff->dstX = orig_x - screenInfo.screens[j]->x;
-	  stuff->dstY = orig_y - screenInfo.screens[j]->y;
-	}
 	stuff->drawable = draw->info[j].id;
 	stuff->gc = gc->info[j].id;
 	result = (* SavedProcVector[X_PutImage])(client);
@@ -1779,7 +1521,6 @@ int PanoramiXGetImage(ClientPtr client)
     DrawablePtr 	pDraw;
     PanoramiXRes	*draw;
     xGetImageReply	xgi;
-    Bool		isRoot;
     char		*pBuf;
     int         	i, x, y, w, h, format, rc;
     Mask		plane = 0, planemask;
@@ -1818,20 +1559,15 @@ int PanoramiXGetImage(ClientPtr client)
     format = stuff->format;
     planemask = stuff->planeMask;
 
-    isRoot = IS_ROOT_DRAWABLE(draw);
+    /* check for being onscreen */
+    if(screenInfo.screens[0]->x + pDraw->x + x < 0 ||
+       screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth ||
+       screenInfo.screens[0]->y + pDraw->y + y < 0 ||
+       screenInfo.screens[0]->y + pDraw->y + y + h > PanoramiXPixHeight)
+	return BadMatch;
 
-    if(isRoot) {
-      if( /* check for being onscreen */
-	x < 0 || x + w > PanoramiXPixWidth ||
-	y < 0 || y + h > PanoramiXPixHeight )
-	    return BadMatch;
-    } else {
-      if( /* check for being onscreen */
-	screenInfo.screens[0]->x + pDraw->x + x < 0 ||
-	screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth ||
-	screenInfo.screens[0]->y + pDraw->y + y < 0 ||
-	screenInfo.screens[0]->y + pDraw->y + y + h > PanoramiXPixHeight ||
-	 /* check for being inside of border */
+    if(!draw->u.win.root) {
+      if( /* check for being inside of border */
        	x < - wBorderWidth((WindowPtr)pDraw) ||
 	x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||
 	y < -wBorderWidth((WindowPtr)pDraw) ||
@@ -1894,7 +1630,7 @@ int PanoramiXGetImage(ClientPtr client)
 		memset(pBuf, 0, nlines * widthBytesLine);
 
 	    XineramaGetImageData(drawables, x, y + linesDone, w, nlines,
-			format, planemask, pBuf, widthBytesLine, isRoot);
+			format, planemask, pBuf, widthBytesLine);
 
 		(void)WriteToClient(client,
 				    (int)(nlines * widthBytesLine),
@@ -1912,7 +1648,7 @@ int PanoramiXGetImage(ClientPtr client)
 
 		    XineramaGetImageData(drawables, x, y + linesDone, w, 
 					nlines, format, plane, pBuf,
-					widthBytesLine, isRoot);
+					widthBytesLine);
 
 		    (void)WriteToClient(client,
 				    (int)(nlines * widthBytesLine),
@@ -1936,9 +1672,7 @@ int
 PanoramiXPolyText8(ClientPtr client)
 {
     PanoramiXRes *gc, *draw;
-    Bool	  isRoot;
     int 	  result, j;
-    int	 	  orig_x, orig_y;
     REQUEST(xPolyTextReq);
 
     REQUEST_AT_LEAST_SIZE(xPolyTextReq);
@@ -1956,17 +1690,9 @@ PanoramiXPolyText8(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = IS_ROOT_DRAWABLE(draw);
-
-    orig_x = stuff->x;
-    orig_y = stuff->y;
     FOR_NSCREENS_BACKWARD(j){
 	stuff->drawable = draw->info[j].id;
 	stuff->gc = gc->info[j].id;
-	if (isRoot) {
-	    stuff->x = orig_x - screenInfo.screens[j]->x;
-	    stuff->y = orig_y - screenInfo.screens[j]->y;
-	}
 	result = (*SavedProcVector[X_PolyText8])(client);
 	if(result != Success) break;
     }
@@ -1977,9 +1703,7 @@ int
 PanoramiXPolyText16(ClientPtr client)
 {
     PanoramiXRes *gc, *draw;
-    Bool	  isRoot;
     int 	  result, j;
-    int	 	  orig_x, orig_y;
     REQUEST(xPolyTextReq);
 
     REQUEST_AT_LEAST_SIZE(xPolyTextReq);
@@ -1997,17 +1721,9 @@ PanoramiXPolyText16(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = IS_ROOT_DRAWABLE(draw);
-
-    orig_x = stuff->x;
-    orig_y = stuff->y;
     FOR_NSCREENS_BACKWARD(j){
 	stuff->drawable = draw->info[j].id;
 	stuff->gc = gc->info[j].id;
-	if (isRoot) {
-	    stuff->x = orig_x - screenInfo.screens[j]->x;
-	    stuff->y = orig_y - screenInfo.screens[j]->y;
-	}
 	result = (*SavedProcVector[X_PolyText16])(client);
 	if(result != Success) break;
     }
@@ -2019,8 +1735,6 @@ int PanoramiXImageText8(ClientPtr client)
 {
     int 	  result, j;
     PanoramiXRes *gc, *draw;
-    Bool	  isRoot;
-    int		  orig_x, orig_y;
     REQUEST(xImageTextReq);
 
     REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars);
@@ -2038,17 +1752,9 @@ int PanoramiXImageText8(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = IS_ROOT_DRAWABLE(draw);
-
-    orig_x = stuff->x;
-    orig_y = stuff->y;
     FOR_NSCREENS_BACKWARD(j){
 	stuff->drawable = draw->info[j].id;
 	stuff->gc = gc->info[j].id;
-	if (isRoot) {
-	    stuff->x = orig_x - screenInfo.screens[j]->x;
-	    stuff->y = orig_y - screenInfo.screens[j]->y;
-	}
 	result = (*SavedProcVector[X_ImageText8])(client);
 	if(result != Success) break;
     }
@@ -2060,8 +1766,6 @@ int PanoramiXImageText16(ClientPtr client)
 {
     int 	  result, j;
     PanoramiXRes *gc, *draw;
-    Bool	  isRoot;
-    int		  orig_x, orig_y;
     REQUEST(xImageTextReq);
 
     REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1);
@@ -2079,17 +1783,9 @@ int PanoramiXImageText16(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = IS_ROOT_DRAWABLE(draw);
-
-    orig_x = stuff->x;
-    orig_y = stuff->y;
     FOR_NSCREENS_BACKWARD(j){
 	stuff->drawable = draw->info[j].id;
 	stuff->gc = gc->info[j].id;
-	if (isRoot) {
-	    stuff->x = orig_x - screenInfo.screens[j]->x;
-	    stuff->y = orig_y - screenInfo.screens[j]->y;
-	}
 	result = (*SavedProcVector[X_ImageText16])(client);
 	if(result != Success) break;
     }
diff --git a/Xext/panoramiXsrv.h b/Xext/panoramiXsrv.h
index 39d4952..b673052 100644
--- a/Xext/panoramiXsrv.h
+++ b/Xext/panoramiXsrv.h
@@ -47,8 +47,7 @@ extern _X_EXPORT void XineramaGetImageData(
     unsigned int format,
     unsigned long planemask,
     char *data,
-    int pitch,
-    Bool isRoot
+    int pitch
 );
 
 static inline void panoramix_setup_ids(PanoramiXRes *resource, 
diff --git a/Xext/shm.c b/Xext/shm.c
index 4141a8f..7fccb23 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -741,9 +741,9 @@ ProcShmGetImage(ClientPtr client)
 static int 
 ProcPanoramiXShmPutImage(ClientPtr client)
 {
-    int			 j, result, orig_x, orig_y;
+    int			 j, result;
     PanoramiXRes	*draw, *gc;
-    Bool		 sendEvent, isRoot;
+    Bool		 sendEvent;
 
     REQUEST(xShmPutImageReq);
     REQUEST_SIZE_MATCH(xShmPutImageReq);
@@ -758,20 +758,12 @@ ProcPanoramiXShmPutImage(ClientPtr client)
     if (result != Success)
         return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
-    orig_x = stuff->dstX;
-    orig_y = stuff->dstY;
     sendEvent = stuff->sendEvent;
     stuff->sendEvent = 0;
     FOR_NSCREENS(j) {
 	if(!j) stuff->sendEvent = sendEvent;
 	stuff->drawable = draw->info[j].id;
 	stuff->gc = gc->info[j].id;
-	if (isRoot) {
-	    stuff->dstX = orig_x - screenInfo.screens[j]->x;
-	    stuff->dstY = orig_y - screenInfo.screens[j]->y;
-	}
 	result = ProcShmPutImage(client);
 	if(result != Success) break;
     }
@@ -789,7 +781,6 @@ ProcPanoramiXShmGetImage(ClientPtr client)
     int         	i, x, y, w, h, format, rc;
     Mask		plane = 0, planemask;
     long		lenPer = 0, length, widthBytesLine;
-    Bool		isRoot;
 
     REQUEST(xShmGetImageReq);
 
@@ -822,20 +813,15 @@ ProcPanoramiXShmGetImage(ClientPtr client)
     format = stuff->format;
     planemask = stuff->planeMask;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
+    /* check for being onscreen */
+    if(screenInfo.screens[0]->x + pDraw->x + x < 0 ||
+       screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth ||
+       screenInfo.screens[0]->y + pDraw->y + y < 0 ||
+       screenInfo.screens[0]->y + pDraw->y + y + h > PanoramiXPixHeight)
+	return BadMatch;
 
-    if(isRoot) {
-      if( /* check for being onscreen */
-	x < 0 || x + w > PanoramiXPixWidth ||
-	y < 0 || y + h > PanoramiXPixHeight )
-	    return BadMatch;
-    } else {
-      if( /* check for being onscreen */
-	screenInfo.screens[0]->x + pDraw->x + x < 0 ||
-	screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth ||
-	screenInfo.screens[0]->y + pDraw->y + y < 0 ||
-	screenInfo.screens[0]->y + pDraw->y + y + h > PanoramiXPixHeight ||
-	 /* check for being inside of border */
+    if(!draw->u.win.root) {
+	if( /* check for being inside of border */
        	x < - wBorderWidth((WindowPtr)pDraw) ||
 	x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||
 	y < -wBorderWidth((WindowPtr)pDraw) ||
@@ -881,7 +867,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
     else if (format == ZPixmap) {
 	    XineramaGetImageData(drawables, x, y, w, h, format, planemask,
 					shmdesc->addr + stuff->offset,
-					widthBytesLine, isRoot);
+					widthBytesLine);
     } else {
 
 	length = stuff->offset;
@@ -889,7 +875,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
 	    if (planemask & plane) {
 		XineramaGetImageData(drawables, x, y, w, h, 
 				     format, plane, shmdesc->addr + length,
-				     widthBytesLine, isRoot);
+				     widthBytesLine);
 		length += lenPer;
 	    }
 	}
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index b968431..0fc78db 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -1657,7 +1657,6 @@ XineramaXvShmPutImage(ClientPtr client)
     REQUEST(xvShmPutImageReq);
     PanoramiXRes *draw, *gc, *port;
     Bool send_event = stuff->send_event;
-    Bool isRoot;
     int result, i, x, y;
 
     REQUEST_SIZE_MATCH(xvShmPutImageReq);
@@ -1677,8 +1676,6 @@ XineramaXvShmPutImage(ClientPtr client)
     if (result != Success)
 	return result;
  
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
     x = stuff->drw_x;
     y = stuff->drw_y;
 
@@ -1689,10 +1686,6 @@ XineramaXvShmPutImage(ClientPtr client)
 	   stuff->gc = gc->info[i].id;
 	   stuff->drw_x = x;
 	   stuff->drw_y = y;
-	   if(isRoot) {
-		stuff->drw_x -= screenInfo.screens[i]->x;
-		stuff->drw_y -= screenInfo.screens[i]->y;
-	   }
 	   stuff->send_event = (send_event && !i) ? 1 : 0;
 
 	   result = ProcXvShmPutImage(client);
@@ -1709,7 +1702,6 @@ XineramaXvPutImage(ClientPtr client)
 {
     REQUEST(xvPutImageReq);
     PanoramiXRes *draw, *gc, *port;
-    Bool isRoot;
     int result, i, x, y;
 
     REQUEST_AT_LEAST_SIZE(xvPutImageReq);
@@ -1729,8 +1721,6 @@ XineramaXvPutImage(ClientPtr client)
     if (result != Success)
 	return result;
  
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
     x = stuff->drw_x;
     y = stuff->drw_y;
 
@@ -1741,10 +1731,6 @@ XineramaXvPutImage(ClientPtr client)
 	   stuff->gc = gc->info[i].id;
 	   stuff->drw_x = x;
 	   stuff->drw_y = y;
-	   if(isRoot) {
-		stuff->drw_x -= screenInfo.screens[i]->x;
-		stuff->drw_y -= screenInfo.screens[i]->y;
-	   }
 
 	   result = ProcXvPutImage(client);
 	}
@@ -1757,7 +1743,6 @@ XineramaXvPutVideo(ClientPtr client)
 {
     REQUEST(xvPutImageReq);
     PanoramiXRes *draw, *gc, *port;
-    Bool isRoot;
     int result, i, x, y;
 
     REQUEST_AT_LEAST_SIZE(xvPutVideoReq);
@@ -1777,8 +1762,6 @@ XineramaXvPutVideo(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
     x = stuff->drw_x;
     y = stuff->drw_y;
 
@@ -1789,10 +1772,6 @@ XineramaXvPutVideo(ClientPtr client)
            stuff->gc = gc->info[i].id;
            stuff->drw_x = x;
            stuff->drw_y = y;
-           if(isRoot) {
-                stuff->drw_x -= screenInfo.screens[i]->x;
-                stuff->drw_y -= screenInfo.screens[i]->y;
-           }
 
            result = ProcXvPutVideo(client);
         }
@@ -1805,7 +1784,6 @@ XineramaXvPutStill(ClientPtr client)
 {
     REQUEST(xvPutImageReq);
     PanoramiXRes *draw, *gc, *port;
-    Bool isRoot;
     int result, i, x, y;
 
     REQUEST_AT_LEAST_SIZE(xvPutImageReq);
@@ -1825,8 +1803,6 @@ XineramaXvPutStill(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
     x = stuff->drw_x;
     y = stuff->drw_y;
 
@@ -1837,10 +1813,6 @@ XineramaXvPutStill(ClientPtr client)
            stuff->gc = gc->info[i].id;
            stuff->drw_x = x;
            stuff->drw_y = y;
-           if(isRoot) {
-                stuff->drw_x -= screenInfo.screens[i]->x;
-                stuff->drw_y -= screenInfo.screens[i]->y;
-           }
 
            result = ProcXvPutStill(client);
         }
diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
index 5131799..8edbfcf 100644
--- a/Xi/xiquerypointer.c
+++ b/Xi/xiquerypointer.c
@@ -184,11 +184,6 @@ ProcXIQueryPointer(ClientPtr client)
     if(!noPanoramiXExtension) {
         rep.root_x += FP1616(screenInfo.screens[0]->x, 0);
         rep.root_y += FP1616(screenInfo.screens[0]->y, 0);
-        if (stuff->win == rep.root)
-        {
-            rep.win_x += FP1616(screenInfo.screens[0]->x, 0);
-            rep.win_y += FP1616(screenInfo.screens[0]->y, 0);
-        }
     }
 #endif
 
diff --git a/dix/window.c b/dix/window.c
index 1953f02..ed928eb 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -508,6 +508,12 @@ CreateRootWindow(ScreenPtr pScreen)
     pWin->drawable.height = pScreen->height;
     pWin->drawable.width = pScreen->width;
     pWin->drawable.x = pWin->drawable.y = 0;
+#ifdef PANORAMIX
+    if(!noPanoramiXExtension) {
+	pWin->drawable.x = -pScreen->x;
+	pWin->drawable.y = -pScreen->y;
+    }
+#endif
 
     box.x1 = 0;
     box.y1 = 0;
diff --git a/render/render.c b/render/render.c
index ebb1d63..d672cb7 100644
--- a/render/render.c
+++ b/render/render.c
@@ -2831,7 +2831,6 @@ PanoramiXRenderComposite (ClientPtr client)
 {
     PanoramiXRes	*src, *msk, *dst;
     int			result = Success, j;
-    xRenderCompositeReq	orig;
     REQUEST(xRenderCompositeReq);
 
     REQUEST_SIZE_MATCH(xRenderCompositeReq);
@@ -2840,30 +2839,11 @@ PanoramiXRenderComposite (ClientPtr client)
     VERIFY_XIN_ALPHA (msk, stuff->mask, client, DixReadAccess);
     VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
     
-    orig = *stuff;
-    
     FOR_NSCREENS_FORWARD(j) {
 	stuff->src = src->info[j].id;
-	if (src->u.pict.root)
-	{
-	    stuff->xSrc = orig.xSrc - screenInfo.screens[j]->x;
-	    stuff->ySrc = orig.ySrc - screenInfo.screens[j]->y;
-	}
 	stuff->dst = dst->info[j].id;
-	if (dst->u.pict.root)
-	{
-	    stuff->xDst = orig.xDst - screenInfo.screens[j]->x;
-	    stuff->yDst = orig.yDst - screenInfo.screens[j]->y;
-	}
 	if (msk)
-	{
 	    stuff->mask = msk->info[j].id;
-	    if (msk->u.pict.root)
-	    {
-		stuff->xMask = orig.xMask - screenInfo.screens[j]->x;
-		stuff->yMask = orig.yMask - screenInfo.screens[j]->y;
-	    }
-	}
 	result = (*PanoramiXSaveRenderVector[X_RenderComposite]) (client);
 	if(result != Success) break;
     }
@@ -2877,8 +2857,6 @@ PanoramiXRenderCompositeGlyphs (ClientPtr client)
     PanoramiXRes    *src, *dst;
     int		    result = Success, j;
     REQUEST(xRenderCompositeGlyphsReq);
-    xGlyphElt	    origElt, *elt;
-    INT16	    xSrc, ySrc;
 
     REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq);
     VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
@@ -2887,23 +2865,9 @@ PanoramiXRenderCompositeGlyphs (ClientPtr client)
     if (client->req_len << 2 >= (sizeof (xRenderCompositeGlyphsReq) +
 				 sizeof (xGlyphElt)))
     {
-	elt = (xGlyphElt *) (stuff + 1);
-	origElt = *elt;
-	xSrc = stuff->xSrc;
-	ySrc = stuff->ySrc;
 	FOR_NSCREENS_FORWARD(j) {
 	    stuff->src = src->info[j].id;
-	    if (src->u.pict.root)
-	    {
-		stuff->xSrc = xSrc - screenInfo.screens[j]->x;
-		stuff->ySrc = ySrc - screenInfo.screens[j]->y;
-	    }
 	    stuff->dst = dst->info[j].id;
-	    if (dst->u.pict.root)
-	    {
-		elt->deltax = origElt.deltax - screenInfo.screens[j]->x;
-		elt->deltay = origElt.deltay - screenInfo.screens[j]->y;
-	    }
 	    result = (*PanoramiXSaveRenderVector[stuff->renderReqType]) (client);
 	    if(result != Success) break;
 	}
@@ -2930,23 +2894,6 @@ PanoramiXRenderFillRectangles (ClientPtr client)
 	memcpy (extra, stuff + 1, extra_len);
 	FOR_NSCREENS_FORWARD(j) {
 	    if (j) memcpy (stuff + 1, extra, extra_len);
-	    if (dst->u.pict.root)
-	    {
-		int x_off = screenInfo.screens[j]->x;
-		int y_off = screenInfo.screens[j]->y;
-
-		if(x_off || y_off) {
-		    xRectangle	*rects = (xRectangle *) (stuff + 1);
-		    int		i = extra_len / sizeof (xRectangle);
-
-		    while (i--)
-		    {
-			rects->x -= x_off;
-			rects->y -= y_off;
-			rects++;
-		    }
-		}
-	    }
 	    stuff->dst = dst->info[j].id;
 	    result = (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client);
 	    if(result != Success) break;
@@ -2979,29 +2926,6 @@ PanoramiXRenderTrapezoids(ClientPtr client)
 
 	FOR_NSCREENS_FORWARD(j) {
 	    if (j) memcpy (stuff + 1, extra, extra_len);
-	    if (dst->u.pict.root) {
-		int x_off = screenInfo.screens[j]->x;
-		int y_off = screenInfo.screens[j]->y;
-
-		if(x_off || y_off) {
-                    xTrapezoid  *trap = (xTrapezoid *) (stuff + 1);
-		    int         i = extra_len / sizeof (xTrapezoid);
-
-		    while (i--) {
-			trap->top -= y_off;
-			trap->bottom -= y_off;
-			trap->left.p1.x -= x_off;
-			trap->left.p1.y -= y_off;
-			trap->left.p2.x -= x_off;
-			trap->left.p2.y -= y_off;
-			trap->right.p1.x -= x_off;
-			trap->right.p1.y -= y_off;
-			trap->right.p2.x -= x_off;
-			trap->right.p2.y -= y_off;
-			trap++;
-		    }
-		}
-	    }
 	    
             stuff->src = src->info[j].id;
             stuff->dst = dst->info[j].id;
@@ -3039,25 +2963,6 @@ PanoramiXRenderTriangles(ClientPtr client)
 
 	FOR_NSCREENS_FORWARD(j) {
 	    if (j) memcpy (stuff + 1, extra, extra_len);
-	    if (dst->u.pict.root) {
-		int x_off = screenInfo.screens[j]->x;
-		int y_off = screenInfo.screens[j]->y;
-
-		if(x_off || y_off) {
-                    xTriangle  *tri = (xTriangle *) (stuff + 1);
-		    int         i = extra_len / sizeof (xTriangle);
-
-		    while (i--) {
-			tri->p1.x -= x_off;
-			tri->p1.y -= y_off;
-			tri->p2.x -= x_off;
-			tri->p2.y -= y_off;
-			tri->p3.x -= x_off;
-			tri->p3.y -= y_off;
-			tri++;
-		    }
-		}
-	    }
 	    
             stuff->src = src->info[j].id;
             stuff->dst = dst->info[j].id;
@@ -3095,21 +3000,6 @@ PanoramiXRenderTriStrip(ClientPtr client)
 
 	FOR_NSCREENS_FORWARD(j) {
 	    if (j) memcpy (stuff + 1, extra, extra_len);
-	    if (dst->u.pict.root) {
-		int x_off = screenInfo.screens[j]->x;
-		int y_off = screenInfo.screens[j]->y;
-
-		if(x_off || y_off) {
-                    xPointFixed  *fixed = (xPointFixed *) (stuff + 1);
-		    int         i = extra_len / sizeof (xPointFixed);
-
-		    while (i--) {
-			fixed->x -= x_off;
-			fixed->y -= y_off;
-			fixed++;
-		    }
-		}
-	    }
 	    
             stuff->src = src->info[j].id;
             stuff->dst = dst->info[j].id;
@@ -3147,21 +3037,6 @@ PanoramiXRenderTriFan(ClientPtr client)
 
 	FOR_NSCREENS_FORWARD(j) {
 	    if (j) memcpy (stuff + 1, extra, extra_len);
-	    if (dst->u.pict.root) {
-		int x_off = screenInfo.screens[j]->x;
-		int y_off = screenInfo.screens[j]->y;
-
-		if(x_off || y_off) {
-                    xPointFixed  *fixed = (xPointFixed *) (stuff + 1);
-		    int         i = extra_len / sizeof (xPointFixed);
-
-		    while (i--) {
-			fixed->x -= x_off;
-			fixed->y -= y_off;
-			fixed++;
-		    }
-		}
-	    }
 	    
             stuff->src = src->info[j].id;
             stuff->dst = dst->info[j].id;
@@ -3185,7 +3060,6 @@ PanoramiXRenderAddTraps (ClientPtr client)
     REQUEST(xRenderAddTrapsReq);
     char	    *extra;
     int		    extra_len;
-    INT16    	    x_off, y_off;
 
     REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq);
     VERIFY_XIN_PICTURE (picture, stuff->picture, client, DixWriteAccess);
@@ -3194,17 +3068,9 @@ PanoramiXRenderAddTraps (ClientPtr client)
 	(extra = (char *) malloc(extra_len)))
     {
 	memcpy (extra, stuff + 1, extra_len);
-	x_off = stuff->xOff;
-	y_off = stuff->yOff;
 	FOR_NSCREENS_FORWARD(j) {
 	    if (j) memcpy (stuff + 1, extra, extra_len);
 	    stuff->picture = picture->info[j].id;
-	    
-	    if (picture->u.pict.root)
-	    {
-		stuff->xOff = x_off + screenInfo.screens[j]->x;
-		stuff->yOff = y_off + screenInfo.screens[j]->y;
-	    }
 	    result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client);
 	    if(result != Success) break;
 	}
-- 
1.7.5.4



More information about the xorg-devel mailing list