diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index edcbb49d5..14e06e160 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -70,7 +70,6 @@ int PanoramiXPixWidth = 0; int PanoramiXPixHeight = 0; int PanoramiXNumScreens = 0; -PanoramiXData *panoramiXdataPtr = NULL; static RegionRec PanoramiXScreenRegion = {{0, 0, 0, 0}, NULL}; static int PanoramiXNumDepths; @@ -120,8 +119,6 @@ typedef struct { CloseScreenProcPtr CloseScreen; } PanoramiXScreenRec, *PanoramiXScreenPtr; -RegionRec XineramaScreenRegions[MAXSCREENS]; - static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr); static void XineramaChangeGC(GCPtr, unsigned long); static void XineramaCopyGC(GCPtr, unsigned long, GCPtr); @@ -154,7 +151,6 @@ XineramaCloseScreen (int i, ScreenPtr pScreen) pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->CreateGC = pScreenPriv->CreateGC; - REGION_UNINIT(pScreen, &XineramaScreenRegions[pScreen->myNum]); if (pScreen->myNum == 0) REGION_UNINIT(pScreen, &PanoramiXScreenRegion); @@ -199,8 +195,8 @@ XineramaValidateGC( if((pDraw->type == DRAWABLE_WINDOW) && !(((WindowPtr)pDraw)->parent)) { /* the root window */ - int x_off = panoramiXdataPtr[pGC->pScreen->myNum].x; - int y_off = panoramiXdataPtr[pGC->pScreen->myNum].y; + int x_off = pGC->pScreen->x; + int y_off = pGC->pScreen->y; int new_val; new_val = pGCPriv->clipOrg.x - x_off; @@ -393,30 +389,28 @@ static void XineramaInitData(ScreenPtr pScreen) REGION_NULL(pScreen, &PanoramiXScreenRegion) for (i = 0; i < PanoramiXNumScreens; i++) { BoxRec TheBox; + RegionRec ScreenRegion; pScreen = screenInfo.screens[i]; - panoramiXdataPtr[i].x = dixScreenOrigins[i].x; - panoramiXdataPtr[i].y = dixScreenOrigins[i].y; - panoramiXdataPtr[i].width = pScreen->width; - panoramiXdataPtr[i].height = pScreen->height; + TheBox.x1 = pScreen->x; + TheBox.x2 = TheBox.x1 + pScreen->width; + TheBox.y1 = pScreen->y; + TheBox.y2 = TheBox.y1 + pScreen->height; - TheBox.x1 = panoramiXdataPtr[i].x; - TheBox.x2 = TheBox.x1 + panoramiXdataPtr[i].width; - TheBox.y1 = panoramiXdataPtr[i].y; - TheBox.y2 = TheBox.y1 + panoramiXdataPtr[i].height; - - REGION_INIT(pScreen, &XineramaScreenRegions[i], &TheBox, 1); + REGION_INIT(pScreen, &ScreenRegion, &TheBox, 1); REGION_UNION(pScreen, &PanoramiXScreenRegion, &PanoramiXScreenRegion, - &XineramaScreenRegions[i]); + &ScreenRegion); + REGION_UNINIT(pScreen, &ScreenRegion); } - PanoramiXPixWidth = panoramiXdataPtr[0].x + panoramiXdataPtr[0].width; - PanoramiXPixHeight = panoramiXdataPtr[0].y + panoramiXdataPtr[0].height; + PanoramiXPixWidth = screenInfo.screens[0]->x + screenInfo.screens[0]->width; + PanoramiXPixHeight = screenInfo.screens[0]->y + screenInfo.screens[0]->height; for (i = 1; i < PanoramiXNumScreens; i++) { - w = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width; - h = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height; + pScreen = screenInfo.screens[i]; + w = pScreen->x + pScreen->width; + h = pScreen->y + pScreen->height; if (PanoramiXPixWidth < w) PanoramiXPixWidth = w; @@ -427,12 +421,7 @@ static void XineramaInitData(ScreenPtr pScreen) void XineramaReinitData(ScreenPtr pScreen) { - int i; - REGION_UNINIT(pScreen, &PanoramiXScreenRegion); - for (i = 0; i < PanoramiXNumScreens; i++) - REGION_UNINIT(pScreen, &XineramaScreenRegions[i]); - XineramaInitData(pScreen); } @@ -473,12 +462,6 @@ void PanoramiXExtensionInit(int argc, char *argv[]) * run in non-PanoramiXeen mode. */ - panoramiXdataPtr = (PanoramiXData *) - calloc(PanoramiXNumScreens, sizeof(PanoramiXData)); - - if (!panoramiXdataPtr) - break; - if (!dixRequestPrivate(PanoramiXGCKey, sizeof(PanoramiXGCRec))) { noPanoramiXExtension = TRUE; return; @@ -836,13 +819,14 @@ PanoramiXConsolidate(void) saver->type = XRT_WINDOW; for (i = 0; i < PanoramiXNumScreens; i++) { - root->info[i].id = WindowTable[i]->drawable.id; + ScreenPtr pScreen = screenInfo.screens[i]; + root->info[i].id = pScreen->root->drawable.id; root->u.win.class = InputOutput; root->u.win.root = TRUE; - saver->info[i].id = savedScreenInfo[i].wid; + saver->info[i].id = pScreen->screensaver.wid; saver->u.win.class = InputOutput; saver->u.win.root = TRUE; - defmap->info[i].id = (screenInfo.screens[i])->defColormap; + defmap->info[i].id = pScreen->defColormap; } AddResource(root->info[0].id, XRT_WINDOW, root); @@ -896,8 +880,6 @@ static void PanoramiXResetProc(ExtensionEntry* extEntry) screenInfo.numScreens = PanoramiXNumScreens; for (i = 256; i--; ) ProcVector[i] = SavedProcVector[i]; - - free(panoramiXdataPtr); } @@ -999,8 +981,8 @@ ProcPanoramiXGetScreenSize(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; /* screen dimensions */ - rep.width = panoramiXdataPtr[stuff->screen].width; - rep.height = panoramiXdataPtr[stuff->screen].height; + rep.width = screenInfo.screens[stuff->screen]->width; + rep.height = screenInfo.screens[stuff->screen]->height; rep.window = stuff->window; rep.screen = stuff->screen; if (client->swapped) { @@ -1072,10 +1054,10 @@ ProcXineramaQueryScreens(ClientPtr client) int i; for(i = 0; i < PanoramiXNumScreens; i++) { - scratch.x_org = panoramiXdataPtr[i].x; - scratch.y_org = panoramiXdataPtr[i].y; - scratch.width = panoramiXdataPtr[i].width; - scratch.height = panoramiXdataPtr[i].height; + scratch.x_org = screenInfo.screens[i]->x; + scratch.y_org = screenInfo.screens[i]->y; + scratch.width = screenInfo.screens[i]->width; + scratch.height = screenInfo.screens[i]->height; if(client->swapped) { int n; @@ -1153,7 +1135,7 @@ XineramaGetImageData( int pitch, Bool isRoot ){ - RegionRec SrcRegion, GrabRegion; + RegionRec SrcRegion, ScreenRegion, GrabRegion; BoxRec SrcBox, *pbox; int x, y, w, h, i, j, nbox, size, sizeNeeded, ScratchPitch, inOut, depth; DrawablePtr pDraw = pDrawables[0]; @@ -1165,8 +1147,8 @@ XineramaGetImageData( SrcBox.x1 = left; SrcBox.y1 = top; if(!isRoot) { - SrcBox.x1 += pDraw->x + panoramiXdataPtr[0].x; - SrcBox.y1 += pDraw->y + panoramiXdataPtr[0].y; + SrcBox.x1 += pDraw->x + screenInfo.screens[0]->x; + SrcBox.y1 += pDraw->y + screenInfo.screens[0]->y; } SrcBox.x2 = SrcBox.x1 + width; SrcBox.y2 = SrcBox.y1 + height; @@ -1177,22 +1159,31 @@ XineramaGetImageData( depth = (format == XYPixmap) ? 1 : pDraw->depth; for(i = 0; i < PanoramiXNumScreens; i++) { + BoxRec TheBox; + ScreenPtr pScreen; pDraw = pDrawables[i]; + pScreen = pDraw->pScreen; - inOut = RECT_IN_REGION(pScreen,&XineramaScreenRegions[i],&SrcBox); + TheBox.x1 = pScreen->x; + TheBox.x2 = TheBox.x1 + pScreen->width; + TheBox.y1 = pScreen->y; + TheBox.y2 = TheBox.y1 + pScreen->height; + + REGION_INIT(pScreen, &ScreenRegion, &TheBox, 1); + inOut = RECT_IN_REGION(pScreen, &ScreenRegion, &SrcBox); + if(inOut == rgnPART) + REGION_INTERSECT(pScreen, &GrabRegion, &SrcRegion, &ScreenRegion); + REGION_UNINIT(pScreen, &ScreenRegion); if(inOut == rgnIN) { - (*pDraw->pScreen->GetImage)(pDraw, - SrcBox.x1 - pDraw->x - panoramiXdataPtr[i].x, - SrcBox.y1 - pDraw->y - panoramiXdataPtr[i].y, + (*pScreen->GetImage)(pDraw, + SrcBox.x1 - pDraw->x - screenInfo.screens[i]->x, + SrcBox.y1 - pDraw->y - screenInfo.screens[i]->y, width, height, format, planemask, data); break; } else if (inOut == rgnOUT) continue; - REGION_INTERSECT(pScreen, &GrabRegion, &SrcRegion, - &XineramaScreenRegions[i]); - nbox = REGION_NUM_RECTS(&GrabRegion); if(nbox) { @@ -1215,10 +1206,10 @@ XineramaGetImageData( } } - x = pbox->x1 - pDraw->x - panoramiXdataPtr[i].x; - y = pbox->y1 - pDraw->y - panoramiXdataPtr[i].y; + x = pbox->x1 - pDraw->x - screenInfo.screens[i]->x; + y = pbox->y1 - pDraw->y - screenInfo.screens[i]->y; - (*pDraw->pScreen->GetImage)(pDraw, x, y, w, h, + (*pScreen->GetImage)(pDraw, x, y, w, h, format, planemask, ScratchMem); /* copy the memory over */ diff --git a/Xext/panoramiX.h b/Xext/panoramiX.h index 35de17951..a8684f0d2 100644 --- a/Xext/panoramiX.h +++ b/Xext/panoramiX.h @@ -46,13 +46,6 @@ Equipment Corporation. #include "gcstruct.h" -typedef struct _PanoramiXData { - int x; - int y; - int width; - int height; -} PanoramiXData; - typedef struct _PanoramiXInfo { XID id ; } PanoramiXInfo; diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index 8752ca519..5ccbe27c8 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -129,14 +129,14 @@ int PanoramiXCreateWindow(ClientPtr client) orig_visual = stuff->visual; orig_x = stuff->x; orig_y = stuff->y; - parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id) || - (stuff->parent == savedScreenInfo[0].wid); + 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 - panoramiXdataPtr[j].x; - stuff->y = orig_y - panoramiXdataPtr[j].y; + 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; @@ -328,14 +328,14 @@ int PanoramiXReparentWindow(ClientPtr client) x = stuff->x; y = stuff->y; - parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id) || - (stuff->parent == savedScreenInfo[0].wid); + 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 - panoramiXdataPtr[j].x; - stuff->y = y - panoramiXdataPtr[j].y; + stuff->x = x - screenInfo.screens[j]->x; + stuff->y = y - screenInfo.screens[j]->y; } result = (*SavedProcVector[X_ReparentWindow])(client); if(result != Success) break; @@ -475,8 +475,8 @@ int PanoramiXConfigureWindow(ClientPtr client) } } - if(pWin->parent && ((pWin->parent == WindowTable[0]) || - (pWin->parent->drawable.id == savedScreenInfo[0].wid))) + 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; @@ -495,9 +495,9 @@ int PanoramiXConfigureWindow(ClientPtr client) if(sib) *((CARD32 *) &stuff[1] + sib_offset) = sib->info[j].id; if(x_offset >= 0) - *((CARD32 *) &stuff[1] + x_offset) = x - panoramiXdataPtr[j].x; + *((CARD32 *) &stuff[1] + x_offset) = x - screenInfo.screens[j]->x; if(y_offset >= 0) - *((CARD32 *) &stuff[1] + y_offset) = y - panoramiXdataPtr[j].y; + *((CARD32 *) &stuff[1] + y_offset) = y - screenInfo.screens[j]->y; result = (*SavedProcVector[X_ConfigureWindow])(client); if(result != Success) break; } @@ -544,7 +544,7 @@ int PanoramiXGetGeometry(ClientPtr client) rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.root = WindowTable[0]->drawable.id; + rep.root = screenInfo.screens[0]->root->drawable.id; rep.depth = pDraw->depth; rep.width = pDraw->width; rep.height = pDraw->height; @@ -562,11 +562,11 @@ int PanoramiXGetGeometry(ClientPtr client) WindowPtr pWin = (WindowPtr)pDraw; rep.x = pWin->origin.x - wBorderWidth (pWin); rep.y = pWin->origin.y - wBorderWidth (pWin); - if((pWin->parent == WindowTable[0]) || - (pWin->parent->drawable.id == savedScreenInfo[0].wid)) + if((pWin->parent == screenInfo.screens[0]->root) || + (pWin->parent->drawable.id == screenInfo.screens[0]->screensaver.wid)) { - rep.x += panoramiXdataPtr[0].x; - rep.y += panoramiXdataPtr[0].y; + rep.x += screenInfo.screens[0]->x; + rep.y += screenInfo.screens[0]->y; } rep.borderWidth = pWin->borderWidth; } @@ -596,11 +596,11 @@ int PanoramiXTranslateCoords(ClientPtr client) rep.sameScreen = xTrue; rep.child = None; - if((pWin == WindowTable[0]) || - (pWin->drawable.id == savedScreenInfo[0].wid)) + if((pWin == screenInfo.screens[0]->root) || + (pWin->drawable.id == screenInfo.screens[0]->screensaver.wid)) { - x = stuff->srcX - panoramiXdataPtr[0].x; - y = stuff->srcY - panoramiXdataPtr[0].y; + 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; @@ -634,11 +634,11 @@ int PanoramiXTranslateCoords(ClientPtr client) } rep.dstX = x - pDst->drawable.x; rep.dstY = y - pDst->drawable.y; - if((pDst == WindowTable[0]) || - (pDst->drawable.id == savedScreenInfo[0].wid)) + if((pDst == screenInfo.screens[0]->root) || + (pWin->drawable.id == screenInfo.screens[0]->screensaver.wid)) { - rep.dstX += panoramiXdataPtr[0].x; - rep.dstY += panoramiXdataPtr[0].y; + rep.dstX += screenInfo.screens[0]->x; + rep.dstY += screenInfo.screens[0]->y; } WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep); @@ -981,8 +981,8 @@ int PanoramiXClearToBackground(ClientPtr client) FOR_NSCREENS_BACKWARD(j) { stuff->window = win->info[j].id; if(isRoot) { - stuff->x = x - panoramiXdataPtr[j].x; - stuff->y = y - panoramiXdataPtr[j].y; + stuff->x = x - screenInfo.screens[j]->x; + stuff->y = y - screenInfo.screens[j]->y; } result = (*SavedProcVector[X_ClearArea])(client); if(result != Success) break; @@ -1084,20 +1084,22 @@ int PanoramiXCopyArea(ClientPtr client) } else { DrawablePtr pDst = NULL, pSrc = NULL; GCPtr pGC = NULL; - RegionPtr pRgn[MAXSCREENS]; + RegionRec totalReg; int rc; + REGION_NULL(unusedScreen, &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 - panoramiXdataPtr[j].x; - stuff->srcY = srcy - panoramiXdataPtr[j].y; + stuff->srcX = srcx - screenInfo.screens[j]->x; + stuff->srcY = srcy - screenInfo.screens[j]->y; } if (dstIsRoot) { - stuff->dstX = dstx - panoramiXdataPtr[j].x; - stuff->dstY = dsty - panoramiXdataPtr[j].y; + stuff->dstX = dstx - screenInfo.screens[j]->x; + stuff->dstY = dsty - screenInfo.screens[j]->y; } VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess); @@ -1116,37 +1118,30 @@ int PanoramiXCopyArea(ClientPtr client) } else pSrc = pDst; - pRgn[j] = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, + pRgn = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, stuff->srcX, stuff->srcY, stuff->width, stuff->height, stuff->dstX, stuff->dstY); - - if(dstShared) { - while(j--) pRgn[j] = NULL; - break; + if(pGC->graphicsExposures && pRgn) { + if(srcIsRoot) { + REGION_TRANSLATE(unusedScreen, pRgn, + screenInfo.screens[j]->x, screenInfo.screens[j]->y); + } + REGION_APPEND(unusedScreen, &totalReg, pRgn); + REGION_DESTROY(unusedScreen, pRgn); } + + if(dstShared) + break; } if(pGC->graphicsExposures) { ScreenPtr pScreen = pDst->pScreen; - RegionRec totalReg; Bool overlap; - - REGION_NULL(pScreen, &totalReg); - FOR_NSCREENS_BACKWARD(j) { - if(pRgn[j]) { - if(srcIsRoot) { - REGION_TRANSLATE(pScreen, pRgn[j], - panoramiXdataPtr[j].x, panoramiXdataPtr[j].y); - } - REGION_APPEND(pScreen, &totalReg, pRgn[j]); - REGION_DESTROY(pScreen, pRgn[j]); - } - } - REGION_VALIDATE(pScreen, &totalReg, &overlap); + REGION_VALIDATE(unusedScreen, &totalReg, &overlap); (*pScreen->SendGraphicsExpose)( client, &totalReg, stuff->dstDrawable, X_CopyArea, 0); - REGION_UNINIT(pScreen, &totalReg); + REGION_UNINIT(unusedScreen, &totalReg); } } @@ -1163,7 +1158,7 @@ int PanoramiXCopyPlane(ClientPtr client) Bool srcShared, dstShared; DrawablePtr psrcDraw, pdstDraw = NULL; GCPtr pGC = NULL; - RegionPtr pRgn[MAXSCREENS]; + RegionRec totalReg; REQUEST(xCopyPlaneReq); REQUEST_SIZE_MATCH(xCopyPlaneReq); @@ -1198,17 +1193,19 @@ int PanoramiXCopyPlane(ClientPtr client) srcx = stuff->srcX; srcy = stuff->srcY; dstx = stuff->dstX; dsty = stuff->dstY; + REGION_NULL(unusedScreen, &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 - panoramiXdataPtr[j].x; - stuff->srcY = srcy - panoramiXdataPtr[j].y; + stuff->srcX = srcx - screenInfo.screens[j]->x; + stuff->srcY = srcy - screenInfo.screens[j]->y; } if (dstIsRoot) { - stuff->dstX = dstx - panoramiXdataPtr[j].x; - stuff->dstY = dsty - panoramiXdataPtr[j].y; + stuff->dstX = dstx - screenInfo.screens[j]->x; + stuff->dstY = dsty - screenInfo.screens[j]->y; } VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess); @@ -1231,33 +1228,26 @@ int PanoramiXCopyPlane(ClientPtr client) return(BadValue); } - pRgn[j] = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC, + pRgn = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC, stuff->srcX, stuff->srcY, stuff->width, stuff->height, stuff->dstX, stuff->dstY, stuff->bitPlane); - - if(dstShared) { - while(j--) pRgn[j] = NULL; - break; + if(pGC->graphicsExposures && pRgn) { + REGION_APPEND(unusedScreen, &totalReg, pRgn); + REGION_DESTROY(unusedScreen, pRgn); } + + if(dstShared) + break; } if(pGC->graphicsExposures) { ScreenPtr pScreen = pdstDraw->pScreen; - RegionRec totalReg; Bool overlap; - - REGION_NULL(pScreen, &totalReg); - FOR_NSCREENS_BACKWARD(j) { - if(pRgn[j]) { - REGION_APPEND(pScreen, &totalReg, pRgn[j]); - REGION_DESTROY(pScreen, pRgn[j]); - } - } - REGION_VALIDATE(pScreen, &totalReg, &overlap); + REGION_VALIDATE(unusedScreen, &totalReg, &overlap); (*pScreen->SendGraphicsExpose)( client, &totalReg, stuff->dstDrawable, X_CopyPlane, 0); - REGION_UNINIT(pScreen, &totalReg); + REGION_UNINIT(unusedScreen, &totalReg); } return Success; @@ -1297,8 +1287,8 @@ int PanoramiXPolyPoint(ClientPtr client) if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint)); if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; + int x_off = screenInfo.screens[j]->x; + int y_off = screenInfo.screens[j]->y; if(x_off || y_off) { xPoint *pnts = (xPoint*)&stuff[1]; @@ -1357,8 +1347,8 @@ int PanoramiXPolyLine(ClientPtr client) if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint)); if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; + int x_off = screenInfo.screens[j]->x; + int y_off = screenInfo.screens[j]->y; if(x_off || y_off) { xPoint *pnts = (xPoint*)&stuff[1]; @@ -1420,8 +1410,8 @@ int PanoramiXPolySegment(ClientPtr client) if(j) memcpy(&stuff[1], origSegs, nsegs * sizeof(xSegment)); if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; + int x_off = screenInfo.screens[j]->x; + int y_off = screenInfo.screens[j]->y; if(x_off || y_off) { xSegment *segs = (xSegment*)&stuff[1]; @@ -1483,8 +1473,8 @@ int PanoramiXPolyRectangle(ClientPtr client) if(j) memcpy(&stuff[1], origRecs, nrects * sizeof(xRectangle)); if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; + int x_off = screenInfo.screens[j]->x; + int y_off = screenInfo.screens[j]->y; if(x_off || y_off) { @@ -1545,8 +1535,8 @@ int PanoramiXPolyArc(ClientPtr client) if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc)); if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; + int x_off = screenInfo.screens[j]->x; + int y_off = screenInfo.screens[j]->y; if(x_off || y_off) { xArc *arcs = (xArc *) &stuff[1]; @@ -1603,8 +1593,8 @@ int PanoramiXFillPoly(ClientPtr client) if(j) memcpy(&stuff[1], locPts, count * sizeof(DDXPointRec)); if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; + int x_off = screenInfo.screens[j]->x; + int y_off = screenInfo.screens[j]->y; if(x_off || y_off) { DDXPointPtr pnts = (DDXPointPtr)&stuff[1]; @@ -1666,8 +1656,8 @@ int PanoramiXPolyFillRectangle(ClientPtr client) if(j) memcpy(&stuff[1], origRects, things * sizeof(xRectangle)); if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; + int x_off = screenInfo.screens[j]->x; + int y_off = screenInfo.screens[j]->y; if(x_off || y_off) { xRectangle *rects = (xRectangle *) &stuff[1]; @@ -1727,8 +1717,8 @@ int PanoramiXPolyFillArc(ClientPtr client) if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc)); if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; + int x_off = screenInfo.screens[j]->x; + int y_off = screenInfo.screens[j]->y; if(x_off || y_off) { xArc *arcs = (xArc *) &stuff[1]; @@ -1780,8 +1770,8 @@ int PanoramiXPutImage(ClientPtr client) orig_y = stuff->dstY; FOR_NSCREENS_BACKWARD(j){ if (isRoot) { - stuff->dstX = orig_x - panoramiXdataPtr[j].x; - stuff->dstY = orig_y - panoramiXdataPtr[j].y; + 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; @@ -1846,10 +1836,10 @@ int PanoramiXGetImage(ClientPtr client) return(BadMatch); } else { if( /* check for being onscreen */ - panoramiXdataPtr[0].x + pDraw->x + x < 0 || - panoramiXdataPtr[0].x + pDraw->x + x + w > PanoramiXPixWidth || - panoramiXdataPtr[0].y + pDraw->y + y < 0 || - panoramiXdataPtr[0].y + pDraw->y + y + h > PanoramiXPixHeight || + 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 */ x < - wBorderWidth((WindowPtr)pDraw) || x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width || @@ -1983,8 +1973,8 @@ PanoramiXPolyText8(ClientPtr client) stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; if (isRoot) { - stuff->x = orig_x - panoramiXdataPtr[j].x; - stuff->y = orig_y - panoramiXdataPtr[j].y; + 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; @@ -2024,8 +2014,8 @@ PanoramiXPolyText16(ClientPtr client) stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; if (isRoot) { - stuff->x = orig_x - panoramiXdataPtr[j].x; - stuff->y = orig_y - panoramiXdataPtr[j].y; + 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; @@ -2065,8 +2055,8 @@ int PanoramiXImageText8(ClientPtr client) stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; if (isRoot) { - stuff->x = orig_x - panoramiXdataPtr[j].x; - stuff->y = orig_y - panoramiXdataPtr[j].y; + 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; @@ -2106,8 +2096,8 @@ int PanoramiXImageText16(ClientPtr client) stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; if (isRoot) { - stuff->x = orig_x - panoramiXdataPtr[j].x; - stuff->y = orig_y - panoramiXdataPtr[j].y; + 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 c77b11927..5b1a3a990 100644 --- a/Xext/panoramiXsrv.h +++ b/Xext/panoramiXsrv.h @@ -9,7 +9,6 @@ #include "panoramiX.h" extern _X_EXPORT int PanoramiXNumScreens; -extern _X_EXPORT PanoramiXData *panoramiXdataPtr; extern _X_EXPORT int PanoramiXPixWidth; extern _X_EXPORT int PanoramiXPixHeight; @@ -22,8 +21,6 @@ extern _X_EXPORT int XineramaDeleteResource(pointer, XID); extern _X_EXPORT void XineramaReinitData(ScreenPtr); -extern _X_EXPORT RegionRec XineramaScreenRegions[MAXSCREENS]; - extern _X_EXPORT unsigned long XRC_DRAWABLE; extern _X_EXPORT unsigned long XRT_WINDOW; extern _X_EXPORT unsigned long XRT_PIXMAP; diff --git a/Xext/saver.c b/Xext/saver.c index fdcbac567..696c4aa22 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -285,7 +285,7 @@ CheckScreenPrivate (ScreenPtr pScreen) { free(pPriv); SetScreenPrivate (pScreen, NULL); - savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL; + pScreen->screensaver.ExternalScreenSaver = NULL; } } @@ -304,7 +304,7 @@ MakeScreenPrivate (ScreenPtr pScreen) pPriv->hasWindow = FALSE; pPriv->installedMap = None; SetScreenPrivate (pScreen, pPriv); - savedScreenInfo[pScreen->myNum].ExternalScreenSaver = ScreenSaverHandle; + pScreen->screensaver.ExternalScreenSaver = ScreenSaverHandle; return pPriv; } @@ -503,8 +503,8 @@ SendScreenSaverNotify (ScreenPtr pScreen, int state, Bool forced) ev.type = ScreenSaverNotify + ScreenSaverEventBase; ev.state = state; ev.timestamp = currentTime.milliseconds; - ev.root = WindowTable[pScreen->myNum]->drawable.id; - ev.window = savedScreenInfo[pScreen->myNum].wid; + ev.root = pScreen->root->drawable.id; + ev.window = pScreen->screensaver.wid; ev.kind = kind; ev.forced = forced; WriteEventsToClient (pEv->client, 1, (xEvent *) &ev); @@ -559,7 +559,7 @@ CreateSaverWindow (ScreenPtr pScreen) Colormap wantMap; ColormapPtr pCmap; - pSaver = &savedScreenInfo[pScreen->myNum]; + pSaver = &pScreen->screensaver; if (pSaver->pWindow) { pSaver->pWindow = NullWindow; @@ -580,7 +580,7 @@ CreateSaverWindow (ScreenPtr pScreen) if (GrabInProgress && GrabInProgress != pAttr->client->index) return FALSE; - pWin = CreateWindow (pSaver->wid, WindowTable[pScreen->myNum], + pWin = CreateWindow (pSaver->wid, pScreen->root, pAttr->x, pAttr->y, pAttr->width, pAttr->height, pAttr->borderWidth, pAttr->class, pAttr->mask, (XID *)pAttr->values, @@ -672,7 +672,7 @@ DestroySaverWindow (ScreenPtr pScreen) if (!pPriv || !pPriv->hasWindow) return FALSE; - pSaver = &savedScreenInfo[pScreen->myNum]; + pSaver = &pScreen->screensaver; if (pSaver->pWindow) { pSaver->pWindow = NullWindow; @@ -756,7 +756,7 @@ ProcScreenSaverQueryInfo (ClientPtr client) if (rc != Success) return rc; - pSaver = &savedScreenInfo[pDraw->pScreen->myNum]; + pSaver = &pDraw->pScreen->screensaver; pPriv = GetScreenPrivate (pDraw->pScreen); UpdateCurrentTime (); @@ -866,7 +866,7 @@ ScreenSaverSetAttributes (ClientPtr client) if (ret != Success) return ret; pScreen = pDraw->pScreen; - pParent = WindowTable[pScreen->myNum]; + pParent = pScreen->root; ret = XaceHook(XACE_SCREENSAVER_ACCESS, client, pScreen, DixSetAttrAccess); if (ret != Success) diff --git a/Xext/shm.c b/Xext/shm.c index 3d9c63352..322709c17 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -598,8 +598,8 @@ ProcPanoramiXShmPutImage(ClientPtr client) stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; if (isRoot) { - stuff->dstX = orig_x - panoramiXdataPtr[j].x; - stuff->dstY = orig_y - panoramiXdataPtr[j].y; + stuff->dstX = orig_x - screenInfo.screens[j]->x; + stuff->dstY = orig_y - screenInfo.screens[j]->y; } result = ProcShmPutImage(client); if(result != Success) break; @@ -660,10 +660,10 @@ ProcPanoramiXShmGetImage(ClientPtr client) return(BadMatch); } else { if( /* check for being onscreen */ - panoramiXdataPtr[0].x + pDraw->x + x < 0 || - panoramiXdataPtr[0].x + pDraw->x + x + w > PanoramiXPixWidth || - panoramiXdataPtr[0].y + pDraw->y + y < 0 || - panoramiXdataPtr[0].y + pDraw->y + y + h > PanoramiXPixHeight || + 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 */ x < - wBorderWidth((WindowPtr)pDraw) || x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width || diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index d7338ad87..c63706d46 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -1690,8 +1690,8 @@ XineramaXvShmPutImage(ClientPtr client) stuff->drw_x = x; stuff->drw_y = y; if(isRoot) { - stuff->drw_x -= panoramiXdataPtr[i].x; - stuff->drw_y -= panoramiXdataPtr[i].y; + stuff->drw_x -= screenInfo.screens[i]->x; + stuff->drw_y -= screenInfo.screens[i]->y; } stuff->send_event = (send_event && !i) ? 1 : 0; @@ -1742,8 +1742,8 @@ XineramaXvPutImage(ClientPtr client) stuff->drw_x = x; stuff->drw_y = y; if(isRoot) { - stuff->drw_x -= panoramiXdataPtr[i].x; - stuff->drw_y -= panoramiXdataPtr[i].y; + stuff->drw_x -= screenInfo.screens[i]->x; + stuff->drw_y -= screenInfo.screens[i]->y; } result = ProcXvPutImage(client); @@ -1790,8 +1790,8 @@ XineramaXvPutVideo(ClientPtr client) stuff->drw_x = x; stuff->drw_y = y; if(isRoot) { - stuff->drw_x -= panoramiXdataPtr[i].x; - stuff->drw_y -= panoramiXdataPtr[i].y; + stuff->drw_x -= screenInfo.screens[i]->x; + stuff->drw_y -= screenInfo.screens[i]->y; } result = ProcXvPutVideo(client); @@ -1838,8 +1838,8 @@ XineramaXvPutStill(ClientPtr client) stuff->drw_x = x; stuff->drw_y = y; if(isRoot) { - stuff->drw_x -= panoramiXdataPtr[i].x; - stuff->drw_y -= panoramiXdataPtr[i].y; + stuff->drw_x -= screenInfo.screens[i]->x; + stuff->drw_y -= screenInfo.screens[i]->y; } result = ProcXvPutStill(client); diff --git a/Xi/closedev.c b/Xi/closedev.c index 159ead55c..e319c737a 100644 --- a/Xi/closedev.c +++ b/Xi/closedev.c @@ -156,7 +156,7 @@ ProcXCloseDevice(ClientPtr client) * Delete passive grabs from all windows for this device. */ for (i = 0; i < screenInfo.numScreens; i++) { - pWin = WindowTable[i]; + pWin = screenInfo.screens[i]->root; DeleteDeviceEvents(d, pWin, client); p1 = pWin->firstChild; DeleteEventsFromChildren(d, p1, client); diff --git a/Xi/exevents.c b/Xi/exevents.c index 41b396c28..56d9bf7fd 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -926,7 +926,7 @@ ProcessRawEvent(RawDeviceEvent *ev, DeviceIntPtr device) } for (i = 0; i < screenInfo.numScreens; i++) - DeliverEventsToWindow(device, WindowTable[i], xi, 1, + DeliverEventsToWindow(device, screenInfo.screens[i]->root, xi, 1, GetEventFilter(device, xi), NULL); free(xi); } @@ -1042,7 +1042,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device) /* see comment in EnqueueEvents regarding the next three lines */ if (ev->any.type == ET_Motion) - ev->device_event.root = WindowTable[pSprite->hotPhys.pScreen->myNum]->drawable.id; + ev->device_event.root = pSprite->hotPhys.pScreen->root->drawable.id; eventinfo.device = device; eventinfo.event = ev; @@ -2120,7 +2120,7 @@ SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count) WindowPtr pWin, p1; for (i = 0; i < screenInfo.numScreens; i++) { - pWin = WindowTable[i]; + pWin = screenInfo.screens[i]->root; if (!pWin) continue; DeliverEventsToWindow(dev, pWin, ev, count, mask, NullGrab); diff --git a/Xi/xichangecursor.c b/Xi/xichangecursor.c index e72cfac03..215339331 100644 --- a/Xi/xichangecursor.c +++ b/Xi/xichangecursor.c @@ -93,7 +93,7 @@ int ProcXIChangeCursor(ClientPtr client) if (stuff->cursor == None) { - if (pWin == WindowTable[pWin->drawable.pScreen->myNum]) + if (pWin == pWin->drawable.pScreen->root) pCursor = rootCursor; else pCursor = (CursorPtr)None; diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c index 41253fb18..b521c48ef 100644 --- a/Xi/xiquerypointer.c +++ b/Xi/xiquerypointer.c @@ -43,6 +43,7 @@ #include "exevents.h" #include "exglobals.h" #include "eventconvert.h" +#include "scrnintstr.h" #include "xkbsrv.h" #ifdef PANORAMIX @@ -181,12 +182,12 @@ ProcXIQueryPointer(ClientPtr client) #ifdef PANORAMIX if(!noPanoramiXExtension) { - rep.root_x += FP1616(panoramiXdataPtr[0].x, 0); - rep.root_y += FP1616(panoramiXdataPtr[0].y, 0); + 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(panoramiXdataPtr[0].x, 0); - rep.win_y += FP1616(panoramiXdataPtr[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/composite/compinit.c b/composite/compinit.c index a81cc740f..e4b68c822 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -141,7 +141,7 @@ compScreenUpdate (ScreenPtr pScreen) compCheckTree (pScreen); if (cs->damaged) { - compWindowUpdate (WindowTable[pScreen->myNum]); + compWindowUpdate (pScreen->root); cs->damaged = FALSE; } } diff --git a/composite/compoverlay.c b/composite/compoverlay.c index 2158cdb5a..67b566c7f 100644 --- a/composite/compoverlay.c +++ b/composite/compoverlay.c @@ -124,7 +124,7 @@ Bool compCreateOverlayWindow (ScreenPtr pScreen) { CompScreenPtr cs = GetCompScreen(pScreen); - WindowPtr pRoot = WindowTable[pScreen->myNum]; + WindowPtr pRoot = pScreen->root; WindowPtr pWin; XID attrs[] = { None, TRUE }; /* backPixmap, overrideRedirect */ int result; diff --git a/composite/compwindow.c b/composite/compwindow.c index f2f6ea3cd..3b16bf980 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -800,7 +800,7 @@ CompositeRealChildHead (WindowPtr pWin) if (!pWin->parent && (screenIsSaved == SCREEN_SAVER_ON) && - (HasSaverWindow (pWin->drawable.pScreen->myNum))) { + (HasSaverWindow (pWin->drawable.pScreen))) { /* First child is the screen saver; see if next child is the overlay */ pChildBefore = pWin->firstChild; diff --git a/dix/devices.c b/dix/devices.c index 250a4980d..998d22a4b 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -360,9 +360,9 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent) /* Sprites appear on first root window, so we can hardcode it */ if (dev->spriteInfo->spriteOwner) { - InitializeSprite(dev, WindowTable[0]); + InitializeSprite(dev, screenInfo.screens[0]->root); /* mode doesn't matter */ - EnterWindow(dev, WindowTable[0], NotifyAncestor); + EnterWindow(dev, screenInfo.screens[0]->root, NotifyAncestor); } else if ((other = NextFreePointerDevice()) == NULL) { @@ -2435,7 +2435,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master) if (dev->spriteInfo->sprite) currentRoot = dev->spriteInfo->sprite->spriteTrace[0]; else /* new device auto-set to floating */ - currentRoot = WindowTable[0]; + currentRoot = screenInfo.screens[0]->root; /* we need to init a fake sprite */ screen = currentRoot->drawable.pScreen; diff --git a/dix/dispatch.c b/dix/dispatch.c index 27cb22022..c0efce5bf 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -562,7 +562,7 @@ CreateConnectionBlock(void) VisualPtr pVisual; pScreen = screenInfo.screens[i]; - root.windowId = WindowTable[i]->drawable.id; + root.windowId = pScreen->root->drawable.id; root.defaultColormap = pScreen->defColormap; root.whitePixel = pScreen->whitePixel; root.blackPixel = pScreen->blackPixel; @@ -912,7 +912,7 @@ GetGeometry(ClientPtr client, xGetGeometryReply *rep) rep->type = X_Reply; rep->length = 0; rep->sequenceNumber = client->sequence; - rep->root = WindowTable[pDraw->pScreen->myNum]->drawable.id; + rep->root = pDraw->pScreen->root->drawable.id; rep->depth = pDraw->depth; rep->width = pDraw->width; rep->height = pDraw->height; @@ -972,7 +972,7 @@ ProcQueryTree(ClientPtr client) return rc; memset(&reply, 0, sizeof(xQueryTreeReply)); reply.type = X_Reply; - reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; + reply.root = pWin->drawable.pScreen->root->drawable.id; reply.sequenceNumber = client->sequence; if (pWin->parent) reply.parent = pWin->parent->drawable.id; @@ -2055,7 +2055,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, } else { - pBoundingDraw = (DrawablePtr)WindowTable[pDraw->pScreen->myNum]; + pBoundingDraw = (DrawablePtr)pDraw->pScreen->root; } xgi.visual = wVisual (pWin); @@ -3666,9 +3666,9 @@ SendConnSetup(ClientPtr client, char *reason) { unsigned int j; xDepth *pDepth; + WindowPtr pRoot = screenInfo.screens[i]->root; - root->currentInputMask = WindowTable[i]->eventMask | - wOtherEventMasks (WindowTable[i]); + root->currentInputMask = pRoot->eventMask | wOtherEventMasks(pRoot); pDepth = (xDepth *)(root + 1); for (j = 0; j < root->nDepths; j++) { @@ -3916,7 +3916,6 @@ AddScreen( any of the strings pointed to by argv. They may be passed to multiple screens. */ - WindowTable[i] = NullWindow; screenInfo.screens[i] = pScreen; screenInfo.numScreens++; if (!(*pfnInit)(i, pScreen, argc, argv)) diff --git a/dix/enterleave.c b/dix/enterleave.c index c08cc3100..eefa7ab8e 100644 --- a/dix/enterleave.c +++ b/dix/enterleave.c @@ -1077,7 +1077,7 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev, for (i = 0; i < nscreens; i++) { - root = WindowTable[i]; + root = screenInfo.screens[i]->root; if (!HasOtherPointer(root, GetPairedDevice(dev)) && !FirstFocusChild(root)) { /* If pointer was on PointerRootWin and changes to NoneWin, and @@ -1138,7 +1138,7 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev, for (i = 0; i < nscreens; i++) { - root = WindowTable[i]; + root = screenInfo.screens[i]->root; if (!HasFocus(root) && !FirstFocusChild(root)) { CoreFocusEvent(dev, FocusIn, mode, B ? NotifyPointerRoot : NotifyDetailNone, root); @@ -1169,7 +1169,7 @@ CoreFocusFromPointerRootOrNone(DeviceIntPtr dev, for (i = 0; i < nscreens; i++) { - root = WindowTable[i]; + root = screenInfo.screens[i]->root; if (!HasFocus(root) && !FirstFocusChild(root)) { /* If pointer was on PointerRootWin and changes to NoneWin, and @@ -1279,7 +1279,7 @@ DeviceFocusEvents(DeviceIntPtr dev, NotifyPointer); /* Notify all the roots */ for (i = 0; i < nscreens; i++) - DeviceFocusEvent(dev, XI_FocusOut, mode, out, WindowTable[i]); + DeviceFocusEvent(dev, XI_FocusOut, mode, out, screenInfo.screens[i]->root); } else { @@ -1293,7 +1293,7 @@ DeviceFocusEvents(DeviceIntPtr dev, } /* Notify all the roots */ for (i = 0; i < nscreens; i++) - DeviceFocusEvent(dev, XI_FocusIn, mode, in, WindowTable[i]); + DeviceFocusEvent(dev, XI_FocusIn, mode, in, screenInfo.screens[i]->root); if (to == PointerRootWin) DeviceFocusInEvents(dev, RootWindow(dev), sprite->win, mode, NotifyPointer); } @@ -1305,7 +1305,7 @@ DeviceFocusEvents(DeviceIntPtr dev, DeviceFocusOutEvents(dev, sprite->win, RootWindow(dev), mode, NotifyPointer); for (i = 0; i < nscreens; i++) - DeviceFocusEvent(dev, XI_FocusOut, mode, out, WindowTable[i]); + DeviceFocusEvent(dev, XI_FocusOut, mode, out, screenInfo.screens[i]->root); if (to->parent != NullWindow) DeviceFocusInEvents(dev, RootWindow(dev), to, mode, NotifyNonlinearVirtual); DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to); diff --git a/dix/events.c b/dix/events.c index 9e05dc96c..502eebd8d 100644 --- a/dix/events.c +++ b/dix/events.c @@ -485,6 +485,13 @@ SyntheticMotion(DeviceIntPtr dev, int x, int y) { #ifdef PANORAMIX static void PostNewCursor(DeviceIntPtr pDev); +static Bool +pointOnScreen(ScreenPtr pScreen, int x, int y) +{ + return x >= pScreen->x && x < pScreen->x + pScreen->width && + y >= pScreen->y && y < pScreen->y + pScreen->height; +} + static Bool XineramaSetCursorPosition( DeviceIntPtr pDev, @@ -493,7 +500,6 @@ XineramaSetCursorPosition( Bool generateEvent ){ ScreenPtr pScreen; - BoxRec box; int i; SpritePtr pSprite = pDev->spriteInfo->sprite; @@ -502,17 +508,16 @@ XineramaSetCursorPosition( that screen are. */ pScreen = pSprite->screen; - x += panoramiXdataPtr[0].x; - y += panoramiXdataPtr[0].y; + x += screenInfo.screens[0]->x; + y += screenInfo.screens[0]->y; - if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum], - x, y, &box)) + if(!pointOnScreen(pScreen, x, y)) { FOR_NSCREENS(i) { if(i == pScreen->myNum) continue; - if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i], x, y, &box)) + if(pointOnScreen(screenInfo.screens[i], x, y)) { pScreen = screenInfo.screens[i]; break; @@ -521,10 +526,10 @@ XineramaSetCursorPosition( } pSprite->screen = pScreen; - pSprite->hotPhys.x = x - panoramiXdataPtr[0].x; - pSprite->hotPhys.y = y - panoramiXdataPtr[0].y; - x -= panoramiXdataPtr[pScreen->myNum].x; - y -= panoramiXdataPtr[pScreen->myNum].y; + pSprite->hotPhys.x = x - screenInfo.screens[0]->x; + pSprite->hotPhys.y = y - screenInfo.screens[0]->y; + x -= pScreen->x; + y -= pScreen->y; return (*pScreen->SetCursorPosition)(pDev, pScreen, x, y, generateEvent); } @@ -542,10 +547,10 @@ XineramaConstrainCursor(DeviceIntPtr pDev) /* Translate the constraining box to the screen the sprite is actually on */ - newBox.x1 += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x; - newBox.x2 += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x; - newBox.y1 += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y; - newBox.y2 += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y; + newBox.x1 += screenInfo.screens[0]->x - pScreen->x; + newBox.x2 += screenInfo.screens[0]->x - pScreen->x; + newBox.y1 += screenInfo.screens[0]->y - pScreen->y; + newBox.y2 += screenInfo.screens[0]->y - pScreen->y; (* pScreen->ConstrainCursor)(pDev, pScreen, &newBox); } @@ -556,9 +561,10 @@ XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin) { SpritePtr pSprite = pDev->spriteInfo->sprite; - if(pWin == WindowTable[0]) { - memcpy(pSprite->windows, WindowTable, - PanoramiXNumScreens*sizeof(WindowPtr)); + if(pWin == screenInfo.screens[0]->root) { + int i; + for (i = 0; i < PanoramiXNumScreens; i++) + pSprite->windows[i] = screenInfo.screens[i]->root; } else { PanoramiXRes *win; int rc, i; @@ -594,12 +600,12 @@ XineramaConfineCursorToWindow(DeviceIntPtr pDev, REGION_COPY(pSprite->screen, &pSprite->Reg1, &pSprite->windows[i]->borderSize); - off_x = panoramiXdataPtr[i].x; - off_y = panoramiXdataPtr[i].y; + off_x = screenInfo.screens[i]->x; + off_y = screenInfo.screens[i]->y; while(i--) { - x = off_x - panoramiXdataPtr[i].x; - y = off_y - panoramiXdataPtr[i].y; + x = off_x - screenInfo.screens[i]->x; + y = off_y - screenInfo.screens[i]->y; if(x || y) REGION_TRANSLATE(pSprite->screen, &pSprite->Reg1, x, y); @@ -607,8 +613,8 @@ XineramaConfineCursorToWindow(DeviceIntPtr pDev, REGION_UNION(pSprite->screen, &pSprite->Reg1, &pSprite->Reg1, &pSprite->windows[i]->borderSize); - off_x = panoramiXdataPtr[i].x; - off_y = panoramiXdataPtr[i].y; + off_x = screenInfo.screens[i]->x; + off_y = screenInfo.screens[i]->y; } pSprite->hotLimits = *REGION_EXTENTS(pSprite->screen, &pSprite->Reg1); @@ -619,7 +625,7 @@ XineramaConfineCursorToWindow(DeviceIntPtr pDev, pSprite->hotShape = NullRegion; pSprite->confined = FALSE; - pSprite->confineWin = (pWin == WindowTable[0]) ? NullWindow : pWin; + pSprite->confineWin = (pWin == screenInfo.screens[0]->root) ? NullWindow : pWin; CheckPhysLimits(pDev, pSprite->current, generateEvents, FALSE, NULL); } @@ -813,12 +819,12 @@ CheckVirtualMotion( REGION_COPY(pSprite->screen, &pSprite->Reg2, &pSprite->windows[i]->borderSize); - off_x = panoramiXdataPtr[i].x; - off_y = panoramiXdataPtr[i].y; + off_x = screenInfo.screens[i]->x; + off_y = screenInfo.screens[i]->y; while(i--) { - x = off_x - panoramiXdataPtr[i].x; - y = off_y - panoramiXdataPtr[i].y; + x = off_x - screenInfo.screens[i]->x; + y = off_y - screenInfo.screens[i]->y; if(x || y) REGION_TRANSLATE(pSprite->screen, &pSprite->Reg2, x, y); @@ -826,8 +832,8 @@ CheckVirtualMotion( REGION_UNION(pSprite->screen, &pSprite->Reg2, &pSprite->Reg2, &pSprite->windows[i]->borderSize); - off_x = panoramiXdataPtr[i].x; - off_y = panoramiXdataPtr[i].y; + off_x = screenInfo.screens[i]->x; + off_y = screenInfo.screens[i]->y; } } else #endif @@ -875,7 +881,7 @@ CheckVirtualMotion( #ifdef PANORAMIX if (noPanoramiXExtension) /* No typo. Only set the root win if disabled */ #endif - RootWindow(pDev) = WindowTable[pSprite->hot.pScreen->myNum]; + RootWindow(pDev) = pSprite->hot.pScreen->root; } static void @@ -1123,7 +1129,7 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device) * updated yet. */ if (ev->any.type == ET_Motion) - ev->device_event.root = WindowTable[pSprite->hotPhys.pScreen->myNum]->drawable.id; + ev->device_event.root = pSprite->hotPhys.pScreen->root->drawable.id; eventinfo.event = ev; eventinfo.device = device; @@ -1134,10 +1140,8 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device) { #ifdef PANORAMIX if(!noPanoramiXExtension) { - event->root_x += panoramiXdataPtr[pSprite->screen->myNum].x - - panoramiXdataPtr[0].x; - event->root_y += panoramiXdataPtr[pSprite->screen->myNum].y - - panoramiXdataPtr[0].y; + event->root_x += pSprite->screen->x - screenInfo.screens[0]->x; + event->root_y += pSprite->screen->y - screenInfo.screens[0]->y; } #endif pSprite->hotPhys.x = event->root_x; @@ -1217,10 +1221,10 @@ PlayReleasedEvents(void) case ET_KeyRelease: case ET_ProximityIn: case ET_ProximityOut: - ev->root_x += panoramiXdataPtr[0].x - - panoramiXdataPtr[pDev->spriteInfo->sprite->screen->myNum].x; - ev->root_y += panoramiXdataPtr[0].y - - panoramiXdataPtr[pDev->spriteInfo->sprite->screen->myNum].y; + ev->root_x += screenInfo.screens[0]->x - + pDev->spriteInfo->sprite->screen->x; + ev->root_y += screenInfo.screens[0]->y - + pDev->spriteInfo->sprite->screen->y; break; default: break; @@ -1339,7 +1343,7 @@ playmore: } else ConfineCursorToWindow(dev, - WindowTable[dev->spriteInfo->sprite->hotPhys.pScreen->myNum], + dev->spriteInfo->sprite->hotPhys.pScreen->root, TRUE, FALSE); PostNewCursor(dev); } @@ -1369,7 +1373,7 @@ ScreenRestructured (ScreenPtr pScreen) } else ConfineCursorToWindow(pDev, - WindowTable[pDev->spriteInfo->sprite->hotPhys.pScreen->myNum], + pDev->spriteInfo->sprite->hotPhys.pScreen->root, TRUE, FALSE); } } @@ -2560,8 +2564,8 @@ PointInBorderSize(WindowPtr pWin, int x, int y) for(i = 1; i < PanoramiXNumScreens; i++) { if(POINT_IN_REGION(pSprite->screen, &pSprite->windows[i]->borderSize, - x + panoramiXdataPtr[0].x - panoramiXdataPtr[i].x, - y + panoramiXdataPtr[0].y - panoramiXdataPtr[i].y, + x + screenInfo.screens[0]->x - screenInfo.screens[i]->x, + y + screenInfo.screens[0]->y - screenInfo.screens[i]->y, &box)) return TRUE; } @@ -2756,17 +2760,15 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev) /* Motion events entering DIX get translated to Screen 0 coordinates. Replayed events have already been translated since they've entered DIX before */ - ev->root_x += panoramiXdataPtr[pSprite->screen->myNum].x - - panoramiXdataPtr[0].x; - ev->root_y += panoramiXdataPtr[pSprite->screen->myNum].y - - panoramiXdataPtr[0].y; + ev->root_x += pSprite->screen->x - screenInfo.screens[0]->x; + ev->root_y += pSprite->screen->y - screenInfo.screens[0]->y; } else #endif { if (pSprite->hot.pScreen != pSprite->hotPhys.pScreen) { pSprite->hot.pScreen = pSprite->hotPhys.pScreen; - RootWindow(pDev) = WindowTable[pSprite->hot.pScreen->myNum]; + RootWindow(pDev) = pSprite->hot.pScreen->root; } } @@ -2849,7 +2851,7 @@ WindowsRestructured(void) #ifdef PANORAMIX /* This was added to support reconfiguration under Xdmx. The problem is - * that if the 0th screen (i.e., WindowTable[0]) is moved to an origin + * that if the 0th screen (i.e., screenInfo.screens[0]) is moved to an origin * other than 0,0, the information in the private sprite structure must * be updated accordingly, or XYToWindow (and other routines) will not * compute correctly. */ @@ -2892,7 +2894,7 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) } else ConfineCursorToWindow( pDev, - WindowTable[pSprite->hotPhys.pScreen->myNum], + pSprite->hotPhys.pScreen->root, TRUE, FALSE); } @@ -3007,10 +3009,10 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) } #ifdef PANORAMIX if(!noPanoramiXExtension) { - pSprite->hotLimits.x1 = -panoramiXdataPtr[0].x; - pSprite->hotLimits.y1 = -panoramiXdataPtr[0].y; - pSprite->hotLimits.x2 = PanoramiXPixWidth - panoramiXdataPtr[0].x; - pSprite->hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y; + pSprite->hotLimits.x1 = -screenInfo.screens[0]->x; + pSprite->hotLimits.y1 = -screenInfo.screens[0]->y; + pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x; + pSprite->hotLimits.y2 = PanoramiXPixHeight - screenInfo.screens[0]->y; pSprite->physLimits = pSprite->hotLimits; pSprite->confineWin = NullWindow; pSprite->hotShape = NullRegion; @@ -3051,7 +3053,7 @@ UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen) pSprite = pDev->spriteInfo->sprite; - win = WindowTable[pScreen->myNum]; + win = pScreen->root; pSprite->hotPhys.pScreen = pScreen; pSprite->hot = pSprite->hotPhys; @@ -3077,10 +3079,10 @@ UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen) #ifdef PANORAMIX if(!noPanoramiXExtension) { - pSprite->hotLimits.x1 = -panoramiXdataPtr[0].x; - pSprite->hotLimits.y1 = -panoramiXdataPtr[0].y; - pSprite->hotLimits.x2 = PanoramiXPixWidth - panoramiXdataPtr[0].x; - pSprite->hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y; + pSprite->hotLimits.x1 = -screenInfo.screens[0]->x; + pSprite->hotLimits.y1 = -screenInfo.screens[0]->y; + pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x; + pSprite->hotLimits.y2 = PanoramiXPixHeight - screenInfo.screens[0]->y; pSprite->physLimits = pSprite->hotLimits; pSprite->screen = pScreen; } @@ -3113,10 +3115,8 @@ NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y) pSprite->hotPhys.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension) { - pSprite->hotPhys.x += panoramiXdataPtr[newScreen->myNum].x - - panoramiXdataPtr[0].x; - pSprite->hotPhys.y += panoramiXdataPtr[newScreen->myNum].y - - panoramiXdataPtr[0].y; + pSprite->hotPhys.x += newScreen->x - screenInfo.screens[0]->x; + pSprite->hotPhys.y += newScreen->y - screenInfo.screens[0]->y; if (newScreen != pSprite->screen) { pSprite->screen = newScreen; /* Make sure we tell the DDX to update its copy of the screen */ @@ -3124,23 +3124,22 @@ NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y) XineramaConfineCursorToWindow(pDev, pSprite->confineWin, TRUE); else - XineramaConfineCursorToWindow(pDev, WindowTable[0], TRUE); + XineramaConfineCursorToWindow(pDev, screenInfo.screens[0]->root, TRUE); /* if the pointer wasn't confined, the DDX won't get told of the pointer warp so we reposition it here */ if(!syncEvents.playingEvents) (*pSprite->screen->SetCursorPosition)( pDev, pSprite->screen, - pSprite->hotPhys.x + panoramiXdataPtr[0].x - - panoramiXdataPtr[pSprite->screen->myNum].x, - pSprite->hotPhys.y + panoramiXdataPtr[0].y - - panoramiXdataPtr[pSprite->screen->myNum].y, FALSE); + pSprite->hotPhys.x + screenInfo.screens[0]->x - + pSprite->screen->x, + pSprite->hotPhys.y + screenInfo.screens[0]->y - + pSprite->screen->y, FALSE); } } else #endif if (newScreen != pSprite->hotPhys.pScreen) - ConfineCursorToWindow(pDev, WindowTable[newScreen->myNum], - TRUE, FALSE); + ConfineCursorToWindow(pDev, newScreen->root, TRUE, FALSE); } #ifdef PANORAMIX @@ -3163,14 +3162,14 @@ XineramaPointInWindowIsVisible( if(!XineramaSetWindowPntrs(inputInfo.pointer, pWin)) return FALSE; - xoff = x + panoramiXdataPtr[0].x; - yoff = y + panoramiXdataPtr[0].y; + xoff = x + screenInfo.screens[0]->x; + yoff = y + screenInfo.screens[0]->y; for(i = 1; i < PanoramiXNumScreens; i++) { pWin = inputInfo.pointer->spriteInfo->sprite->windows[i]; pScreen = pWin->drawable.pScreen; - x = xoff - panoramiXdataPtr[i].x; - y = yoff - panoramiXdataPtr[i].y; + x = xoff - screenInfo.screens[i]->x; + y = yoff - screenInfo.screens[i]->y; if(POINT_IN_REGION(pScreen, &pWin->borderClip, x, y, &box) && (!wInputShape(pWin) || @@ -3215,9 +3214,9 @@ XineramaWarpPointer(ClientPtr client) winX = source->drawable.x; winY = source->drawable.y; - if(source == WindowTable[0]) { - winX -= panoramiXdataPtr[0].x; - winY -= panoramiXdataPtr[0].y; + if(source == screenInfo.screens[0]->root) { + winX -= screenInfo.screens[0]->x; + winY -= screenInfo.screens[0]->y; } if (x < winX + stuff->srcX || y < winY + stuff->srcY || @@ -3231,9 +3230,9 @@ XineramaWarpPointer(ClientPtr client) if (dest) { x = dest->drawable.x; y = dest->drawable.y; - if(dest == WindowTable[0]) { - x -= panoramiXdataPtr[0].x; - y -= panoramiXdataPtr[0].y; + if(dest == screenInfo.screens[0]->root) { + x -= screenInfo.screens[0]->x; + y -= screenInfo.screens[0]->y; } } @@ -4997,11 +4996,11 @@ ProcQueryPointer(ClientPtr client) #ifdef PANORAMIX if(!noPanoramiXExtension) { - rep.rootX += panoramiXdataPtr[0].x; - rep.rootY += panoramiXdataPtr[0].y; + rep.rootX += screenInfo.screens[0]->x; + rep.rootY += screenInfo.screens[0]->y; if(stuff->id == rep.root) { - rep.winX += panoramiXdataPtr[0].x; - rep.winY += panoramiXdataPtr[0].y; + rep.winX += screenInfo.screens[0]->x; + rep.winY += screenInfo.screens[0]->y; } } #endif @@ -5670,7 +5669,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) #ifdef PANORAMIX if(!noPanoramiXExtension && - (panoramiXdataPtr[0].x || panoramiXdataPtr[0].y)) + (screenInfo.screens[0]->x || screenInfo.screens[0]->y)) { switch(events->u.u.type) { case MotionNotify: @@ -5687,13 +5686,13 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) */ count = 1; /* should always be 1 */ memcpy(&eventCopy, events, sizeof(xEvent)); - eventCopy.u.keyButtonPointer.rootX += panoramiXdataPtr[0].x; - eventCopy.u.keyButtonPointer.rootY += panoramiXdataPtr[0].y; + eventCopy.u.keyButtonPointer.rootX += screenInfo.screens[0]->x; + eventCopy.u.keyButtonPointer.rootY += screenInfo.screens[0]->y; if(eventCopy.u.keyButtonPointer.event == eventCopy.u.keyButtonPointer.root) { - eventCopy.u.keyButtonPointer.eventX += panoramiXdataPtr[0].x; - eventCopy.u.keyButtonPointer.eventY += panoramiXdataPtr[0].y; + eventCopy.u.keyButtonPointer.eventX += screenInfo.screens[0]->x; + eventCopy.u.keyButtonPointer.eventY += screenInfo.screens[0]->y; } events = &eventCopy; break; diff --git a/dix/getevents.c b/dix/getevents.c index eeef41448..3892f6fb2 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -1210,8 +1210,8 @@ PostSyntheticMotion(DeviceIntPtr pDev, will translate from sprite screen to screen 0 upon reentry to the DIX layer. */ if (!noPanoramiXExtension) { - x += panoramiXdataPtr[0].x - panoramiXdataPtr[screen].x; - y += panoramiXdataPtr[0].y - panoramiXdataPtr[screen].y; + x += screenInfo.screens[0]->x - screenInfo.screens[screen]->x; + y += screenInfo.screens[0]->y - screenInfo.screens[screen]->y; } #endif diff --git a/dix/globals.c b/dix/globals.c index c24a94fbe..82a85c28e 100644 --- a/dix/globals.c +++ b/dix/globals.c @@ -83,8 +83,6 @@ ClientPtr serverClient; int currentMaxClients; /* current size of clients array */ long maxBigRequestSize = MAX_BIG_REQUEST_SIZE; -WindowPtr WindowTable[MAXSCREENS]; - unsigned long globalSerialNumber = 0; unsigned long serverGeneration = 0; @@ -137,5 +135,3 @@ char *display; char *ConnectionInfo; CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND; - -DDXPointRec dixScreenOrigins[MAXSCREENS]; diff --git a/dix/main.c b/dix/main.c index 3e500ba4d..982fedd6b 100644 --- a/dix/main.c +++ b/dix/main.c @@ -249,7 +249,7 @@ int main(int argc, char *argv[], char *envp[]) #endif for (i = 0; i < screenInfo.numScreens; i++) - InitRootWindow(WindowTable[i]); + InitRootWindow(screenInfo.screens[i]->root); InitCoreDevices(); InitInput(argc, argv); @@ -303,7 +303,8 @@ int main(int argc, char *argv[], char *envp[]) CloseInput(); - memset(WindowTable, 0, sizeof(WindowTable)); + for (i = 0; i < screenInfo.numScreens; i++) + screenInfo.screens[i]->root = NullWindow; CloseDownDevices(); CloseDownEvents(); diff --git a/dix/window.c b/dix/window.c index 00854c6d5..9e1f491d8 100644 --- a/dix/window.c +++ b/dix/window.c @@ -151,12 +151,10 @@ WindowSeekDeviceCursor(WindowPtr pWin, int screenIsSaved = SCREEN_SAVER_OFF; -ScreenSaverStuffRec savedScreenInfo[MAXSCREENS]; - static int FocusPrivatesKeyIndex; DevPrivateKey FocusPrivatesKey = &FocusPrivatesKeyIndex; -static Bool TileScreenSaver(int i, int kind); +static Bool TileScreenSaver(ScreenPtr pScreen, int kind); #define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \ @@ -212,7 +210,7 @@ PrintWindowTree(void) for (i=0; iroot; miPrintRegion(&pWin->clipList); p1 = pWin->firstChild; PrintChildren(p1, 4); @@ -258,7 +256,7 @@ TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, pointer data) int WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, pointer data) { - return(TraverseTree(WindowTable[pScreen->myNum], func, data)); + return(TraverseTree(pScreen->root, func, data)); } /* hack for forcing backing store on all windows */ @@ -363,12 +361,12 @@ CreateRootWindow(ScreenPtr pScreen) if (!pWin) return FALSE; - savedScreenInfo[pScreen->myNum].pWindow = NULL; - savedScreenInfo[pScreen->myNum].wid = FakeClientID(0); - savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL; + pScreen->screensaver.pWindow = NULL; + pScreen->screensaver.wid = FakeClientID(0); + pScreen->screensaver.ExternalScreenSaver = NULL; screenIsSaved = SCREEN_SAVER_OFF; - WindowTable[pScreen->myNum] = pWin; + pScreen->root = pWin; pWin->drawable.pScreen = pScreen; pWin->drawable.type = DRAWABLE_WINDOW; @@ -539,7 +537,7 @@ RealChildHead(WindowPtr pWin) if (!pWin->parent && (screenIsSaved == SCREEN_SAVER_ON) && - (HasSaverWindow (pWin->drawable.pScreen->myNum))) + (HasSaverWindow (pWin->drawable.pScreen))) return (pWin->firstChild); else return (NullWindow); @@ -1329,7 +1327,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) */ if ( cursorID == None) { - if (pWin == WindowTable[pWin->drawable.pScreen->myNum]) + if (pWin == pWin->drawable.pScreen->root) pCursor = rootCursor; else pCursor = (CursorPtr) None; @@ -2238,8 +2236,8 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) event.u.configureRequest.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension && (!pParent || !pParent->parent)) { - event.u.configureRequest.x += panoramiXdataPtr[0].x; - event.u.configureRequest.y += panoramiXdataPtr[0].y; + event.u.configureRequest.x += screenInfo.screens[0]->x; + event.u.configureRequest.y += screenInfo.screens[0]->y; } #endif event.u.configureRequest.width = w; @@ -2319,8 +2317,8 @@ ActuallyDoSomething: event.u.configureNotify.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension && (!pParent || !pParent->parent)) { - event.u.configureNotify.x += panoramiXdataPtr[0].x; - event.u.configureNotify.y += panoramiXdataPtr[0].y; + event.u.configureNotify.x += screenInfo.screens[0]->x; + event.u.configureNotify.y += screenInfo.screens[0]->y; } #endif event.u.configureNotify.width = w; @@ -2473,8 +2471,8 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent, event.u.reparent.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension && !pParent->parent) { - event.u.reparent.x += panoramiXdataPtr[0].x; - event.u.reparent.y += panoramiXdataPtr[0].y; + event.u.reparent.x += screenInfo.screens[0]->x; + event.u.reparent.y += screenInfo.screens[0]->y; } #endif event.u.reparent.override = pWin->overrideRedirect; @@ -2966,7 +2964,7 @@ HandleSaveSet(ClientPtr client) pWin = SaveSetWindow(client->saveSet[j]); #ifdef XFIXES if (SaveSetToRoot(client->saveSet[j])) - pParent = WindowTable[pWin->drawable.pScreen->myNum]; + pParent = pWin->drawable.pScreen->root; else #endif { @@ -3034,7 +3032,7 @@ NotClippedByChildren(WindowPtr pWin) pReg = REGION_CREATE(pScreen, NullBox, 1); if (pWin->parent || screenIsSaved != SCREEN_SAVER_ON || - !HasSaverWindow (pWin->drawable.pScreen->myNum)) + !HasSaverWindow (pWin->drawable.pScreen)) { REGION_INTERSECT(pScreen, pReg, &pWin->borderClip, &pWin->winSize); } @@ -3152,33 +3150,33 @@ dixSaveScreens(ClientPtr client, int on, int mode) } for (i = 0; i < screenInfo.numScreens; i++) { + ScreenPtr pScreen = screenInfo.screens[i]; if (on == SCREEN_SAVER_FORCER) - (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], on); - if (savedScreenInfo[i].ExternalScreenSaver) + (* pScreen->SaveScreen) (pScreen, on); + if (pScreen->screensaver.ExternalScreenSaver) { - if ((*savedScreenInfo[i].ExternalScreenSaver) - (screenInfo.screens[i], type, on == SCREEN_SAVER_FORCER)) + if ((*pScreen->screensaver.ExternalScreenSaver) + (pScreen, type, on == SCREEN_SAVER_FORCER)) continue; } if (type == screenIsSaved) continue; switch (type) { case SCREEN_SAVER_OFF: - if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED) + if (pScreen->screensaver.blanked == SCREEN_IS_BLANKED) { - (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], - what); + (* pScreen->SaveScreen) (pScreen, what); } - else if (HasSaverWindow (i)) + else if (HasSaverWindow (pScreen)) { - savedScreenInfo[i].pWindow = NullWindow; - FreeResource(savedScreenInfo[i].wid, RT_NONE); + pScreen->screensaver.pWindow = NullWindow; + FreeResource(pScreen->screensaver.wid, RT_NONE); } break; case SCREEN_SAVER_CYCLE: - if (savedScreenInfo[i].blanked == SCREEN_IS_TILED) + if (pScreen->screensaver.blanked == SCREEN_IS_TILED) { - WindowPtr pWin = savedScreenInfo[i].pWindow; + WindowPtr pWin = pScreen->screensaver.pWindow; /* make it look like screen saver is off, so that * NotClippedByChildren will compute a clip list * for the root window, so miPaintWindow works @@ -3202,35 +3200,33 @@ dixSaveScreens(ClientPtr client, int on, int mode) * Call the DDX saver in case it wants to do something * at cycle time */ - else if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED) + else if (pScreen->screensaver.blanked == SCREEN_IS_BLANKED) { - (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], - type); + (* pScreen->SaveScreen) (pScreen, type); } break; case SCREEN_SAVER_ON: if (ScreenSaverBlanking != DontPreferBlanking) { - if ((* screenInfo.screens[i]->SaveScreen) - (screenInfo.screens[i], what)) + if ((* pScreen->SaveScreen) (pScreen, what)) { - savedScreenInfo[i].blanked = SCREEN_IS_BLANKED; + pScreen->screensaver.blanked = SCREEN_IS_BLANKED; continue; } if ((ScreenSaverAllowExposures != DontAllowExposures) && - TileScreenSaver(i, SCREEN_IS_BLACK)) + TileScreenSaver(pScreen, SCREEN_IS_BLACK)) { - savedScreenInfo[i].blanked = SCREEN_IS_BLACK; + pScreen->screensaver.blanked = SCREEN_IS_BLACK; continue; } } if ((ScreenSaverAllowExposures != DontAllowExposures) && - TileScreenSaver(i, SCREEN_IS_TILED)) + TileScreenSaver(pScreen, SCREEN_IS_TILED)) { - savedScreenInfo[i].blanked = SCREEN_IS_TILED; + pScreen->screensaver.blanked = SCREEN_IS_TILED; } else - savedScreenInfo[i].blanked = SCREEN_ISNT_SAVED; + pScreen->screensaver.blanked = SCREEN_ISNT_SAVED; break; } } @@ -3252,7 +3248,7 @@ SaveScreens(int on, int mode) } static Bool -TileScreenSaver(int i, int kind) +TileScreenSaver(ScreenPtr pScreen, int kind) { int j; int result; @@ -3269,9 +3265,9 @@ TileScreenSaver(int i, int kind) attri = 0; switch (kind) { case SCREEN_IS_TILED: - switch (WindowTable[i]->backgroundState) { + switch (pScreen->root->backgroundState) { case BackgroundPixel: - attributes[attri++] = WindowTable[i]->background.pixel; + attributes[attri++] = pScreen->root->background.pixel; mask |= CWBackPixel; break; case BackgroundPixmap: @@ -3283,7 +3279,7 @@ TileScreenSaver(int i, int kind) } break; case SCREEN_IS_BLACK: - attributes[attri++] = WindowTable[i]->drawable.pScreen->blackPixel; + attributes[attri++] = pScreen->root->drawable.pScreen->blackPixel; mask |= CWBackPixel; break; } @@ -3330,14 +3326,14 @@ TileScreenSaver(int i, int kind) } } - pWin = savedScreenInfo[i].pWindow = - CreateWindow(savedScreenInfo[i].wid, - WindowTable[i], + pWin = pScreen->screensaver.pWindow = + CreateWindow(pScreen->screensaver.wid, + pScreen->root, -RANDOM_WIDTH, -RANDOM_WIDTH, - (unsigned short)screenInfo.screens[i]->width + RANDOM_WIDTH, - (unsigned short)screenInfo.screens[i]->height + RANDOM_WIDTH, + (unsigned short)pScreen->width + RANDOM_WIDTH, + (unsigned short)pScreen->height + RANDOM_WIDTH, 0, InputOutput, mask, attributes, 0, serverClient, - wVisual (WindowTable[i]), &result); + wVisual (pScreen->root), &result); if (cursor) FreeResource (cursorID, RT_NONE); @@ -3346,7 +3342,7 @@ TileScreenSaver(int i, int kind) return FALSE; if (!AddResource(pWin->drawable.id, RT_WINDOW, - (pointer)savedScreenInfo[i].pWindow)) + (pointer)pScreen->screensaver.pWindow)) return FALSE; if (mask & CWBackPixmap) diff --git a/fb/fb.h b/fb/fb.h index 91c91eeb2..e2222a5c7 100644 --- a/fb/fb.h +++ b/fb/fb.h @@ -740,7 +740,7 @@ typedef struct { #define fbWindowEnabled(pWin) \ REGION_NOTEMPTY((pWin)->drawable.pScreen, \ - &WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip) + &(pWin)->drawable.pScreen->root->borderClip) #define fbDrawableEnabled(pDrawable) \ ((pDrawable)->type == DRAWABLE_PIXMAP ? \ diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c index bf5640db7..7e0368699 100644 --- a/hw/dmx/dmxcursor.c +++ b/hw/dmx/dmxcursor.c @@ -230,7 +230,7 @@ static int dmxSLFindNext(int *list) /** Make one pass over all the screens and return the number updated. */ static int dmxTryComputeScreenOrigins(int *screensLeft) { - ScreenPtr pScreen; + ScreenPtr pScreen, refScreen; DMXScreenInfo *screen; int i, ref; int changed = 0; @@ -239,54 +239,56 @@ static int dmxTryComputeScreenOrigins(int *screensLeft) if (!screensLeft[i]) continue; screen = &dmxScreens[i]; + pScreen = screenInfo.screens[i]; switch (screen->where) { case PosAbsolute: - dixScreenOrigins[i].x = screen->whereX; - dixScreenOrigins[i].y = screen->whereY; + pScreen->x = screen->whereX; + pScreen->y = screen->whereY; ++changed, screensLeft[i] = 0; break; case PosRelative: ref = screen->whereRefScreen; if (screensLeft[ref]) break; - dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->whereX; - dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->whereY; + refScreen = screenInfo.screens[ref]; + pScreen->x = refScreen->x + screen->whereX; + pScreen->y = refScreen->y + screen->whereY; ++changed, screensLeft[i] = 0; break; case PosRightOf: ref = screen->whereRefScreen; if (screensLeft[ref]) break; - pScreen = screenInfo.screens[ref]; - dixScreenOrigins[i].x = dixScreenOrigins[ref].x + pScreen->width; - dixScreenOrigins[i].y = dixScreenOrigins[ref].y; + refScreen = screenInfo.screens[ref]; + pScreen->x = refScreen->x + refScreen->width; + pScreen->y = refScreen->y; ++changed, screensLeft[i] = 0; break; case PosLeftOf: ref = screen->whereRefScreen; if (screensLeft[ref]) break; - pScreen = screenInfo.screens[i]; - dixScreenOrigins[i].x = dixScreenOrigins[ref].x - pScreen->width; - dixScreenOrigins[i].y = dixScreenOrigins[ref].y; + refScreen = screenInfo.screens[ref]; + pScreen->x = refScreen->x - pScreen->width; + pScreen->y = refScreen->y; ++changed, screensLeft[i] = 0; break; case PosBelow: ref = screen->whereRefScreen; if (screensLeft[ref]) break; - pScreen = screenInfo.screens[ref]; - dixScreenOrigins[i].x = dixScreenOrigins[ref].x; - dixScreenOrigins[i].y = dixScreenOrigins[ref].y + pScreen->height; + refScreen = screenInfo.screens[ref]; + pScreen->x = refScreen->x; + pScreen->y = refScreen->y + refScreen->height; ++changed, screensLeft[i] = 0; break; case PosAbove: ref = screen->whereRefScreen; if (screensLeft[ref]) break; - pScreen = screenInfo.screens[i]; - dixScreenOrigins[i].x = dixScreenOrigins[ref].x; - dixScreenOrigins[i].y = dixScreenOrigins[ref].y - pScreen->height; + refScreen = screenInfo.screens[ref]; + pScreen->x = refScreen->x; + pScreen->y = refScreen->y - pScreen->height; ++changed, screensLeft[i] = 0; break; case PosNone: @@ -298,6 +300,7 @@ static int dmxTryComputeScreenOrigins(int *screensLeft) static void dmxComputeScreenOrigins(void) { + ScreenPtr pScreen; int *screensLeft; int i, ref; int minX, minY; @@ -313,8 +316,9 @@ static void dmxComputeScreenOrigins(void) * guarantees that we will eventually terminate. */ ref = dmxScreens[i].whereRefScreen; - dixScreenOrigins[ref].x = dixScreenOrigins[ref].y = 0; - screensLeft[ref] = 0; + pScreen = screenInfo.screens[ref]; + pScreen->x = pScreen->y = 0; + screensLeft[ref] = 0; } } dmxSLFree(screensLeft); @@ -322,18 +326,18 @@ static void dmxComputeScreenOrigins(void) /* Justify the topmost and leftmost to * (0,0). */ - minX = dixScreenOrigins[0].x; - minY = dixScreenOrigins[0].y; + minX = screenInfo.screens[0]->x; + minY = screenInfo.screens[0]->y; for (i = 1; i < dmxNumScreens; i++) { /* Compute minX, minY */ - if (dixScreenOrigins[i].x < minX) - minX = dixScreenOrigins[i].x; - if (dixScreenOrigins[i].y < minY) - minY = dixScreenOrigins[i].y; + if (screenInfo.screens[i]->x < minX) + minX = screenInfo.screens[i]->x; + if (screenInfo.screens[i]->y < minY) + minY = screenInfo.screens[i]->y; } if (minX || minY) { for (i = 0; i < dmxNumScreens; i++) { - dixScreenOrigins[i].x -= minX; - dixScreenOrigins[i].y -= minY; + screenInfo.screens[i]->x -= minX; + screenInfo.screens[i]->y -= minY; } } } @@ -398,8 +402,8 @@ void dmxInitOrigins(void) for (i = 0; i < dmxNumScreens; i++) { DMXScreenInfo *dmxScreen = &dmxScreens[i]; - dmxScreen->rootXOrigin = dixScreenOrigins[i].x; - dmxScreen->rootYOrigin = dixScreenOrigins[i].y; + dmxScreen->rootXOrigin = screenInfo.screens[i]->x; + dmxScreen->rootYOrigin = screenInfo.screens[i]->y; } dmxReInitOrigins(); diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c index c8e8dae65..5945a5eda 100644 --- a/hw/dmx/dmxextension.c +++ b/hw/dmx/dmxextension.c @@ -297,7 +297,7 @@ void dmxFlushPendingSyncs(void) void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h) { DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - WindowPtr pRoot = WindowTable[pScreen->myNum]; + WindowPtr pRoot = pScreen->root; WindowPtr pChild; Bool anyMarked = FALSE; @@ -402,7 +402,7 @@ static void dmxConfigureScreenWindow(int idx, static void dmxConfigureRootWindow(int idx, int x, int y, int w, int h) { DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - WindowPtr pRoot = WindowTable[idx]; + WindowPtr pRoot = screenInfo.screens[idx]->root; /* NOTE: Either this function or the ones that it calls must handle * the case where w == 0 || h == 0. Currently, the functions that @@ -437,7 +437,7 @@ static void dmxSetRootWindowOrigin(int idx, int x, int y) { DMXScreenInfo *dmxScreen = &dmxScreens[idx]; ScreenPtr pScreen = screenInfo.screens[idx]; - WindowPtr pRoot = WindowTable[idx]; + WindowPtr pRoot = pScreen->root; WindowPtr pChild; int xoff; int yoff; @@ -447,18 +447,18 @@ static void dmxSetRootWindowOrigin(int idx, int x, int y) dmxScreen->rootYOrigin = y; /* Compute offsets here in case has been changed above */ - xoff = x - dixScreenOrigins[idx].x; - yoff = y - dixScreenOrigins[idx].y; + xoff = x - pScreen->x; + yoff = y - pScreen->y; - /* Adjust the root window's position in dixScreenOrigins */ - dixScreenOrigins[idx].x = dmxScreen->rootXOrigin; - dixScreenOrigins[idx].y = dmxScreen->rootYOrigin; + /* Adjust the root window's position */ + pScreen->x = dmxScreen->rootXOrigin; + pScreen->y = dmxScreen->rootYOrigin; /* Recalculate the Xinerama regions and data structs */ XineramaReinitData(pScreen); /* Adjust each of the root window's children */ - if (!idx) ReinitializeRootWindow(WindowTable[0], xoff, yoff); + if (!idx) ReinitializeRootWindow(screenInfo.screens[0]->root, xoff, yoff); pChild = pRoot->firstChild; while (pChild) { /* Adjust child window's position */ @@ -634,7 +634,7 @@ int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs) int i; for (i = 0; i < dmxNumScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; - WindowPtr pChild = WindowTable[i]->firstChild; + WindowPtr pChild = pScreen->root->firstChild; while (pChild) { /* Adjust child window's position */ pScreen->MoveWindow(pChild, @@ -914,7 +914,7 @@ static void dmxBECreateResources(pointer value, XID id, RESTYPE type, static void dmxBECreateWindowTree(int idx) { DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - WindowPtr pRoot = WindowTable[idx]; + WindowPtr pRoot = screenInfo.screens[idx]->root; dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot); WindowPtr pWin; @@ -982,7 +982,7 @@ static void dmxBECreateWindowTree(int idx) static void dmxForceExposures(int idx) { ScreenPtr pScreen = screenInfo.screens[idx]; - WindowPtr pRoot = WindowTable[idx]; + WindowPtr pRoot = pScreen->root; Bool anyMarked = FALSE; WindowPtr pChild; @@ -1510,7 +1510,7 @@ static void dmxBEDestroyScratchGCs(int scrnNum) * destroy a window as well as all of it's children. */ static void dmxBEDestroyWindowTree(int idx) { - WindowPtr pWin = WindowTable[idx]; + WindowPtr pWin = screenInfo.screens[idx]->root; WindowPtr pChild = pWin; while (1) { diff --git a/hw/dmx/doc/dmx.xml b/hw/dmx/doc/dmx.xml index 12d7067dc..c6dc0ccd4 100644 --- a/hw/dmx/doc/dmx.xml +++ b/hw/dmx/doc/dmx.xml @@ -1497,9 +1497,7 @@ PanoramiX prefix. The Xinerama extension is registered by calling AddExtension(). - A local per-screen array of data structures - (panoramiXdataPtr[]) - is allocated for each physical screen, and GC and Screen private + GC and Screen private indexes are allocated, and both GC and Screen private areas are allocated for each physical screen. These hold Xinerama-specific per-GC and per-Screen data. Each screen's CreateGC and CloseScreen @@ -1509,13 +1507,10 @@ PanoramiX prefix. Xinerama windows, pixmaps and colormaps. - A region (XineramaScreenRegions[i]) is initialized for each - physical screen, and single region (PanoramiXScreenRegion) is - initialized to be the union of the screen regions. The - panoramiXdataPtr[] array is also initialized with the size and - origin of each screen. The relative positioning information for the - physical screens is taken from the array - dixScreenOrigins[], which + A region (PanoramiXScreenRegion) is + initialized to be the union of the screen regions. + The relative positioning information for the + physical screens is taken from the ScreenRec x and y members, which the DDX layer must initialize in InitOutput(). The bounds of the combined screen is also calculated (PanoramiXPixWidth and PanoramiXPixHeight). diff --git a/hw/dmx/input/dmxcommon.c b/hw/dmx/input/dmxcommon.c index da5b77893..c665dad90 100644 --- a/hw/dmx/input/dmxcommon.c +++ b/hw/dmx/input/dmxcommon.c @@ -370,7 +370,7 @@ void dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) Display *display = priv->display; int num; int i, j, k; - int (*handler)(Display *, char *, char *); + XextErrorHandler handler; if (!display && !(display = XOpenDisplay(dmxInput->name))) return; @@ -526,10 +526,9 @@ int dmxFindPointerScreen(int x, int y) int i; for (i = 0; i < dmxNumScreens; i++) { - if (x >= dixScreenOrigins[i].x - && x < dixScreenOrigins[i].x + screenInfo.screens[i]->width - && y >= dixScreenOrigins[i].y - && y < dixScreenOrigins[i].y + screenInfo.screens[i]->height) + ScreenPtr pScreen = screenInfo.screens[i]; + if (x >= pScreen->x && x < pScreen->x + pScreen->width && + y >= pScreen->y && y < pScreen->y + pScreen->height) return i; } return -1; diff --git a/hw/dmx/input/dmxconsole.c b/hw/dmx/input/dmxconsole.c index 9542efacd..297166edd 100644 --- a/hw/dmx/input/dmxconsole.c +++ b/hw/dmx/input/dmxconsole.c @@ -204,7 +204,8 @@ static void dmxConsoleDrawWindows(pointer private) XUnionRectWithRegion(&rect, whole, whole); for (i = 0; i < dmxNumScreens; i++) { - WindowPtr pRoot = WindowTable[i]; + ScreenPtr pScreen = screenInfo.screens[i]; + WindowPtr pRoot = pScreen->root; WindowPtr pChild; #if DMX_WINDOW_DEBUG @@ -227,10 +228,8 @@ static void dmxConsoleDrawWindows(pointer private) pChild->overrideRedirect, REGION_NUM_RECTS(&pChild->clipList)); #endif - rect.x = scalex(priv, pChild->drawable.x - + dixScreenOrigins[i].x); - rect.y = scaley(priv, pChild->drawable.y - + dixScreenOrigins[i].y); + rect.x = scalex(priv, pChild->drawable.x + pScreen->x); + rect.y = scaley(priv, pChild->drawable.y + pScreen->y); rect.width = scalex(priv, pChild->drawable.width); rect.height = scaley(priv, pChild->drawable.height); XDrawRectangle(dpy, priv->pixmap, priv->gc, @@ -263,15 +262,15 @@ static void dmxConsoleDraw(myPrivate *priv, int updateCursor, int update) DMXScreenInfo *dmxScreen = &dmxScreens[i]; XFillRectangle(dpy, priv->pixmap, dmxScreen->beDisplay ? priv->gcRev : priv->gcDet, - scalex(priv, dixScreenOrigins[i].x), - scaley(priv, dixScreenOrigins[i].y), + scalex(priv, screenInfo.screens[i]->x), + scaley(priv, screenInfo.screens[i]->y), scalex(priv, screenInfo.screens[i]->width), scaley(priv, screenInfo.screens[i]->height)); } for (i = 0; i < dmxNumScreens; i++) { XDrawRectangle(dpy, priv->pixmap, priv->gc, - scalex(priv, dixScreenOrigins[i].x), - scaley(priv, dixScreenOrigins[i].y), + scalex(priv, screenInfo.screens[i]->x), + scaley(priv, screenInfo.screens[i]->y), scalex(priv, screenInfo.screens[i]->width), scaley(priv, screenInfo.screens[i]->height)); } @@ -671,11 +670,11 @@ static void dmxConsoleComputeWidthHeight(myPrivate *priv, * possible by computing the visible * bounding box. */ for (i = 0; i < dmxNumScreens; i++) { - if (dixScreenOrigins[i].x+screenInfo.screens[i]->width > *width) - *width = dixScreenOrigins[i].x+screenInfo.screens[i]->width; + if (screenInfo.screens[i]->x+screenInfo.screens[i]->width > *width) + *width = screenInfo.screens[i]->x+screenInfo.screens[i]->width; - if (dixScreenOrigins[i].y+screenInfo.screens[i]->height > *height) - *height = dixScreenOrigins[i].y+screenInfo.screens[i]->height; + if (screenInfo.screens[i]->y+screenInfo.screens[i]->height > *height) + *height = screenInfo.screens[i]->y+screenInfo.screens[i]->height; } #endif diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c index 5943e9248..814fc1a89 100644 --- a/hw/dmx/input/dmxinputinit.c +++ b/hw/dmx/input/dmxinputinit.c @@ -570,7 +570,7 @@ static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput, int i; #ifdef PANORAMIX - if (!noPanoramiXExtension && pWindow && pWindow->parent != WindowTable[0]) + if (!noPanoramiXExtension && pWindow && pWindow->parent != screenInfo.screens[0]->root) return; #endif #if DMX_WINDOW_DEBUG @@ -827,7 +827,7 @@ static void dmxPopulateLocal(DMXInputInfo *dmxInput, dmxArg a) } } -int dmxInputExtensionErrorHandler(Display *dsp, char *name, char *reason) +int dmxInputExtensionErrorHandler(Display *dsp, _Xconst char *name, _Xconst char *reason) { return 0; } @@ -839,7 +839,7 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI) Display *display; int num; int i, j; - int (*handler)(Display *, char *, char *); + XextErrorHandler handler; if (!(display = XOpenDisplay(dmxInput->name))) return; diff --git a/hw/dmx/input/dmxinputinit.h b/hw/dmx/input/dmxinputinit.h index 2e625cfd4..5a4a4106c 100644 --- a/hw/dmx/input/dmxinputinit.h +++ b/hw/dmx/input/dmxinputinit.h @@ -276,8 +276,8 @@ extern void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl *ctrl); extern void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice, pointer ctrl, int unknown); -extern int dmxInputExtensionErrorHandler(Display *dsp, char *name, - char *reason); +extern int dmxInputExtensionErrorHandler(Display *dsp, _Xconst char *name, + _Xconst char *reason); extern int dmxInputDetach(DMXInputInfo *dmxInput); extern void dmxInputDetachAll(DMXScreenInfo *dmxScreen); diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 9d1b38376..7993f9bd1 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -95,7 +95,7 @@ KdOsFuncs *kdOsFuncs; void KdSetRootClip (ScreenPtr pScreen, BOOL enable) { - WindowPtr pWin = WindowTable[pScreen->myNum]; + WindowPtr pWin = pScreen->root; WindowPtr pChild; Bool WasViewable; Bool anyMarked = FALSE; @@ -941,9 +941,8 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) pScreenPriv->card = card; pScreenPriv->bytesPerPixel = screen->fb.bitsPerPixel >> 3; pScreenPriv->dpmsState = KD_DPMS_NORMAL; -#ifdef PANORAMIX - dixScreenOrigins[pScreen->myNum] = screen->origin; -#endif + pScreen->x = screen->origin.x; + pScreen->y = screen->origin.y; if (!monitorResolution) monitorResolution = 75; diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c index 9cde0599d..714743a8c 100644 --- a/hw/xfree86/common/xf86Cursor.c +++ b/hw/xfree86/common/xf86Cursor.c @@ -581,7 +581,7 @@ xf86InitOrigins(void) { unsigned long screensLeft, prevScreensLeft, mask; screenLayoutPtr screen; - ScreenPtr pScreen; + ScreenPtr pScreen, refScreen; int x1, x2, y1, y2, left, right, top, bottom; int i, j, ref, minX, minY, min, max; xf86ScreenLayoutPtr pLayout; @@ -608,6 +608,7 @@ xf86InitOrigins(void) continue; } + pScreen = xf86Screens[i]->pScreen; switch(screen->where) { case PosObsolete: OldStyleConfig = TRUE; @@ -620,7 +621,7 @@ xf86InitOrigins(void) break; } pLayout->left = AddEdge(pLayout->left, - 0, xf86Screens[i]->pScreen->height, + 0, pScreen->height, xf86Screens[ref]->pScreen->width, 0, ref); } if(screen->right) { @@ -629,7 +630,6 @@ xf86InitOrigins(void) ErrorF("Referenced uninitialized screen in Layout!\n"); break; } - pScreen = xf86Screens[i]->pScreen; pLayout->right = AddEdge(pLayout->right, 0, pScreen->height, -pScreen->width, 0, ref); } @@ -640,7 +640,7 @@ xf86InitOrigins(void) break; } pLayout->up = AddEdge(pLayout->up, - 0, xf86Screens[i]->pScreen->width, + 0, pScreen->width, 0, xf86Screens[ref]->pScreen->height, ref); } if(screen->bottom) { @@ -649,7 +649,6 @@ xf86InitOrigins(void) ErrorF("Referenced uninitialized screen in Layout!\n"); break; } - pScreen = xf86Screens[i]->pScreen; pLayout->down = AddEdge(pLayout->down, 0, pScreen->width, 0, -pScreen->height, ref); } @@ -658,8 +657,8 @@ xf86InitOrigins(void) screen->x = screen->y = 0; /* FALLTHROUGH */ case PosAbsolute: - dixScreenOrigins[i].x = screen->x; - dixScreenOrigins[i].y = screen->y; + pScreen->x = screen->x; + pScreen->y = screen->y; screensLeft &= ~(1 << i); break; case PosRelative: @@ -669,8 +668,9 @@ xf86InitOrigins(void) break; } if(screensLeft & (1 << ref)) break; - dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->x; - dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->y; + refScreen = xf86Screens[ref]->pScreen; + pScreen->x = refScreen->x + screen->x; + pScreen->y = refScreen->y + screen->y; screensLeft &= ~(1 << i); break; case PosRightOf: @@ -680,10 +680,9 @@ xf86InitOrigins(void) break; } if(screensLeft & (1 << ref)) break; - pScreen = xf86Screens[ref]->pScreen; - dixScreenOrigins[i].x = - dixScreenOrigins[ref].x + pScreen->width; - dixScreenOrigins[i].y = dixScreenOrigins[ref].y; + refScreen = xf86Screens[ref]->pScreen; + pScreen->x = refScreen->x + refScreen->width; + pScreen->y = refScreen->y; screensLeft &= ~(1 << i); break; case PosLeftOf: @@ -693,10 +692,9 @@ xf86InitOrigins(void) break; } if(screensLeft & (1 << ref)) break; - pScreen = xf86Screens[i]->pScreen; - dixScreenOrigins[i].x = - dixScreenOrigins[ref].x - pScreen->width; - dixScreenOrigins[i].y = dixScreenOrigins[ref].y; + refScreen = xf86Screens[ref]->pScreen; + pScreen->x = refScreen->x - pScreen->width; + pScreen->y = refScreen->y; screensLeft &= ~(1 << i); break; case PosBelow: @@ -706,10 +704,9 @@ xf86InitOrigins(void) break; } if(screensLeft & (1 << ref)) break; - pScreen = xf86Screens[ref]->pScreen; - dixScreenOrigins[i].x = dixScreenOrigins[ref].x; - dixScreenOrigins[i].y = - dixScreenOrigins[ref].y + pScreen->height; + refScreen = xf86Screens[ref]->pScreen; + pScreen->x = refScreen->x; + pScreen->y = refScreen->y + refScreen->height; screensLeft &= ~(1 << i); break; case PosAbove: @@ -719,10 +716,9 @@ xf86InitOrigins(void) break; } if(screensLeft & (1 << ref)) break; - pScreen = xf86Screens[i]->pScreen; - dixScreenOrigins[i].x = dixScreenOrigins[ref].x; - dixScreenOrigins[i].y = - dixScreenOrigins[ref].y - pScreen->height; + refScreen = xf86Screens[ref]->pScreen; + pScreen->x = refScreen->x; + pScreen->y = refScreen->y - pScreen->height; screensLeft &= ~(1 << i); break; default: @@ -741,7 +737,7 @@ xf86InitOrigins(void) while(!((1 << i) & screensLeft)){ i++; } ref = xf86ConfigLayout.screens[i].refscreen->screennum; - dixScreenOrigins[ref].x = dixScreenOrigins[ref].y = 0; + xf86Screens[ref]->pScreen->x = xf86Screens[ref]->pScreen->y = 0; screensLeft &= ~(1 << ref); } @@ -749,20 +745,20 @@ xf86InitOrigins(void) } /* justify the topmost and leftmost to (0,0) */ - minX = dixScreenOrigins[0].x; - minY = dixScreenOrigins[0].y; + minX = xf86Screens[0]->pScreen->x; + minY = xf86Screens[0]->pScreen->y; for(i = 1; i < xf86NumScreens; i++) { - if(dixScreenOrigins[i].x < minX) - minX = dixScreenOrigins[i].x; - if(dixScreenOrigins[i].y < minY) - minY = dixScreenOrigins[i].y; + if(xf86Screens[i]->pScreen->x < minX) + minX = xf86Screens[i]->pScreen->x; + if(xf86Screens[i]->pScreen->y < minY) + minY = xf86Screens[i]->pScreen->y; } if (minX || minY) { for(i = 0; i < xf86NumScreens; i++) { - dixScreenOrigins[i].x -= minX; - dixScreenOrigins[i].y -= minY; + xf86Screens[i]->pScreen->x -= minX; + xf86Screens[i]->pScreen->y -= minY; } } @@ -775,18 +771,20 @@ xf86InitOrigins(void) pScreen = xf86Screens[i]->pScreen; - left = dixScreenOrigins[i].x; + left = pScreen->x; right = left + pScreen->width; - top = dixScreenOrigins[i].y; + top = pScreen->y; bottom = top + pScreen->height; for(j = 0; j < xf86NumScreens; j++) { if(i == j) continue; - x1 = dixScreenOrigins[j].x; - x2 = x1 + xf86Screens[j]->pScreen->width; - y1 = dixScreenOrigins[j].y; - y2 = y1 + xf86Screens[j]->pScreen->height; + refScreen = xf86Screens[j]->pScreen; + + x1 = refScreen->x; + x2 = x1 + refScreen->width; + y1 = refScreen->y; + y2 = y1 + refScreen->height; if((bottom > y1) && (top < y2)) { min = y1 - top; @@ -796,13 +794,13 @@ xf86InitOrigins(void) if(((left - 1) >= x1) && ((left - 1) < x2)) pLayout->left = AddEdge(pLayout->left, min, max, - dixScreenOrigins[i].x - dixScreenOrigins[j].x, - dixScreenOrigins[i].y - dixScreenOrigins[j].y, j); + pScreen->x - refScreen->x, + pScreen->y - refScreen->y, j); if((right >= x1) && (right < x2)) pLayout->right = AddEdge(pLayout->right, min, max, - dixScreenOrigins[i].x - dixScreenOrigins[j].x, - dixScreenOrigins[i].y - dixScreenOrigins[j].y, j); + pScreen->x - refScreen->x, + pScreen->y - refScreen->y, j); } @@ -814,13 +812,13 @@ xf86InitOrigins(void) if(((top - 1) >= y1) && ((top - 1) < y2)) pLayout->up = AddEdge(pLayout->up, min, max, - dixScreenOrigins[i].x - dixScreenOrigins[j].x, - dixScreenOrigins[i].y - dixScreenOrigins[j].y, j); + pScreen->x - refScreen->x, + pScreen->y - refScreen->y, j); if((bottom >= y1) && (bottom < y2)) pLayout->down = AddEdge(pLayout->down, min, max, - dixScreenOrigins[i].x - dixScreenOrigins[j].x, - dixScreenOrigins[i].y - dixScreenOrigins[j].y, j); + pScreen->x - refScreen->x, + pScreen->y - refScreen->y, j); } } } diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index d4b935157..1aad2d100 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1062,7 +1062,7 @@ xf86SetBlackWhitePixels(ScreenPtr pScreen) static void xf86SetRootClip (ScreenPtr pScreen, Bool enable) { - WindowPtr pWin = WindowTable[pScreen->myNum]; + WindowPtr pWin = pScreen->root; WindowPtr pChild; Bool WasViewable = (Bool)(pWin->viewable); Bool anyMarked = FALSE; diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c index 455a02cc2..77053b8c2 100644 --- a/hw/xfree86/common/xf86RandR.c +++ b/hw/xfree86/common/xf86RandR.c @@ -159,7 +159,7 @@ xf86RandRSetMode (ScreenPtr pScreen, int oldmmHeight = pScreen->mmHeight; int oldVirtualX = scrp->virtualX; int oldVirtualY = scrp->virtualY; - WindowPtr pRoot = WindowTable[pScreen->myNum]; + WindowPtr pRoot = pScreen->root; Bool ret = TRUE; if (pRoot && scrp->vtSema) diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c index 2b33f2585..efed677af 100644 --- a/hw/xfree86/common/xf86xv.c +++ b/hw/xfree86/common/xf86xv.c @@ -1881,7 +1881,7 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes) void xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes) { - DrawablePtr root = &WindowTable[pScreen->myNum]->drawable; + DrawablePtr root = &pScreen->root->drawable; ChangeGCVal pval[2]; BoxPtr pbox = REGION_RECTS(clipboxes); int i, nbox = REGION_NUM_RECTS(clipboxes); diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c index 754fe372c..448762879 100644 --- a/hw/xfree86/dixmods/extmod/xf86vmode.c +++ b/hw/xfree86/dixmods/extmod/xf86vmode.c @@ -347,7 +347,7 @@ SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced) ev.type = XF86VidModeNotify + XF86VidModeEventBase; ev.state = state; ev.timestamp = currentTime.milliseconds; - ev.root = WindowTable[pScreen->myNum]->drawable.id; + ev.root = pScreen->root->drawable.id; ev.kind = kind; ev.forced = forced; WriteEventsToClient (pEv->client, 1, (xEvent *) &ev); diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c index 77f7fe295..f7cea5ede 100644 --- a/hw/xfree86/dri/dri.c +++ b/hw/xfree86/dri/dri.c @@ -1187,7 +1187,7 @@ DRIDriverClipNotify(ScreenPtr pScreen) if (pDRIPriv->nrWindows > 0) { pDRIPriv->nrWalked = 0; - TraverseTree(WindowTable[pScreen->myNum], DRIDCNTreeTraversal, + TraverseTree(pScreen->root, DRIDCNTreeTraversal, (pointer)pDRIWindows); } diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 556285383..9ec4caa54 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -607,7 +607,7 @@ DRI2CanFlip(DrawablePtr pDraw) if (pDraw->type == DRAWABLE_PIXMAP) return TRUE; - pRoot = WindowTable[pScreen->myNum]; + pRoot = pScreen->root; pRootPixmap = pScreen->GetWindowPixmap(pRoot); pWin = (WindowPtr) pDraw; diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 9dfce3fed..8d598d6e7 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -517,7 +517,7 @@ xf86RandR12SetMode (ScreenPtr pScreen, int oldHeight = pScreen->height; int oldmmWidth = pScreen->mmWidth; int oldmmHeight = pScreen->mmHeight; - WindowPtr pRoot = WindowTable[pScreen->myNum]; + WindowPtr pRoot = pScreen->root; DisplayModePtr currentMode = NULL; Bool ret = TRUE; PixmapPtr pspix = NULL; @@ -685,7 +685,7 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen, XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); - WindowPtr pRoot = WindowTable[pScreen->myNum]; + WindowPtr pRoot = pScreen->root; PixmapPtr pScrnPix = (*pScreen->GetScreenPixmap)(pScreen); Bool ret = FALSE; int c; @@ -739,7 +739,7 @@ finish: if (pRoot && pScrn->vtSema) (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE); #if RANDR_12_INTERFACE - if (xf86RandR12Key && WindowTable[pScreen->myNum] && ret) + if (xf86RandR12Key && pScreen->root && ret) RRScreenSizeNotify (pScreen); #endif return ret; diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c index 2714fee51..e3683a8ed 100644 --- a/hw/xfree86/modes/xf86Rotate.c +++ b/hw/xfree86/modes/xf86Rotate.c @@ -76,9 +76,9 @@ xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region) { ScrnInfoPtr scrn = crtc->scrn; ScreenPtr screen = scrn->pScreen; - WindowPtr root = WindowTable[screen->myNum]; + WindowPtr root = screen->root; PixmapPtr dst_pixmap = crtc->rotatedPixmap; - PictFormatPtr format = compWindowFormat (WindowTable[screen->myNum]); + PictFormatPtr format = compWindowFormat (screen->root); int error; PicturePtr src, dst; int n = REGION_NUM_RECTS(region); diff --git a/hw/xfree86/xaa/xaaCpyWin.c b/hw/xfree86/xaa/xaaCpyWin.c index d37c8ec1e..d58db8ea1 100644 --- a/hw/xfree86/xaa/xaaCpyWin.c +++ b/hw/xfree86/xaa/xaaCpyWin.c @@ -47,7 +47,7 @@ XAACopyWindow( return; } - pwinRoot = WindowTable[pScreen->myNum]; + pwinRoot = pScreen->root; REGION_NULL(pScreen, &rgnDst); diff --git a/hw/xfree86/xaa/xaaOverlay.c b/hw/xfree86/xaa/xaaOverlay.c index 2af808396..14de9bd34 100644 --- a/hw/xfree86/xaa/xaaOverlay.c +++ b/hw/xfree86/xaa/xaaOverlay.c @@ -54,7 +54,7 @@ XAACopyWindow8_32( return; } - pwinRoot = WindowTable[pScreen->myNum]; + pwinRoot = pScreen->root; if(doUnderlay) freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip); diff --git a/hw/xfree86/xaa/xaaOverlayDF.c b/hw/xfree86/xaa/xaaOverlayDF.c index 3b848ac84..b186cb5cd 100644 --- a/hw/xfree86/xaa/xaaOverlayDF.c +++ b/hw/xfree86/xaa/xaaOverlayDF.c @@ -324,7 +324,7 @@ XAAOverCopyWindow( RegionRec rgnDst; BoxPtr pbox; int i, nbox, dx, dy; - WindowPtr pRoot = WindowTable[pScreen->myNum]; + WindowPtr pRoot = pScreen->root; if (!pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) { diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c index 0845f67f0..1c77ad984 100644 --- a/hw/xquartz/applewm.c +++ b/hw/xquartz/applewm.c @@ -140,10 +140,8 @@ AppleWMSetScreenOrigin( { int32_t data[2]; - data[0] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].x - + darwinMainScreenX); - data[1] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].y - + darwinMainScreenY); + data[0] = pWin->drawable.pScreen->x + darwinMainScreenX; + data[1] = pWin->drawable.pScreen->y + darwinMainScreenY; dixChangeWindowProperty(serverClient, pWin, xa_native_screen_origin(), XA_INTEGER, 32, PropModeReplace, 2, data, TRUE); diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c index 580fe4ae0..7453eccdf 100644 --- a/hw/xquartz/darwin.c +++ b/hw/xquartz/darwin.c @@ -262,8 +262,8 @@ static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv return FALSE; } - dixScreenOrigins[index].x = dfb->x; - dixScreenOrigins[index].y = dfb->y; + pScreen->x = dfb->x; + pScreen->y = dfb->y; /* ErrorF("Screen %d added: %dx%d @ (%d,%d)\n", index, dfb->width, dfb->height, dfb->x, dfb->y); */ @@ -526,16 +526,16 @@ DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo) { int i, left, top; - left = dixScreenOrigins[0].x; - top = dixScreenOrigins[0].y; + left = pScreenInfo->screens[0]->x; + top = pScreenInfo->screens[0]->y; /* Find leftmost screen. If there's a tie, take the topmost of the two. */ for (i = 1; i < pScreenInfo->numScreens; i++) { - if (dixScreenOrigins[i].x < left || - (dixScreenOrigins[i].x == left && dixScreenOrigins[i].y < top)) + if (pScreenInfo->screens[i]->x < left || + (pScreenInfo->screens[i]->x == left && pScreenInfo->screens[i]->y < top)) { - left = dixScreenOrigins[i].x; - top = dixScreenOrigins[i].y; + left = pScreenInfo->screens[i]->x; + top = pScreenInfo->screens[i]->y; } } @@ -551,10 +551,10 @@ DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo) if (darwinMainScreenX != 0 || darwinMainScreenY != 0) { for (i = 0; i < pScreenInfo->numScreens; i++) { - dixScreenOrigins[i].x -= darwinMainScreenX; - dixScreenOrigins[i].y -= darwinMainScreenY; + pScreenInfo->screens[i]->x -= darwinMainScreenX; + pScreenInfo->screens[i]->y -= darwinMainScreenY; DEBUG_LOG("Screen %d placed at X11 coordinate (%d,%d).\n", - i, dixScreenOrigins[i].x, dixScreenOrigins[i].y); + i, pScreenInfo->screens[i]->x, pScreenInfo->screens[i]->y); } } } @@ -793,7 +793,7 @@ void AbortDDX( void ) void xf86SetRootClip (ScreenPtr pScreen, int enable) { - WindowPtr pWin = WindowTable[pScreen->myNum]; + WindowPtr pWin = pScreen->root; WindowPtr pChild; Bool WasViewable = (Bool)(pWin->viewable); Bool anyMarked = TRUE; diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 421efcedf..147b32a09 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -377,8 +377,8 @@ static void DarwinPrepareValuators(DeviceIntPtr pDev, int *valuators, ScreenPtr float pointer_x, float pointer_y, float pressure, float tilt_x, float tilt_y) { /* Fix offset between darwin and X screens */ - pointer_x -= darwinMainScreenX + dixScreenOrigins[screen->myNum].x; - pointer_y -= darwinMainScreenY + dixScreenOrigins[screen->myNum].y; + pointer_x -= darwinMainScreenX + screen->x; + pointer_y -= darwinMainScreenY + screen->y; if(pointer_x < 0.0) pointer_x = 0.0; diff --git a/hw/xquartz/pseudoramiX.c b/hw/xquartz/pseudoramiX.c index 5868ab129..298ec2be9 100644 --- a/hw/xquartz/pseudoramiX.c +++ b/hw/xquartz/pseudoramiX.c @@ -255,9 +255,9 @@ static int ProcPseudoramiXGetScreenSize(ClientPtr client) rep.sequenceNumber = client->sequence; /* screen dimensions */ rep.width = pseudoramiXScreens[stuff->screen].w; - // was panoramiXdataPtr[stuff->screen].width; + // was screenInfo.screens[stuff->screen]->width; rep.height = pseudoramiXScreens[stuff->screen].h; - // was panoramiXdataPtr[stuff->screen].height; + // was screenInfo.screens[stuff->screen]->height; if (client->swapped) { swaps (&rep.sequenceNumber, n); swapl (&rep.length, n); diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c index 36d18eba3..bb37e4abe 100644 --- a/hw/xquartz/quartz.c +++ b/hw/xquartz/quartz.c @@ -259,8 +259,8 @@ void QuartzUpdateScreens(void) { PseudoramiXResetScreens(); quartzProcs->AddPseudoramiXScreens(&x, &y, &width, &height); - dixScreenOrigins[pScreen->myNum].x = x; - dixScreenOrigins[pScreen->myNum].y = y; + pScreen->x = x; + pScreen->y = y; pScreen->mmWidth = pScreen->mmWidth * ((double) width / pScreen->width); pScreen->mmHeight = pScreen->mmHeight * ((double) height / pScreen->height); pScreen->width = width; @@ -269,14 +269,14 @@ void QuartzUpdateScreens(void) { DarwinAdjustScreenOrigins(&screenInfo); quartzProcs->UpdateScreen(pScreen); - /* DarwinAdjustScreenOrigins or UpdateScreen may change dixScreenOrigins, + /* DarwinAdjustScreenOrigins or UpdateScreen may change pScreen->x/y, * so use it rather than x/y */ - sx = dixScreenOrigins[pScreen->myNum].x + darwinMainScreenX; - sy = dixScreenOrigins[pScreen->myNum].y + darwinMainScreenY; + sx = pScreen->x + darwinMainScreenX; + sy = pScreen->y + darwinMainScreenY; /* Adjust the root window. */ - pRoot = WindowTable[pScreen->myNum]; + pRoot = pScreen->root; AppleWMSetScreenOrigin(pRoot); pScreen->ResizeWindow(pRoot, x - sx, y - sy, width, height, NULL); miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND); @@ -292,7 +292,7 @@ void QuartzUpdateScreens(void) { inputInfo.pointer->spriteInfo->sprite->physLimits = bounds; inputInfo.pointer->spriteInfo->sprite->hotLimits = bounds; - DEBUG_LOG("Root Window: %dx%d @ (%d, %d) darwinMainScreen (%d, %d) xy (%d, %d) dixScreenOrigins (%d, %d)\n", width, height, x - sx, y - sy, darwinMainScreenX, darwinMainScreenY, x, y, dixScreenOrigins[pScreen->myNum].x, dixScreenOrigins[pScreen->myNum].y); + DEBUG_LOG("Root Window: %dx%d @ (%d, %d) darwinMainScreen (%d, %d) xy (%d, %d) dixScreenOrigins (%d, %d)\n", width, height, x - sx, y - sy, darwinMainScreenX, darwinMainScreenY, x, y, pScreen->x, pScreen->y); /* Send an event for the root reconfigure */ e.u.u.type = ConfigureNotify; diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c index c1c8b2005..fdb85630d 100644 --- a/hw/xquartz/xpr/xprCursor.c +++ b/hw/xquartz/xpr/xprCursor.c @@ -296,8 +296,8 @@ QuartzWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { int sx, sy; - sx = dixScreenOrigins[pScreen->myNum].x + darwinMainScreenX; - sy = dixScreenOrigins[pScreen->myNum].y + darwinMainScreenY; + sx = pScreen->x + darwinMainScreenX; + sy = pScreen->y + darwinMainScreenY; CGWarpMouseCursorPosition(CGPointMake(sx + x, sy + y)); } diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c index 53dde7acc..6dc2c87fa 100644 --- a/hw/xquartz/xpr/xprFrame.c +++ b/hw/xquartz/xpr/xprFrame.c @@ -576,7 +576,7 @@ xprHideWindows(Bool hide) for (screen = 0; screen < screenInfo.numScreens; screen++) { RootlessFrameID prevWid = NULL; - pRoot = WindowTable[screenInfo.screens[screen]->myNum]; + pRoot = screenInfo.screens[screen]->root; for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib) { RootlessWindowRec *winRec = WINREC(pWin); diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c index d574721b3..87e97d4e2 100644 --- a/hw/xquartz/xpr/xprScreen.c +++ b/hw/xquartz/xpr/xprScreen.c @@ -397,7 +397,7 @@ xprUpdateScreen(ScreenPtr pScreen) rootlessGlobalOffsetX = darwinMainScreenX; rootlessGlobalOffsetY = darwinMainScreenY; - AppleWMSetScreenOrigin(WindowTable[pScreen->myNum]); + AppleWMSetScreenOrigin(pScreen->root); RootlessRepositionWindows(pScreen); RootlessUpdateScreenPixmap(pScreen); @@ -416,7 +416,7 @@ xprInitInput(int argc, char **argv) rootlessGlobalOffsetY = darwinMainScreenY; for (i = 0; i < screenInfo.numScreens; i++) - AppleWMSetScreenOrigin(WindowTable[i]); + AppleWMSetScreenOrigin(screenInfo.screens[i]->root); } /* diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c index ad9e66a0b..6d91ce0d6 100644 --- a/hw/xwin/winkeybd.c +++ b/hw/xwin/winkeybd.c @@ -262,7 +262,7 @@ winRestoreModeKeyStates (void) /* Only process events if the rootwindow is mapped. The keyboard events * will cause segfaults otherwise */ - if (WindowTable && WindowTable[0] && WindowTable[0]->mapped == FALSE) + if (screenInfo.screens[0]->root && screenInfo.screens[0]->root->mapped == FALSE) processEvents = FALSE; /* Force to process all pending events in the mi event queue */ diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c index 4fa987cd9..7add0e3f4 100644 --- a/hw/xwin/winscrinit.c +++ b/hw/xwin/winscrinit.c @@ -243,11 +243,11 @@ winScreenInit (int index, Note the screen origin in a normalized coordinate space where (0,0) is at the top left of the native virtual desktop area */ - dixScreenOrigins[index].x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN); - dixScreenOrigins[index].y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN); + pScreen->x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN); + pScreen->y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN); ErrorF("Screen %d added at virtual desktop coordinate (%d,%d).\n", - index, dixScreenOrigins[index].x, dixScreenOrigins[index].y); + index, pScreen->x, pScreen->y); #if CYGDEBUG || YES winDebug ("winScreenInit - returning\n"); diff --git a/hw/xwin/winwin32rootlesswindow.c b/hw/xwin/winwin32rootlesswindow.c index 3a49ead69..214e8954b 100755 --- a/hw/xwin/winwin32rootlesswindow.c +++ b/hw/xwin/winwin32rootlesswindow.c @@ -407,7 +407,7 @@ void winMWExtWMRestackWindows (ScreenPtr pScreen) { winScreenPriv(pScreen); - WindowPtr pRoot = WindowTable[pScreen->myNum]; + WindowPtr pRoot = pScreen->root; WindowPtr pWin = NULL; WindowPtr pWinPrev = NULL; win32RootlessWindowPtr pRLWin = NULL; diff --git a/hw/xwin/winwindow.c b/hw/xwin/winwindow.c index d0c360f34..9348d5c1c 100644 --- a/hw/xwin/winwindow.c +++ b/hw/xwin/winwindow.c @@ -144,7 +144,7 @@ winCopyWindowNativeGDI (WindowPtr pWin, #endif /* Get a pointer to the root window */ - pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; + pwinRoot = pWin->drawable.pScreen->root; /* Create a region for the destination */ prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1); diff --git a/include/globals.h b/include/globals.h index 6959fc71a..8b80a652b 100644 --- a/include/globals.h +++ b/include/globals.h @@ -19,12 +19,9 @@ extern _X_EXPORT char *defaultFontPath; extern _X_EXPORT int monitorResolution; extern _X_EXPORT int defaultColorVisualClass; -extern _X_EXPORT WindowPtr WindowTable[MAXSCREENS]; extern _X_EXPORT int GrabInProgress; extern _X_EXPORT Bool noTestExtensions; -extern _X_EXPORT DDXPointRec dixScreenOrigins[MAXSCREENS]; - extern _X_EXPORT char *ConnectionInfo; #ifdef DPMSExtension diff --git a/include/scrnintstr.h b/include/scrnintstr.h index 21b4a1600..d67b26411 100644 --- a/include/scrnintstr.h +++ b/include/scrnintstr.h @@ -82,6 +82,16 @@ typedef struct _Depth { VisualID *vids; /* block of visual ids for this depth */ } DepthRec; +typedef struct _ScreenSaverStuff { + WindowPtr pWindow; + XID wid; + char blanked; + Bool (*ExternalScreenSaver)( + ScreenPtr /*pScreen*/, + int /*xstate*/, + Bool /*force*/); +} ScreenSaverStuffRec; + /* * There is a typedef for each screen function pointer so that code that @@ -446,7 +456,7 @@ typedef void (* DeviceCursorCleanupProcPtr)( typedef struct _Screen { int myNum; /* index of this instance in Screens[] */ ATOM id; - short width, height; + short x, y, width, height; short mmWidth, mmHeight; short numDepths; unsigned char rootDepth; @@ -468,6 +478,8 @@ typedef struct _Screen { pointer devPrivate; short numVisuals; VisualPtr visuals; + WindowPtr root; + ScreenSaverStuffRec screensaver; /* Random screen procedures */ diff --git a/include/windowstr.h b/include/windowstr.h index 96bee9b93..29b95fc37 100644 --- a/include/windowstr.h +++ b/include/windowstr.h @@ -204,24 +204,15 @@ extern _X_EXPORT Mask DontPropagateMasks[]; #define HasBorder(w) ((w)->borderWidth || wClipShape(w)) -typedef struct _ScreenSaverStuff { - WindowPtr pWindow; - XID wid; - char blanked; - Bool (*ExternalScreenSaver)( - ScreenPtr /*pScreen*/, - int /*xstate*/, - Bool /*force*/); -} ScreenSaverStuffRec, *ScreenSaverStuffPtr; +typedef struct _ScreenSaverStuff *ScreenSaverStuffPtr; #define SCREEN_IS_BLANKED 0 #define SCREEN_ISNT_SAVED 1 #define SCREEN_IS_TILED 2 #define SCREEN_IS_BLACK 3 -#define HasSaverWindow(i) (savedScreenInfo[i].pWindow != NullWindow) +#define HasSaverWindow(pScreen) (pScreen->screensaver.pWindow != NullWindow) extern _X_EXPORT int screenIsSaved; -extern _X_EXPORT ScreenSaverStuffRec savedScreenInfo[MAXSCREENS]; #endif /* WINDOWSTRUCT_H */ diff --git a/mi/midispcur.c b/mi/midispcur.c index f2b22293d..87eb27d4e 100644 --- a/mi/midispcur.c +++ b/mi/midispcur.c @@ -66,12 +66,9 @@ static DevPrivateKey miDCSpriteKey = miDCSpriteKeyIndex; typedef struct { GCPtr pSourceGC, pMaskGC; GCPtr pSaveGC, pRestoreGC; - GCPtr pMoveGC; - GCPtr pPixSourceGC, pPixMaskGC; - PixmapPtr pSave, pTemp; + PixmapPtr pSave; #ifdef ARGB_CURSOR PicturePtr pRootPicture; - PicturePtr pTempPicture; #endif } miDCBufferRec, *miDCBufferPtr; @@ -408,7 +405,7 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, } pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); - pWin = WindowTable[pScreen->myNum]; + pWin = pScreen->root; pBuffer = MIDCBUFFER(pDev, pScreen); #ifdef ARGB_CURSOR @@ -451,7 +448,7 @@ miDCSaveUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen, pBuffer = MIDCBUFFER(pDev, pScreen); pSave = pBuffer->pSave; - pWin = WindowTable[pScreen->myNum]; + pWin = pScreen->root; if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h) { if (pSave) @@ -485,7 +482,7 @@ miDCRestoreUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen, pBuffer = MIDCBUFFER(pDev, pScreen); pSave = pBuffer->pSave; - pWin = WindowTable[pScreen->myNum]; + pWin = pScreen->root; if (!pSave) return FALSE; @@ -497,244 +494,11 @@ miDCRestoreUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen, return TRUE; } -Bool -miDCChangeSave (DeviceIntPtr pDev, ScreenPtr pScreen, - int x, int y, int w, int h, int dx, int dy) -{ - miDCScreenPtr pScreenPriv; - miDCBufferPtr pBuffer; - PixmapPtr pSave; - WindowPtr pWin; - GCPtr pGC; - int sourcex, sourcey, destx, desty, copyw, copyh; - - pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miDCScreenKey); - pBuffer = MIDCBUFFER(pDev, pScreen); - - pSave = pBuffer->pSave; - pWin = WindowTable[pScreen->myNum]; - /* - * restore the bits which are about to get trashed - */ - if (!pSave) - return FALSE; - - pGC = pBuffer->pRestoreGC; - if (pWin->drawable.serialNumber != pGC->serialNumber) - ValidateGC ((DrawablePtr) pWin, pGC); - /* - * copy the old bits to the screen. - */ - if (dy > 0) - { - (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, - 0, h - dy, w, dy, x + dx, y + h); - } - else if (dy < 0) - { - (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, - 0, 0, w, -dy, x + dx, y + dy); - } - if (dy >= 0) - { - desty = y + dy; - sourcey = 0; - copyh = h - dy; - } - else - { - desty = y; - sourcey = - dy; - copyh = h + dy; - } - if (dx > 0) - { - (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, - w - dx, sourcey, dx, copyh, x + w, desty); - } - else if (dx < 0) - { - (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, - 0, sourcey, -dx, copyh, x + dx, desty); - } - - pGC = pBuffer->pSaveGC; - if (pSave->drawable.serialNumber != pGC->serialNumber) - ValidateGC ((DrawablePtr) pSave, pGC); - /* - * move the bits that are still valid within the pixmap - */ - if (dx >= 0) - { - sourcex = 0; - destx = dx; - copyw = w - dx; - } - else - { - destx = 0; - sourcex = - dx; - copyw = w + dx; - } - if (dy >= 0) - { - sourcey = 0; - desty = dy; - copyh = h - dy; - } - else - { - desty = 0; - sourcey = -dy; - copyh = h + dy; - } - (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pSave, pGC, - sourcex, sourcey, copyw, copyh, destx, desty); - /* - * copy the new bits from the screen into the remaining areas of the - * pixmap - */ - if (dy > 0) - { - (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, - x, y, w, dy, 0, 0); - } - else if (dy < 0) - { - (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, - x, y + h + dy, w, -dy, 0, h + dy); - } - if (dy >= 0) - { - desty = dy; - sourcey = y + dy; - copyh = h - dy; - } - else - { - desty = 0; - sourcey = y; - copyh = h + dy; - } - if (dx > 0) - { - (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, - x, sourcey, dx, copyh, 0, desty); - } - else if (dx < 0) - { - (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, - x + w + dx, sourcey, -dx, copyh, w + dx, desty); - } - return TRUE; -} - -Bool -miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, - int x, int y, int w, int h, int dx, int dy, - unsigned long source, unsigned long mask) -{ - miDCCursorPtr pPriv; - miDCScreenPtr pScreenPriv; - miDCBufferPtr pBuffer; - int status; - WindowPtr pWin; - GCPtr pGC; - XID gcval = FALSE; - PixmapPtr pTemp; - - pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates, - CursorScreenKey(pScreen)); - if (!pPriv) - { - pPriv = miDCRealize(pScreen, pCursor); - if (!pPriv) - return FALSE; - } - pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miDCScreenKey); - pWin = WindowTable[pScreen->myNum]; - pBuffer = MIDCBUFFER(pDev, pScreen); - - pTemp = pBuffer->pTemp; - if (!pTemp || - pTemp->drawable.width != pBuffer->pSave->drawable.width || - pTemp->drawable.height != pBuffer->pSave->drawable.height) - { - if (pTemp) - (*pScreen->DestroyPixmap) (pTemp); -#ifdef ARGB_CURSOR - if (pBuffer->pTempPicture) - { - FreePicture (pBuffer->pTempPicture, 0); - pBuffer->pTempPicture = 0; - } -#endif - pBuffer->pTemp = pTemp = (*pScreen->CreatePixmap) - (pScreen, w, h, pBuffer->pSave->drawable.depth, 0); - if (!pTemp) - return FALSE; - } - if (!pBuffer->pMoveGC) - { - pBuffer->pMoveGC = CreateGC ((DrawablePtr)pTemp, - GCGraphicsExposures, &gcval, &status, (XID)0, serverClient); - if (!pBuffer->pMoveGC) - return FALSE; - } - /* - * copy the saved area to a temporary pixmap - */ - pGC = pBuffer->pMoveGC; - if (pGC->serialNumber != pTemp->drawable.serialNumber) - ValidateGC ((DrawablePtr) pTemp, pGC); - (*pGC->ops->CopyArea)((DrawablePtr)pBuffer->pSave, - (DrawablePtr)pTemp, pGC, 0, 0, w, h, 0, 0); - - /* - * draw the cursor in the temporary pixmap - */ -#ifdef ARGB_CURSOR - if (pPriv->pPicture) - { - if (!EnsurePicture(pBuffer->pTempPicture, &pTemp->drawable, pWin)) - return FALSE; - CompositePicture (PictOpOver, - pPriv->pPicture, - NULL, - pBuffer->pTempPicture, - 0, 0, 0, 0, - dx, dy, - pCursor->bits->width, - pCursor->bits->height); - } - else -#endif - { - miDCPutBits ((DrawablePtr)pTemp, pPriv, - pBuffer->pPixSourceGC, pBuffer->pPixMaskGC, - dx, dy, pCursor->bits->width, pCursor->bits->height, - source, mask); - } - - pGC = pBuffer->pRestoreGC; - if (pWin->drawable.serialNumber != pGC->serialNumber) - ValidateGC ((DrawablePtr) pWin, pGC); - - (*pGC->ops->CopyArea) ((DrawablePtr) pTemp, (DrawablePtr) pWin, - pGC, - 0, 0, w, h, x, y); - return TRUE; -} - Bool miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) { miDCBufferPtr pBuffer; WindowPtr pWin; - XID gcval = FALSE; - int status; int i; if (!DevHasCursor(pDev)) @@ -749,7 +513,7 @@ miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) goto failure; dixSetPrivate(&pDev->devPrivates, miDCSpriteKey + pScreen->myNum, pBuffer); - pWin = WindowTable[pScreen->myNum]; + pWin = pScreen->root; pBuffer->pSourceGC = miDCMakeGC(pWin); if (!pBuffer->pSourceGC) @@ -767,28 +531,12 @@ miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) if (!pBuffer->pRestoreGC) goto failure; - pBuffer->pMoveGC = CreateGC ((DrawablePtr)pWin, - GCGraphicsExposures, &gcval, &status, (XID)0, serverClient); - if (!pBuffer->pMoveGC) - goto failure; - - pBuffer->pPixSourceGC = CreateGC ((DrawablePtr)pWin, - GCGraphicsExposures, &gcval, &status, (XID)0, serverClient); - if (!pBuffer->pPixSourceGC) - goto failure; - - pBuffer->pPixMaskGC = CreateGC ((DrawablePtr)pWin, - GCGraphicsExposures, &gcval, &status, (XID)0, serverClient); - if (!pBuffer->pPixMaskGC) - goto failure; - #ifdef ARGB_CURSOR pBuffer->pRootPicture = NULL; - pBuffer->pTempPicture = NULL; #endif - // these get (re)allocated lazily depending on the cursor size - pBuffer->pSave = pBuffer->pTemp = NULL; + /* (re)allocated lazily depending on the cursor size */ + pBuffer->pSave = NULL; } return TRUE; @@ -820,12 +568,14 @@ miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) if (pBuffer->pMaskGC) FreeGC(pBuffer->pMaskGC, (GContext) 0); if (pBuffer->pSaveGC) FreeGC(pBuffer->pSaveGC, (GContext) 0); if (pBuffer->pRestoreGC) FreeGC(pBuffer->pRestoreGC, (GContext) 0); - if (pBuffer->pMoveGC) FreeGC(pBuffer->pMoveGC, (GContext) 0); - if (pBuffer->pPixSourceGC) FreeGC(pBuffer->pPixSourceGC, (GContext) 0); - if (pBuffer->pPixMaskGC) FreeGC(pBuffer->pPixMaskGC, (GContext) 0); + +#ifdef ARGB_CURSOR + /* If a pRootPicture was allocated for a root window, it + * is freed when that root window is destroyed, so don't + * free it again here. */ +#endif if (pBuffer->pSave) (*pScreen->DestroyPixmap)(pBuffer->pSave); - if (pBuffer->pTemp) (*pScreen->DestroyPixmap)(pBuffer->pTemp); free(pBuffer); dixSetPrivate(&pDev->devPrivates, miDCSpriteKey + pScreen->myNum, NULL); diff --git a/mi/miexpose.c b/mi/miexpose.c index 57968dd2a..088149be7 100644 --- a/mi/miexpose.c +++ b/mi/miexpose.c @@ -424,9 +424,9 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy) XID realWin = 0; if(!pWin->parent) { - x = panoramiXdataPtr[scrnum].x; - y = panoramiXdataPtr[scrnum].y; - pWin = WindowTable[0]; + x = screenInfo.screens[scrnum]->x; + y = screenInfo.screens[scrnum]->y; + pWin = screenInfo.screens[0]->root; realWin = pWin->drawable.id; } else if (scrnum) { PanoramiXRes *win; diff --git a/mi/mioverlay.c b/mi/mioverlay.c index df43196df..da3ff4ae7 100644 --- a/mi/mioverlay.c +++ b/mi/mioverlay.c @@ -306,7 +306,7 @@ miOverlayReparentWindow(WindowPtr pWin, WindowPtr pPriorParent) { if(IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)) { /* This could probably be more optimal */ - RebuildTree(WindowTable[pWin->drawable.pScreen->myNum]->firstChild); + RebuildTree(pWin->drawable.pScreen->root->firstChild); } } @@ -1610,7 +1610,7 @@ miOverlayChangeBorderWidth( void miOverlaySetRootClip(ScreenPtr pScreen, Bool enable) { - WindowPtr pRoot = WindowTable[pScreen->myNum]; + WindowPtr pRoot = pScreen->root; miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pRoot); MARK_UNDERLAY(pRoot); @@ -1741,7 +1741,7 @@ miOverlayComputeCompositeClip(GCPtr pGC, WindowPtr pWin) pregWin = REGION_CREATE(pScreen, NullBox, 1); freeTmpClip = TRUE; if (pWin->parent || (screenIsSaved != SCREEN_SAVER_ON) || - !HasSaverWindow (pScreen->myNum)) + !HasSaverWindow (pScreen)) { REGION_INTERSECT(pScreen,pregWin,&pTree->borderClip,&pWin->winSize); } diff --git a/mi/misprite.c b/mi/misprite.c index 3d10bc819..2962abfc3 100644 --- a/mi/misprite.c +++ b/mi/misprite.c @@ -798,73 +798,9 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, miSpriteFindColors (pPointer, pScreen); } if (pPointer->isUp) { -#if 0 - /* FIXME: Disabled for MPX, should be rewritten */ - int sx, sy; - /* - * check to see if the old saved region - * encloses the new sprite, in which case we use - * the flicker-free MoveCursor primitive. - */ - sx = pointer->x - (int)pCursor->bits->xhot; - sy = pointer->y - (int)pCursor->bits->yhot; - if (sx + (int) pCursor->bits->width >= pointer->saved.x1 && - sx < pointer->saved.x2 && - sy + (int) pCursor->bits->height >= pointer->saved.y1 && - sy < pointer->saved.y2 && - (int) pCursor->bits->width + (2 * SPRITE_PAD) == - pointer->saved.x2 - pointer->saved.x1 && - (int) pCursor->bits->height + (2 * SPRITE_PAD) == - pointer->saved.y2 - pointer->saved.y1 - ) - { - DamageDrawInternal (pScreen, TRUE); - miSpriteIsDown(pCursorInfo); - if (!(sx >= pointer->saved.x1 && - sx + (int)pCursor->bits->width < pointer->saved.x2 - && sy >= pointer->saved.y1 && - sy + (int)pCursor->bits->height < - pointer->saved.y2)) - { - int oldx1, oldy1, dx, dy; - - oldx1 = pointer->saved.x1; - oldy1 = pointer->saved.y1; - dx = oldx1 - (sx - SPRITE_PAD); - dy = oldy1 - (sy - SPRITE_PAD); - pointer->saved.x1 -= dx; - pointer->saved.y1 -= dy; - pointer->saved.x2 -= dx; - pointer->saved.y2 -= dy; - (void) miDCChangeSave(pScreen, - pointer->saved.x1, - pointer->saved.y1, - pointer->saved.x2 - - pointer->saved.x1, - pointer->saved.y2 - - pointer->saved.y1, - dx, dy); - } - (void) miDCMoveCursor(pScreen, pCursor, - pointer->saved.x1, - pointer->saved.y1, - pointer->saved.x2 - - pointer->saved.x1, - pointer->saved.y2 - - pointer->saved.y1, - sx - pointer->saved.x1, - sy - pointer->saved.y1, - pointer->colors[SOURCE_COLOR].pixel, - pointer->colors[MASK_COLOR].pixel); - miSpriteIsUp(pCursorInfo); - DamageDrawInternal (pScreen, FALSE); - } - else -#endif - { - SPRITE_DEBUG (("SetCursor remove %d\n", pDev->id)); - miSpriteRemoveCursor (pDev, pScreen); - } + /* TODO: reimplement flicker-free MoveCursor */ + SPRITE_DEBUG (("SetCursor remove %d\n", pDev->id)); + miSpriteRemoveCursor (pDev, pScreen); } if (!pPointer->isUp && pPointer->pCursor) diff --git a/mi/misprite.h b/mi/misprite.h index 78bf52cd4..632d207ea 100644 --- a/mi/misprite.h +++ b/mi/misprite.h @@ -46,12 +46,5 @@ extern Bool miDCSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, int w, int h); extern Bool miDCRestoreUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, int w, int h); -extern Bool miDCMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, - CursorPtr pCursor, int x, int y, - int w, int h, int dx, int dy, - unsigned long source, unsigned long mask); -extern Bool miDCChangeSave(DeviceIntPtr pDev, ScreenPtr pScreen, - int x, int y, int w, int h, - int dx, int dy); extern Bool miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen); extern void miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen); diff --git a/miext/rootless/rootlessCommon.c b/miext/rootless/rootlessCommon.c index 39a3eed0f..dd3f953ca 100644 --- a/miext/rootless/rootlessCommon.c +++ b/miext/rootless/rootlessCommon.c @@ -447,7 +447,7 @@ RootlessRedisplay(WindowPtr pWindow) void RootlessRepositionWindows(ScreenPtr pScreen) { - WindowPtr root = WindowTable[pScreen->myNum]; + WindowPtr root = pScreen->root; WindowPtr win; if (root != NULL) { @@ -468,7 +468,7 @@ RootlessRepositionWindows(ScreenPtr pScreen) void RootlessRedisplayScreen(ScreenPtr pScreen) { - WindowPtr root = WindowTable[pScreen->myNum]; + WindowPtr root = pScreen->root; if (root != NULL) { WindowPtr win; diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h index f44c4e8cf..8a4b81321 100644 --- a/miext/rootless/rootlessCommon.h +++ b/miext/rootless/rootlessCommon.h @@ -213,7 +213,7 @@ extern RegionRec rootlessHugeRoot; // Returns TRUE if this window is a root window #define IsRoot(pWin) \ - ((pWin) == WindowTable[(pWin)->drawable.pScreen->myNum]) + ((pWin) == (pWin)->drawable.pScreen->root) /* diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c index 7a24af842..d24ca04ad 100644 --- a/miext/rootless/rootlessScreen.c +++ b/miext/rootless/rootlessScreen.c @@ -493,7 +493,7 @@ static void expose_1 (WindowPtr pWin) { void RootlessScreenExpose (ScreenPtr pScreen) { - expose_1 (WindowTable[pScreen->myNum]); + expose_1 (pScreen->root); } diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c index 22a548a0f..ce088c7dc 100644 --- a/miext/rootless/rootlessWindow.c +++ b/miext/rootless/rootlessWindow.c @@ -53,9 +53,9 @@ extern Bool no_configure_window; #ifdef ROOTLESS_GLOBAL_COORDS #define SCREEN_TO_GLOBAL_X \ - (dixScreenOrigins[pScreen->myNum].x + rootlessGlobalOffsetX) + (pScreen->x + rootlessGlobalOffsetX) #define SCREEN_TO_GLOBAL_Y \ - (dixScreenOrigins[pScreen->myNum].y + rootlessGlobalOffsetY) + (pScreen->y + rootlessGlobalOffsetY) #else #define SCREEN_TO_GLOBAL_X 0 #define SCREEN_TO_GLOBAL_Y 0 @@ -109,8 +109,8 @@ void RootlessNativeWindowMoved (WindowPtr pWin) { if (xp_get_window_bounds (MAKE_WINDOW_ID(winRec->wid), &bounds) != Success) return; - sx = dixScreenOrigins[pWin->drawable.pScreen->myNum].x + darwinMainScreenX; - sy = dixScreenOrigins[pWin->drawable.pScreen->myNum].y + darwinMainScreenY; + sx = pWin->drawable.pScreen->x + darwinMainScreenX; + sy = pWin->drawable.pScreen->y + darwinMainScreenY; /* Fake up a ConfigureWindow packet to resize the window to the current bounds. */ vlist[0] = (INT16) bounds.x1 - sx; @@ -1517,7 +1517,7 @@ RootlessOrderAllWindows (void) RL_DEBUG_MSG("RootlessOrderAllWindows() "); for (i = 0; i < screenInfo.numScreens; i++) { if (screenInfo.screens[i] == NULL) continue; - pWin = WindowTable[i]; + pWin = screenInfo.screens[i]->root; if (pWin == NULL) continue; for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) { @@ -1533,7 +1533,7 @@ void RootlessEnableRoot (ScreenPtr pScreen) { WindowPtr pRoot; - pRoot = WindowTable[pScreen->myNum]; + pRoot = pScreen->root; RootlessEnsureFrame (pRoot); (*pScreen->ClearToBackground) (pRoot, 0, 0, 0, 0, TRUE); @@ -1546,7 +1546,7 @@ RootlessDisableRoot (ScreenPtr pScreen) WindowPtr pRoot; RootlessWindowRec *winRec; - pRoot = WindowTable[pScreen->myNum]; + pRoot = pScreen->root; winRec = WINREC (pRoot); if (NULL == winRec) @@ -1572,8 +1572,10 @@ RootlessHideAllWindows (void) for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; - pWin = WindowTable[i]; - if (pScreen == NULL || pWin == NULL) + if (pScreen == NULL) + continue; + pWin = pScreen->root; + if (pWin == NULL) continue; for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) @@ -1609,8 +1611,10 @@ RootlessShowAllWindows (void) for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; - pWin = WindowTable[i]; - if (pScreen == NULL || pWin == NULL) + if (pScreen == NULL) + continue; + pWin = pScreen->root; + if (pWin == NULL) continue; for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) diff --git a/randr/rrscreen.c b/randr/rrscreen.c index a940f8aae..a2a0f36a6 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -73,7 +73,7 @@ RREditConnectionInfo (ScreenPtr pScreen) void RRSendConfigNotify (ScreenPtr pScreen) { - WindowPtr pWin = WindowTable[pScreen->myNum]; + WindowPtr pWin = pScreen->root; xEvent event; event.u.u.type = ConfigureNotify; @@ -97,7 +97,7 @@ RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen) rrScrPriv (pScreen); xRRScreenChangeNotifyEvent se; RRCrtcPtr crtc = pScrPriv->numCrtcs ? pScrPriv->crtcs[0] : NULL; - WindowPtr pRoot = WindowTable[pScreen->myNum]; + WindowPtr pRoot = pScreen->root; se.type = RRScreenChangeNotify + RREventBase; se.rotation = (CARD8) (crtc ? crtc->rotation : RR_Rotate_0); @@ -620,7 +620,7 @@ ProcRRGetScreenInfo (ClientPtr client) rep.setOfRotations = RR_Rotate_0; rep.sequenceNumber = client->sequence; rep.length = 0; - rep.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; + rep.root = pWin->drawable.pScreen->root->drawable.id; rep.timestamp = currentTime.milliseconds; rep.configTimestamp = currentTime.milliseconds; rep.nSizes = 0; @@ -649,7 +649,7 @@ ProcRRGetScreenInfo (ClientPtr client) rep.setOfRotations = output->crtc->rotations; rep.sequenceNumber = client->sequence; rep.length = 0; - rep.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; + rep.root = pWin->drawable.pScreen->root->drawable.id; rep.timestamp = pScrPriv->lastSetTime.milliseconds; rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds; rep.rotation = output->crtc->rotation; @@ -961,7 +961,7 @@ sendReply: rep.newTimestamp = pScrPriv->lastSetTime.milliseconds; rep.newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds; - rep.root = WindowTable[pDraw->pScreen->myNum]->drawable.id; + rep.root = pDraw->pScreen->root->drawable.id; if (client->swapped) { diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c index 457b2b40f..c1bd5bb33 100644 --- a/randr/rrxinerama.c +++ b/randr/rrxinerama.c @@ -216,7 +216,7 @@ ProcRRXineramaGetScreenSize(ClientPtr client) return rc; pScreen = pWin->drawable.pScreen; - pRoot = WindowTable[pScreen->myNum]; + pRoot = pScreen->root; rep.type = X_Reply; rep.length = 0; diff --git a/record/record.c b/record/record.c index 3724dc7a9..46231c913 100644 --- a/record/record.c +++ b/record/record.c @@ -43,6 +43,7 @@ and Jim Haggerty of Metheus. #include "swaprep.h" #include "inputstr.h" #include "eventconvert.h" +#include "scrnintstr.h" #include @@ -755,11 +756,11 @@ RecordSendProtocolEvents(RecordClientsAndProtocolPtr pRCAP, int scr = XineramaGetCursorScreen(inputInfo.pointer); memcpy(&shiftedEvent, pev, sizeof(xEvent)); shiftedEvent.u.keyButtonPointer.rootX += - panoramiXdataPtr[scr].x - - panoramiXdataPtr[0].x; + screenInfo.screens[scr]->x - + screenInfo.screens[0]->x; shiftedEvent.u.keyButtonPointer.rootY += - panoramiXdataPtr[scr].y - - panoramiXdataPtr[0].y; + screenInfo.screens[scr]->y - + screenInfo.screens[0]->y; pEvToRecord = &shiftedEvent; } #endif /* PANORAMIX */ diff --git a/render/render.c b/render/render.c index b58dd3ebe..78ecf43b7 100644 --- a/render/render.c +++ b/render/render.c @@ -2681,7 +2681,7 @@ PanoramiXRenderCreatePicture (ClientPtr client) newPict->info[0].id = stuff->pid; if (refDraw->type == XRT_WINDOW && - stuff->drawable == WindowTable[0]->drawable.id) + stuff->drawable == screenInfo.screens[0]->root->drawable.id) { newPict->u.pict.root = TRUE; } @@ -2832,22 +2832,22 @@ PanoramiXRenderComposite (ClientPtr client) stuff->src = src->info[j].id; if (src->u.pict.root) { - stuff->xSrc = orig.xSrc - panoramiXdataPtr[j].x; - stuff->ySrc = orig.ySrc - panoramiXdataPtr[j].y; + 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 - panoramiXdataPtr[j].x; - stuff->yDst = orig.yDst - panoramiXdataPtr[j].y; + 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 - panoramiXdataPtr[j].x; - stuff->yMask = orig.yMask - panoramiXdataPtr[j].y; + stuff->xMask = orig.xMask - screenInfo.screens[j]->x; + stuff->yMask = orig.yMask - screenInfo.screens[j]->y; } } result = (*PanoramiXSaveRenderVector[X_RenderComposite]) (client); @@ -2881,14 +2881,14 @@ PanoramiXRenderCompositeGlyphs (ClientPtr client) stuff->src = src->info[j].id; if (src->u.pict.root) { - stuff->xSrc = xSrc - panoramiXdataPtr[j].x; - stuff->ySrc = ySrc - panoramiXdataPtr[j].y; + 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 - panoramiXdataPtr[j].x; - elt->deltay = origElt.deltay - panoramiXdataPtr[j].y; + 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; @@ -2918,8 +2918,8 @@ PanoramiXRenderFillRectangles (ClientPtr client) if (j) memcpy (stuff + 1, extra, extra_len); if (dst->u.pict.root) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; + int x_off = screenInfo.screens[j]->x; + int y_off = screenInfo.screens[j]->y; if(x_off || y_off) { xRectangle *rects = (xRectangle *) (stuff + 1); @@ -2966,8 +2966,8 @@ PanoramiXRenderTrapezoids(ClientPtr client) FOR_NSCREENS_FORWARD(j) { if (j) memcpy (stuff + 1, extra, extra_len); if (dst->u.pict.root) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; + int x_off = screenInfo.screens[j]->x; + int y_off = screenInfo.screens[j]->y; if(x_off || y_off) { xTrapezoid *trap = (xTrapezoid *) (stuff + 1); @@ -3026,8 +3026,8 @@ PanoramiXRenderTriangles(ClientPtr client) FOR_NSCREENS_FORWARD(j) { if (j) memcpy (stuff + 1, extra, extra_len); if (dst->u.pict.root) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; + int x_off = screenInfo.screens[j]->x; + int y_off = screenInfo.screens[j]->y; if(x_off || y_off) { xTriangle *tri = (xTriangle *) (stuff + 1); @@ -3082,8 +3082,8 @@ PanoramiXRenderTriStrip(ClientPtr client) FOR_NSCREENS_FORWARD(j) { if (j) memcpy (stuff + 1, extra, extra_len); if (dst->u.pict.root) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; + int x_off = screenInfo.screens[j]->x; + int y_off = screenInfo.screens[j]->y; if(x_off || y_off) { xPointFixed *fixed = (xPointFixed *) (stuff + 1); @@ -3134,8 +3134,8 @@ PanoramiXRenderTriFan(ClientPtr client) FOR_NSCREENS_FORWARD(j) { if (j) memcpy (stuff + 1, extra, extra_len); if (dst->u.pict.root) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; + int x_off = screenInfo.screens[j]->x; + int y_off = screenInfo.screens[j]->y; if(x_off || y_off) { xPointFixed *fixed = (xPointFixed *) (stuff + 1); @@ -3188,8 +3188,8 @@ PanoramiXRenderAddTraps (ClientPtr client) if (picture->u.pict.root) { - stuff->xOff = x_off + panoramiXdataPtr[j].x; - stuff->yOff = y_off + panoramiXdataPtr[j].y; + 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; diff --git a/xfixes/cursor.c b/xfixes/cursor.c index d3a207ddb..5f08db7a5 100644 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -690,7 +690,7 @@ ReplaceCursor (CursorPtr pCursor, } } /* this "knows" that WindowHasNewCursor doesn't depend on it's argument */ - WindowHasNewCursor (WindowTable[0]); + WindowHasNewCursor (screenInfo.screens[0]->root); } static Bool diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 93175c538..0f3ffa468 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -43,6 +43,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "opaque.h" #include "property.h" +#include "scrnintstr.h" #define XKBSRV_NEED_FILE_FUNCS #include #include "xkbgeom.h" @@ -210,7 +211,7 @@ char * pval; ErrorF("[xkb] Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n", out,len); } - dixChangeWindowProperty(serverClient, WindowTable[0], name, XA_STRING, 8, + dixChangeWindowProperty(serverClient, screenInfo.screens[0]->root, name, XA_STRING, 8, PropModeReplace, len, pval, TRUE); free(pval); return TRUE;