Commit e7fae9ec authored by Jamey Sharp's avatar Jamey Sharp

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's avatarJamey Sharp <jamey@minilop.net>
Reviewed-by: default avatarTiago Vignatti <tiago.vignatti@nokia.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com> (i686 GNU/Linux)
parent 80b5d3a3
......@@ -837,7 +837,7 @@ PanoramiXConsolidate(void)
for (i = 0; i < PanoramiXNumScreens; i++) {
ScreenPtr pScreen = screenInfo.screens[i];
root->info[i].id = WindowTable[i]->drawable.id;
root->info[i].id = pScreen->root->drawable.id;
root->u.win.class = InputOutput;
root->u.win.root = TRUE;
saver->info[i].id = pScreen->screensaver.wid;
......
......@@ -129,7 +129,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 == screenInfo.screens[0]->screensaver.wid);
FOR_NSCREENS_BACKWARD(j) {
stuff->wid = newWin->info[j].id;
......@@ -328,7 +328,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 == screenInfo.screens[0]->screensaver.wid);
FOR_NSCREENS_BACKWARD(j) {
stuff->window = win->info[j].id;
......@@ -475,7 +475,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 == screenInfo.screens[0]->screensaver.wid)))
{
if ((Mask)stuff->mask & CWX) {
......@@ -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,7 +562,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 == screenInfo.screens[0]->screensaver.wid))
{
rep.x += panoramiXdataPtr[0].x;
......@@ -596,7 +596,7 @@ int PanoramiXTranslateCoords(ClientPtr client)
rep.sameScreen = xTrue;
rep.child = None;
if((pWin == WindowTable[0]) ||
if((pWin == screenInfo.screens[0]->root) ||
(pWin->drawable.id == screenInfo.screens[0]->screensaver.wid))
{
x = stuff->srcX - panoramiXdataPtr[0].x;
......@@ -634,7 +634,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) ||
(pWin->drawable.id == screenInfo.screens[0]->screensaver.wid))
{
rep.dstX += panoramiXdataPtr[0].x;
......
......@@ -503,7 +503,7 @@ 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.root = pScreen->root->drawable.id;
ev.window = pScreen->screensaver.wid;
ev.kind = kind;
ev.forced = forced;
......@@ -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,
......@@ -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)
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -141,7 +141,7 @@ compScreenUpdate (ScreenPtr pScreen)
compCheckTree (pScreen);
if (cs->damaged)
{
compWindowUpdate (WindowTable[pScreen->myNum]);
compWindowUpdate (pScreen->root);
cs->damaged = FALSE;
}
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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))
......
......@@ -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);
......
......@@ -556,9 +556,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;
......@@ -619,7 +620,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);
}
......@@ -875,7 +876,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 +1124,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;
......@@ -1339,7 +1340,7 @@ playmore:
}
else
ConfineCursorToWindow(dev,
WindowTable[dev->spriteInfo->sprite->hotPhys.pScreen->myNum],
dev->spriteInfo->sprite->hotPhys.pScreen->root,
TRUE, FALSE);
PostNewCursor(dev);
}
......@@ -1369,7 +1370,7 @@ ScreenRestructured (ScreenPtr pScreen)
}
else
ConfineCursorToWindow(pDev,
WindowTable[pDev->spriteInfo->sprite->hotPhys.pScreen->myNum],
pDev->spriteInfo->sprite->hotPhys.pScreen->root,
TRUE, FALSE);
}
}
......@@ -2766,7 +2767,7 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
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 +2850,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 +2893,7 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
} else
ConfineCursorToWindow(
pDev,
WindowTable[pSprite->hotPhys.pScreen->myNum],
pSprite->hotPhys.pScreen->root,
TRUE, FALSE);
}
......@@ -3051,7 +3052,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;
......@@ -3124,7 +3125,7 @@ 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)
......@@ -3139,8 +3140,7 @@ NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y)
} else
#endif
if (newScreen != pSprite->hotPhys.pScreen)
ConfineCursorToWindow(pDev, WindowTable[newScreen->myNum],
TRUE, FALSE);
ConfineCursorToWindow(pDev, newScreen->root, TRUE, FALSE);
}
#ifdef PANORAMIX
......@@ -3215,7 +3215,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;
}
......@@ -3231,7 +3231,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;
}
......
......@@ -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;
......
......@@ -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();
......
......@@ -210,7 +210,7 @@ PrintWindowTree(void)
for (i=0; i<screenInfo.numScreens; i++)
{
ErrorF("[dix] WINDOW %d\n", i);
pWin = WindowTable[i];
pWin = screenInfo.screens[i]->root;
miPrintRegion(&pWin->clipList);
p1 = pWin->firstChild;
PrintChildren(p1, 4);
......@@ -256,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 */
......@@ -366,7 +366,7 @@ CreateRootWindow(ScreenPtr pScreen)
pScreen->screensaver.ExternalScreenSaver = NULL;
screenIsSaved = SCREEN_SAVER_OFF;
WindowTable[pScreen->myNum] = pWin;
pScreen->root = pWin;
pWin->drawable.pScreen = pScreen;
pWin->drawable.type = DRAWABLE_WINDOW;
......@@ -1327,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;
......@@ -2964,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
{
......@@ -3250,7 +3250,6 @@ SaveScreens(int on, int mode)
static Bool
TileScreenSaver(ScreenPtr pScreen, int kind)
{
int i = pScreen->myNum;
int j;
int result;
XID attributes[3];
......@@ -3266,9 +3265,9 @@ TileScreenSaver(ScreenPtr pScreen, 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:
......@@ -3280,7 +3279,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
}
break;
case SCREEN_IS_BLACK:
attributes[attri++] = WindowTable[i]->drawable.pScreen->blackPixel;
attributes[attri++] = pScreen->root->drawable.pScreen->blackPixel;
mask |= CWBackPixel;
break;
}
......@@ -3329,12 +3328,12 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
pWin = pScreen->screensaver.pWindow =
CreateWindow(pScreen->screensaver.wid,
WindowTable[i],
pScreen->root,
-RANDOM_WIDTH, -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);
......
......@@ -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 ? \
......
......@@ -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;
......@@ -458,7 +458,7 @@ static void dmxSetRootWindowOrigin(int idx, int x, int y)
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) {
......
......@@ -204,7 +204,7 @@ static void dmxConsoleDrawWindows(pointer private)
XUnionRectWithRegion(&rect, whole, whole);
for (i = 0; i < dmxNumScreens; i++) {
WindowPtr pRoot = WindowTable[i];