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/dix/main.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'nx-X11/programs/Xserver/dix/main.c') diff --git a/nx-X11/programs/Xserver/dix/main.c b/nx-X11/programs/Xserver/dix/main.c index 050da899e..25fbb8b65 100644 --- a/nx-X11/programs/Xserver/dix/main.c +++ b/nx-X11/programs/Xserver/dix/main.c @@ -332,9 +332,6 @@ main(int argc, char *argv[], char *envp[]) screenInfo.arraySize = MAXSCREENS; screenInfo.numScreens = 0; screenInfo.numVideoScreens = -1; - WindowTable = (WindowPtr *)xalloc(MAXSCREENS * sizeof(WindowPtr)); - if (!WindowTable) - FatalError("couldn't create root window table"); /* * Just in case the ddx doesnt supply a format for depth 1 (like qvss). @@ -419,8 +416,8 @@ main(int argc, char *argv[], char *envp[]) #endif for (i = 0; i < screenInfo.numScreens; i++) - InitRootWindow(WindowTable[i]); - DefineInitialRootWindow(WindowTable[0]); + InitRootWindow(screenInfo.screens[i]->root); + DefineInitialRootWindow(screenInfo.screens[0]->root); SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); #ifdef DPMSExtension SetDPMSTimers(); @@ -456,7 +453,11 @@ main(int argc, char *argv[], char *envp[]) FreeAllResources(); #endif + for (i = 0; i < screenInfo.numScreens; i++) + screenInfo.screens[i]->root = NullWindow; CloseDownDevices(); + CloseDownEvents(); + for (i = screenInfo.numScreens - 1; i >= 0; i--) { FreeScratchPixmapsForScreen(i); @@ -466,9 +467,6 @@ main(int argc, char *argv[], char *envp[]) FreeScreen(screenInfo.screens[i]); screenInfo.numScreens = i; } - CloseDownEvents(); - xfree(WindowTable); - WindowTable = NULL; FreeFonts(); #ifdef DPMSExtension @@ -595,7 +593,7 @@ CreateConnectionBlock() VisualPtr pVisual; pScreen = screenInfo.screens[i]; - root.windowId = WindowTable[i]->drawable.id; + root.windowId = screenInfo.screens[i]->root->drawable.id; root.defaultColormap = pScreen->defColormap; root.whitePixel = pScreen->whitePixel; root.blackPixel = pScreen->blackPixel; @@ -769,7 +767,6 @@ AddScreen( multiple screens. */ pScreen->rgf = ~0L; /* there are no scratch GCs yet*/ - WindowTable[i] = NullWindow; screenInfo.screens[i] = pScreen; screenInfo.numScreens++; if (!(*pfnInit)(i, pScreen, argc, argv)) @@ -784,6 +781,7 @@ AddScreen( static void FreeScreen(ScreenPtr pScreen) { + pScreen->root = NullWindow; xfree(pScreen->WindowPrivateSizes); xfree(pScreen->GCPrivateSizes); #ifdef PIXPRIV -- cgit v1.2.3