From c61bb8cc59bf645f1bf4dbc5fd5464d559b3ecad Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 20 Jun 2016 12:18:53 +0200 Subject: Move each screen's root-window pointer into ScreenRec. Backported from X.org: commit e7fae9ecc42ab5e73b89117722dbf4117d928f9a Author: Jamey Sharp Date: Sat May 22 00:26:28 2010 -0700 Move each screen's root-window pointer into ScreenRec. Many references to the WindowTable array already had the corresponding screen pointer handy, which meant they usually looked like "WindowTable[pScreen->myNum]". Adding a field to ScreenRec instead of keeping this information in a parallel array simplifies those expressions, and eliminates a MAXSCREENS-sized array. Since dix uses this data, a screen private entry isn't appropriate. xf86-video-dummy currently uses WindowTable, so it needs to be updated to reflect this change. Signed-off-by: Jamey Sharp Reviewed-by: Tiago Vignatti Tested-by: Tiago Vignatti (i686 GNU/Linux) Backport to nx-libs: Mike Gabriel --- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 30 ++++++++++++++------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/NXwindow.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index 70c378b9e..5daa65443 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -240,7 +240,7 @@ PrintWindowTree() for (i=0; iroot; RegionPrint(&pWin->clipList); p1 = pWin->firstChild; PrintChildren(p1, 4); @@ -286,7 +286,7 @@ TraverseTree(register WindowPtr pWin, VisitWindowProcPtr func, void * data) int WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, void * data) { - return(TraverseTree(WindowTable[pScreen->myNum], func, data)); + return(TraverseTree(pScreen->root, func, data)); } /* hack for forcing backing store on all windows */ @@ -457,7 +457,9 @@ CreateRootWindow(ScreenPtr pScreen) savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL; screenIsSaved = SCREEN_SAVER_OFF; - WindowTable[pScreen->myNum] = pWin; + pScreen->root = pWin; + + pScreen->root = pWin; pWin->drawable.pScreen = pScreen; pWin->drawable.type = DRAWABLE_WINDOW; @@ -583,11 +585,11 @@ InitRootWindow(WindowPtr pWin) /* * A root window is created for each screen by main - * and the pointer is saved in WindowTable as in the - * following snippet: + * and the pointer is saved in screenInfo.screens as + * in the following snippet: * * for (i = 0; i < screenInfo.numScreens; i++) - * InitRootWindow(WindowTable[i]); + * InitRootWindow(screenInfo.screens[i]->root); * * Our root window on the real display was already * created at the time the screen was opened, so it @@ -1583,7 +1585,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt */ if ( cursorID == None) { - if (pWin == WindowTable[pWin->drawable.pScreen->myNum]) + if (pWin == pWin->drawable.pScreen->root) pCursor = rootCursor; else pCursor = (CursorPtr) None; @@ -2863,7 +2865,7 @@ ReparentWindow(register WindowPtr pWin, register WindowPtr pParent, pWin->parent = pParent; pPrev = RealChildHead(pParent); - if (pWin->parent == WindowTable[0]) + if (pWin->parent == screenInfo.screens[0]->root) { nxagentSetTopLevelEventMask(pWin); } @@ -3442,7 +3444,7 @@ HandleSaveSet(register 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 { @@ -3744,9 +3746,9 @@ TileScreenSaver(int i, int kind) attri = 0; switch (kind) { case SCREEN_IS_TILED: - switch (WindowTable[i]->backgroundState) { + switch (screenInfo.screens[i]->root->backgroundState) { case BackgroundPixel: - attributes[attri++] = WindowTable[i]->background.pixel; + attributes[attri++] = screenInfo.screens[i]->root->background.pixel; mask |= CWBackPixel; break; case BackgroundPixmap: @@ -3758,7 +3760,7 @@ TileScreenSaver(int i, int kind) } break; case SCREEN_IS_BLACK: - attributes[attri++] = WindowTable[i]->drawable.pScreen->blackPixel; + attributes[attri++] = screenInfo.screens[i]->root->drawable.pScreen->blackPixel; mask |= CWBackPixel; break; } @@ -3806,12 +3808,12 @@ TileScreenSaver(int i, int kind) pWin = savedScreenInfo[i].pWindow = CreateWindow(savedScreenInfo[i].wid, - WindowTable[i], + screenInfo.screens[i]->root, -RANDOM_WIDTH, -RANDOM_WIDTH, (unsigned short)screenInfo.screens[i]->width + RANDOM_WIDTH, (unsigned short)screenInfo.screens[i]->height + RANDOM_WIDTH, 0, InputOutput, mask, attributes, 0, serverClient, - wVisual (WindowTable[i]), &result); + wVisual (screenInfo.screens[i]->root), &result); if (cursor) FreeResource (cursorID, RT_NONE); -- cgit v1.2.3