aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/dix
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/dix')
-rw-r--r--nx-X11/programs/Xserver/dix/dispatch.c16
-rw-r--r--nx-X11/programs/Xserver/dix/events.c45
-rw-r--r--nx-X11/programs/Xserver/dix/globals.c2
-rw-r--r--nx-X11/programs/Xserver/dix/main.c18
-rw-r--r--nx-X11/programs/Xserver/dix/resource.c8
-rw-r--r--nx-X11/programs/Xserver/dix/window.c20
6 files changed, 53 insertions, 56 deletions
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);