diff options
author | Keith Packard <keithp@keithp.com> | 2010-06-03 15:09:32 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-06-03 15:09:32 -0700 |
commit | 0f12e86e600522768f5f64eafc1230526e700ab7 (patch) | |
tree | 616002b2996ba0c39be05c3d7ea5e06a9c001a41 /dix | |
parent | aa7c09f7d04d59852b850b2b6993f4cbdc7ec940 (diff) | |
parent | f114f54986aca1add4c8808a05d9692e289547e7 (diff) |
Merge remote branch 'jamey/for-keith'
Diffstat (limited to 'dix')
-rw-r--r-- | dix/devices.c | 6 | ||||
-rw-r--r-- | dix/dispatch.c | 13 | ||||
-rw-r--r-- | dix/enterleave.c | 12 | ||||
-rw-r--r-- | dix/events.c | 179 | ||||
-rw-r--r-- | dix/getevents.c | 4 | ||||
-rw-r--r-- | dix/globals.c | 4 | ||||
-rw-r--r-- | dix/main.c | 5 | ||||
-rw-r--r-- | dix/window.c | 102 |
8 files changed, 158 insertions, 167 deletions
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..502eebd8d 100644 --- a/dix/events.c +++ b/dix/events.c @@ -486,6 +486,13 @@ SyntheticMotion(DeviceIntPtr dev, int x, int y) { static void PostNewCursor(DeviceIntPtr pDev); static Bool +pointOnScreen(ScreenPtr pScreen, int x, int y) +{ + return x >= pScreen->x && x < pScreen->x + pScreen->width && + y >= pScreen->y && y < pScreen->y + pScreen->height; +} + +static Bool XineramaSetCursorPosition( DeviceIntPtr pDev, int x, @@ -493,7 +500,6 @@ XineramaSetCursorPosition( Bool generateEvent ){ ScreenPtr pScreen; - BoxRec box; int i; SpritePtr pSprite = pDev->spriteInfo->sprite; @@ -502,17 +508,16 @@ XineramaSetCursorPosition( that screen are. */ pScreen = pSprite->screen; - x += panoramiXdataPtr[0].x; - y += panoramiXdataPtr[0].y; + x += screenInfo.screens[0]->x; + y += screenInfo.screens[0]->y; - if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum], - x, y, &box)) + if(!pointOnScreen(pScreen, x, y)) { FOR_NSCREENS(i) { if(i == pScreen->myNum) continue; - if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i], x, y, &box)) + if(pointOnScreen(screenInfo.screens[i], x, y)) { pScreen = screenInfo.screens[i]; break; @@ -521,10 +526,10 @@ XineramaSetCursorPosition( } pSprite->screen = pScreen; - pSprite->hotPhys.x = x - panoramiXdataPtr[0].x; - pSprite->hotPhys.y = y - panoramiXdataPtr[0].y; - x -= panoramiXdataPtr[pScreen->myNum].x; - y -= panoramiXdataPtr[pScreen->myNum].y; + pSprite->hotPhys.x = x - screenInfo.screens[0]->x; + pSprite->hotPhys.y = y - screenInfo.screens[0]->y; + x -= pScreen->x; + y -= pScreen->y; return (*pScreen->SetCursorPosition)(pDev, pScreen, x, y, generateEvent); } @@ -542,10 +547,10 @@ XineramaConstrainCursor(DeviceIntPtr pDev) /* Translate the constraining box to the screen the sprite is actually on */ - newBox.x1 += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x; - newBox.x2 += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x; - newBox.y1 += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y; - newBox.y2 += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y; + newBox.x1 += screenInfo.screens[0]->x - pScreen->x; + newBox.x2 += screenInfo.screens[0]->x - pScreen->x; + newBox.y1 += screenInfo.screens[0]->y - pScreen->y; + newBox.y2 += screenInfo.screens[0]->y - pScreen->y; (* pScreen->ConstrainCursor)(pDev, pScreen, &newBox); } @@ -556,9 +561,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; @@ -594,12 +600,12 @@ XineramaConfineCursorToWindow(DeviceIntPtr pDev, REGION_COPY(pSprite->screen, &pSprite->Reg1, &pSprite->windows[i]->borderSize); - off_x = panoramiXdataPtr[i].x; - off_y = panoramiXdataPtr[i].y; + off_x = screenInfo.screens[i]->x; + off_y = screenInfo.screens[i]->y; while(i--) { - x = off_x - panoramiXdataPtr[i].x; - y = off_y - panoramiXdataPtr[i].y; + x = off_x - screenInfo.screens[i]->x; + y = off_y - screenInfo.screens[i]->y; if(x || y) REGION_TRANSLATE(pSprite->screen, &pSprite->Reg1, x, y); @@ -607,8 +613,8 @@ XineramaConfineCursorToWindow(DeviceIntPtr pDev, REGION_UNION(pSprite->screen, &pSprite->Reg1, &pSprite->Reg1, &pSprite->windows[i]->borderSize); - off_x = panoramiXdataPtr[i].x; - off_y = panoramiXdataPtr[i].y; + off_x = screenInfo.screens[i]->x; + off_y = screenInfo.screens[i]->y; } pSprite->hotLimits = *REGION_EXTENTS(pSprite->screen, &pSprite->Reg1); @@ -619,7 +625,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); } @@ -813,12 +819,12 @@ CheckVirtualMotion( REGION_COPY(pSprite->screen, &pSprite->Reg2, &pSprite->windows[i]->borderSize); - off_x = panoramiXdataPtr[i].x; - off_y = panoramiXdataPtr[i].y; + off_x = screenInfo.screens[i]->x; + off_y = screenInfo.screens[i]->y; while(i--) { - x = off_x - panoramiXdataPtr[i].x; - y = off_y - panoramiXdataPtr[i].y; + x = off_x - screenInfo.screens[i]->x; + y = off_y - screenInfo.screens[i]->y; if(x || y) REGION_TRANSLATE(pSprite->screen, &pSprite->Reg2, x, y); @@ -826,8 +832,8 @@ CheckVirtualMotion( REGION_UNION(pSprite->screen, &pSprite->Reg2, &pSprite->Reg2, &pSprite->windows[i]->borderSize); - off_x = panoramiXdataPtr[i].x; - off_y = panoramiXdataPtr[i].y; + off_x = screenInfo.screens[i]->x; + off_y = screenInfo.screens[i]->y; } } else #endif @@ -875,7 +881,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 +1129,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; @@ -1134,10 +1140,8 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device) { #ifdef PANORAMIX if(!noPanoramiXExtension) { - event->root_x += panoramiXdataPtr[pSprite->screen->myNum].x - - panoramiXdataPtr[0].x; - event->root_y += panoramiXdataPtr[pSprite->screen->myNum].y - - panoramiXdataPtr[0].y; + event->root_x += pSprite->screen->x - screenInfo.screens[0]->x; + event->root_y += pSprite->screen->y - screenInfo.screens[0]->y; } #endif pSprite->hotPhys.x = event->root_x; @@ -1217,10 +1221,10 @@ PlayReleasedEvents(void) case ET_KeyRelease: case ET_ProximityIn: case ET_ProximityOut: - ev->root_x += panoramiXdataPtr[0].x - - panoramiXdataPtr[pDev->spriteInfo->sprite->screen->myNum].x; - ev->root_y += panoramiXdataPtr[0].y - - panoramiXdataPtr[pDev->spriteInfo->sprite->screen->myNum].y; + ev->root_x += screenInfo.screens[0]->x - + pDev->spriteInfo->sprite->screen->x; + ev->root_y += screenInfo.screens[0]->y - + pDev->spriteInfo->sprite->screen->y; break; default: break; @@ -1339,7 +1343,7 @@ playmore: } else ConfineCursorToWindow(dev, - WindowTable[dev->spriteInfo->sprite->hotPhys.pScreen->myNum], + dev->spriteInfo->sprite->hotPhys.pScreen->root, TRUE, FALSE); PostNewCursor(dev); } @@ -1369,7 +1373,7 @@ ScreenRestructured (ScreenPtr pScreen) } else ConfineCursorToWindow(pDev, - WindowTable[pDev->spriteInfo->sprite->hotPhys.pScreen->myNum], + pDev->spriteInfo->sprite->hotPhys.pScreen->root, TRUE, FALSE); } } @@ -2560,8 +2564,8 @@ PointInBorderSize(WindowPtr pWin, int x, int y) for(i = 1; i < PanoramiXNumScreens; i++) { if(POINT_IN_REGION(pSprite->screen, &pSprite->windows[i]->borderSize, - x + panoramiXdataPtr[0].x - panoramiXdataPtr[i].x, - y + panoramiXdataPtr[0].y - panoramiXdataPtr[i].y, + x + screenInfo.screens[0]->x - screenInfo.screens[i]->x, + y + screenInfo.screens[0]->y - screenInfo.screens[i]->y, &box)) return TRUE; } @@ -2756,17 +2760,15 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev) /* Motion events entering DIX get translated to Screen 0 coordinates. Replayed events have already been translated since they've entered DIX before */ - ev->root_x += panoramiXdataPtr[pSprite->screen->myNum].x - - panoramiXdataPtr[0].x; - ev->root_y += panoramiXdataPtr[pSprite->screen->myNum].y - - panoramiXdataPtr[0].y; + ev->root_x += pSprite->screen->x - screenInfo.screens[0]->x; + ev->root_y += pSprite->screen->y - screenInfo.screens[0]->y; } else #endif { 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 +2851,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 +2894,7 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) } else ConfineCursorToWindow( pDev, - WindowTable[pSprite->hotPhys.pScreen->myNum], + pSprite->hotPhys.pScreen->root, TRUE, FALSE); } @@ -3007,10 +3009,10 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) } #ifdef PANORAMIX if(!noPanoramiXExtension) { - pSprite->hotLimits.x1 = -panoramiXdataPtr[0].x; - pSprite->hotLimits.y1 = -panoramiXdataPtr[0].y; - pSprite->hotLimits.x2 = PanoramiXPixWidth - panoramiXdataPtr[0].x; - pSprite->hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y; + pSprite->hotLimits.x1 = -screenInfo.screens[0]->x; + pSprite->hotLimits.y1 = -screenInfo.screens[0]->y; + pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x; + pSprite->hotLimits.y2 = PanoramiXPixHeight - screenInfo.screens[0]->y; pSprite->physLimits = pSprite->hotLimits; pSprite->confineWin = NullWindow; pSprite->hotShape = NullRegion; @@ -3051,7 +3053,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; @@ -3077,10 +3079,10 @@ UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen) #ifdef PANORAMIX if(!noPanoramiXExtension) { - pSprite->hotLimits.x1 = -panoramiXdataPtr[0].x; - pSprite->hotLimits.y1 = -panoramiXdataPtr[0].y; - pSprite->hotLimits.x2 = PanoramiXPixWidth - panoramiXdataPtr[0].x; - pSprite->hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y; + pSprite->hotLimits.x1 = -screenInfo.screens[0]->x; + pSprite->hotLimits.y1 = -screenInfo.screens[0]->y; + pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x; + pSprite->hotLimits.y2 = PanoramiXPixHeight - screenInfo.screens[0]->y; pSprite->physLimits = pSprite->hotLimits; pSprite->screen = pScreen; } @@ -3113,10 +3115,8 @@ NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y) pSprite->hotPhys.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension) { - pSprite->hotPhys.x += panoramiXdataPtr[newScreen->myNum].x - - panoramiXdataPtr[0].x; - pSprite->hotPhys.y += panoramiXdataPtr[newScreen->myNum].y - - panoramiXdataPtr[0].y; + pSprite->hotPhys.x += newScreen->x - screenInfo.screens[0]->x; + pSprite->hotPhys.y += newScreen->y - screenInfo.screens[0]->y; if (newScreen != pSprite->screen) { pSprite->screen = newScreen; /* Make sure we tell the DDX to update its copy of the screen */ @@ -3124,23 +3124,22 @@ 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) (*pSprite->screen->SetCursorPosition)( pDev, pSprite->screen, - pSprite->hotPhys.x + panoramiXdataPtr[0].x - - panoramiXdataPtr[pSprite->screen->myNum].x, - pSprite->hotPhys.y + panoramiXdataPtr[0].y - - panoramiXdataPtr[pSprite->screen->myNum].y, FALSE); + pSprite->hotPhys.x + screenInfo.screens[0]->x - + pSprite->screen->x, + pSprite->hotPhys.y + screenInfo.screens[0]->y - + pSprite->screen->y, FALSE); } } else #endif if (newScreen != pSprite->hotPhys.pScreen) - ConfineCursorToWindow(pDev, WindowTable[newScreen->myNum], - TRUE, FALSE); + ConfineCursorToWindow(pDev, newScreen->root, TRUE, FALSE); } #ifdef PANORAMIX @@ -3163,14 +3162,14 @@ XineramaPointInWindowIsVisible( if(!XineramaSetWindowPntrs(inputInfo.pointer, pWin)) return FALSE; - xoff = x + panoramiXdataPtr[0].x; - yoff = y + panoramiXdataPtr[0].y; + xoff = x + screenInfo.screens[0]->x; + yoff = y + screenInfo.screens[0]->y; for(i = 1; i < PanoramiXNumScreens; i++) { pWin = inputInfo.pointer->spriteInfo->sprite->windows[i]; pScreen = pWin->drawable.pScreen; - x = xoff - panoramiXdataPtr[i].x; - y = yoff - panoramiXdataPtr[i].y; + x = xoff - screenInfo.screens[i]->x; + y = yoff - screenInfo.screens[i]->y; if(POINT_IN_REGION(pScreen, &pWin->borderClip, x, y, &box) && (!wInputShape(pWin) || @@ -3215,9 +3214,9 @@ XineramaWarpPointer(ClientPtr client) winX = source->drawable.x; winY = source->drawable.y; - if(source == WindowTable[0]) { - winX -= panoramiXdataPtr[0].x; - winY -= panoramiXdataPtr[0].y; + if(source == screenInfo.screens[0]->root) { + winX -= screenInfo.screens[0]->x; + winY -= screenInfo.screens[0]->y; } if (x < winX + stuff->srcX || y < winY + stuff->srcY || @@ -3231,9 +3230,9 @@ XineramaWarpPointer(ClientPtr client) if (dest) { x = dest->drawable.x; y = dest->drawable.y; - if(dest == WindowTable[0]) { - x -= panoramiXdataPtr[0].x; - y -= panoramiXdataPtr[0].y; + if(dest == screenInfo.screens[0]->root) { + x -= screenInfo.screens[0]->x; + y -= screenInfo.screens[0]->y; } } @@ -4997,11 +4996,11 @@ ProcQueryPointer(ClientPtr client) #ifdef PANORAMIX if(!noPanoramiXExtension) { - rep.rootX += panoramiXdataPtr[0].x; - rep.rootY += panoramiXdataPtr[0].y; + rep.rootX += screenInfo.screens[0]->x; + rep.rootY += screenInfo.screens[0]->y; if(stuff->id == rep.root) { - rep.winX += panoramiXdataPtr[0].x; - rep.winY += panoramiXdataPtr[0].y; + rep.winX += screenInfo.screens[0]->x; + rep.winY += screenInfo.screens[0]->y; } } #endif @@ -5670,7 +5669,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) #ifdef PANORAMIX if(!noPanoramiXExtension && - (panoramiXdataPtr[0].x || panoramiXdataPtr[0].y)) + (screenInfo.screens[0]->x || screenInfo.screens[0]->y)) { switch(events->u.u.type) { case MotionNotify: @@ -5687,13 +5686,13 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) */ count = 1; /* should always be 1 */ memcpy(&eventCopy, events, sizeof(xEvent)); - eventCopy.u.keyButtonPointer.rootX += panoramiXdataPtr[0].x; - eventCopy.u.keyButtonPointer.rootY += panoramiXdataPtr[0].y; + eventCopy.u.keyButtonPointer.rootX += screenInfo.screens[0]->x; + eventCopy.u.keyButtonPointer.rootY += screenInfo.screens[0]->y; if(eventCopy.u.keyButtonPointer.event == eventCopy.u.keyButtonPointer.root) { - eventCopy.u.keyButtonPointer.eventX += panoramiXdataPtr[0].x; - eventCopy.u.keyButtonPointer.eventY += panoramiXdataPtr[0].y; + eventCopy.u.keyButtonPointer.eventX += screenInfo.screens[0]->x; + eventCopy.u.keyButtonPointer.eventY += screenInfo.screens[0]->y; } events = &eventCopy; break; diff --git a/dix/getevents.c b/dix/getevents.c index eeef41448..3892f6fb2 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -1210,8 +1210,8 @@ PostSyntheticMotion(DeviceIntPtr pDev, will translate from sprite screen to screen 0 upon reentry to the DIX layer. */ if (!noPanoramiXExtension) { - x += panoramiXdataPtr[0].x - panoramiXdataPtr[screen].x; - y += panoramiXdataPtr[0].y - panoramiXdataPtr[screen].y; + x += screenInfo.screens[0]->x - screenInfo.screens[screen]->x; + y += screenInfo.screens[0]->y - screenInfo.screens[screen]->y; } #endif diff --git a/dix/globals.c b/dix/globals.c index c24a94fbe..82a85c28e 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; @@ -137,5 +135,3 @@ char *display; char *ConnectionInfo; CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND; - -DDXPointRec dixScreenOrigins[MAXSCREENS]; 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 00854c6d5..9e1f491d8 100644 --- a/dix/window.c +++ b/dix/window.c @@ -151,12 +151,10 @@ WindowSeekDeviceCursor(WindowPtr pWin, int screenIsSaved = SCREEN_SAVER_OFF; -ScreenSaverStuffRec savedScreenInfo[MAXSCREENS]; - static int FocusPrivatesKeyIndex; DevPrivateKey FocusPrivatesKey = &FocusPrivatesKeyIndex; -static Bool TileScreenSaver(int i, int kind); +static Bool TileScreenSaver(ScreenPtr pScreen, int kind); #define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \ @@ -212,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); @@ -258,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 */ @@ -363,12 +361,12 @@ CreateRootWindow(ScreenPtr pScreen) if (!pWin) return FALSE; - savedScreenInfo[pScreen->myNum].pWindow = NULL; - savedScreenInfo[pScreen->myNum].wid = FakeClientID(0); - savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL; + pScreen->screensaver.pWindow = NULL; + pScreen->screensaver.wid = FakeClientID(0); + pScreen->screensaver.ExternalScreenSaver = NULL; screenIsSaved = SCREEN_SAVER_OFF; - WindowTable[pScreen->myNum] = pWin; + pScreen->root = pWin; pWin->drawable.pScreen = pScreen; pWin->drawable.type = DRAWABLE_WINDOW; @@ -539,7 +537,7 @@ RealChildHead(WindowPtr pWin) if (!pWin->parent && (screenIsSaved == SCREEN_SAVER_ON) && - (HasSaverWindow (pWin->drawable.pScreen->myNum))) + (HasSaverWindow (pWin->drawable.pScreen))) return (pWin->firstChild); else return (NullWindow); @@ -1329,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; @@ -2238,8 +2236,8 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) event.u.configureRequest.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension && (!pParent || !pParent->parent)) { - event.u.configureRequest.x += panoramiXdataPtr[0].x; - event.u.configureRequest.y += panoramiXdataPtr[0].y; + event.u.configureRequest.x += screenInfo.screens[0]->x; + event.u.configureRequest.y += screenInfo.screens[0]->y; } #endif event.u.configureRequest.width = w; @@ -2319,8 +2317,8 @@ ActuallyDoSomething: event.u.configureNotify.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension && (!pParent || !pParent->parent)) { - event.u.configureNotify.x += panoramiXdataPtr[0].x; - event.u.configureNotify.y += panoramiXdataPtr[0].y; + event.u.configureNotify.x += screenInfo.screens[0]->x; + event.u.configureNotify.y += screenInfo.screens[0]->y; } #endif event.u.configureNotify.width = w; @@ -2473,8 +2471,8 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent, event.u.reparent.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension && !pParent->parent) { - event.u.reparent.x += panoramiXdataPtr[0].x; - event.u.reparent.y += panoramiXdataPtr[0].y; + event.u.reparent.x += screenInfo.screens[0]->x; + event.u.reparent.y += screenInfo.screens[0]->y; } #endif event.u.reparent.override = pWin->overrideRedirect; @@ -2966,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 { @@ -3034,7 +3032,7 @@ NotClippedByChildren(WindowPtr pWin) pReg = REGION_CREATE(pScreen, NullBox, 1); if (pWin->parent || screenIsSaved != SCREEN_SAVER_ON || - !HasSaverWindow (pWin->drawable.pScreen->myNum)) + !HasSaverWindow (pWin->drawable.pScreen)) { REGION_INTERSECT(pScreen, pReg, &pWin->borderClip, &pWin->winSize); } @@ -3152,33 +3150,33 @@ dixSaveScreens(ClientPtr client, int on, int mode) } for (i = 0; i < screenInfo.numScreens; i++) { + ScreenPtr pScreen = screenInfo.screens[i]; if (on == SCREEN_SAVER_FORCER) - (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], on); - if (savedScreenInfo[i].ExternalScreenSaver) + (* pScreen->SaveScreen) (pScreen, on); + if (pScreen->screensaver.ExternalScreenSaver) { - if ((*savedScreenInfo[i].ExternalScreenSaver) - (screenInfo.screens[i], type, on == SCREEN_SAVER_FORCER)) + if ((*pScreen->screensaver.ExternalScreenSaver) + (pScreen, type, on == SCREEN_SAVER_FORCER)) continue; } if (type == screenIsSaved) continue; switch (type) { case SCREEN_SAVER_OFF: - if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED) + if (pScreen->screensaver.blanked == SCREEN_IS_BLANKED) { - (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], - what); + (* pScreen->SaveScreen) (pScreen, what); } - else if (HasSaverWindow (i)) + else if (HasSaverWindow (pScreen)) { - savedScreenInfo[i].pWindow = NullWindow; - FreeResource(savedScreenInfo[i].wid, RT_NONE); + pScreen->screensaver.pWindow = NullWindow; + FreeResource(pScreen->screensaver.wid, RT_NONE); } break; case SCREEN_SAVER_CYCLE: - if (savedScreenInfo[i].blanked == SCREEN_IS_TILED) + if (pScreen->screensaver.blanked == SCREEN_IS_TILED) { - WindowPtr pWin = savedScreenInfo[i].pWindow; + WindowPtr pWin = pScreen->screensaver.pWindow; /* make it look like screen saver is off, so that * NotClippedByChildren will compute a clip list * for the root window, so miPaintWindow works @@ -3202,35 +3200,33 @@ dixSaveScreens(ClientPtr client, int on, int mode) * Call the DDX saver in case it wants to do something * at cycle time */ - else if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED) + else if (pScreen->screensaver.blanked == SCREEN_IS_BLANKED) { - (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], - type); + (* pScreen->SaveScreen) (pScreen, type); } break; case SCREEN_SAVER_ON: if (ScreenSaverBlanking != DontPreferBlanking) { - if ((* screenInfo.screens[i]->SaveScreen) - (screenInfo.screens[i], what)) + if ((* pScreen->SaveScreen) (pScreen, what)) { - savedScreenInfo[i].blanked = SCREEN_IS_BLANKED; + pScreen->screensaver.blanked = SCREEN_IS_BLANKED; continue; } if ((ScreenSaverAllowExposures != DontAllowExposures) && - TileScreenSaver(i, SCREEN_IS_BLACK)) + TileScreenSaver(pScreen, SCREEN_IS_BLACK)) { - savedScreenInfo[i].blanked = SCREEN_IS_BLACK; + pScreen->screensaver.blanked = SCREEN_IS_BLACK; continue; } } if ((ScreenSaverAllowExposures != DontAllowExposures) && - TileScreenSaver(i, SCREEN_IS_TILED)) + TileScreenSaver(pScreen, SCREEN_IS_TILED)) { - savedScreenInfo[i].blanked = SCREEN_IS_TILED; + pScreen->screensaver.blanked = SCREEN_IS_TILED; } else - savedScreenInfo[i].blanked = SCREEN_ISNT_SAVED; + pScreen->screensaver.blanked = SCREEN_ISNT_SAVED; break; } } @@ -3252,7 +3248,7 @@ SaveScreens(int on, int mode) } static Bool -TileScreenSaver(int i, int kind) +TileScreenSaver(ScreenPtr pScreen, int kind) { int j; int result; @@ -3269,9 +3265,9 @@ TileScreenSaver(int i, 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: @@ -3283,7 +3279,7 @@ TileScreenSaver(int i, int kind) } break; case SCREEN_IS_BLACK: - attributes[attri++] = WindowTable[i]->drawable.pScreen->blackPixel; + attributes[attri++] = pScreen->root->drawable.pScreen->blackPixel; mask |= CWBackPixel; break; } @@ -3330,14 +3326,14 @@ TileScreenSaver(int i, int kind) } } - pWin = savedScreenInfo[i].pWindow = - CreateWindow(savedScreenInfo[i].wid, - WindowTable[i], + pWin = pScreen->screensaver.pWindow = + CreateWindow(pScreen->screensaver.wid, + pScreen->root, -RANDOM_WIDTH, -RANDOM_WIDTH, - (unsigned short)screenInfo.screens[i]->width + RANDOM_WIDTH, - (unsigned short)screenInfo.screens[i]->height + 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); @@ -3346,7 +3342,7 @@ TileScreenSaver(int i, int kind) return FALSE; if (!AddResource(pWin->drawable.id, RT_WINDOW, - (pointer)savedScreenInfo[i].pWindow)) + (pointer)pScreen->screensaver.pWindow)) return FALSE; if (mask & CWBackPixmap) |