diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-06-20 12:18:53 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-06-21 04:09:16 +0200 |
commit | c61bb8cc59bf645f1bf4dbc5fd5464d559b3ecad (patch) | |
tree | 99b43f999db460959346ca3d29d261052deb6b3d /nx-X11 | |
parent | 590862d39d6e7cea6425416a5ef6fa2e747bcc0c (diff) | |
download | nx-libs-c61bb8cc59bf645f1bf4dbc5fd5464d559b3ecad.tar.gz nx-libs-c61bb8cc59bf645f1bf4dbc5fd5464d559b3ecad.tar.bz2 nx-libs-c61bb8cc59bf645f1bf4dbc5fd5464d559b3ecad.zip |
Move each screen's root-window pointer into ScreenRec.
Backported from X.org:
commit e7fae9ecc42ab5e73b89117722dbf4117d928f9a
Author: Jamey Sharp <jamey@minilop.net>
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 <jamey@minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com> (i686 GNU/Linux)
Backport to nx-libs: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Diffstat (limited to 'nx-X11')
42 files changed, 225 insertions, 224 deletions
diff --git a/nx-X11/programs/Xserver/Xext/panoramiX.c b/nx-X11/programs/Xserver/Xext/panoramiX.c index 2671ba0d3..9c5eefe4a 100644 --- a/nx-X11/programs/Xserver/Xext/panoramiX.c +++ b/nx-X11/programs/Xserver/Xext/panoramiX.c @@ -896,7 +896,7 @@ void PanoramiXConsolidate(void) for (i = 0; i < PanoramiXNumScreens; i++) { - root->info[i].id = WindowTable[i]->drawable.id; + root->info[i].id = screenInfo.screens[i]->root->drawable.id; root->u.win.class = InputOutput; root->u.win.root = TRUE; saver->info[i].id = savedScreenInfo[i].wid; diff --git a/nx-X11/programs/Xserver/Xext/panoramiX.h b/nx-X11/programs/Xserver/Xext/panoramiX.h index 3f70b6473..8113e3072 100644 --- a/nx-X11/programs/Xserver/Xext/panoramiX.h +++ b/nx-X11/programs/Xserver/Xext/panoramiX.h @@ -89,11 +89,11 @@ typedef struct { #define FORCE_ROOT(a) { \ int _j; \ for (_j = PanoramiXNumScreens - 1; _j; _j--) \ - if ((a).root == WindowTable[_j]->drawable.id) \ + if ((a).root == screenInfo.screens[_j]->root->drawable.id) \ break; \ (a).rootX += panoramiXdataPtr[_j].x; \ (a).rootY += panoramiXdataPtr[_j].y; \ - (a).root = WindowTable[0]->drawable.id; \ + (a).root = screenInfo.screens[0]->root->drawable.id; \ } #define FORCE_WIN(a) { \ diff --git a/nx-X11/programs/Xserver/Xext/panoramiXprocs.c b/nx-X11/programs/Xserver/Xext/panoramiXprocs.c index 17fe6d6c6..b4719d76f 100644 --- a/nx-X11/programs/Xserver/Xext/panoramiXprocs.c +++ b/nx-X11/programs/Xserver/Xext/panoramiXprocs.c @@ -146,7 +146,7 @@ int PanoramiXCreateWindow(ClientPtr client) orig_visual = stuff->visual; orig_x = stuff->x; orig_y = stuff->y; - parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id) || + parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) || (stuff->parent == savedScreenInfo[0].wid); FOR_NSCREENS_BACKWARD(j) { stuff->wid = newWin->info[j].id; @@ -336,7 +336,7 @@ int PanoramiXReparentWindow(ClientPtr client) x = stuff->x; y = stuff->y; - parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id) || + parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) || (stuff->parent == savedScreenInfo[0].wid); FOR_NSCREENS_BACKWARD(j) { stuff->window = win->info[j].id; @@ -476,7 +476,7 @@ int PanoramiXConfigureWindow(ClientPtr client) } } - if(pWin->parent && ((pWin->parent == WindowTable[0]) || + if(pWin->parent && ((pWin->parent == screenInfo.screens[0]->root) || (pWin->parent->drawable.id == savedScreenInfo[0].wid))) { if ((Mask)stuff->mask & CWX) { @@ -540,7 +540,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; @@ -558,7 +558,7 @@ 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]) || + if((pWin->parent == screenInfo.screens[0]->root) || (pWin->parent->drawable.id == savedScreenInfo[0].wid)) { rep.x += panoramiXdataPtr[0].x; @@ -594,7 +594,7 @@ int PanoramiXTranslateCoords(ClientPtr client) rep.sameScreen = xTrue; rep.child = None; - if((pWin == WindowTable[0]) || + if((pWin == screenInfo.screens[0]->root) || (pWin->drawable.id == savedScreenInfo[0].wid)) { x = stuff->srcX - panoramiXdataPtr[0].x; @@ -636,7 +636,7 @@ int PanoramiXTranslateCoords(ClientPtr client) } rep.dstX = x - pDst->drawable.x; rep.dstY = y - pDst->drawable.y; - if((pDst == WindowTable[0]) || + if((pDst == screenInfo.screens[0]->root) || (pDst->drawable.id == savedScreenInfo[0].wid)) { rep.dstX += panoramiXdataPtr[0].x; diff --git a/nx-X11/programs/Xserver/Xext/saver.c b/nx-X11/programs/Xserver/Xext/saver.c index ec91d080a..a871be9b7 100644 --- a/nx-X11/programs/Xserver/Xext/saver.c +++ b/nx-X11/programs/Xserver/Xext/saver.c @@ -473,7 +473,7 @@ SendScreenSaverNotify (pScreen, state, forced) ev.state = state; ev.sequenceNumber = client->sequence; ev.timestamp = currentTime.milliseconds; - ev.root = WindowTable[pScreen->myNum]->drawable.id; + ev.root = pScreen->root->drawable.id; ev.window = savedScreenInfo[pScreen->myNum].wid; ev.kind = kind; ev.forced = forced; @@ -549,7 +549,7 @@ CreateSaverWindow (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, @@ -830,7 +830,7 @@ ScreenSaverSetAttributes (ClientPtr client) if (!pDraw) return BadDrawable; pScreen = pDraw->pScreen; - pParent = WindowTable[pScreen->myNum]; + pParent = pScreen->root; len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2); if (Ones(stuff->mask) != len) diff --git a/nx-X11/programs/Xserver/Xext/xtest.c b/nx-X11/programs/Xserver/Xext/xtest.c index 8a03db5f9..565e8e8d7 100644 --- a/nx-X11/programs/Xserver/Xext/xtest.c +++ b/nx-X11/programs/Xserver/Xext/xtest.c @@ -409,7 +409,7 @@ ProcXTestFakeInput(client) if (RegionContainsPoint( &XineramaScreenRegions[i], x, y, &box)) { - root = WindowTable[i]; + root = screenInfo.screens[i]->root; x -= panoramiXdataPtr[i].x; y -= panoramiXdataPtr[i].y; ev->u.keyButtonPointer.rootX = x; diff --git a/nx-X11/programs/Xserver/Xi/chgptr.c b/nx-X11/programs/Xserver/Xi/chgptr.c index 925d43c07..4877fcc84 100644 --- a/nx-X11/programs/Xserver/Xi/chgptr.c +++ b/nx-X11/programs/Xserver/Xi/chgptr.c @@ -208,7 +208,7 @@ SendEventToAllWindows (dev, mask, ev, count) for (i=0; i<screenInfo.numScreens; i++) { - pWin = WindowTable[i]; + pWin = screenInfo.screens[i]->root; (void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id); p1 = pWin->firstChild; FindInterestedChildren (dev, p1, mask, ev, count); diff --git a/nx-X11/programs/Xserver/Xi/closedev.c b/nx-X11/programs/Xserver/Xi/closedev.c index ae46f50c6..5f90b57a4 100644 --- a/nx-X11/programs/Xserver/Xi/closedev.c +++ b/nx-X11/programs/Xserver/Xi/closedev.c @@ -124,7 +124,7 @@ ProcXCloseDevice(client) 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/nx-X11/programs/Xserver/composite/compalloc.c b/nx-X11/programs/Xserver/composite/compalloc.c index 9279a5248..017459b6b 100644 --- a/nx-X11/programs/Xserver/composite/compalloc.c +++ b/nx-X11/programs/Xserver/composite/compalloc.c @@ -32,7 +32,7 @@ static void compScreenUpdate(ScreenPtr pScreen) { compCheckTree(pScreen); - compPaintChildrenToWindow(pScreen, WindowTable[pScreen->myNum]); + compPaintChildrenToWindow(pScreen, pScreen->root); } static void diff --git a/nx-X11/programs/Xserver/composite/compoverlay.c b/nx-X11/programs/Xserver/composite/compoverlay.c index dfe59f3cf..226bbcb6a 100644 --- a/nx-X11/programs/Xserver/composite/compoverlay.c +++ b/nx-X11/programs/Xserver/composite/compoverlay.c @@ -129,7 +129,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/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c index a76c0723c..66671d1f4 100644 --- a/nx-X11/programs/Xserver/dix/dispatch.c +++ b/nx-X11/programs/Xserver/dix/dispatch.c @@ -234,8 +234,8 @@ FlushClientCaches(XID id) { if (client->lastDrawableID == id) { - client->lastDrawableID = WindowTable[0]->drawable.id; - client->lastDrawable = (DrawablePtr)WindowTable[0]; + client->lastDrawableID = screenInfo.screens[0]->root->drawable.id; + client->lastDrawable = (DrawablePtr)screenInfo.screens[0]->root; } else if (client->lastGCID == id) { @@ -793,7 +793,7 @@ GetGeometry(register 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; @@ -854,7 +854,7 @@ ProcQueryTree(register ClientPtr client) return(BadWindow); 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; @@ -3633,8 +3633,8 @@ void InitClient(ClientPtr client, int i, void * ospriv) if (i) { client->closeDownMode = DestroyAll; - client->lastDrawable = (DrawablePtr)WindowTable[0]; - client->lastDrawableID = WindowTable[0]->drawable.id; + client->lastDrawable = (DrawablePtr)screenInfo.screens[0]->root; + client->lastDrawableID = screenInfo.screens[0]->root->drawable.id; } else { @@ -3853,8 +3853,8 @@ SendConnSetup(register ClientPtr client, char *reason) register unsigned int j; register xDepth *pDepth; - root->currentInputMask = WindowTable[i]->eventMask | - wOtherEventMasks (WindowTable[i]); + root->currentInputMask = screenInfo.screens[i]->root->eventMask | + wOtherEventMasks (screenInfo.screens[i]->root); pDepth = (xDepth *)(root + 1); for (j = 0; j < root->nDepths; j++) { diff --git a/nx-X11/programs/Xserver/dix/events.c b/nx-X11/programs/Xserver/dix/events.c index 9005cd226..8f943887a 100644 --- a/nx-X11/programs/Xserver/dix/events.c +++ b/nx-X11/programs/Xserver/dix/events.c @@ -413,9 +413,10 @@ XineramaCheckPhysLimits( static Bool XineramaSetWindowPntrs(WindowPtr pWin) { - if(pWin == WindowTable[0]) { - memcpy(sprite.windows, WindowTable, - PanoramiXNumScreens*sizeof(WindowPtr)); + if(pWin == screenInfo.screens[0]->root) { + int i; + for (i = 0; i < PanoramiXNumScreens; i++) + sprite.windows[i] = screenInfo.screens[i]->root; } else { PanoramiXRes *win; int i; @@ -601,7 +602,7 @@ XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents) sprite.hotShape = NullRegion; sprite.confined = FALSE; - sprite.confineWin = (pWin == WindowTable[0]) ? NullWindow : pWin; + sprite.confineWin = (pWin == screenInfo.screens[0]->root) ? NullWindow : pWin; XineramaCheckPhysLimits(sprite.current, generateEvents); } @@ -797,7 +798,7 @@ CheckVirtualMotion( qe->event->u.keyButtonPointer.rootY = sprite.hot.y; } } - ROOT = WindowTable[sprite.hot.pScreen->myNum]; + ROOT = sprite.hot.pScreen->root; } static void @@ -997,7 +998,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count) */ if (xE->u.u.type == MotionNotify) XE_KBPTR.root = - WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id; + sprite.hotPhys.pScreen->root->drawable.id; eventinfo.events = xE; eventinfo.count = count; CallCallbacks(&DeviceEventCallback, (void *)&eventinfo); @@ -1160,7 +1161,7 @@ playmore: ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); } else - ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum], + ConfineCursorToWindow(sprite.hotPhys.pScreen->root, TRUE, FALSE); PostNewCursor(); } @@ -1178,7 +1179,7 @@ ScreenRestructured (ScreenPtr pScreen) ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); } else - ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum], + ConfineCursorToWindow(sprite.hotPhys.pScreen->root, TRUE, FALSE); } #endif @@ -1976,7 +1977,7 @@ CheckMotion(xEvent *xE) if (sprite.hot.pScreen != sprite.hotPhys.pScreen) { sprite.hot.pScreen = sprite.hotPhys.pScreen; - ROOT = WindowTable[sprite.hot.pScreen->myNum]; + ROOT = sprite.hot.pScreen->root; } sprite.hot.x = XE_KBPTR.rootX; sprite.hot.y = XE_KBPTR.rootY; @@ -2034,7 +2035,7 @@ WindowsRestructured() #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]->root) 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. */ @@ -2067,7 +2068,7 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) sprite.hotPhys.x = sprite.hotPhys.y = 0; ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); } else - ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum], + ConfineCursorToWindow(sprite.hotPhys.pScreen->root, TRUE, FALSE); } #endif @@ -2144,7 +2145,7 @@ NewCurrentScreen(ScreenPtr newScreen, int x, int y) if(sprite.confineWin) XineramaConfineCursorToWindow(sprite.confineWin, TRUE); else - XineramaConfineCursorToWindow(WindowTable[0], TRUE); + XineramaConfineCursorToWindow(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) @@ -2157,7 +2158,7 @@ NewCurrentScreen(ScreenPtr newScreen, int x, int y) } else #endif if (newScreen != sprite.hotPhys.pScreen) - ConfineCursorToWindow(WindowTable[newScreen->myNum], TRUE, FALSE); + ConfineCursorToWindow(newScreen->root, TRUE, FALSE); } #ifdef PANORAMIX @@ -2231,7 +2232,7 @@ XineramaWarpPointer(ClientPtr client) winX = source->drawable.x; winY = source->drawable.y; - if(source == WindowTable[0]) { + if(source == screenInfo.screens[0]->root) { winX -= panoramiXdataPtr[0].x; winY -= panoramiXdataPtr[0].y; } @@ -2247,7 +2248,7 @@ XineramaWarpPointer(ClientPtr client) if (dest) { x = dest->drawable.x; y = dest->drawable.y; - if(dest == WindowTable[0]) { + if(dest == screenInfo.screens[0]->root) { x -= panoramiXdataPtr[0].x; y -= panoramiXdataPtr[0].y; } @@ -2822,7 +2823,7 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count /* see comment in EnqueueEvents regarding the next three lines */ if (xE->u.u.type == MotionNotify) XE_KBPTR.root = - WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id; + sprite.hotPhys.pScreen->root->drawable.id; eventinfo.events = xE; eventinfo.count = count; CallCallbacks(&DeviceEventCallback, (void *)&eventinfo); @@ -3356,11 +3357,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode) /* Notify all the roots */ #ifdef PANORAMIX if ( !noPanoramiXExtension ) - FocusEvent(dev, FocusOut, mode, out, WindowTable[0]); + FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[0]->root); else #endif for (i=0; i<screenInfo.numScreens; i++) - FocusEvent(dev, FocusOut, mode, out, WindowTable[i]); + FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[i]->root); } else { @@ -3375,11 +3376,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode) /* Notify all the roots */ #ifdef PANORAMIX if ( !noPanoramiXExtension ) - FocusEvent(dev, FocusIn, mode, in, WindowTable[0]); + FocusEvent(dev, FocusIn, mode, in, screenInfo.screens[0]->root); else #endif for (i=0; i<screenInfo.numScreens; i++) - FocusEvent(dev, FocusIn, mode, in, WindowTable[i]); + FocusEvent(dev, FocusIn, mode, in, screenInfo.screens[i]->root); if (toWin == PointerRootWin) (void)FocusInEvents(dev, ROOT, sprite.win, NullWindow, mode, NotifyPointer, TRUE); @@ -3393,11 +3394,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode) TRUE); #ifdef PANORAMIX if ( !noPanoramiXExtension ) - FocusEvent(dev, FocusOut, mode, out, WindowTable[0]); + FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[0]->root); else #endif for (i=0; i<screenInfo.numScreens; i++) - FocusEvent(dev, FocusOut, mode, out, WindowTable[i]); + FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[i]->root); if (toWin->parent != NullWindow) (void)FocusInEvents(dev, ROOT, toWin, toWin, mode, NotifyNonlinearVirtual, TRUE); diff --git a/nx-X11/programs/Xserver/dix/globals.c b/nx-X11/programs/Xserver/dix/globals.c index 9d9e8bfe7..632d0f82b 100644 --- a/nx-X11/programs/Xserver/dix/globals.c +++ b/nx-X11/programs/Xserver/dix/globals.c @@ -86,8 +86,6 @@ ClientPtr serverClient; int currentMaxClients; /* current size of clients array */ long maxBigRequestSize = MAX_BIG_REQUEST_SIZE; -WindowPtr *WindowTable; - unsigned long globalSerialNumber = 0; unsigned long serverGeneration = 0; 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 diff --git a/nx-X11/programs/Xserver/dix/resource.c b/nx-X11/programs/Xserver/dix/resource.c index ed8a255f5..d579b33fa 100644 --- a/nx-X11/programs/Xserver/dix/resource.c +++ b/nx-X11/programs/Xserver/dix/resource.c @@ -544,8 +544,8 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) } if(clients[cid] && (id == clients[cid]->lastDrawableID)) { - clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0]; - clients[cid]->lastDrawableID = WindowTable[0]->drawable.id; + clients[cid]->lastDrawable = (DrawablePtr)screenInfo.screens[0]->root; + clients[cid]->lastDrawableID = screenInfo.screens[0]->root->drawable.id; } } if (!gotOne) @@ -582,8 +582,8 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) } if(clients[cid] && (id == clients[cid]->lastDrawableID)) { - clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0]; - clients[cid]->lastDrawableID = WindowTable[0]->drawable.id; + clients[cid]->lastDrawable = (DrawablePtr)screenInfo.screens[0]->root; + clients[cid]->lastDrawableID = screenInfo.screens[0]->root->drawable.id; } } } diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c index 6221af4d1..5a4818f88 100644 --- a/nx-X11/programs/Xserver/dix/window.c +++ b/nx-X11/programs/Xserver/dix/window.c @@ -191,7 +191,7 @@ PrintWindowTree() for (i=0; i<screenInfo.numScreens; i++) { ErrorF( "WINDOW %d\n", i); - pWin = WindowTable[i]; + pWin = screenInfo.screens[i]->root; RegionPrint(&pWin->clipList); p1 = pWin->firstChild; PrintChildren(p1, 4); @@ -237,7 +237,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 */ @@ -384,7 +384,7 @@ CreateRootWindow(ScreenPtr pScreen) savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL; screenIsSaved = SCREEN_SAVER_OFF; - WindowTable[pScreen->myNum] = pWin; + pScreen->root = pWin; pWin->drawable.pScreen = pScreen; pWin->drawable.type = DRAWABLE_WINDOW; @@ -1348,7 +1348,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; @@ -3088,7 +3088,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 { @@ -3382,9 +3382,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: @@ -3396,7 +3396,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; } @@ -3444,12 +3444,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); diff --git a/nx-X11/programs/Xserver/fb/fb.h b/nx-X11/programs/Xserver/fb/fb.h index 1da5d2470..008ab3ec7 100644 --- a/nx-X11/programs/Xserver/fb/fb.h +++ b/nx-X11/programs/Xserver/fb/fb.h @@ -582,8 +582,7 @@ extern const GCFuncs fbGCFuncs; #endif #ifdef FB_OLD_SCREEN -# define FB_OLD_MISCREENINIT /* miScreenInit requires 14 args, not 13 */ -extern WindowPtr *WindowTable; +# define FB_OLD_MISCREENINIT /* miScreenInit requires 14 args, not 13 */ #endif #ifdef FB_24_32BIT @@ -704,7 +703,7 @@ typedef struct { #define fbWindowEnabled(pWin) \ RegionNotEmpty(\ - &WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip) + &(pWin)->drawable.pScreen->root->borderClip) #define fbDrawableEnabled(pDrawable) \ ((pDrawable)->type == DRAWABLE_PIXMAP ? \ diff --git a/nx-X11/programs/Xserver/fb/fbwindow.c b/nx-X11/programs/Xserver/fb/fbwindow.c index 5ce7ba729..b2df19f0d 100644 --- a/nx-X11/programs/Xserver/fb/fbwindow.c +++ b/nx-X11/programs/Xserver/fb/fbwindow.c @@ -262,7 +262,7 @@ fbFillRegionTiled (DrawablePtr pDrawable, if(!noPanoramiXExtension) { int index = pDrawable->pScreen->myNum; - if(&WindowTable[index]->drawable == pDrawable) + if(&screenInfo.screens[index]->root->drawable == pDrawable) { xRot -= panoramiXdataPtr[index].x; yRot -= panoramiXdataPtr[index].y; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index f3656d2c0..a0dfbf602 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -22,6 +22,7 @@ #include "Xatom.h" #include "selection.h" #include "windowstr.h" +#include "scrnintstr.h" #include "Windows.h" #include "Atoms.h" @@ -255,7 +256,7 @@ void nxagentClearSelection(XEvent *X) NullGrab); } - CurrentSelections[i].window = WindowTable[0]->drawable.id; + CurrentSelections[i].window = screenInfo.screens[0]->root->drawable.id; CurrentSelections[i].client = NullClient; lastSelectionOwner[i].client = NULL; @@ -424,7 +425,7 @@ FIXME: Do we need this? * Fictitious window. */ - x.u.selectionRequest.requestor = WindowTable[0]->drawable.id; + x.u.selectionRequest.requestor = screenInfo.screens[0]->root->drawable.id; /* * Don't send the same window, some programs are @@ -1502,13 +1503,13 @@ int nxagentInitClipboard(WindowPtr pWin) lastSelectionOwner[nxagentPrimarySelection].selection = XA_PRIMARY; lastSelectionOwner[nxagentPrimarySelection].client = NullClient; - lastSelectionOwner[nxagentPrimarySelection].window = WindowTable[0]->drawable.id; + lastSelectionOwner[nxagentPrimarySelection].window = screenInfo.screens[0]->root->drawable.id; lastSelectionOwner[nxagentPrimarySelection].windowPtr = NULL; lastSelectionOwner[nxagentPrimarySelection].lastTimeChanged = GetTimeInMillis(); lastSelectionOwner[nxagentClipboardSelection].selection = nxagentClipboardAtom; lastSelectionOwner[nxagentClipboardSelection].client = NullClient; - lastSelectionOwner[nxagentClipboardSelection].window = WindowTable[0]->drawable.id; + lastSelectionOwner[nxagentClipboardSelection].window = screenInfo.screens[0]->root->drawable.id; lastSelectionOwner[nxagentClipboardSelection].windowPtr = NULL; lastSelectionOwner[nxagentClipboardSelection].lastTimeChanged = GetTimeInMillis(); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Composite.c b/nx-X11/programs/Xserver/hw/nxagent/Composite.c index ae3cbb5a4..d6239d619 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Composite.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Composite.c @@ -125,7 +125,7 @@ void nxagentRedirectDefaultWindows() for (i = 0; i < screenInfo.numScreens; i++) { - WindowPtr pWin = WindowTable[i]; + WindowPtr pWin = screenInfo.screens[i]->root; ScreenPtr pScreen = pWin -> drawable.pScreen; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 9dac8066a..377e119ab 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -3292,7 +3292,7 @@ void nxagentSendDeferredBackgroundExposures(void) fprintf(stderr, "nxagentSendDeferredBackgroundExposures: Going to send deferred exposures to the root window.\n"); #endif - TraverseTree(WindowTable[0], nxagentClipAndSendClearExpose, (void *) nxagentDeferredBackgroundExposures); + TraverseTree(screenInfo.screens[0]->root, nxagentClipAndSendClearExpose, (void *) nxagentDeferredBackgroundExposures); RegionEmpty(nxagentDeferredBackgroundExposures); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 0a6540fa3..52b869f71 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -629,8 +629,8 @@ void nxagentShadowSwitchResizeMode(ScreenPtr pScreen) { nxagentShadowSetRatio(1.0, 1.0); - nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], WindowTable[0], - WindowTable[0] -> drawable.width, WindowTable[0] -> drawable.height); + nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], screenInfo.screens[0]->root, + screenInfo.screens[0]->root -> drawable.width, screenInfo.screens[0]->root -> drawable.height); sizeHints.max_width = nxagentOption(RootWidth); sizeHints.max_height = nxagentOption(RootHeight); @@ -640,13 +640,13 @@ void nxagentShadowSwitchResizeMode(ScreenPtr pScreen) else { nxagentShadowSetRatio(nxagentOption(Width) * 1.0 / - WindowTable[0] -> drawable.width, + screenInfo.screens[0]->root -> drawable.width, nxagentOption(Height) * 1.0 / - WindowTable[0] -> drawable.height); + screenInfo.screens[0]->root -> drawable.height); nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], - WindowTable[0], WindowTable[0] -> drawable.width, - WindowTable[0] -> drawable.height); + screenInfo.screens[0]->root, screenInfo.screens[0]->root -> drawable.width, + screenInfo.screens[0]->root -> drawable.height); sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); @@ -963,10 +963,10 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) case doDebugTree: { fprintf(stderr, "\n ========== nxagentRemoteWindowsTree ==========\n"); - nxagentRemoteWindowsTree(nxagentWindow(WindowTable[0]), 0); + nxagentRemoteWindowsTree(nxagentWindow(screenInfo.screens[0]->root), 0); fprintf(stderr, "\n========== nxagentInternalWindowsTree ==========\n"); - nxagentInternalWindowsTree(WindowTable[0], 0); + nxagentInternalWindowsTree(screenInfo.screens[0]->root, 0); break; } @@ -1405,7 +1405,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was (X.xmotion.y_root < nxagentLastEnteredTopLevelWindow -> drawable.y + 4)) { if (pWin && nxagentClientIsDialog(wClient(pWin)) == 0 && - nxagentLastEnteredTopLevelWindow -> parent == WindowTable[0] && + nxagentLastEnteredTopLevelWindow -> parent == screenInfo.screens[0]->root && nxagentLastEnteredTopLevelWindow -> overrideRedirect == False && X.xmotion.x_root > (nxagentLastEnteredTopLevelWindow -> drawable.x + (nxagentLastEnteredTopLevelWindow -> drawable.width >> 1) - 50) && @@ -1625,7 +1625,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was if (pWin != NULL) { for (pTLWin = pWin; - pTLWin -> parent != WindowTable[pTLWin -> drawable.pScreen -> myNum]; + pTLWin -> parent != pTLWin -> drawable.pScreen -> root; pTLWin = pTLWin -> parent); } @@ -2454,7 +2454,7 @@ FIXME: This can be maybe optimized by consuming the RegionValidate(&sum, &overlap); RegionIntersect(&sum, &sum, - &WindowTable[pWin->drawable.pScreen->myNum]->winSize); + &pWin->drawable.pScreen->root->winSize); #ifdef DEBUG fprintf(stderr, "nxagentHandleExposeEvent: Sending events for window id [%ld].\n", @@ -3147,7 +3147,7 @@ int nxagentCheckWindowConfiguration(XConfigureEvent* X) fprintf(stderr, "nxagentCheckWindowConfiguration: Before restacking top level window [%p]\n", (void *) nxagentWindowPtr(X -> window)); - for (pSib = WindowTable[0] -> firstChild; pSib; pSib = pSib -> nextSib) + for (pSib = screenInfo.screens[0]->root -> firstChild; pSib; pSib = pSib -> nextSib) { fprintf(stderr, "nxagentCheckWindowConfiguration: Top level window: [%p].\n", (void *) pSib); @@ -3431,7 +3431,7 @@ int nxagentHandleConfigureNotify(XEvent* X) nxagentUpdateViewportFrame(0, 0, nxagentOption(RootWidth), nxagentOption(RootHeight)); - XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[pScreen -> myNum]), + XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root), nxagentOption(RootX), nxagentOption(RootY)); } @@ -4245,7 +4245,7 @@ void nxagentForwardRemoteExpose(void) fprintf(stderr, "nxagentForwardRemoteExpose: Going to forward events.\n"); #endif - TraverseTree(WindowTable[0], nxagentClipAndSendExpose, (void *)nxagentRemoteExposeRegion); + TraverseTree(screenInfo.screens[0]->root, nxagentClipAndSendExpose, (void *)nxagentRemoteExposeRegion); /* * Now this region should be empty. @@ -4420,7 +4420,7 @@ int nxagentHandleRRScreenChangeNotify(XEvent *X) nxagentResizeScreen(screenInfo.screens[DefaultScreen(nxagentDisplay)], Xr -> width, Xr -> height, Xr -> mwidth, Xr -> mheight); - nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], WindowTable[0], + nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], screenInfo.screens[0]->root, Xr -> width, Xr -> height); nxagentShadowSetWindowsSize(); diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index adeaff870..5e89e67bd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -344,13 +344,13 @@ InitSelections() CurrentSelections[0].selection = XA_PRIMARY; CurrentSelections[0].lastTimeChanged = ClientTimeToServerTime(0); - CurrentSelections[0].window = WindowTable[0]->drawable.id; + CurrentSelections[0].window = screenInfo.screens[0]->root->drawable.id; CurrentSelections[0].pWin = NULL; CurrentSelections[0].client = NullClient; CurrentSelections[1].selection = MakeAtom("CLIPBOARD", 9, 1); CurrentSelections[1].lastTimeChanged = ClientTimeToServerTime(0); - CurrentSelections[1].window = WindowTable[0]->drawable.id; + CurrentSelections[1].window = screenInfo.screens[0]->root->drawable.id; CurrentSelections[1].pWin = NULL; CurrentSelections[1].client = NullClient; } @@ -374,8 +374,8 @@ FlushClientCaches(XID id) { if (client->lastDrawableID == id) { - client->lastDrawableID = WindowTable[0]->drawable.id; - client->lastDrawable = (DrawablePtr)WindowTable[0]; + client->lastDrawableID = screenInfo.screens[0]->root->drawable.id; + client->lastDrawable = (DrawablePtr)screenInfo.screens[0]->root; } else if (client->lastGCID == id) { @@ -1161,7 +1161,7 @@ GetGeometry(register 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; @@ -1221,7 +1221,7 @@ ProcQueryTree(register ClientPtr client) return(BadWindow); 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; @@ -4319,8 +4319,8 @@ void InitClient(ClientPtr client, int i, void * ospriv) if (i) { client->closeDownMode = DestroyAll; - client->lastDrawable = (DrawablePtr)WindowTable[0]; - client->lastDrawableID = WindowTable[0]->drawable.id; + client->lastDrawable = (DrawablePtr)screenInfo.screens[0]->root; + client->lastDrawableID = screenInfo.screens[0]->root->drawable.id; } else { @@ -4563,8 +4563,8 @@ SendConnSetup(register ClientPtr client, char *reason) register unsigned int j; register xDepth *pDepth; - root->currentInputMask = WindowTable[i]->eventMask | - wOtherEventMasks (WindowTable[i]); + root->currentInputMask = screenInfo.screens[i]->root->eventMask | + wOtherEventMasks (screenInfo.screens[i]->root); pDepth = (xDepth *)(root + 1); for (j = 0; j < root->nDepths; j++) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index 89c5c0b19..3142233ac 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -162,7 +162,6 @@ extern Bool XkbFilterEvents(ClientPtr, int, xEvent *); #endif #ifdef XEVIE -extern WindowPtr *WindowTable; extern int xevieFlag; extern int xevieClientIndex; extern DeviceIntPtr xeviemouse; @@ -465,9 +464,10 @@ XineramaCheckPhysLimits( static Bool XineramaSetWindowPntrs(WindowPtr pWin) { - if(pWin == WindowTable[0]) { - memcpy(sprite.windows, WindowTable, - PanoramiXNumScreens*sizeof(WindowPtr)); + if(pWin == screenInfo.screens[0]->root) { + int i; + for (i = 0; i < PanoramiXNumScreens; i++) + sprite.windows[i] = screenInfo.screens[i]->root; } else { PanoramiXRes *win; int i; @@ -692,7 +692,7 @@ XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents) sprite.hotShape = NullRegion; sprite.confined = FALSE; - sprite.confineWin = (pWin == WindowTable[0]) ? NullWindow : pWin; + sprite.confineWin = (pWin == screenInfo.screens[0]->root) ? NullWindow : pWin; XineramaCheckPhysLimits(sprite.current, generateEvents); } @@ -909,7 +909,7 @@ CheckVirtualMotion( qe->event->u.keyButtonPointer.rootY = sprite.hot.y; } } - ROOT = WindowTable[sprite.hot.pScreen->myNum]; + ROOT = sprite.hot.pScreen->root; } static void @@ -1109,7 +1109,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count) */ if (xE->u.u.type == MotionNotify) XE_KBPTR.root = - WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id; + sprite.hotPhys.pScreen->root->drawable.id; eventinfo.events = xE; eventinfo.count = count; CallCallbacks(&DeviceEventCallback, (void *)&eventinfo); @@ -1272,7 +1272,7 @@ playmore: ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); } else - ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum], + ConfineCursorToWindow(sprite.hotPhys.pScreen->root, TRUE, FALSE); PostNewCursor(); } @@ -1290,7 +1290,7 @@ ScreenRestructured (ScreenPtr pScreen) ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); } else - ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum], + ConfineCursorToWindow(sprite.hotPhys.pScreen->root, TRUE, FALSE); } #endif @@ -2219,7 +2219,7 @@ CheckMotion(xEvent *xE) if (sprite.hot.pScreen != sprite.hotPhys.pScreen) { sprite.hot.pScreen = sprite.hotPhys.pScreen; - ROOT = WindowTable[sprite.hot.pScreen->myNum]; + ROOT = sprite.hot.pScreen->root; } #ifdef XEVIE xeviehot.x = @@ -2307,9 +2307,9 @@ WindowsRestructured() #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 - * other than 0,0, the information in the private sprite structure must - * be updated accordingly, or XYToWindow (and other routines) will not + * that if the 0th screen (i.e., screenInfo.screens[0]->root) 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. */ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) { @@ -2339,7 +2339,7 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) sprite.hotPhys.x = sprite.hotPhys.y = 0; ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); } else - ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum], + ConfineCursorToWindow(sprite.hotPhys.pScreen->root, TRUE, FALSE); } #endif @@ -2435,7 +2435,7 @@ NewCurrentScreen(ScreenPtr newScreen, int x, int y) if(sprite.confineWin) XineramaConfineCursorToWindow(sprite.confineWin, TRUE); else - XineramaConfineCursorToWindow(WindowTable[0], TRUE); + XineramaConfineCursorToWindow(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) @@ -2448,7 +2448,7 @@ NewCurrentScreen(ScreenPtr newScreen, int x, int y) } else #endif if (newScreen != sprite.hotPhys.pScreen) - ConfineCursorToWindow(WindowTable[newScreen->myNum], TRUE, FALSE); + ConfineCursorToWindow(newScreen->root, TRUE, FALSE); } #ifdef PANORAMIX @@ -2520,7 +2520,7 @@ XineramaWarpPointer(ClientPtr client) winX = source->drawable.x; winY = source->drawable.y; - if(source == WindowTable[0]) { + if(source == screenInfo.screens[0]->root) { winX -= panoramiXdataPtr[0].x; winY -= panoramiXdataPtr[0].y; } @@ -2536,7 +2536,7 @@ XineramaWarpPointer(ClientPtr client) if (dest) { x = dest->drawable.x; y = dest->drawable.y; - if(dest == WindowTable[0]) { + if(dest == screenInfo.screens[0]->root) { x -= panoramiXdataPtr[0].x; y -= panoramiXdataPtr[0].y; } @@ -3206,7 +3206,7 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count /* see comment in EnqueueEvents regarding the next three lines */ if (xE->u.u.type == MotionNotify) XE_KBPTR.root = - WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id; + sprite.hotPhys.pScreen->root->drawable.id; eventinfo.events = xE; eventinfo.count = count; CallCallbacks(&DeviceEventCallback, (void *)&eventinfo); @@ -3818,11 +3818,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode) /* Notify all the roots */ #ifdef PANORAMIX if ( !noPanoramiXExtension ) - FocusEvent(dev, FocusOut, mode, out, WindowTable[0]); + FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[0]->root); else #endif for (i=0; i<screenInfo.numScreens; i++) - FocusEvent(dev, FocusOut, mode, out, WindowTable[i]); + FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[i]->root); } else { @@ -3837,11 +3837,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode) /* Notify all the roots */ #ifdef PANORAMIX if ( !noPanoramiXExtension ) - FocusEvent(dev, FocusIn, mode, in, WindowTable[0]); + FocusEvent(dev, FocusIn, mode, in, screenInfo.screens[0]->root); else #endif for (i=0; i<screenInfo.numScreens; i++) - FocusEvent(dev, FocusIn, mode, in, WindowTable[i]); + FocusEvent(dev, FocusIn, mode, in, screenInfo.screens[i]->root); if (toWin == PointerRootWin) (void)FocusInEvents(dev, ROOT, sprite.win, NullWindow, mode, NotifyPointer, TRUE); @@ -3855,11 +3855,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode) TRUE); #ifdef PANORAMIX if ( !noPanoramiXExtension ) - FocusEvent(dev, FocusOut, mode, out, WindowTable[0]); + FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[0]->root); else #endif for (i=0; i<screenInfo.numScreens; i++) - FocusEvent(dev, FocusOut, mode, out, WindowTable[i]); + FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[i]->root); if (toWin->parent != NullWindow) (void)FocusInEvents(dev, ROOT, toWin, toWin, mode, NotifyNonlinearVirtual, TRUE); diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c b/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c index ad75b43f8..a52a5200a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c @@ -504,7 +504,7 @@ miSendExposures(pWin, pRgn, dx, dy) if(!pWin->parent) { x = panoramiXdataPtr[scrnum].x; y = panoramiXdataPtr[scrnum].y; - pWin = WindowTable[0]; + pWin = screenInfo.screens[0]->root; realWin = pWin->drawable.id; } else if (scrnum) { PanoramiXRes *win; @@ -788,7 +788,7 @@ int what; gcmask |= GCFunction | GCClipMask; i = pScreen->myNum; - pRoot = WindowTable[i]; + pRoot = screenInfo.screens[i]->root; pBgWin = pWin; if (what == PW_BORDER) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c index 1999c33b0..238e5a39c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c @@ -3204,7 +3204,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; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c index 39a1992de..226d20f34 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c @@ -699,8 +699,8 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) } if(clients[cid] && (id == clients[cid]->lastDrawableID)) { - clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0]; - clients[cid]->lastDrawableID = WindowTable[0]->drawable.id; + clients[cid]->lastDrawable = (DrawablePtr)screenInfo.screens[0]->root; + clients[cid]->lastDrawableID = screenInfo.screens[0]->root->drawable.id; } } if (!gotOne) @@ -740,8 +740,8 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) } if(clients[cid] && (id == clients[cid]->lastDrawableID)) { - clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0]; - clients[cid]->lastDrawableID = WindowTable[0]->drawable.id; + clients[cid]->lastDrawable = (DrawablePtr)screenInfo.screens[0]->root; + clients[cid]->lastDrawableID = screenInfo.screens[0]->root->drawable.id; } } } 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; i<screenInfo.numScreens; i++) { ErrorF( "WINDOW %d\n", i); - pWin = WindowTable[i]; + pWin = screenInfo.screens[i]->root; 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); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index c9f62b1fe..f429f1499 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -1449,7 +1449,7 @@ Bool nxagentFbOnShadowDisplay() XGCValues value; XImage *image; Visual *pVisual; - WindowPtr pWin = WindowTable[0]; + WindowPtr pWin = screenInfo.screens[0]->root; unsigned int format; int depth, width, height, length; char *data = NULL; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c index a725e20e7..49877f9d7 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c @@ -20,6 +20,7 @@ #include "../../include/window.h" #include "windowstr.h" #include "colormapst.h" +#include "scrnintstr.h" #include "propertyst.h" #include "Agent.h" @@ -242,7 +243,7 @@ Bool nxagentRootlessTreesMatch() Window *children_return; unsigned int nChildrenReturn; WindowPtr pW; - WindowPtr pTestWin = WindowTable[0] -> firstChild; + WindowPtr pTestWin = screenInfo.screens[0]->root -> firstChild; Bool treesMatch = True; Status result; @@ -267,7 +268,7 @@ Bool nxagentRootlessTreesMatch() pW = nxagentRootlessTopLevelWindow(children_return[nChildrenReturn]); } - if (pW && pW != WindowTable[0]) + if (pW && pW != screenInfo.screens[0]->root) { if (treesMatch && pTestWin && pTestWin == pW) { @@ -316,7 +317,7 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren) pWin = nxagentRootlessTopLevelWindow(children[i]); } - if (pWin && pWin != WindowTable[0]) + if (pWin && pWin != screenInfo.screens[0]->root) { toplevel[ntoplevel++] = pWin; } @@ -338,14 +339,14 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren) fprintf(stderr, "nxagentRootlessRestack: Internal top level windows before restack:"); - for (pWin = WindowTable[0] -> firstChild; pWin != NULL; pWin = pWin -> nextSib) + for (pWin = screenInfo.screens[0]->root -> firstChild; pWin != NULL; pWin = pWin -> nextSib) { fprintf(stderr, "[%p]\n", pWin); } #endif - pWin = WindowTable[0] -> firstChild; + pWin = screenInfo.screens[0]->root -> firstChild; values[1] = (XID) Above; @@ -381,7 +382,7 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren) fprintf(stderr, "nxagentRootlessRestack: Internal top level windows after restack:"); - for (pWin = WindowTable[0] -> firstChild; pWin != NULL; pWin = pWin -> nextSib) + for (pWin = screenInfo.screens[0]->root -> firstChild; pWin != NULL; pWin = pWin -> nextSib) { fprintf(stderr, "[%p]\n", pWin); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 50d278ed7..a4b39a4fe 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -2116,7 +2116,7 @@ Bool nxagentCloseScreen(int index, ScreenPtr pScreen) static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable) { - WindowPtr pWin = WindowTable[pScreen->myNum]; + WindowPtr pWin = pScreen->root; WindowPtr pChild; Bool WasViewable = (Bool)(pWin->viewable); Bool anyMarked = FALSE; @@ -2409,21 +2409,21 @@ FIXME: We should try to restore the previously box.x2 = width; box.y2 = height; - WindowTable[pScreen -> myNum] -> drawable.width = width; - WindowTable[pScreen -> myNum] -> drawable.height = height; - WindowTable[pScreen -> myNum] -> drawable.x = 0; - WindowTable[pScreen -> myNum] -> drawable.y = 0; + pScreen->root -> drawable.width = width; + pScreen->root -> drawable.height = height; + pScreen->root -> drawable.x = 0; + pScreen->root -> drawable.y = 0; - RegionInit(&WindowTable[pScreen -> myNum] -> borderSize, &box, 1); - RegionInit(&WindowTable[pScreen -> myNum] -> winSize, &box, 1); - RegionInit(&WindowTable[pScreen -> myNum] -> clipList, &box, 1); - RegionInit(&WindowTable[pScreen -> myNum] -> borderClip, &box, 1); + RegionInit(&pScreen->root -> borderSize, &box, 1); + RegionInit(&pScreen->root -> winSize, &box, 1); + RegionInit(&pScreen->root -> clipList, &box, 1); + RegionInit(&pScreen->root -> borderClip, &box, 1); - (*pScreen -> PositionWindow)(WindowTable[pScreen -> myNum], 0, 0); + (*pScreen -> PositionWindow)(pScreen->root, 0, 0); nxagentSetRootClip(pScreen, 1); - XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[0]), + XMoveWindow(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), nxagentOption(RootX), nxagentOption(RootY)); nxagentMoveViewport(pScreen, 0, 0); @@ -3522,7 +3522,7 @@ FIXME: The port information is not used at the moment and produces a { mcop_local_atom = MakeAtom(mcop_atom, strlen(mcop_atom), 1); - ChangeWindowProperty(WindowTable[pScreen->myNum], + ChangeWindowProperty(pScreen->root, mcop_local_atom, XA_STRING, iReturnFormat, PropModeReplace, @@ -3667,9 +3667,9 @@ int nxagentChangeScreenConfig(int screen, int width, int height, int mmWidth, in int r; #ifdef TEST - fprintf(stderr, "nxagentChangeScreenConfig: WindowTable[%d] is %p\n", screen, WindowTable[screen]); + fprintf(stderr, "nxagentChangeScreenConfig: screenInfo.screens[%d]->root is %p\n", screen, screenInfo.screens[screen]); #endif - if (WindowTable[screen] == NULL) + if (screenInfo.screens[screen]->root == NULL) { return 0; } @@ -3692,7 +3692,7 @@ int nxagentChangeScreenConfig(int screen, int width, int height, int mmWidth, in return 0; } - pScreen = WindowTable[screen] -> drawable.pScreen; + pScreen = screenInfo.screens[screen] -> root -> drawable.pScreen; #ifdef TEST fprintf(stderr, "nxagentChangeScreenConfig: Changing config to %dx%d.\n", width, height); @@ -4124,7 +4124,7 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, values.subwindow_mode = IncludeInferiors; - gc = XCreateGC(nxagentDisplay, nxagentWindow(WindowTable[0]), GCSubwindowMode, &values); + gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values); /* * Initialize to the corrupted region. @@ -4234,7 +4234,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, */ RegionIntersect(prgnRestore, prgnRestore, - &WindowTable[pWin -> drawable.pScreen -> myNum] -> winSize); + &pWin -> drawable.pScreen -> root -> winSize); pBackingStore = (miBSWindowPtr) pWin -> backStorage; @@ -4245,7 +4245,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, values.subwindow_mode = ClipByChildren; - gc = XCreateGC(nxagentDisplay, nxagentWindow(WindowTable[0]), GCSubwindowMode, &values); + gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values); /* * Translate the reference point to the origin of the window. @@ -4406,7 +4406,7 @@ void nxagentShadowAdaptToRatio(void) nxagentShadowSetRatio(nxagentOption(Width) * 1.0 / nxagentShadowWidth, nxagentOption(Height) * 1.0 / nxagentShadowHeight); - nxagentShadowCreateMainWindow(pScreen, WindowTable[0], nxagentShadowWidth, nxagentShadowHeight); + nxagentShadowCreateMainWindow(pScreen, screenInfo.screens[0]->root, nxagentShadowWidth, nxagentShadowHeight); sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); @@ -4456,7 +4456,7 @@ void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height) XlibGC gc; XGCValues value; XImage *image; - WindowPtr pWin = WindowTable[0]; + WindowPtr pWin = screenInfo.screens[0]->root; unsigned int format; int depth, pixmapWidth, pixmapHeight, length; char *data; @@ -4668,7 +4668,7 @@ FIXME value.fill_style = FillSolid; value.function = GXcopy; - gc = XCreateGC(shadow, nxagentWindow(WindowTable[0]), GCBackground | + gc = XCreateGC(shadow, nxagentWindow(screenInfo.screens[0]->root), GCBackground | GCForeground | GCFillStyle | GCPlaneMask | GCFunction, &value); NXCleanImage(image); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index a069b3e23..35cb7cea9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -396,15 +396,15 @@ void nxagentRemoveSplashWindow(WindowPtr pWin) XDestroyWindow(nxagentDisplay, nxagentSplashWindow); nxagentSplashWindow = None; - nxagentRefreshWindows(WindowTable[0]); + nxagentRefreshWindows(screenInfo.screens[0]->root); #ifdef TEST fprintf(stderr, "nxagentRemoveSplashWindow: setting the ownership of %s (%d) on window 0x%lx\n", - "NX_CUT_BUFFER_SERVER", (int)serverCutProperty, nxagentWindow(WindowTable[0])); + "NX_CUT_BUFFER_SERVER", (int)serverCutProperty, nxagentWindow(screenInfo.screens[0]->root)); #endif XSetSelectionOwner(nxagentDisplay, serverCutProperty, - nxagentWindow(WindowTable[0]), CurrentTime); + nxagentWindow(screenInfo.screens[0]->root), CurrentTime); } if (nxagentPixmapLogo) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index b553627dd..514ee5140 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -196,7 +196,7 @@ static Bool nxagentCheckWindowIntegrity(WindowPtr pWin); WindowPtr nxagentGetWindowFromID(Window id) { - WindowPtr pWin = WindowTable[0]; + WindowPtr pWin = screenInfo.screens[0]->root; while (pWin && nxagentWindowPriv(pWin)) { @@ -508,7 +508,7 @@ FIXME: Do all the windows for which nxagentWindowTopLevel(pWin) Bool nxagentSomeWindowsAreMapped() { - WindowPtr pWin = WindowTable[0] -> firstChild; + WindowPtr pWin = screenInfo.screens[0]->root -> firstChild; while (pWin) { @@ -884,7 +884,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) nxagentUpdateViewportFrame(0, 0, nxagentOption(RootWidth), nxagentOption(RootHeight)); - XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[pScreen -> myNum]), + XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root), nxagentOption(RootX), nxagentOption(RootY)); /* @@ -995,7 +995,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) nxagentUpdateViewportFrame(0, 0, nxagentOption(Width), nxagentOption(Height)); - XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[pScreen -> myNum]), 0, 0); + XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root), 0, 0); XMapWindow(nxagentDisplay, w); nxagentChangeOption(RootX, 0); @@ -1156,11 +1156,11 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift) -nxagentOption(RootY) + nxagentOption(Height)); fprintf(stderr, "nxagentMoveViewport: Root geometry x=[%d] y=[%d]\n", - WindowTable[pScreen -> myNum] -> drawable.x, - WindowTable[pScreen -> myNum] -> drawable.y ); + pScreen->root -> drawable.x, + pScreen->root -> drawable.y ); #endif - XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[pScreen -> myNum]), + XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root), nxagentOption(RootX), nxagentOption(RootY)); if (nxagentOption(ClientOs) == ClientOsWinnt) @@ -2437,7 +2437,7 @@ static int nxagentForceExposure(WindowPtr pWin, void * ptr) { RegionPtr exposedRgn; BoxRec Box; - WindowPtr pRoot = WindowTable[pWin->drawable.pScreen->myNum]; + WindowPtr pRoot = pWin->drawable.pScreen->root; if (pWin -> drawable.class != InputOnly) { @@ -2491,7 +2491,7 @@ void nxagentMapDefaultWindows() for (i = 0; i < screenInfo.numScreens; i++) { - WindowPtr pWin = WindowTable[i]; + WindowPtr pWin = screenInfo.screens[i]->root; ScreenPtr pScreen = pWin -> drawable.pScreen; @@ -2606,7 +2606,7 @@ Bool nxagentDisconnectAllWindows(void) for (i = 0; i < screenInfo.numScreens; i++) { - pWin = WindowTable[i]; + pWin = screenInfo.screens[i]->root; nxagentTraverseWindow( pWin, nxagentDisconnectWindow, &succeded); nxagentDefaultWindows[i] = None; } @@ -2684,16 +2684,16 @@ Bool nxagentReconnectAllWindows(void *p0) fprintf(stderr, "nxagentReconnectAllWindows\n"); #endif - if (WindowTable[0] -> backgroundState == BackgroundPixmap && - WindowTable[0] -> background.pixmap == NULL) + if (screenInfo.screens[0]->root -> backgroundState == BackgroundPixmap && + screenInfo.screens[0]->root -> background.pixmap == NULL) { FatalError("nxagentReconnectAllWindows: correct the FIXME\n"); } if (nxagentOption(Fullscreen)) { - WindowTable[0] -> origin.x = nxagentOption(RootX); - WindowTable[0] -> origin.y = nxagentOption(RootY); + screenInfo.screens[0]->root -> origin.x = nxagentOption(RootX); + screenInfo.screens[0]->root -> origin.y = nxagentOption(RootY); } if (!nxagentLoopOverWindows(nxagentReconnectWindow)) @@ -2739,8 +2739,8 @@ Bool nxagentReconnectAllWindows(void *p0) if (nxagentOption(Fullscreen)) { - WindowTable[0] -> origin.x = 0; - WindowTable[0] -> origin.y = 0; + screenInfo.screens[0]->root -> origin.x = 0; + screenInfo.screens[0]->root -> origin.y = 0; } #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG @@ -2751,7 +2751,7 @@ Bool nxagentReconnectAllWindows(void *p0) #endif - if (nxagentInitClipboard(WindowTable[0]) == -1) + if (nxagentInitClipboard(screenInfo.screens[0]->root) == -1) { #ifdef WARNING fprintf(stderr, "nxagentReconnectAllWindows: WARNING! Couldn't initialize the clipboard.\n"); @@ -2848,7 +2848,7 @@ static Bool nxagentLoopOverWindows(void (*pF)(void *, XID, void *)) for (i = 0; i < screenInfo.numScreens; i++) { - pWin = WindowTable[i]; + pWin = screenInfo.screens[i]->root; nxagentTraverseWindow(pWin, pF, &windowSuccess); } @@ -2995,7 +2995,7 @@ FIXME: Do we need to set save unders attribute here? * if a client handles this. */ - if (nxagentOption(Rootless) && (pWin != WindowTable[0])) + if (nxagentOption(Rootless) && (pWin != screenInfo.screens[0]->root)) { if (nxagentWindowTopLevel(pWin)) { @@ -3196,7 +3196,7 @@ static void nxagentReconfigureWindow(void * param0, XID param1, void * data_buff nxagentShapeWindow(pWin); #endif - if (pWin != WindowTable[0]) + if (pWin != screenInfo.screens[0]->root) { if (pWin->realized) { @@ -3238,7 +3238,7 @@ Bool nxagentCheckIllegalRootMonitoring(WindowPtr pWin, Mask mask) Mask invalidMask = SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask; if (nxagentOption(Rootless) && - pWin == WindowTable[0] && + pWin == screenInfo.screens[0]->root && (mask & invalidMask)) { return True; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Windows.h b/nx-X11/programs/Xserver/hw/nxagent/Windows.h index 3ca74ba8e..dedb60299 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Windows.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Windows.h @@ -167,7 +167,7 @@ extern int nxagentWindowPrivateIndex; #define nxagentRefreshScreen() \ do\ {\ - nxagentRefreshWindows(WindowTable[0]);\ + nxagentRefreshWindows(screenInfo.screens[0]->root);\ } while (0) WindowPtr nxagentWindowPtr(Window window); diff --git a/nx-X11/programs/Xserver/include/globals.h b/nx-X11/programs/Xserver/include/globals.h index 5513b82d0..a8b3a62f6 100644 --- a/nx-X11/programs/Xserver/include/globals.h +++ b/nx-X11/programs/Xserver/include/globals.h @@ -20,7 +20,6 @@ extern Bool loadableFonts; extern int defaultColorVisualClass; extern Bool Must_have_memory; -extern WindowPtr *WindowTable; extern int GrabInProgress; extern char *ConnectionInfo; extern Bool noTestExtensions; diff --git a/nx-X11/programs/Xserver/include/scrnintstr.h b/nx-X11/programs/Xserver/include/scrnintstr.h index 2597d6b67..728b16f91 100644 --- a/nx-X11/programs/Xserver/include/scrnintstr.h +++ b/nx-X11/programs/Xserver/include/scrnintstr.h @@ -549,6 +549,7 @@ typedef struct _Screen { void * devPrivate; short numVisuals; VisualPtr visuals; + WindowPtr root; int WindowPrivateLen; unsigned *WindowPrivateSizes; unsigned totalWindowSize; diff --git a/nx-X11/programs/Xserver/mi/mibank.c b/nx-X11/programs/Xserver/mi/mibank.c index 24e202094..b607af1c1 100644 --- a/nx-X11/programs/Xserver/mi/mibank.c +++ b/nx-X11/programs/Xserver/mi/mibank.c @@ -1768,7 +1768,7 @@ miBankGetImage( pBankImage); (*pScreenPriv->pBankGC->ops->CopyArea)( - (DrawablePtr)WindowTable[pScreen->myNum], + (DrawablePtr)pScreen->root, (DrawablePtr)pScreenPriv->pBankPixmap, pScreenPriv->pBankGC, sx + pDrawable->x, sy + pDrawable->y, w, h, 0, 0); @@ -1835,7 +1835,7 @@ miBankGetSpans( continue; (*pScreenPriv->pBankGC->ops->CopyArea)( - (DrawablePtr)WindowTable[pScreen->myNum], + (DrawablePtr)pScreen->root, (DrawablePtr)pScreenPriv->pBankPixmap, pScreenPriv->pBankGC, ppt->x, ppt->y, *pwidth, 1, 0, 0); @@ -1958,7 +1958,7 @@ miBankCopyWindow( ScreenPtr pScreen = pWindow->drawable.pScreen; GCPtr pGC; int dx, dy, nBox; - DrawablePtr pDrawable = (DrawablePtr)WindowTable[pScreen->myNum]; + DrawablePtr pDrawable = (DrawablePtr)pScreen->root; RegionPtr pRgnDst; BoxPtr pBox, pBoxTmp, pBoxNext, pBoxBase, pBoxNew1, pBoxNew2; XID subWindowMode = IncludeInferiors; diff --git a/nx-X11/programs/Xserver/mi/midispcur.c b/nx-X11/programs/Xserver/mi/midispcur.c index a16c2977e..6ffb9efea 100644 --- a/nx-X11/programs/Xserver/mi/midispcur.c +++ b/nx-X11/programs/Xserver/mi/midispcur.c @@ -477,7 +477,7 @@ miDCPutUpCursor (pScreen, pCursor, x, y, source, mask) return FALSE; } pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; - pWin = WindowTable[pScreen->myNum]; + pWin = pScreen->root; #ifdef ARGB_CURSOR if (pPriv->pPicture) { @@ -523,7 +523,7 @@ miDCSaveUnderCursor (pScreen, x, y, w, h) pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pSave = pScreenPriv->pSave; - pWin = WindowTable[pScreen->myNum]; + pWin = pScreen->root; if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h) { if (pSave) @@ -555,7 +555,7 @@ miDCRestoreUnderCursor (pScreen, x, y, w, h) pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pSave = pScreenPriv->pSave; - pWin = WindowTable[pScreen->myNum]; + pWin = pScreen->root; if (!pSave) return FALSE; if (!EnsureGC(pScreenPriv->pRestoreGC, pWin)) @@ -581,7 +581,7 @@ miDCChangeSave (pScreen, x, y, w, h, dx, dy) pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pSave = pScreenPriv->pSave; - pWin = WindowTable[pScreen->myNum]; + pWin = pScreen->root; /* * restore the bits which are about to get trashed */ @@ -723,7 +723,7 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask) return FALSE; } pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; - pWin = WindowTable[pScreen->myNum]; + pWin = pScreen->root; pTemp = pScreenPriv->pTemp; if (!pTemp || pTemp->drawable.width != pScreenPriv->pSave->drawable.width || diff --git a/nx-X11/programs/Xserver/mi/miexpose.c b/nx-X11/programs/Xserver/mi/miexpose.c index 379dd380f..7b7480a91 100644 --- a/nx-X11/programs/Xserver/mi/miexpose.c +++ b/nx-X11/programs/Xserver/mi/miexpose.c @@ -468,7 +468,7 @@ miSendExposures(pWin, pRgn, dx, dy) if(!pWin->parent) { x = panoramiXdataPtr[scrnum].x; y = panoramiXdataPtr[scrnum].y; - pWin = WindowTable[0]; + pWin = screenInfo.screens[0]->root; realWin = pWin->drawable.id; } else if (scrnum) { PanoramiXRes *win; @@ -715,7 +715,7 @@ int what; gcmask |= GCFunction | GCClipMask; i = pScreen->myNum; - pRoot = WindowTable[i]; + pRoot = screenInfo.screens[i]->root; pBgWin = pWin; if (what == PW_BORDER) diff --git a/nx-X11/programs/Xserver/mi/mioverlay.c b/nx-X11/programs/Xserver/mi/mioverlay.c index 96d5cc4f0..e89ce8fa0 100644 --- a/nx-X11/programs/Xserver/mi/mioverlay.c +++ b/nx-X11/programs/Xserver/mi/mioverlay.c @@ -317,7 +317,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); } } @@ -1733,7 +1733,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); diff --git a/nx-X11/programs/Xserver/render/render.c b/nx-X11/programs/Xserver/render/render.c index 2dedbc9c4..b165cf549 100644 --- a/nx-X11/programs/Xserver/render/render.c +++ b/nx-X11/programs/Xserver/render/render.c @@ -2663,7 +2663,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; } diff --git a/nx-X11/programs/Xserver/xfixes/cursor.c b/nx-X11/programs/Xserver/xfixes/cursor.c index 8bdaca84d..acdd9cf2e 100755 --- a/nx-X11/programs/Xserver/xfixes/cursor.c +++ b/nx-X11/programs/Xserver/xfixes/cursor.c @@ -616,7 +616,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/nx-X11/programs/Xserver/xkb/xkbInit.c b/nx-X11/programs/Xserver/xkb/xkbInit.c index 9afe0dacc..bd65c4d97 100644 --- a/nx-X11/programs/Xserver/xkb/xkbInit.c +++ b/nx-X11/programs/Xserver/xkb/xkbInit.c @@ -49,6 +49,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 <nx-X11/extensions/XKBsrv.h> #include <nx-X11/extensions/XKBgeom.h> @@ -230,7 +231,7 @@ char * pval; ErrorF("Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n", out,len); } - ChangeWindowProperty(WindowTable[0],name,XA_STRING,8,PropModeReplace, + ChangeWindowProperty(screenInfo.screens[0]->root,name,XA_STRING,8,PropModeReplace, len,pval,True); DEALLOCATE_LOCAL(pval); return True; |