[RFC PATCH] CreateRootWindow: Set root windows' drawable.x/y to -pScreen->x/y.
Jamey Sharp
jamey at minilop.net
Thu Jun 10 15:37:40 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.
Other windows still have root-relative drawable coordinates, as if the
root window's coordinates were (0,0). See CreateWindow.
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.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
---
I'm not proposing this for 1.9--in fact I've only compile-tested it and
it's probably wrong somehow. But I'd like to get feedback on whether a
patch like this one is a good idea and what it breaks.
If this approach is good, I have or can write patches to move ValidateGC
and DestroyGC from GCFuncs to ScreenRec, and eliminate the other five
GCFuncs. The patches I have along those lines so far kill 730 lines of
code, on top of the 800 removed here, and promise more to come.
This change also makes my experimental xinerama-rework branch more
feasible. That branch already kills 1,000 lines of code, and should be
able to kill more if this patch works--I got stuck trying to deal with
root-window offsets, and this patch sidesteps that problem entirely.
I think I'm getting toward being able to kill off the Xinerama layer
entirely, without losing its functionality, while making hotplug screens
feasible. If I figure out what I mean by that, I'll let you know. :-)
dix/window.c | 14 +-
Xext/panoramiX.c | 243 +++---------------------------
Xext/panoramiXprocs.c | 409 +++----------------------------------------------
Xext/shm.c | 38 ++---
Xext/xvdisp.c | 56 +-------
Xi/xiquerypointer.c | 4 +-
render/render.c | 188 +----------------------
7 files changed, 77 insertions(+), 875 deletions(-)
diff --git a/dix/window.c b/dix/window.c
index 4a47dd5..6d89bae 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;
@@ -685,12 +686,15 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
if (pWin->borderIsPixel == FALSE)
pWin->border.pixmap->refcnt++;
- pWin->origin.x = x + (int)bw;
- pWin->origin.y = y + (int)bw;
pWin->drawable.width = w;
pWin->drawable.height = h;
- pWin->drawable.x = pParent->drawable.x + x + (int)bw;
- pWin->drawable.y = pParent->drawable.y + y + (int)bw;
+ pWin->drawable.x = pWin->origin.x = x + (int)bw;
+ pWin->drawable.y = pWin->origin.y = y + (int)bw;
+ if (pParent->parent)
+ {
+ pWin->drawable.x += pParent->drawable.x;
+ pWin->drawable.y += pParent->drawable.y;
+ }
/* set up clip list correctly for unobscured WindowPtr */
RegionNull(&pWin->clipList);
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index b73c53f..ed7c291 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;
}
@@ -1142,19 +940,15 @@ XineramaGetImageData(
){
RegionRec SrcRegion, ScreenRegion, GrabRegion;
BoxRec SrcBox, *pbox;
- int x, y, w, h, i, j, nbox, size, sizeNeeded, ScratchPitch, inOut, depth;
+ int xoff, yoff, w, h, i, nbox, size, sizeNeeded, ScratchPitch, inOut, depth;
DrawablePtr pDraw = pDrawables[0];
char *ScratchMem = NULL;
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;
@@ -1180,10 +974,15 @@ XineramaGetImageData(
RegionIntersect(&GrabRegion, &SrcRegion, &ScreenRegion);
RegionUninit(&ScreenRegion);
+ xoff = screenInfo.screens[i]->x;
+ yoff = screenInfo.screens[i]->y;
+ if(!isRoot) {
+ xoff += pDraw->x;
+ yoff += pDraw->y;
+ }
+
if(inOut == rgnIN) {
- (*pScreen->GetImage)(pDraw,
- SrcBox.x1 - pDraw->x - screenInfo.screens[i]->x,
- SrcBox.y1 - pDraw->y - screenInfo.screens[i]->y,
+ (*pScreen->GetImage)(pDraw, SrcBox.x1 - xoff, SrcBox.y1 - yoff,
width, height, format, planemask, data);
break;
} else if (inOut == rgnOUT)
@@ -1211,19 +1010,15 @@ XineramaGetImageData(
}
}
- x = pbox->x1 - pDraw->x - screenInfo.screens[i]->x;
- y = pbox->y1 - pDraw->y - screenInfo.screens[i]->y;
-
- (*pScreen->GetImage)(pDraw, x, y, w, h,
- format, planemask, ScratchMem);
+ (*pScreen->GetImage)(pDraw, pbox->x1 - xoff, pbox->y1 - yoff,
+ w, h, format, planemask, ScratchMem);
/* copy the memory over */
if(depth == 1) {
- int k, shift, leftover, index, index2;
-
- x = pbox->x1 - SrcBox.x1;
- y = pbox->y1 - SrcBox.y1;
+ int j, k, shift, leftover, index, index2;
+ int x = pbox->x1 - SrcBox.x1;
+ int y = pbox->y1 - SrcBox.y1;
shift = x & 7;
x >>= 3;
leftover = w & 7;
@@ -1256,9 +1051,9 @@ XineramaGetImageData(
}
}
} else {
- j = BitsPerPixel(depth) >> 3;
- x = (pbox->x1 - SrcBox.x1) * j;
- y = pbox->y1 - SrcBox.y1;
+ int j = BitsPerPixel(depth) >> 3;
+ int x = (pbox->x1 - SrcBox.x1) * j;
+ int y = pbox->y1 - SrcBox.y1;
w *= j;
for(j = 0; j < h; j++) {
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index b744e4d..617f109 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,9 @@ int PanoramiXCopyArea(ClientPtr client)
if(!(data = calloc(1, stuff->height * pitch)))
return BadAlloc;
- XineramaGetImageData(drawables, srcx, srcy,
+ XineramaGetImageData(drawables, stuff->srcX, stuff->srcY,
stuff->width, stuff->height, ZPixmap, ~0, data, pitch,
- srcIsRoot);
+ src->u.win.root);
FOR_NSCREENS_BACKWARD(j) {
stuff->gc = gc->info[j].id;
@@ -1072,7 +996,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 +1016,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 +1038,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 +1061,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 +1093,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) {
@@ -1255,8 +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,37 +1166,14 @@ 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));
- memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j){
-
- 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);
if(result != Success) break;
}
- free(origPts);
return result;
} else
return Success;
@@ -1315,8 +1184,6 @@ int PanoramiXPolyLine(ClientPtr client)
{
PanoramiXRes *gc, *draw;
int result, npoint, j;
- xPoint *origPts;
- Bool isRoot;
REQUEST(xPolyLineReq);
REQUEST_AT_LEAST_SIZE(xPolyLineReq);
@@ -1334,37 +1201,14 @@ 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));
- memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j){
-
- 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);
if(result != Success) break;
}
- free(origPts);
return result;
} else
return Success;
@@ -1373,10 +1217,8 @@ 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,40 +1236,16 @@ 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;
if (nsegs > 0) {
- origSegs = malloc(nsegs * sizeof(xSegment));
- memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
FOR_NSCREENS_FORWARD(j){
-
- 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);
if(result != Success) break;
}
- free(origSegs);
return result;
} else
return Success;
@@ -1436,10 +1254,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);
REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
@@ -1457,39 +1273,16 @@ 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;
if (nrects > 0){
- origRecs = malloc(nrects * sizeof(xRectangle));
- memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j){
-
- 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);
if(result != Success) break;
}
- free(origRecs);
return result;
} else
return Success;
@@ -1498,10 +1291,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);
REQUEST_AT_LEAST_SIZE(xPolyArcReq);
@@ -1519,37 +1310,16 @@ 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);
if (narcs > 0){
- origArcs = malloc(narcs * sizeof(xArc));
- memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j){
-
- 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);
if(result != Success) break;
}
- free(origArcs);
return result;
} else
return Success;
@@ -1560,8 +1330,6 @@ int PanoramiXFillPoly(ClientPtr client)
{
int result, count, j;
PanoramiXRes *gc, *draw;
- Bool isRoot;
- DDXPointPtr locPts;
REQUEST(xFillPolyReq);
REQUEST_AT_LEAST_SIZE(xFillPolyReq);
@@ -1579,38 +1347,14 @@ 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));
- memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec));
FOR_NSCREENS_FORWARD(j){
-
- 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);
if(result != Success) break;
}
- free(locPts);
return result;
} else
return Success;
@@ -1619,10 +1363,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);
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
@@ -1640,38 +1382,16 @@ 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;
if (things > 0){
- origRects = malloc(things * sizeof(xRectangle));
- memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j){
-
- 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);
if(result != Success) break;
}
- free(origRects);
return result;
} else
return Success;
@@ -1681,9 +1401,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
int PanoramiXPolyFillArc(ClientPtr client)
{
PanoramiXRes *gc, *draw;
- Bool isRoot;
- int result, narcs, i, j;
- xArc *origArcs;
+ int result, narcs, j;
REQUEST(xPolyFillArcReq);
REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
@@ -1701,38 +1419,16 @@ 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);
if (narcs > 0) {
- origArcs = malloc(narcs * sizeof(xArc));
- memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j){
-
- 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);
if(result != Success) break;
}
- free(origArcs);
return result;
} else
return Success;
@@ -1742,8 +1438,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 +1456,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 +1472,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 +1510,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 +1581,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, draw->u.win.root);
(void)WriteToClient(client,
(int)(nlines * widthBytesLine),
@@ -1918,7 +1599,7 @@ int PanoramiXGetImage(ClientPtr client)
XineramaGetImageData(drawables, x, y + linesDone, w,
nlines, format, plane, pBuf,
- widthBytesLine, isRoot);
+ widthBytesLine, draw->u.win.root);
(void)WriteToClient(client,
(int)(nlines * widthBytesLine),
@@ -1942,9 +1623,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 +1641,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 +1654,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 +1672,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 +1686,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 +1703,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 +1717,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 +1734,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/shm.c b/Xext/shm.c
index 3230d83..e8d00ff 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, draw->u.win.root);
} 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, draw->u.win.root);
length += lenPer;
}
}
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index deddebd..2008975 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -1657,8 +1657,7 @@ XineramaXvShmPutImage(ClientPtr client)
REQUEST(xvShmPutImageReq);
PanoramiXRes *draw, *gc, *port;
Bool send_event = stuff->send_event;
- Bool isRoot;
- int result, i, x, y;
+ int result, i;
REQUEST_SIZE_MATCH(xvShmPutImageReq);
@@ -1677,22 +1676,11 @@ 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;
-
FOR_NSCREENS_BACKWARD(i) {
if(port->info[i].id) {
stuff->drawable = draw->info[i].id;
stuff->port = port->info[i].id;
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,8 +1697,7 @@ XineramaXvPutImage(ClientPtr client)
{
REQUEST(xvPutImageReq);
PanoramiXRes *draw, *gc, *port;
- Bool isRoot;
- int result, i, x, y;
+ int result, i;
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
@@ -1729,22 +1716,11 @@ 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;
-
FOR_NSCREENS_BACKWARD(i) {
if(port->info[i].id) {
stuff->drawable = draw->info[i].id;
stuff->port = port->info[i].id;
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,8 +1733,7 @@ XineramaXvPutVideo(ClientPtr client)
{
REQUEST(xvPutImageReq);
PanoramiXRes *draw, *gc, *port;
- Bool isRoot;
- int result, i, x, y;
+ int result, i;
REQUEST_AT_LEAST_SIZE(xvPutVideoReq);
@@ -1777,22 +1752,11 @@ 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;
-
FOR_NSCREENS_BACKWARD(i) {
if(port->info[i].id) {
stuff->drawable = draw->info[i].id;
stuff->port = port->info[i].id;
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,8 +1769,7 @@ XineramaXvPutStill(ClientPtr client)
{
REQUEST(xvPutImageReq);
PanoramiXRes *draw, *gc, *port;
- Bool isRoot;
- int result, i, x, y;
+ int result, i;
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
@@ -1825,22 +1788,11 @@ 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;
-
FOR_NSCREENS_BACKWARD(i) {
if(port->info[i].id) {
stuff->drawable = draw->info[i].id;
stuff->port = port->info[i].id;
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..c1fc66a 100644
--- a/Xi/xiquerypointer.c
+++ b/Xi/xiquerypointer.c
@@ -186,8 +186,8 @@ ProcXIQueryPointer(ClientPtr client)
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);
+ 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..aa27f06 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;
}
@@ -2904,40 +2868,18 @@ PanoramiXRenderFillRectangles (ClientPtr client)
PanoramiXRes *dst;
int result = Success, j;
REQUEST(xRenderFillRectanglesReq);
- char *extra;
int extra_len;
REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq);
VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq);
- if (extra_len &&
- (extra = (char *) malloc(extra_len)))
+ if (extra_len)
{
- 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;
}
- free(extra);
}
return result;
@@ -2949,7 +2891,6 @@ PanoramiXRenderTrapezoids(ClientPtr client)
PanoramiXRes *src, *dst;
int result = Success, j;
REQUEST(xRenderTrapezoidsReq);
- char *extra;
int extra_len;
REQUEST_AT_LEAST_SIZE (xRenderTrapezoidsReq);
@@ -2959,36 +2900,8 @@ PanoramiXRenderTrapezoids(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq);
- if (extra_len &&
- (extra = (char *) malloc(extra_len))) {
- memcpy (extra, stuff + 1, extra_len);
-
+ if (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) {
- 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;
result =
@@ -2996,8 +2909,6 @@ PanoramiXRenderTrapezoids(ClientPtr client)
if(result != Success) break;
}
-
- free(extra);
}
return result;
@@ -3009,7 +2920,6 @@ PanoramiXRenderTriangles(ClientPtr client)
PanoramiXRes *src, *dst;
int result = Success, j;
REQUEST(xRenderTrianglesReq);
- char *extra;
int extra_len;
REQUEST_AT_LEAST_SIZE (xRenderTrianglesReq);
@@ -3019,32 +2929,8 @@ PanoramiXRenderTriangles(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq);
- if (extra_len &&
- (extra = (char *) malloc(extra_len))) {
- memcpy (extra, stuff + 1, extra_len);
-
+ if (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) {
- 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;
result =
@@ -3052,8 +2938,6 @@ PanoramiXRenderTriangles(ClientPtr client)
if(result != Success) break;
}
-
- free(extra);
}
return result;
@@ -3065,7 +2949,6 @@ PanoramiXRenderTriStrip(ClientPtr client)
PanoramiXRes *src, *dst;
int result = Success, j;
REQUEST(xRenderTriStripReq);
- char *extra;
int extra_len;
REQUEST_AT_LEAST_SIZE (xRenderTriStripReq);
@@ -3075,28 +2958,8 @@ PanoramiXRenderTriStrip(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq);
- if (extra_len &&
- (extra = (char *) malloc(extra_len))) {
- memcpy (extra, stuff + 1, extra_len);
-
+ if (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) {
- 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;
result =
@@ -3104,8 +2967,6 @@ PanoramiXRenderTriStrip(ClientPtr client)
if(result != Success) break;
}
-
- free(extra);
}
return result;
@@ -3117,7 +2978,6 @@ PanoramiXRenderTriFan(ClientPtr client)
PanoramiXRes *src, *dst;
int result = Success, j;
REQUEST(xRenderTriFanReq);
- char *extra;
int extra_len;
REQUEST_AT_LEAST_SIZE (xRenderTriFanReq);
@@ -3127,28 +2987,8 @@ PanoramiXRenderTriFan(ClientPtr client)
extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq);
- if (extra_len &&
- (extra = (char *) malloc(extra_len))) {
- memcpy (extra, stuff + 1, extra_len);
-
+ if (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) {
- 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;
result =
@@ -3156,8 +2996,6 @@ PanoramiXRenderTriFan(ClientPtr client)
if(result != Success) break;
}
-
- free(extra);
}
return result;
@@ -3169,32 +3007,18 @@ PanoramiXRenderAddTraps (ClientPtr client)
PanoramiXRes *picture;
int result = Success, j;
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);
extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
- if (extra_len &&
- (extra = (char *) malloc(extra_len)))
+ if (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;
}
- free(extra);
}
return result;
--
1.7.0
More information about the xorg-devel
mailing list