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

Jamey Sharp jamey at minilop.net
Wed Jun 23 11:15:49 PDT 2010


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've managed to test this version of the patch, and it Works For Me. If
you have a multi-GPU hardware setup, please test this patch. I'd like to
merge it in 1.10.

My test setup is an Xorg server configured with two video-dummy screens
and Xinerama enabled, plus x11vnc so I could see the exciting bugs the
first version introduced. (Bonus: This all runs nicely without root
privileges.)

Two out of the three bugs the first patch had were because I thought I
needed special-case code. Turns out, when I deleted the special cases it
all just worked.

 dix/window.c          |    3 +-
 Xext/panoramiX.c      |  213 +-----------------------------
 Xext/panoramiXprocs.c |  354 ++++---------------------------------------------
 Xext/panoramiXsrv.h   |    3 +-
 Xext/shm.c            |   38 ++----
 Xext/xvdisp.c         |   28 ----
 Xi/xiquerypointer.c   |    5 -
 render/render.c       |  134 -------------------
 8 files changed, 43 insertions(+), 735 deletions(-)

diff --git a/dix/window.c b/dix/window.c
index 4a47dd5..513686a 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -405,7 +405,8 @@ CreateRootWindow(ScreenPtr pScreen)
     pWin->origin.x = pWin->origin.y = 0;
     pWin->drawable.height = pScreen->height;
     pWin->drawable.width = pScreen->width;
-    pWin->drawable.x = pWin->drawable.y = 0;
+    pWin->drawable.x = -pScreen->x;
+    pWin->drawable.y = -pScreen->y;
 
     box.x1 = 0;
     box.y1 = 0;
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index b73c53f..0492f64 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -103,45 +103,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 void XineramaChangeClip(GCPtr, int, pointer, int);
-static void XineramaDestroyClip(GCPtr);
-static void XineramaCopyClip(GCPtr, GCPtr);
-
-static GCFuncs XineramaGCFuncs = {
-    XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC,
-    XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip
-};
-
-#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)
 {
@@ -149,7 +117,6 @@ XineramaCloseScreen (int i, ScreenPtr pScreen)
 	dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
 
     pScreen->CloseScreen = pScreenPriv->CloseScreen;
-    pScreen->CreateGC = pScreenPriv->CreateGC;
 
     if (pScreen->myNum == 0)
 	RegionUninit(&PanoramiXScreenRegion);
@@ -159,168 +126,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);
-}
-
-static void
-XineramaChangeClip (
-    GCPtr   pGC,
-    int		type,
-    pointer	pvalue,
-    int		nrects 
-){
-    Xinerama_GC_FUNC_PROLOGUE (pGC);
-    (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
-    Xinerama_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-XineramaCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    Xinerama_GC_FUNC_PROLOGUE (pgcDst);
-    (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
-    Xinerama_GC_FUNC_EPILOGUE (pgcDst);
-}
-
-static void
-XineramaDestroyClip(GCPtr pGC)
-{
-    Xinerama_GC_FUNC_PROLOGUE (pGC);
-    (* pGC->funcs->DestroyClip)(pGC);
-    Xinerama_GC_FUNC_EPILOGUE (pGC);
-}
-
 int
 XineramaDeleteResource(pointer data, XID id)
 {
@@ -448,11 +253,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;
@@ -482,10 +282,8 @@ void PanoramiXExtensionInit(int argc, char *argv[])
 		return;
 	   }
 	
-	   pScreenPriv->CreateGC = pScreen->CreateGC;
 	   pScreenPriv->CloseScreen = pScreen->CloseScreen;
 	
-	   pScreen->CreateGC = XineramaCreateGC;
 	   pScreen->CloseScreen = XineramaCloseScreen;
 	}
 
@@ -1137,8 +935,7 @@ XineramaGetImageData(
     unsigned int format,
     unsigned long planemask,
     char *data,
-    int pitch,
-    Bool isRoot
+    int pitch
 ){
     RegionRec SrcRegion, ScreenRegion, GrabRegion;
     BoxRec SrcBox, *pbox;
@@ -1149,12 +946,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/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 67b4030..fa50544 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);
     
@@ -127,17 +125,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)
@@ -310,8 +300,6 @@ int PanoramiXReparentWindow(ClientPtr client)
 {
     PanoramiXRes *win, *parent;
     int         result, j;
-    int		x, y;
-    Bool	parentIsRoot;
     REQUEST(xReparentWindowReq);
 
     REQUEST_SIZE_MATCH(xReparentWindowReq);
@@ -326,17 +314,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;
     }
@@ -441,10 +421,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);
@@ -453,12 +430,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)
@@ -475,29 +446,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;
     }
@@ -596,15 +550,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;
@@ -633,12 +580,6 @@ int PanoramiXTranslateCoords(ClientPtr client)
     }
     rep.dstX = x - pDst->drawable.x;
     rep.dstY = y - pDst->drawable.y;
-    if((pDst == screenInfo.screens[0]->root) ||
-       (pWin->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;
@@ -963,8 +904,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);
@@ -974,15 +914,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;
     }
@@ -1003,10 +936,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);
 
@@ -1034,13 +965,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;
@@ -1059,9 +983,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;
@@ -1072,7 +995,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);
 
@@ -1092,14 +1015,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);
 
@@ -1122,10 +1037,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);
 	    }
@@ -1149,10 +1060,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;
@@ -1183,28 +1092,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) {
@@ -1256,7 +1149,6 @@ int PanoramiXPolyPoint(ClientPtr client)
     PanoramiXRes *gc, *draw;
     int 	  result, npoint, j;
     xPoint 	  *origPts;
-    Bool	  isRoot;
     REQUEST(xPolyPointReq);
 
     REQUEST_AT_LEAST_SIZE(xPolyPointReq);
@@ -1274,7 +1166,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));
@@ -1283,22 +1174,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);
@@ -1316,7 +1191,6 @@ int PanoramiXPolyLine(ClientPtr client)
     PanoramiXRes *gc, *draw;
     int 	  result, npoint, j;
     xPoint 	  *origPts;
-    Bool	  isRoot;
     REQUEST(xPolyLineReq);
 
     REQUEST_AT_LEAST_SIZE(xPolyLineReq);
@@ -1334,7 +1208,6 @@ int PanoramiXPolyLine(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(xPolyLineReq));
     if (npoint > 0){
         origPts = malloc(npoint * sizeof(xPoint));
@@ -1343,22 +1216,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);
@@ -1373,10 +1230,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);
@@ -1394,8 +1250,6 @@ int PanoramiXPolySegment(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
     nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
     if(nsegs & 4) return BadLength;
     nsegs >>= 3;
@@ -1406,22 +1260,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);
@@ -1436,9 +1274,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);
 
@@ -1457,8 +1294,6 @@ int PanoramiXPolyRectangle(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
     nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
     if(nrects & 4) return BadLength;
     nrects >>= 3;
@@ -1469,21 +1304,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);
@@ -1498,9 +1318,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);
 
@@ -1519,8 +1338,6 @@ int PanoramiXPolyArc(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
     narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
     if(narcs % sizeof(xArc)) return BadLength;
     narcs /= sizeof(xArc);
@@ -1531,19 +1348,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);
@@ -1560,7 +1364,6 @@ int PanoramiXFillPoly(ClientPtr client)
 {
     int 	  result, count, j;
     PanoramiXRes *gc, *draw;
-    Bool	  isRoot;
     DDXPointPtr	  locPts;
     REQUEST(xFillPolyReq);
 
@@ -1579,8 +1382,6 @@ int PanoramiXFillPoly(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
     count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
     if (count > 0){
 	locPts = malloc(count * sizeof(DDXPointRec));
@@ -1589,22 +1390,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);
@@ -1619,9 +1404,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);
 
@@ -1640,8 +1424,6 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
     things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
     if(things & 4) return BadLength;
     things >>= 3;
@@ -1652,20 +1434,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);
@@ -1681,8 +1449,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);
 
@@ -1701,8 +1468,6 @@ int PanoramiXPolyFillArc(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
     narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
     if (narcs % sizeof(xArc)) return BadLength;
     narcs /= sizeof(xArc);
@@ -1713,20 +1478,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);
@@ -1742,8 +1493,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);
@@ -1761,15 +1511,7 @@ int PanoramiXPutImage(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
-    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);
@@ -1785,7 +1527,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;
@@ -1824,20 +1565,15 @@ int PanoramiXGetImage(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) ||
@@ -1900,7 +1636,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),
@@ -1918,7 +1654,7 @@ int PanoramiXGetImage(ClientPtr client)
 
 		    XineramaGetImageData(drawables, x, y + linesDone, w, 
 					nlines, format, plane, pBuf,
-					widthBytesLine, isRoot);
+					widthBytesLine);
 
 		    (void)WriteToClient(client,
 				    (int)(nlines * widthBytesLine),
@@ -1942,9 +1678,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);
@@ -1962,17 +1696,9 @@ PanoramiXPolyText8(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
-    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;
     }
@@ -1983,9 +1709,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);
@@ -2003,17 +1727,9 @@ PanoramiXPolyText16(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
-    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;
     }
@@ -2025,8 +1741,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);
@@ -2044,17 +1758,9 @@ int PanoramiXImageText8(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
-    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;
     }
@@ -2066,8 +1772,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);
@@ -2085,17 +1789,9 @@ int PanoramiXImageText16(ClientPtr client)
     if (result != Success)
 	return result;
 
-    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
-
-    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 5b1a3a9..95aca35 100644
--- a/Xext/panoramiXsrv.h
+++ b/Xext/panoramiXsrv.h
@@ -46,8 +46,7 @@ extern _X_EXPORT void XineramaGetImageData(
     unsigned int format,
     unsigned long planemask,
     char *data,
-    int pitch,
-    Bool isRoot
+    int pitch
 );
 
 #endif /* _PANORAMIXSRV_H_ */
diff --git a/Xext/shm.c b/Xext/shm.c
index 3230d83..90b2bd0 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -585,9 +585,9 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
 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);
@@ -602,20 +602,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;
     }
@@ -633,7 +625,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);
 
@@ -666,20 +657,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) ||
@@ -725,7 +711,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;
@@ -733,7 +719,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 deddebd..3577be4 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 b521c48..b816fd0 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/render/render.c b/render/render.c
index ef233e4..d0dcab4 100644
--- a/render/render.c
+++ b/render/render.c
@@ -2817,7 +2817,6 @@ PanoramiXRenderComposite (ClientPtr client)
 {
     PanoramiXRes	*src, *msk, *dst;
     int			result = Success, j;
-    xRenderCompositeReq	orig;
     REQUEST(xRenderCompositeReq);
 
     REQUEST_SIZE_MATCH(xRenderCompositeReq);
@@ -2826,30 +2825,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;
     }
@@ -2863,8 +2843,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);
@@ -2873,23 +2851,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;
 	}
@@ -2916,23 +2880,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;
@@ -2965,29 +2912,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;
@@ -3025,25 +2949,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;
@@ -3081,21 +2986,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;
@@ -3133,21 +3023,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;
@@ -3171,7 +3046,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);
@@ -3180,17 +3054,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.0



More information about the xorg-devel mailing list