105b261ecSmrg/* 205b261ecSmrg 305b261ecSmrgCopyright 1993 by Davor Matic 405b261ecSmrg 505b261ecSmrgPermission to use, copy, modify, distribute, and sell this software 605b261ecSmrgand its documentation for any purpose is hereby granted without fee, 705b261ecSmrgprovided that the above copyright notice appear in all copies and that 805b261ecSmrgboth that copyright notice and this permission notice appear in 905b261ecSmrgsupporting documentation. Davor Matic makes no representations about 1005b261ecSmrgthe suitability of this software for any purpose. It is provided "as 1105b261ecSmrgis" without express or implied warranty. 1205b261ecSmrg 1305b261ecSmrg*/ 1405b261ecSmrg 1505b261ecSmrg#ifdef HAVE_XNEST_CONFIG_H 1605b261ecSmrg#include <xnest-config.h> 1705b261ecSmrg#endif 1805b261ecSmrg 1905b261ecSmrg#include <X11/X.h> 2005b261ecSmrg#include <X11/Xproto.h> 2105b261ecSmrg#include "scrnintstr.h" 2205b261ecSmrg#include "dix.h" 2305b261ecSmrg#include "mi.h" 2405b261ecSmrg#include "micmap.h" 2505b261ecSmrg#include "colormapst.h" 2605b261ecSmrg#include "resource.h" 2705b261ecSmrg 2805b261ecSmrg#include "Xnest.h" 2905b261ecSmrg 3005b261ecSmrg#include "Display.h" 3105b261ecSmrg#include "Screen.h" 3205b261ecSmrg#include "XNGC.h" 3305b261ecSmrg#include "GCOps.h" 3405b261ecSmrg#include "Drawable.h" 3505b261ecSmrg#include "XNFont.h" 3605b261ecSmrg#include "Color.h" 3705b261ecSmrg#include "XNCursor.h" 3805b261ecSmrg#include "Visual.h" 3905b261ecSmrg#include "Events.h" 4005b261ecSmrg#include "Init.h" 4105b261ecSmrg#include "mipointer.h" 4205b261ecSmrg#include "Args.h" 434642e01fSmrg#include "mipointrst.h" 4405b261ecSmrg 4505b261ecSmrgWindow xnestDefaultWindows[MAXSCREENS]; 4605b261ecSmrgWindow xnestScreenSaverWindows[MAXSCREENS]; 476747b715SmrgDevPrivateKeyRec xnestCursorScreenKeyRec; 4805b261ecSmrg 4905b261ecSmrgScreenPtr 5005b261ecSmrgxnestScreen(Window window) 5105b261ecSmrg{ 5235c4bbdfSmrg int i; 5305b261ecSmrg 5435c4bbdfSmrg for (i = 0; i < xnestNumScreens; i++) 5535c4bbdfSmrg if (xnestDefaultWindows[i] == window) 5635c4bbdfSmrg return screenInfo.screens[i]; 5735c4bbdfSmrg 5835c4bbdfSmrg return NULL; 5905b261ecSmrg} 6005b261ecSmrg 6105b261ecSmrgstatic int 6205b261ecSmrgoffset(unsigned long mask) 6305b261ecSmrg{ 6435c4bbdfSmrg int count; 6535c4bbdfSmrg 6635c4bbdfSmrg for (count = 0; !(mask & 1) && count < 32; count++) 6735c4bbdfSmrg mask >>= 1; 6835c4bbdfSmrg 6935c4bbdfSmrg return count; 7005b261ecSmrg} 7105b261ecSmrg 7205b261ecSmrgstatic Bool 7305b261ecSmrgxnestSaveScreen(ScreenPtr pScreen, int what) 7405b261ecSmrg{ 7535c4bbdfSmrg if (xnestSoftwareScreenSaver) 7635c4bbdfSmrg return False; 7735c4bbdfSmrg else { 7835c4bbdfSmrg switch (what) { 7935c4bbdfSmrg case SCREEN_SAVER_ON: 8035c4bbdfSmrg XMapRaised(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]); 8135c4bbdfSmrg xnestSetScreenSaverColormapWindow(pScreen); 8235c4bbdfSmrg break; 8335c4bbdfSmrg 8435c4bbdfSmrg case SCREEN_SAVER_OFF: 8535c4bbdfSmrg XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]); 8635c4bbdfSmrg xnestSetInstalledColormapWindows(pScreen); 8735c4bbdfSmrg break; 8835c4bbdfSmrg 8935c4bbdfSmrg case SCREEN_SAVER_FORCER: 9035c4bbdfSmrg lastEventTime = GetTimeInMillis(); 9135c4bbdfSmrg XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]); 9235c4bbdfSmrg xnestSetInstalledColormapWindows(pScreen); 9335c4bbdfSmrg break; 9435c4bbdfSmrg 9535c4bbdfSmrg case SCREEN_SAVER_CYCLE: 9635c4bbdfSmrg XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]); 9735c4bbdfSmrg xnestSetInstalledColormapWindows(pScreen); 9835c4bbdfSmrg break; 9935c4bbdfSmrg } 10035c4bbdfSmrg return True; 10105b261ecSmrg } 10205b261ecSmrg} 10305b261ecSmrg 10405b261ecSmrgstatic Bool 10505b261ecSmrgxnestCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) 10605b261ecSmrg{ 10705b261ecSmrg return FALSE; 10805b261ecSmrg} 10905b261ecSmrg 11005b261ecSmrgstatic void 11105b261ecSmrgxnestCrossScreen(ScreenPtr pScreen, Bool entering) 11205b261ecSmrg{ 11305b261ecSmrg} 11405b261ecSmrg 11535c4bbdfSmrgstatic miPointerScreenFuncRec xnestPointerCursorFuncs = { 11605b261ecSmrg xnestCursorOffScreen, 11705b261ecSmrg xnestCrossScreen, 11805b261ecSmrg miPointerWarpCursor 11905b261ecSmrg}; 12005b261ecSmrg 12135c4bbdfSmrgstatic miPointerSpriteFuncRec xnestPointerSpriteFuncs = { 12205b261ecSmrg xnestRealizeCursor, 12305b261ecSmrg xnestUnrealizeCursor, 12405b261ecSmrg xnestSetCursor, 12505b261ecSmrg xnestMoveCursor, 1264642e01fSmrg xnestDeviceCursorInitialize, 1274642e01fSmrg xnestDeviceCursorCleanup 12805b261ecSmrg}; 12905b261ecSmrg 13005b261ecSmrgBool 13135c4bbdfSmrgxnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) 13205b261ecSmrg{ 13335c4bbdfSmrg VisualPtr visuals; 13435c4bbdfSmrg DepthPtr depths; 13535c4bbdfSmrg int numVisuals, numDepths; 13635c4bbdfSmrg int i, j, depthIndex; 13735c4bbdfSmrg unsigned long valuemask; 13835c4bbdfSmrg XSetWindowAttributes attributes; 13935c4bbdfSmrg XWindowAttributes gattributes; 14035c4bbdfSmrg XSizeHints sizeHints; 14135c4bbdfSmrg VisualID defaultVisual; 14235c4bbdfSmrg int rootDepth; 14335c4bbdfSmrg miPointerScreenPtr PointPriv; 14435c4bbdfSmrg 14535c4bbdfSmrg if (!dixRegisterPrivateKey 14635c4bbdfSmrg (&xnestWindowPrivateKeyRec, PRIVATE_WINDOW, sizeof(xnestPrivWin))) 14735c4bbdfSmrg return FALSE; 14835c4bbdfSmrg if (!dixRegisterPrivateKey 14935c4bbdfSmrg (&xnestGCPrivateKeyRec, PRIVATE_GC, sizeof(xnestPrivGC))) 15035c4bbdfSmrg return FALSE; 15135c4bbdfSmrg if (!dixRegisterPrivateKey 15235c4bbdfSmrg (&xnestPixmapPrivateKeyRec, PRIVATE_PIXMAP, sizeof(xnestPrivPixmap))) 15335c4bbdfSmrg return FALSE; 15435c4bbdfSmrg if (!dixRegisterPrivateKey 15535c4bbdfSmrg (&xnestColormapPrivateKeyRec, PRIVATE_COLORMAP, 15635c4bbdfSmrg sizeof(xnestPrivColormap))) 15735c4bbdfSmrg return FALSE; 15835c4bbdfSmrg if (!dixRegisterPrivateKey(&xnestCursorScreenKeyRec, PRIVATE_SCREEN, 0)) 15935c4bbdfSmrg return FALSE; 16035c4bbdfSmrg 16135c4bbdfSmrg visuals = xallocarray(xnestNumVisuals, sizeof(VisualRec)); 16235c4bbdfSmrg numVisuals = 0; 16335c4bbdfSmrg 16435c4bbdfSmrg depths = (DepthPtr) malloc(MAXDEPTH * sizeof(DepthRec)); 16535c4bbdfSmrg depths[0].depth = 1; 16635c4bbdfSmrg depths[0].numVids = 0; 16735c4bbdfSmrg depths[0].vids = (VisualID *) malloc(MAXVISUALSPERDEPTH * sizeof(VisualID)); 16835c4bbdfSmrg numDepths = 1; 16935c4bbdfSmrg 17035c4bbdfSmrg for (i = 0; i < xnestNumVisuals; i++) { 17135c4bbdfSmrg visuals[numVisuals].class = xnestVisuals[i].class; 17235c4bbdfSmrg visuals[numVisuals].bitsPerRGBValue = xnestVisuals[i].bits_per_rgb; 17335c4bbdfSmrg visuals[numVisuals].ColormapEntries = xnestVisuals[i].colormap_size; 17435c4bbdfSmrg visuals[numVisuals].nplanes = xnestVisuals[i].depth; 17535c4bbdfSmrg visuals[numVisuals].redMask = xnestVisuals[i].red_mask; 17635c4bbdfSmrg visuals[numVisuals].greenMask = xnestVisuals[i].green_mask; 17735c4bbdfSmrg visuals[numVisuals].blueMask = xnestVisuals[i].blue_mask; 17835c4bbdfSmrg visuals[numVisuals].offsetRed = offset(xnestVisuals[i].red_mask); 17935c4bbdfSmrg visuals[numVisuals].offsetGreen = offset(xnestVisuals[i].green_mask); 18035c4bbdfSmrg visuals[numVisuals].offsetBlue = offset(xnestVisuals[i].blue_mask); 18135c4bbdfSmrg 18235c4bbdfSmrg /* Check for and remove duplicates. */ 18335c4bbdfSmrg for (j = 0; j < numVisuals; j++) { 18435c4bbdfSmrg if (visuals[numVisuals].class == visuals[j].class && 18535c4bbdfSmrg visuals[numVisuals].bitsPerRGBValue == 18635c4bbdfSmrg visuals[j].bitsPerRGBValue && 18735c4bbdfSmrg visuals[numVisuals].ColormapEntries == 18835c4bbdfSmrg visuals[j].ColormapEntries && 18935c4bbdfSmrg visuals[numVisuals].nplanes == visuals[j].nplanes && 19035c4bbdfSmrg visuals[numVisuals].redMask == visuals[j].redMask && 19135c4bbdfSmrg visuals[numVisuals].greenMask == visuals[j].greenMask && 19235c4bbdfSmrg visuals[numVisuals].blueMask == visuals[j].blueMask && 19335c4bbdfSmrg visuals[numVisuals].offsetRed == visuals[j].offsetRed && 19435c4bbdfSmrg visuals[numVisuals].offsetGreen == visuals[j].offsetGreen && 19535c4bbdfSmrg visuals[numVisuals].offsetBlue == visuals[j].offsetBlue) 19635c4bbdfSmrg break; 19735c4bbdfSmrg } 19835c4bbdfSmrg if (j < numVisuals) 19935c4bbdfSmrg break; 20035c4bbdfSmrg 20135c4bbdfSmrg visuals[numVisuals].vid = FakeClientID(0); 20235c4bbdfSmrg 20335c4bbdfSmrg depthIndex = UNDEFINED; 20435c4bbdfSmrg for (j = 0; j < numDepths; j++) 20535c4bbdfSmrg if (depths[j].depth == xnestVisuals[i].depth) { 20635c4bbdfSmrg depthIndex = j; 20735c4bbdfSmrg break; 20835c4bbdfSmrg } 20935c4bbdfSmrg 21035c4bbdfSmrg if (depthIndex == UNDEFINED) { 21135c4bbdfSmrg depthIndex = numDepths; 21235c4bbdfSmrg depths[depthIndex].depth = xnestVisuals[i].depth; 21335c4bbdfSmrg depths[depthIndex].numVids = 0; 21435c4bbdfSmrg depths[depthIndex].vids = 21535c4bbdfSmrg (VisualID *) malloc(MAXVISUALSPERDEPTH * sizeof(VisualID)); 21635c4bbdfSmrg numDepths++; 21735c4bbdfSmrg } 21835c4bbdfSmrg if (depths[depthIndex].numVids >= MAXVISUALSPERDEPTH) { 21935c4bbdfSmrg FatalError("Visual table overflow"); 22035c4bbdfSmrg } 22135c4bbdfSmrg depths[depthIndex].vids[depths[depthIndex].numVids] = 22235c4bbdfSmrg visuals[numVisuals].vid; 22335c4bbdfSmrg depths[depthIndex].numVids++; 22435c4bbdfSmrg 22535c4bbdfSmrg numVisuals++; 22605b261ecSmrg } 22735c4bbdfSmrg visuals = reallocarray(visuals, numVisuals, sizeof(VisualRec)); 22835c4bbdfSmrg 22935c4bbdfSmrg defaultVisual = visuals[xnestDefaultVisualIndex].vid; 23035c4bbdfSmrg rootDepth = visuals[xnestDefaultVisualIndex].nplanes; 23135c4bbdfSmrg 23235c4bbdfSmrg if (xnestParentWindow != 0) { 23335c4bbdfSmrg XGetWindowAttributes(xnestDisplay, xnestParentWindow, &gattributes); 23435c4bbdfSmrg xnestWidth = gattributes.width; 23535c4bbdfSmrg xnestHeight = gattributes.height; 23605b261ecSmrg } 23735c4bbdfSmrg 23835c4bbdfSmrg /* myNum */ 23935c4bbdfSmrg /* id */ 24035c4bbdfSmrg miScreenInit(pScreen, NULL, xnestWidth, xnestHeight, 1, 1, xnestWidth, rootDepth, numDepths, depths, defaultVisual, /* root visual */ 24135c4bbdfSmrg numVisuals, visuals); 24235c4bbdfSmrg 24335c4bbdfSmrg pScreen->defColormap = (Colormap) FakeClientID(0); 24435c4bbdfSmrg pScreen->minInstalledCmaps = MINCMAPS; 24535c4bbdfSmrg pScreen->maxInstalledCmaps = MAXCMAPS; 24635c4bbdfSmrg pScreen->backingStoreSupport = NotUseful; 24735c4bbdfSmrg pScreen->saveUnderSupport = NotUseful; 24835c4bbdfSmrg pScreen->whitePixel = xnestWhitePixel; 24935c4bbdfSmrg pScreen->blackPixel = xnestBlackPixel; 25035c4bbdfSmrg /* GCperDepth */ 2511b5d61b8Smrg /* defaultStipple */ 25235c4bbdfSmrg pScreen->devPrivate = NULL; 25335c4bbdfSmrg /* WindowPrivateLen */ 25435c4bbdfSmrg /* WindowPrivateSizes */ 25535c4bbdfSmrg /* totalWindowSize */ 25635c4bbdfSmrg /* GCPrivateLen */ 25735c4bbdfSmrg /* GCPrivateSizes */ 25835c4bbdfSmrg /* totalGCSize */ 25935c4bbdfSmrg 26035c4bbdfSmrg /* Random screen procedures */ 26135c4bbdfSmrg 26235c4bbdfSmrg pScreen->QueryBestSize = xnestQueryBestSize; 26335c4bbdfSmrg pScreen->SaveScreen = xnestSaveScreen; 26435c4bbdfSmrg pScreen->GetImage = xnestGetImage; 26535c4bbdfSmrg pScreen->GetSpans = xnestGetSpans; 26635c4bbdfSmrg 26735c4bbdfSmrg /* Window Procedures */ 26835c4bbdfSmrg 26935c4bbdfSmrg pScreen->CreateWindow = xnestCreateWindow; 27035c4bbdfSmrg pScreen->DestroyWindow = xnestDestroyWindow; 27135c4bbdfSmrg pScreen->PositionWindow = xnestPositionWindow; 27235c4bbdfSmrg pScreen->ChangeWindowAttributes = xnestChangeWindowAttributes; 27335c4bbdfSmrg pScreen->RealizeWindow = xnestRealizeWindow; 27435c4bbdfSmrg pScreen->UnrealizeWindow = xnestUnrealizeWindow; 27535c4bbdfSmrg pScreen->PostValidateTree = NULL; 27635c4bbdfSmrg pScreen->WindowExposures = xnestWindowExposures; 27735c4bbdfSmrg pScreen->CopyWindow = xnestCopyWindow; 27835c4bbdfSmrg pScreen->ClipNotify = xnestClipNotify; 27935c4bbdfSmrg 28035c4bbdfSmrg /* Pixmap procedures */ 28135c4bbdfSmrg 28235c4bbdfSmrg pScreen->CreatePixmap = xnestCreatePixmap; 28335c4bbdfSmrg pScreen->DestroyPixmap = xnestDestroyPixmap; 28435c4bbdfSmrg pScreen->ModifyPixmapHeader = xnestModifyPixmapHeader; 28535c4bbdfSmrg 28635c4bbdfSmrg /* Font procedures */ 28735c4bbdfSmrg 28835c4bbdfSmrg pScreen->RealizeFont = xnestRealizeFont; 28935c4bbdfSmrg pScreen->UnrealizeFont = xnestUnrealizeFont; 29035c4bbdfSmrg 29135c4bbdfSmrg /* GC procedures */ 29235c4bbdfSmrg 29335c4bbdfSmrg pScreen->CreateGC = xnestCreateGC; 29435c4bbdfSmrg 29535c4bbdfSmrg /* Colormap procedures */ 29635c4bbdfSmrg 29735c4bbdfSmrg pScreen->CreateColormap = xnestCreateColormap; 29835c4bbdfSmrg pScreen->DestroyColormap = xnestDestroyColormap; 29935c4bbdfSmrg pScreen->InstallColormap = xnestInstallColormap; 30035c4bbdfSmrg pScreen->UninstallColormap = xnestUninstallColormap; 30135c4bbdfSmrg pScreen->ListInstalledColormaps = xnestListInstalledColormaps; 30235c4bbdfSmrg pScreen->StoreColors = xnestStoreColors; 30335c4bbdfSmrg pScreen->ResolveColor = xnestResolveColor; 30435c4bbdfSmrg 30535c4bbdfSmrg pScreen->BitmapToRegion = xnestPixmapToRegion; 30635c4bbdfSmrg 30735c4bbdfSmrg /* OS layer procedures */ 30835c4bbdfSmrg 30935c4bbdfSmrg pScreen->BlockHandler = (ScreenBlockHandlerProcPtr) NoopDDA; 31035c4bbdfSmrg pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr) NoopDDA; 31135c4bbdfSmrg 31235c4bbdfSmrg miDCInitialize(pScreen, &xnestPointerCursorFuncs); /* init SW rendering */ 31335c4bbdfSmrg PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); 31435c4bbdfSmrg xnestCursorFuncs.spriteFuncs = PointPriv->spriteFuncs; 31535c4bbdfSmrg dixSetPrivate(&pScreen->devPrivates, xnestCursorScreenKey, 31635c4bbdfSmrg &xnestCursorFuncs); 31735c4bbdfSmrg PointPriv->spriteFuncs = &xnestPointerSpriteFuncs; 31835c4bbdfSmrg 31935c4bbdfSmrg pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay, 32035c4bbdfSmrg DefaultScreen(xnestDisplay)) 32135c4bbdfSmrg / DisplayWidth(xnestDisplay, DefaultScreen(xnestDisplay)); 32235c4bbdfSmrg pScreen->mmHeight = 32335c4bbdfSmrg xnestHeight * DisplayHeightMM(xnestDisplay, 32435c4bbdfSmrg DefaultScreen(xnestDisplay)) / 32535c4bbdfSmrg DisplayHeight(xnestDisplay, DefaultScreen(xnestDisplay)); 32635c4bbdfSmrg 32735c4bbdfSmrg /* overwrite miCloseScreen with our own */ 32835c4bbdfSmrg pScreen->CloseScreen = xnestCloseScreen; 32935c4bbdfSmrg 33035c4bbdfSmrg if (!miScreenDevPrivateInit(pScreen, xnestWidth, NULL)) 33135c4bbdfSmrg return FALSE; 33235c4bbdfSmrg 33335c4bbdfSmrg /* overwrite miSetShape with our own */ 33435c4bbdfSmrg pScreen->SetShape = xnestSetShape; 33535c4bbdfSmrg 33635c4bbdfSmrg /* devPrivates */ 33705b261ecSmrg 33805b261ecSmrg#define POSITION_OFFSET (pScreen->myNum * (xnestWidth + xnestHeight) / 32) 33935c4bbdfSmrg 34035c4bbdfSmrg if (xnestDoFullGeneration) { 34135c4bbdfSmrg 34235c4bbdfSmrg valuemask = CWBackPixel | CWEventMask | CWColormap; 34335c4bbdfSmrg attributes.background_pixel = xnestWhitePixel; 34435c4bbdfSmrg attributes.event_mask = xnestEventMask; 34535c4bbdfSmrg attributes.colormap = 34635c4bbdfSmrg xnestDefaultVisualColormap(xnestDefaultVisual(pScreen)); 34735c4bbdfSmrg 34835c4bbdfSmrg if (xnestParentWindow != 0) { 34935c4bbdfSmrg xnestDefaultWindows[pScreen->myNum] = xnestParentWindow; 35035c4bbdfSmrg XSelectInput(xnestDisplay, xnestDefaultWindows[pScreen->myNum], 35135c4bbdfSmrg xnestEventMask); 35235c4bbdfSmrg } 35335c4bbdfSmrg else 35435c4bbdfSmrg xnestDefaultWindows[pScreen->myNum] = 35535c4bbdfSmrg XCreateWindow(xnestDisplay, 35635c4bbdfSmrg DefaultRootWindow(xnestDisplay), 35735c4bbdfSmrg xnestX + POSITION_OFFSET, 35835c4bbdfSmrg xnestY + POSITION_OFFSET, 35935c4bbdfSmrg xnestWidth, xnestHeight, 36035c4bbdfSmrg xnestBorderWidth, 36135c4bbdfSmrg pScreen->rootDepth, 36235c4bbdfSmrg InputOutput, 36335c4bbdfSmrg xnestDefaultVisual(pScreen), 36435c4bbdfSmrg valuemask, &attributes); 36535c4bbdfSmrg 36635c4bbdfSmrg if (!xnestWindowName) 36735c4bbdfSmrg xnestWindowName = argv[0]; 36835c4bbdfSmrg 36935c4bbdfSmrg sizeHints.flags = PPosition | PSize | PMaxSize; 37035c4bbdfSmrg sizeHints.x = xnestX + POSITION_OFFSET; 37135c4bbdfSmrg sizeHints.y = xnestY + POSITION_OFFSET; 37235c4bbdfSmrg sizeHints.width = sizeHints.max_width = xnestWidth; 37335c4bbdfSmrg sizeHints.height = sizeHints.max_height = xnestHeight; 37435c4bbdfSmrg if (xnestUserGeometry & XValue || xnestUserGeometry & YValue) 37535c4bbdfSmrg sizeHints.flags |= USPosition; 37635c4bbdfSmrg if (xnestUserGeometry & WidthValue || xnestUserGeometry & HeightValue) 37735c4bbdfSmrg sizeHints.flags |= USSize; 37835c4bbdfSmrg XSetStandardProperties(xnestDisplay, 37935c4bbdfSmrg xnestDefaultWindows[pScreen->myNum], 38035c4bbdfSmrg xnestWindowName, 38135c4bbdfSmrg xnestWindowName, 38235c4bbdfSmrg xnestIconBitmap, argv, argc, &sizeHints); 38335c4bbdfSmrg 38435c4bbdfSmrg XMapWindow(xnestDisplay, xnestDefaultWindows[pScreen->myNum]); 38535c4bbdfSmrg 38635c4bbdfSmrg valuemask = CWBackPixmap | CWColormap; 38735c4bbdfSmrg attributes.background_pixmap = xnestScreenSaverPixmap; 38835c4bbdfSmrg attributes.colormap = 38935c4bbdfSmrg DefaultColormap(xnestDisplay, DefaultScreen(xnestDisplay)); 39035c4bbdfSmrg xnestScreenSaverWindows[pScreen->myNum] = 39135c4bbdfSmrg XCreateWindow(xnestDisplay, 39235c4bbdfSmrg xnestDefaultWindows[pScreen->myNum], 39335c4bbdfSmrg 0, 0, xnestWidth, xnestHeight, 0, 39435c4bbdfSmrg DefaultDepth(xnestDisplay, 39535c4bbdfSmrg DefaultScreen(xnestDisplay)), 39635c4bbdfSmrg InputOutput, DefaultVisual(xnestDisplay, 39735c4bbdfSmrg DefaultScreen 39835c4bbdfSmrg (xnestDisplay)), valuemask, 39935c4bbdfSmrg &attributes); 40035c4bbdfSmrg } 40135c4bbdfSmrg 40235c4bbdfSmrg if (!xnestCreateDefaultColormap(pScreen)) 40335c4bbdfSmrg return False; 40435c4bbdfSmrg 40535c4bbdfSmrg return True; 40605b261ecSmrg} 40705b261ecSmrg 40805b261ecSmrgBool 40935c4bbdfSmrgxnestCloseScreen(ScreenPtr pScreen) 41005b261ecSmrg{ 41135c4bbdfSmrg int i; 41235c4bbdfSmrg 41335c4bbdfSmrg for (i = 0; i < pScreen->numDepths; i++) 41435c4bbdfSmrg free(pScreen->allowedDepths[i].vids); 41535c4bbdfSmrg free(pScreen->allowedDepths); 41635c4bbdfSmrg free(pScreen->visuals); 41735c4bbdfSmrg free(pScreen->devPrivate); 41835c4bbdfSmrg 41935c4bbdfSmrg /* 42035c4bbdfSmrg If xnestDoFullGeneration all x resources will be destroyed upon closing 42135c4bbdfSmrg the display connection. There is no need to generate extra protocol. 42235c4bbdfSmrg */ 42335c4bbdfSmrg 42435c4bbdfSmrg return True; 42505b261ecSmrg} 426