summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-05-22 00:26:28 -0700
committerJamey Sharp <jamey@minilop.net>2010-06-03 14:03:23 -0700
commite7fae9ecc42ab5e73b89117722dbf4117d928f9a (patch)
treeb7897e7a64fe01e3989ec1e7a5a7db69797126e6
parent80b5d3a3264d2c5167e5ac85a3b04af0f89cece1 (diff)
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)
-rw-r--r--Xext/panoramiX.c2
-rw-r--r--Xext/panoramiXprocs.c14
-rw-r--r--Xext/saver.c6
-rw-r--r--Xi/closedev.c2
-rw-r--r--Xi/exevents.c6
-rw-r--r--Xi/xichangecursor.c2
-rw-r--r--composite/compinit.c2
-rw-r--r--composite/compoverlay.c2
-rw-r--r--dix/devices.c6
-rw-r--r--dix/dispatch.c13
-rw-r--r--dix/enterleave.c12
-rw-r--r--dix/events.c34
-rw-r--r--dix/globals.c2
-rw-r--r--dix/main.c5
-rw-r--r--dix/window.c21
-rw-r--r--fb/fb.h2
-rw-r--r--hw/dmx/dmxextension.c16
-rw-r--r--hw/dmx/input/dmxconsole.c2
-rw-r--r--hw/dmx/input/dmxinputinit.c2
-rw-r--r--hw/kdrive/src/kdrive.c2
-rw-r--r--hw/xfree86/common/xf86Helper.c2
-rw-r--r--hw/xfree86/common/xf86RandR.c2
-rw-r--r--hw/xfree86/common/xf86xv.c2
-rw-r--r--hw/xfree86/dixmods/extmod/xf86vmode.c2
-rw-r--r--hw/xfree86/dri/dri.c2
-rw-r--r--hw/xfree86/dri2/dri2.c2
-rw-r--r--hw/xfree86/modes/xf86RandR12.c6
-rw-r--r--hw/xfree86/modes/xf86Rotate.c4
-rw-r--r--hw/xfree86/xaa/xaaCpyWin.c2
-rw-r--r--hw/xfree86/xaa/xaaOverlay.c2
-rw-r--r--hw/xfree86/xaa/xaaOverlayDF.c2
-rw-r--r--hw/xquartz/darwin.c2
-rw-r--r--hw/xquartz/quartz.c2
-rw-r--r--hw/xquartz/xpr/xprFrame.c2
-rw-r--r--hw/xquartz/xpr/xprScreen.c4
-rw-r--r--hw/xwin/winkeybd.c2
-rwxr-xr-xhw/xwin/winwin32rootlesswindow.c2
-rw-r--r--hw/xwin/winwindow.c2
-rw-r--r--include/globals.h1
-rw-r--r--include/scrnintstr.h1
-rw-r--r--mi/midispcur.c8
-rw-r--r--mi/miexpose.c2
-rw-r--r--mi/mioverlay.c4
-rw-r--r--miext/rootless/rootlessCommon.c4
-rw-r--r--miext/rootless/rootlessCommon.h2
-rw-r--r--miext/rootless/rootlessScreen.c2
-rw-r--r--miext/rootless/rootlessWindow.c18
-rw-r--r--randr/rrscreen.c10
-rw-r--r--randr/rrxinerama.c2
-rw-r--r--render/render.c2
-rw-r--r--xfixes/cursor.c2
-rw-r--r--xkb/xkbInit.c3
52 files changed, 130 insertions, 128 deletions
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 594da0e95..e1cef87a5 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -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;
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 08ea3ec90..6b199cf7b 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -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;
diff --git a/Xext/saver.c b/Xext/saver.c
index da61fbe60..696c4aa22 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -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)
diff --git a/Xi/closedev.c b/Xi/closedev.c
index 159ead55c..e319c737a 100644
--- a/Xi/closedev.c
+++ b/Xi/closedev.c
@@ -156,7 +156,7 @@ ProcXCloseDevice(ClientPtr client)
* Delete passive grabs from all windows for this device. */
for (i = 0; i < screenInfo.numScreens; i++) {
- pWin = WindowTable[i];
+ pWin = screenInfo.screens[i]->root;
DeleteDeviceEvents(d, pWin, client);
p1 = pWin->firstChild;
DeleteEventsFromChildren(d, p1, client);
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 41b396c28..56d9bf7fd 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -926,7 +926,7 @@ ProcessRawEvent(RawDeviceEvent *ev, DeviceIntPtr device)
}
for (i = 0; i < screenInfo.numScreens; i++)
- DeliverEventsToWindow(device, WindowTable[i], xi, 1,
+ DeliverEventsToWindow(device, screenInfo.screens[i]->root, xi, 1,
GetEventFilter(device, xi), NULL);
free(xi);
}
@@ -1042,7 +1042,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
/* see comment in EnqueueEvents regarding the next three lines */
if (ev->any.type == ET_Motion)
- ev->device_event.root = WindowTable[pSprite->hotPhys.pScreen->myNum]->drawable.id;
+ ev->device_event.root = pSprite->hotPhys.pScreen->root->drawable.id;
eventinfo.device = device;
eventinfo.event = ev;
@@ -2120,7 +2120,7 @@ SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count)
WindowPtr pWin, p1;
for (i = 0; i < screenInfo.numScreens; i++) {
- pWin = WindowTable[i];
+ pWin = screenInfo.screens[i]->root;
if (!pWin)
continue;
DeliverEventsToWindow(dev, pWin, ev, count, mask, NullGrab);
diff --git a/Xi/xichangecursor.c b/Xi/xichangecursor.c
index e72cfac03..215339331 100644
--- a/Xi/xichangecursor.c
+++ b/Xi/xichangecursor.c
@@ -93,7 +93,7 @@ int ProcXIChangeCursor(ClientPtr client)
if (stuff->cursor == None)
{
- if (pWin == WindowTable[pWin->drawable.pScreen->myNum])
+ if (pWin == pWin->drawable.pScreen->root)
pCursor = rootCursor;
else
pCursor = (CursorPtr)None;
diff --git a/composite/compinit.c b/composite/compinit.c
index a81cc740f..e4b68c822 100644
--- a/composite/compinit.c
+++ b/composite/compinit.c
@@ -141,7 +141,7 @@ compScreenUpdate (ScreenPtr pScreen)
compCheckTree (pScreen);
if (cs->damaged)
{
- compWindowUpdate (WindowTable[pScreen->myNum]);
+ compWindowUpdate (pScreen->root);
cs->damaged = FALSE;
}
}
diff --git a/composite/compoverlay.c b/composite/compoverlay.c
index 2158cdb5a..67b566c7f 100644
--- a/composite/compoverlay.c
+++ b/composite/compoverlay.c
@@ -124,7 +124,7 @@ Bool
compCreateOverlayWindow (ScreenPtr pScreen)
{
CompScreenPtr cs = GetCompScreen(pScreen);
- WindowPtr pRoot = WindowTable[pScreen->myNum];
+ WindowPtr pRoot = pScreen->root;
WindowPtr pWin;
XID attrs[] = { None, TRUE }; /* backPixmap, overrideRedirect */
int result;
diff --git a/dix/devices.c b/dix/devices.c
index 250a4980d..998d22a4b 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -360,9 +360,9 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
/* Sprites appear on first root window, so we can hardcode it */
if (dev->spriteInfo->spriteOwner)
{
- InitializeSprite(dev, WindowTable[0]);
+ InitializeSprite(dev, screenInfo.screens[0]->root);
/* mode doesn't matter */
- EnterWindow(dev, WindowTable[0], NotifyAncestor);
+ EnterWindow(dev, screenInfo.screens[0]->root, NotifyAncestor);
}
else if ((other = NextFreePointerDevice()) == NULL)
{
@@ -2435,7 +2435,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
if (dev->spriteInfo->sprite)
currentRoot = dev->spriteInfo->sprite->spriteTrace[0];
else /* new device auto-set to floating */
- currentRoot = WindowTable[0];
+ currentRoot = screenInfo.screens[0]->root;
/* we need to init a fake sprite */
screen = currentRoot->drawable.pScreen;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 27cb22022..c0efce5bf 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -562,7 +562,7 @@ CreateConnectionBlock(void)
VisualPtr pVisual;
pScreen = screenInfo.screens[i];
- root.windowId = WindowTable[i]->drawable.id;
+ root.windowId = pScreen->root->drawable.id;
root.defaultColormap = pScreen->defColormap;
root.whitePixel = pScreen->whitePixel;
root.blackPixel = pScreen->blackPixel;
@@ -912,7 +912,7 @@ GetGeometry(ClientPtr client, xGetGeometryReply *rep)
rep->type = X_Reply;
rep->length = 0;
rep->sequenceNumber = client->sequence;
- rep->root = WindowTable[pDraw->pScreen->myNum]->drawable.id;
+ rep->root = pDraw->pScreen->root->drawable.id;
rep->depth = pDraw->depth;
rep->width = pDraw->width;
rep->height = pDraw->height;
@@ -972,7 +972,7 @@ ProcQueryTree(ClientPtr client)
return rc;
memset(&reply, 0, sizeof(xQueryTreeReply));
reply.type = X_Reply;
- reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id;
+ reply.root = pWin->drawable.pScreen->root->drawable.id;
reply.sequenceNumber = client->sequence;
if (pWin->parent)
reply.parent = pWin->parent->drawable.id;
@@ -2055,7 +2055,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
}
else
{
- pBoundingDraw = (DrawablePtr)WindowTable[pDraw->pScreen->myNum];
+ pBoundingDraw = (DrawablePtr)pDraw->pScreen->root;
}
xgi.visual = wVisual (pWin);
@@ -3666,9 +3666,9 @@ SendConnSetup(ClientPtr client, char *reason)
{
unsigned int j;
xDepth *pDepth;
+ WindowPtr pRoot = screenInfo.screens[i]->root;
- root->currentInputMask = WindowTable[i]->eventMask |
- wOtherEventMasks (WindowTable[i]);
+ root->currentInputMask = pRoot->eventMask | wOtherEventMasks(pRoot);
pDepth = (xDepth *)(root + 1);
for (j = 0; j < root->nDepths; j++)
{
@@ -3916,7 +3916,6 @@ AddScreen(
any of the strings pointed to by argv. They may be passed to
multiple screens.
*/
- WindowTable[i] = NullWindow;
screenInfo.screens[i] = pScreen;
screenInfo.numScreens++;
if (!(*pfnInit)(i, pScreen, argc, argv))
diff --git a/dix/enterleave.c b/dix/enterleave.c
index c08cc3100..eefa7ab8e 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -1077,7 +1077,7 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev,
for (i = 0; i < nscreens; i++)
{
- root = WindowTable[i];
+ root = screenInfo.screens[i]->root;
if (!HasOtherPointer(root, GetPairedDevice(dev)) && !FirstFocusChild(root))
{
/* If pointer was on PointerRootWin and changes to NoneWin, and
@@ -1138,7 +1138,7 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev,
for (i = 0; i < nscreens; i++)
{
- root = WindowTable[i];
+ root = screenInfo.screens[i]->root;
if (!HasFocus(root) && !FirstFocusChild(root))
{
CoreFocusEvent(dev, FocusIn, mode, B ? NotifyPointerRoot : NotifyDetailNone, root);
@@ -1169,7 +1169,7 @@ CoreFocusFromPointerRootOrNone(DeviceIntPtr dev,
for (i = 0; i < nscreens; i++)
{
- root = WindowTable[i];
+ root = screenInfo.screens[i]->root;
if (!HasFocus(root) && !FirstFocusChild(root))
{
/* If pointer was on PointerRootWin and changes to NoneWin, and
@@ -1279,7 +1279,7 @@ DeviceFocusEvents(DeviceIntPtr dev,
NotifyPointer);
/* Notify all the roots */
for (i = 0; i < nscreens; i++)
- DeviceFocusEvent(dev, XI_FocusOut, mode, out, WindowTable[i]);
+ DeviceFocusEvent(dev, XI_FocusOut, mode, out, screenInfo.screens[i]->root);
}
else
{
@@ -1293,7 +1293,7 @@ DeviceFocusEvents(DeviceIntPtr dev,
}
/* Notify all the roots */
for (i = 0; i < nscreens; i++)
- DeviceFocusEvent(dev, XI_FocusIn, mode, in, WindowTable[i]);
+ DeviceFocusEvent(dev, XI_FocusIn, mode, in, screenInfo.screens[i]->root);
if (to == PointerRootWin)
DeviceFocusInEvents(dev, RootWindow(dev), sprite->win, mode, NotifyPointer);
}
@@ -1305,7 +1305,7 @@ DeviceFocusEvents(DeviceIntPtr dev,
DeviceFocusOutEvents(dev, sprite->win, RootWindow(dev), mode,
NotifyPointer);
for (i = 0; i < nscreens; i++)
- DeviceFocusEvent(dev, XI_FocusOut, mode, out, WindowTable[i]);
+ DeviceFocusEvent(dev, XI_FocusOut, mode, out, screenInfo.screens[i]->root);
if (to->parent != NullWindow)
DeviceFocusInEvents(dev, RootWindow(dev), to, mode, NotifyNonlinearVirtual);
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to);
diff --git a/dix/events.c b/dix/events.c
index 9e05dc96c..01865969b 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -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;
}
diff --git a/dix/globals.c b/dix/globals.c
index c24a94fbe..28e7d072d 100644
--- a/dix/globals.c
+++ b/dix/globals.c
@@ -83,8 +83,6 @@ ClientPtr serverClient;
int currentMaxClients; /* current size of clients array */
long maxBigRequestSize = MAX_BIG_REQUEST_SIZE;
-WindowPtr WindowTable[MAXSCREENS];
-
unsigned long globalSerialNumber = 0;
unsigned long serverGeneration = 0;
diff --git a/dix/main.c b/dix/main.c
index 3e500ba4d..982fedd6b 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -249,7 +249,7 @@ int main(int argc, char *argv[], char *envp[])
#endif
for (i = 0; i < screenInfo.numScreens; i++)
- InitRootWindow(WindowTable[i]);
+ InitRootWindow(screenInfo.screens[i]->root);
InitCoreDevices();
InitInput(argc, argv);
@@ -303,7 +303,8 @@ int main(int argc, char *argv[], char *envp[])
CloseInput();
- memset(WindowTable, 0, sizeof(WindowTable));
+ for (i = 0; i < screenInfo.numScreens; i++)
+ screenInfo.screens[i]->root = NullWindow;
CloseDownDevices();
CloseDownEvents();
diff --git a/dix/window.c b/dix/window.c
index bdad749e8..71edd4681 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -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);
diff --git a/fb/fb.h b/fb/fb.h
index 91c91eeb2..e2222a5c7 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -740,7 +740,7 @@ typedef struct {
#define fbWindowEnabled(pWin) \
REGION_NOTEMPTY((pWin)->drawable.pScreen, \
- &WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip)
+ &(pWin)->drawable.pScreen->root->borderClip)
#define fbDrawableEnabled(pDrawable) \
((pDrawable)->type == DRAWABLE_PIXMAP ? \
diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c
index c8e8dae65..678f29054 100644
--- a/hw/dmx/dmxextension.c
+++ b/hw/dmx/dmxextension.c
@@ -297,7 +297,7 @@ void dmxFlushPendingSyncs(void)
void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- WindowPtr pRoot = WindowTable[pScreen->myNum];
+ WindowPtr pRoot = pScreen->root;
WindowPtr pChild;
Bool anyMarked = FALSE;
@@ -402,7 +402,7 @@ static void dmxConfigureScreenWindow(int idx,
static void dmxConfigureRootWindow(int idx, int x, int y, int w, int h)
{
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- WindowPtr pRoot = WindowTable[idx];
+ WindowPtr pRoot = screenInfo.screens[idx]->root;
/* NOTE: Either this function or the ones that it calls must handle
* the case where w == 0 || h == 0. Currently, the functions that
@@ -437,7 +437,7 @@ static void dmxSetRootWindowOrigin(int idx, int x, int y)
{
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
ScreenPtr pScreen = screenInfo.screens[idx];
- WindowPtr pRoot = WindowTable[idx];
+ WindowPtr pRoot = pScreen->root;
WindowPtr pChild;
int xoff;
int yoff;
@@ -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) {
diff --git a/hw/dmx/input/dmxconsole.c b/hw/dmx/input/dmxconsole.c
index 9542efacd..bf34169ab 100644
--- a/hw/dmx/input/dmxconsole.c
+++ b/hw/dmx/input/dmxconsole.c
@@ -204,7 +204,7 @@ static void dmxConsoleDrawWindows(pointer private)
XUnionRectWithRegion(&rect, whole, whole);
for (i = 0; i < dmxNumScreens; i++) {
- WindowPtr pRoot = WindowTable[i];
+ WindowPtr pRoot = screenInfo.screens[i]->root;
WindowPtr pChild;
#if DMX_WINDOW_DEBUG
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 1242be1bd..814fc1a89 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -570,7 +570,7 @@ static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput,
int i;
#ifdef PANORAMIX
- if (!noPanoramiXExtension && pWindow && pWindow->parent != WindowTable[0])
+ if (!noPanoramiXExtension && pWindow && pWindow->parent != screenInfo.screens[0]->root)
return;
#endif
#if DMX_WINDOW_DEBUG
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 9d1b38376..10df02dbc 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -95,7 +95,7 @@ KdOsFuncs *kdOsFuncs;
void
KdSetRootClip (ScreenPtr pScreen, BOOL enable)
{
- WindowPtr pWin = WindowTable[pScreen->myNum];
+ WindowPtr pWin = pScreen->root;
WindowPtr pChild;
Bool WasViewable;
Bool anyMarked = FALSE;
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index d4b935157..1aad2d100 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1062,7 +1062,7 @@ xf86SetBlackWhitePixels(ScreenPtr pScreen)
static void
xf86SetRootClip (ScreenPtr pScreen, Bool enable)
{
- WindowPtr pWin = WindowTable[pScreen->myNum];
+ WindowPtr pWin = pScreen->root;
WindowPtr pChild;
Bool WasViewable = (Bool)(pWin->viewable);
Bool anyMarked = FALSE;
diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c
index 455a02cc2..77053b8c2 100644
--- a/hw/xfree86/common/xf86RandR.c
+++ b/hw/xfree86/common/xf86RandR.c
@@ -159,7 +159,7 @@ xf86RandRSetMode (ScreenPtr pScreen,
int oldmmHeight = pScreen->mmHeight;
int oldVirtualX = scrp->virtualX;
int oldVirtualY = scrp->virtualY;
- WindowPtr pRoot = WindowTable[pScreen->myNum];
+ WindowPtr pRoot = pScreen->root;
Bool ret = TRUE;
if (pRoot && scrp->vtSema)
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 2b33f2585..efed677af 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1881,7 +1881,7 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
void
xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
{
- DrawablePtr root = &WindowTable[pScreen->myNum]->drawable;
+ DrawablePtr root = &pScreen->root->drawable;
ChangeGCVal pval[2];
BoxPtr pbox = REGION_RECTS(clipboxes);
int i, nbox = REGION_NUM_RECTS(clipboxes);
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 754fe372c..448762879 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -347,7 +347,7 @@ SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
ev.type = XF86VidModeNotify + XF86VidModeEventBase;
ev.state = state;
ev.timestamp = currentTime.milliseconds;
- ev.root = WindowTable[pScreen->myNum]->drawable.id;
+ ev.root = pScreen->root->drawable.id;
ev.kind = kind;
ev.forced = forced;
WriteEventsToClient (pEv->client, 1, (xEvent *) &ev);
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 77f7fe295..f7cea5ede 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -1187,7 +1187,7 @@ DRIDriverClipNotify(ScreenPtr pScreen)
if (pDRIPriv->nrWindows > 0) {
pDRIPriv->nrWalked = 0;
- TraverseTree(WindowTable[pScreen->myNum], DRIDCNTreeTraversal,
+ TraverseTree(pScreen->root, DRIDCNTreeTraversal,
(pointer)pDRIWindows);
}
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 556285383..9ec4caa54 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -607,7 +607,7 @@ DRI2CanFlip(DrawablePtr pDraw)
if (pDraw->type == DRAWABLE_PIXMAP)
return TRUE;
- pRoot = WindowTable[pScreen->myNum];
+ pRoot = pScreen->root;
pRootPixmap = pScreen->GetWindowPixmap(pRoot);
pWin = (WindowPtr) pDraw;
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 9dfce3fed..8d598d6e7 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -517,7 +517,7 @@ xf86RandR12SetMode (ScreenPtr pScreen,
int oldHeight = pScreen->height;
int oldmmWidth = pScreen->mmWidth;
int oldmmHeight = pScreen->mmHeight;
- WindowPtr pRoot = WindowTable[pScreen->myNum];
+ WindowPtr pRoot = pScreen->root;
DisplayModePtr currentMode = NULL;
Bool ret = TRUE;
PixmapPtr pspix = NULL;
@@ -685,7 +685,7 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- WindowPtr pRoot = WindowTable[pScreen->myNum];
+ WindowPtr pRoot = pScreen->root;
PixmapPtr pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
Bool ret = FALSE;
int c;
@@ -739,7 +739,7 @@ finish:
if (pRoot && pScrn->vtSema)
(*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
#if RANDR_12_INTERFACE
- if (xf86RandR12Key && WindowTable[pScreen->myNum] && ret)
+ if (xf86RandR12Key && pScreen->root && ret)
RRScreenSizeNotify (pScreen);
#endif
return ret;
diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 2714fee51..e3683a8ed 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -76,9 +76,9 @@ xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region)
{
ScrnInfoPtr scrn = crtc->scrn;
ScreenPtr screen = scrn->pScreen;
- WindowPtr root = WindowTable[screen->myNum];
+ WindowPtr root = screen->root;
PixmapPtr dst_pixmap = crtc->rotatedPixmap;
- PictFormatPtr format = compWindowFormat (WindowTable[screen->myNum]);
+ PictFormatPtr format = compWindowFormat (screen->root);
int error;
PicturePtr src, dst;
int n = REGION_NUM_RECTS(region);
diff --git a/hw/xfree86/xaa/xaaCpyWin.c b/hw/xfree86/xaa/xaaCpyWin.c
index d37c8ec1e..d58db8ea1 100644
--- a/hw/xfree86/xaa/xaaCpyWin.c
+++ b/hw/xfree86/xaa/xaaCpyWin.c
@@ -47,7 +47,7 @@ XAACopyWindow(
return;
}
- pwinRoot = WindowTable[pScreen->myNum];
+ pwinRoot = pScreen->root;
REGION_NULL(pScreen, &rgnDst);
diff --git a/hw/xfree86/xaa/xaaOverlay.c b/hw/xfree86/xaa/xaaOverlay.c
index 2af808396..14de9bd34 100644
--- a/hw/xfree86/xaa/xaaOverlay.c
+++ b/hw/xfree86/xaa/xaaOverlay.c
@@ -54,7 +54,7 @@ XAACopyWindow8_32(
return;
}
- pwinRoot = WindowTable[pScreen->myNum];
+ pwinRoot = pScreen->root;
if(doUnderlay)
freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip);
diff --git a/hw/xfree86/xaa/xaaOverlayDF.c b/hw/xfree86/xaa/xaaOverlayDF.c
index 3b848ac84..b186cb5cd 100644
--- a/hw/xfree86/xaa/xaaOverlayDF.c
+++ b/hw/xfree86/xaa/xaaOverlayDF.c
@@ -324,7 +324,7 @@ XAAOverCopyWindow(
RegionRec rgnDst;
BoxPtr pbox;
int i, nbox, dx, dy;
- WindowPtr pRoot = WindowTable[pScreen->myNum];
+ WindowPtr pRoot = pScreen->root;
if (!pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 580fe4ae0..825afa0de 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -793,7 +793,7 @@ void AbortDDX( void )
void
xf86SetRootClip (ScreenPtr pScreen, int enable)
{
- WindowPtr pWin = WindowTable[pScreen->myNum];
+ WindowPtr pWin = pScreen->root;
WindowPtr pChild;
Bool WasViewable = (Bool)(pWin->viewable);
Bool anyMarked = TRUE;
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 36d18eba3..ac7fedd13 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -276,7 +276,7 @@ void QuartzUpdateScreens(void) {
sy = dixScreenOrigins[pScreen->myNum].y + darwinMainScreenY;
/* Adjust the root window. */
- pRoot = WindowTable[pScreen->myNum];
+ pRoot = pScreen->root;
AppleWMSetScreenOrigin(pRoot);
pScreen->ResizeWindow(pRoot, x - sx, y - sy, width, height, NULL);
miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 53dde7acc..6dc2c87fa 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -576,7 +576,7 @@ xprHideWindows(Bool hide)
for (screen = 0; screen < screenInfo.numScreens; screen++) {
RootlessFrameID prevWid = NULL;
- pRoot = WindowTable[screenInfo.screens[screen]->myNum];
+ pRoot = screenInfo.screens[screen]->root;
for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib) {
RootlessWindowRec *winRec = WINREC(pWin);
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index d574721b3..87e97d4e2 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -397,7 +397,7 @@ xprUpdateScreen(ScreenPtr pScreen)
rootlessGlobalOffsetX = darwinMainScreenX;
rootlessGlobalOffsetY = darwinMainScreenY;
- AppleWMSetScreenOrigin(WindowTable[pScreen->myNum]);
+ AppleWMSetScreenOrigin(pScreen->root);
RootlessRepositionWindows(pScreen);
RootlessUpdateScreenPixmap(pScreen);
@@ -416,7 +416,7 @@ xprInitInput(int argc, char **argv)
rootlessGlobalOffsetY = darwinMainScreenY;
for (i = 0; i < screenInfo.numScreens; i++)
- AppleWMSetScreenOrigin(WindowTable[i]);
+ AppleWMSetScreenOrigin(screenInfo.screens[i]->root);
}
/*
diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c
index ad9e66a0b..6d91ce0d6 100644
--- a/hw/xwin/winkeybd.c
+++ b/hw/xwin/winkeybd.c
@@ -262,7 +262,7 @@ winRestoreModeKeyStates (void)
/* Only process events if the rootwindow is mapped. The keyboard events
* will cause segfaults otherwise */
- if (WindowTable && WindowTable[0] && WindowTable[0]->mapped == FALSE)
+ if (screenInfo.screens[0]->root && screenInfo.screens[0]->root->mapped == FALSE)
processEvents = FALSE;
/* Force to process all pending events in the mi event queue */
diff --git a/hw/xwin/winwin32rootlesswindow.c b/hw/xwin/winwin32rootlesswindow.c
index 3a49ead69..214e8954b 100755
--- a/hw/xwin/winwin32rootlesswindow.c
+++ b/hw/xwin/winwin32rootlesswindow.c
@@ -407,7 +407,7 @@ void
winMWExtWMRestackWindows (ScreenPtr pScreen)
{
winScreenPriv(pScreen);
- WindowPtr pRoot = WindowTable[pScreen->myNum];
+ WindowPtr pRoot = pScreen->root;
WindowPtr pWin = NULL;
WindowPtr pWinPrev = NULL;
win32RootlessWindowPtr pRLWin = NULL;
diff --git a/hw/xwin/winwindow.c b/hw/xwin/winwindow.c
index d0c360f34..9348d5c1c 100644
--- a/hw/xwin/winwindow.c
+++ b/hw/xwin/winwindow.c
@@ -144,7 +144,7 @@ winCopyWindowNativeGDI (WindowPtr pWin,
#endif
/* Get a pointer to the root window */
- pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
+ pwinRoot = pWin->drawable.pScreen->root;
/* Create a region for the destination */
prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
diff --git a/include/globals.h b/include/globals.h
index 6959fc71a..7de262fe3 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -19,7 +19,6 @@ extern _X_EXPORT char *defaultFontPath;
extern _X_EXPORT int monitorResolution;
extern _X_EXPORT int defaultColorVisualClass;
-extern _X_EXPORT WindowPtr WindowTable[MAXSCREENS];
extern _X_EXPORT int GrabInProgress;
extern _X_EXPORT Bool noTestExtensions;
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 1460bc4c6..f8171ca5c 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -478,6 +478,7 @@ typedef struct _Screen {
pointer devPrivate;
short numVisuals;
VisualPtr visuals;
+ WindowPtr root;
ScreenSaverStuffRec screensaver;
/* Random screen procedures */
diff --git a/mi/midispcur.c b/mi/midispcur.c
index c279010e6..87eb27d4e 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -405,7 +405,7 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
}
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pWin = WindowTable[pScreen->myNum];
+ pWin = pScreen->root;
pBuffer = MIDCBUFFER(pDev, pScreen);
#ifdef ARGB_CURSOR
@@ -448,7 +448,7 @@ miDCSaveUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
pBuffer = MIDCBUFFER(pDev, pScreen);
pSave = pBuffer->pSave;
- pWin = WindowTable[pScreen->myNum];
+ pWin = pScreen->root;
if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h)
{
if (pSave)
@@ -482,7 +482,7 @@ miDCRestoreUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
pBuffer = MIDCBUFFER(pDev, pScreen);
pSave = pBuffer->pSave;
- pWin = WindowTable[pScreen->myNum];
+ pWin = pScreen->root;
if (!pSave)
return FALSE;
@@ -513,7 +513,7 @@ miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
goto failure;
dixSetPrivate(&pDev->devPrivates, miDCSpriteKey + pScreen->myNum, pBuffer);
- pWin = WindowTable[pScreen->myNum];
+ pWin = pScreen->root;
pBuffer->pSourceGC = miDCMakeGC(pWin);
if (!pBuffer->pSourceGC)
diff --git a/mi/miexpose.c b/mi/miexpose.c
index 57968dd2a..9249ca9f9 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -426,7 +426,7 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int 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;
diff --git a/mi/mioverlay.c b/mi/mioverlay.c
index 1a3ac4185..da3ff4ae7 100644
--- a/mi/mioverlay.c
+++ b/mi/mioverlay.c
@@ -306,7 +306,7 @@ miOverlayReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
{
if(IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)) {
/* This could probably be more optimal */
- RebuildTree(WindowTable[pWin->drawable.pScreen->myNum]->firstChild);
+ RebuildTree(pWin->drawable.pScreen->root->firstChild);
}
}
@@ -1610,7 +1610,7 @@ miOverlayChangeBorderWidth(
void
miOverlaySetRootClip(ScreenPtr pScreen, Bool enable)
{
- WindowPtr pRoot = WindowTable[pScreen->myNum];
+ WindowPtr pRoot = pScreen->root;
miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pRoot);
MARK_UNDERLAY(pRoot);
diff --git a/miext/rootless/rootlessCommon.c b/miext/rootless/rootlessCommon.c
index 39a3eed0f..dd3f953ca 100644
--- a/miext/rootless/rootlessCommon.c
+++ b/miext/rootless/rootlessCommon.c
@@ -447,7 +447,7 @@ RootlessRedisplay(WindowPtr pWindow)
void
RootlessRepositionWindows(ScreenPtr pScreen)
{
- WindowPtr root = WindowTable[pScreen->myNum];
+ WindowPtr root = pScreen->root;
WindowPtr win;
if (root != NULL) {
@@ -468,7 +468,7 @@ RootlessRepositionWindows(ScreenPtr pScreen)
void
RootlessRedisplayScreen(ScreenPtr pScreen)
{
- WindowPtr root = WindowTable[pScreen->myNum];
+ WindowPtr root = pScreen->root;
if (root != NULL) {
WindowPtr win;
diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h
index f44c4e8cf..8a4b81321 100644
--- a/miext/rootless/rootlessCommon.h
+++ b/miext/rootless/rootlessCommon.h
@@ -213,7 +213,7 @@ extern RegionRec rootlessHugeRoot;
// Returns TRUE if this window is a root window
#define IsRoot(pWin) \
- ((pWin) == WindowTable[(pWin)->drawable.pScreen->myNum])
+ ((pWin) == (pWin)->drawable.pScreen->root)
/*
diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c
index 7a24af842..d24ca04ad 100644
--- a/miext/rootless/rootlessScreen.c
+++ b/miext/rootless/rootlessScreen.c
@@ -493,7 +493,7 @@ static void expose_1 (WindowPtr pWin) {
void
RootlessScreenExpose (ScreenPtr pScreen)
{
- expose_1 (WindowTable[pScreen->myNum]);
+ expose_1 (pScreen->root);
}
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 22a548a0f..5955cd99c 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -1517,7 +1517,7 @@ RootlessOrderAllWindows (void)
RL_DEBUG_MSG("RootlessOrderAllWindows() ");
for (i = 0; i < screenInfo.numScreens; i++) {
if (screenInfo.screens[i] == NULL) continue;
- pWin = WindowTable[i];
+ pWin = screenInfo.screens[i]->root;
if (pWin == NULL) continue;
for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib) {
@@ -1533,7 +1533,7 @@ void
RootlessEnableRoot (ScreenPtr pScreen)
{
WindowPtr pRoot;
- pRoot = WindowTable[pScreen->myNum];
+ pRoot = pScreen->root;
RootlessEnsureFrame (pRoot);
(*pScreen->ClearToBackground) (pRoot, 0, 0, 0, 0, TRUE);
@@ -1546,7 +1546,7 @@ RootlessDisableRoot (ScreenPtr pScreen)
WindowPtr pRoot;
RootlessWindowRec *winRec;
- pRoot = WindowTable[pScreen->myNum];
+ pRoot = pScreen->root;
winRec = WINREC (pRoot);
if (NULL == winRec)
@@ -1572,8 +1572,10 @@ RootlessHideAllWindows (void)
for (i = 0; i < screenInfo.numScreens; i++)
{
pScreen = screenInfo.screens[i];
- pWin = WindowTable[i];
- if (pScreen == NULL || pWin == NULL)
+ if (pScreen == NULL)
+ continue;
+ pWin = pScreen->root;
+ if (pWin == NULL)
continue;
for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib)
@@ -1609,8 +1611,10 @@ RootlessShowAllWindows (void)
for (i = 0; i < screenInfo.numScreens; i++)
{
pScreen = screenInfo.screens[i];
- pWin = WindowTable[i];
- if (pScreen == NULL || pWin == NULL)
+ if (pScreen == NULL)
+ continue;
+ pWin = pScreen->root;
+ if (pWin == NULL)
continue;
for (pWin = pWin->firstChild; pWin != NULL; pWin = pWin->nextSib)
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index a940f8aae..a2a0f36a6 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -73,7 +73,7 @@ RREditConnectionInfo (ScreenPtr pScreen)
void
RRSendConfigNotify (ScreenPtr pScreen)
{
- WindowPtr pWin = WindowTable[pScreen->myNum];
+ WindowPtr pWin = pScreen->root;
xEvent event;
event.u.u.type = ConfigureNotify;
@@ -97,7 +97,7 @@ RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen)
rrScrPriv (pScreen);
xRRScreenChangeNotifyEvent se;
RRCrtcPtr crtc = pScrPriv->numCrtcs ? pScrPriv->crtcs[0] : NULL;
- WindowPtr pRoot = WindowTable[pScreen->myNum];
+ WindowPtr pRoot = pScreen->root;
se.type = RRScreenChangeNotify + RREventBase;
se.rotation = (CARD8) (crtc ? crtc->rotation : RR_Rotate_0);
@@ -620,7 +620,7 @@ ProcRRGetScreenInfo (ClientPtr client)
rep.setOfRotations = RR_Rotate_0;
rep.sequenceNumber = client->sequence;
rep.length = 0;
- rep.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id;
+ rep.root = pWin->drawable.pScreen->root->drawable.id;
rep.timestamp = currentTime.milliseconds;
rep.configTimestamp = currentTime.milliseconds;
rep.nSizes = 0;
@@ -649,7 +649,7 @@ ProcRRGetScreenInfo (ClientPtr client)
rep.setOfRotations = output->crtc->rotations;
rep.sequenceNumber = client->sequence;
rep.length = 0;
- rep.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id;
+ rep.root = pWin->drawable.pScreen->root->drawable.id;
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
rep.rotation = output->crtc->rotation;
@@ -961,7 +961,7 @@ sendReply:
rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
rep.newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds;
- rep.root = WindowTable[pDraw->pScreen->myNum]->drawable.id;
+ rep.root = pDraw->pScreen->root->drawable.id;
if (client->swapped)
{
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index 457b2b40f..c1bd5bb33 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -216,7 +216,7 @@ ProcRRXineramaGetScreenSize(ClientPtr client)
return rc;
pScreen = pWin->drawable.pScreen;
- pRoot = WindowTable[pScreen->myNum];
+ pRoot = pScreen->root;
rep.type = X_Reply;
rep.length = 0;
diff --git a/render/render.c b/render/render.c
index b58dd3ebe..d34250227 100644
--- a/render/render.c
+++ b/render/render.c
@@ -2681,7 +2681,7 @@ PanoramiXRenderCreatePicture (ClientPtr client)
newPict->info[0].id = stuff->pid;
if (refDraw->type == XRT_WINDOW &&
- stuff->drawable == WindowTable[0]->drawable.id)
+ stuff->drawable == screenInfo.screens[0]->root->drawable.id)
{
newPict->u.pict.root = TRUE;
}
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index d3a207ddb..5f08db7a5 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -690,7 +690,7 @@ ReplaceCursor (CursorPtr pCursor,
}
}
/* this "knows" that WindowHasNewCursor doesn't depend on it's argument */
- WindowHasNewCursor (WindowTable[0]);
+ WindowHasNewCursor (screenInfo.screens[0]->root);
}
static Bool
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 93175c538..0f3ffa468 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -43,6 +43,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "opaque.h"
#include "property.h"
+#include "scrnintstr.h"
#define XKBSRV_NEED_FILE_FUNCS
#include <xkbsrv.h>
#include "xkbgeom.h"
@@ -210,7 +211,7 @@ char * pval;
ErrorF("[xkb] Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n",
out,len);
}
- dixChangeWindowProperty(serverClient, WindowTable[0], name, XA_STRING, 8,
+ dixChangeWindowProperty(serverClient, screenInfo.screens[0]->root, name, XA_STRING, 8,
PropModeReplace, len, pval, TRUE);
free(pval);
return TRUE;