Screen.c revision 4642e01f
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 "mibstore.h"
2505b261ecSmrg#include "micmap.h"
2605b261ecSmrg#include "colormapst.h"
2705b261ecSmrg#include "resource.h"
2805b261ecSmrg
2905b261ecSmrg#include "Xnest.h"
3005b261ecSmrg
3105b261ecSmrg#include "Display.h"
3205b261ecSmrg#include "Screen.h"
3305b261ecSmrg#include "XNGC.h"
3405b261ecSmrg#include "GCOps.h"
3505b261ecSmrg#include "Drawable.h"
3605b261ecSmrg#include "XNFont.h"
3705b261ecSmrg#include "Color.h"
3805b261ecSmrg#include "XNCursor.h"
3905b261ecSmrg#include "Visual.h"
4005b261ecSmrg#include "Events.h"
4105b261ecSmrg#include "Init.h"
4205b261ecSmrg#include "mipointer.h"
4305b261ecSmrg#include "Args.h"
444642e01fSmrg#include "mipointrst.h"
4505b261ecSmrg
4605b261ecSmrgWindow xnestDefaultWindows[MAXSCREENS];
4705b261ecSmrgWindow xnestScreenSaverWindows[MAXSCREENS];
484642e01fSmrgstatic int xnestCursorScreenKeyIndex;
494642e01fSmrgDevPrivateKey xnestCursorScreenKey = &xnestCursorScreenKeyIndex;
5005b261ecSmrg
5105b261ecSmrgScreenPtr
5205b261ecSmrgxnestScreen(Window window)
5305b261ecSmrg{
5405b261ecSmrg  int i;
5505b261ecSmrg
5605b261ecSmrg  for (i = 0; i < xnestNumScreens; i++)
5705b261ecSmrg    if (xnestDefaultWindows[i] == window)
5805b261ecSmrg      return screenInfo.screens[i];
5905b261ecSmrg
6005b261ecSmrg  return NULL;
6105b261ecSmrg}
6205b261ecSmrg
6305b261ecSmrgstatic int
6405b261ecSmrgoffset(unsigned long mask)
6505b261ecSmrg{
6605b261ecSmrg  int count;
6705b261ecSmrg
6805b261ecSmrg  for (count = 0; !(mask & 1) && count < 32; count++)
6905b261ecSmrg    mask >>= 1;
7005b261ecSmrg
7105b261ecSmrg  return count;
7205b261ecSmrg}
7305b261ecSmrg
7405b261ecSmrgstatic Bool
7505b261ecSmrgxnestSaveScreen(ScreenPtr pScreen, int what)
7605b261ecSmrg{
7705b261ecSmrg  if (xnestSoftwareScreenSaver)
7805b261ecSmrg    return False;
7905b261ecSmrg  else {
8005b261ecSmrg    switch (what) {
8105b261ecSmrg    case SCREEN_SAVER_ON:
8205b261ecSmrg      XMapRaised(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
8305b261ecSmrg      xnestSetScreenSaverColormapWindow(pScreen);
8405b261ecSmrg      break;
8505b261ecSmrg
8605b261ecSmrg    case SCREEN_SAVER_OFF:
8705b261ecSmrg      XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
8805b261ecSmrg      xnestSetInstalledColormapWindows(pScreen);
8905b261ecSmrg      break;
9005b261ecSmrg
9105b261ecSmrg    case SCREEN_SAVER_FORCER:
9205b261ecSmrg      lastEventTime = GetTimeInMillis();
9305b261ecSmrg      XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
9405b261ecSmrg      xnestSetInstalledColormapWindows(pScreen);
9505b261ecSmrg      break;
9605b261ecSmrg
9705b261ecSmrg    case SCREEN_SAVER_CYCLE:
9805b261ecSmrg      XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
9905b261ecSmrg      xnestSetInstalledColormapWindows(pScreen);
10005b261ecSmrg      break;
10105b261ecSmrg    }
10205b261ecSmrg    return True;
10305b261ecSmrg  }
10405b261ecSmrg}
10505b261ecSmrg
10605b261ecSmrgstatic Bool
10705b261ecSmrgxnestCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
10805b261ecSmrg{
10905b261ecSmrg    return FALSE;
11005b261ecSmrg}
11105b261ecSmrg
11205b261ecSmrgstatic void
11305b261ecSmrgxnestCrossScreen(ScreenPtr pScreen, Bool entering)
11405b261ecSmrg{
11505b261ecSmrg}
11605b261ecSmrg
11705b261ecSmrgstatic miPointerScreenFuncRec xnestPointerCursorFuncs =
11805b261ecSmrg{
11905b261ecSmrg    xnestCursorOffScreen,
12005b261ecSmrg    xnestCrossScreen,
12105b261ecSmrg    miPointerWarpCursor
12205b261ecSmrg};
12305b261ecSmrg
12405b261ecSmrgstatic miPointerSpriteFuncRec xnestPointerSpriteFuncs =
12505b261ecSmrg{
12605b261ecSmrg    xnestRealizeCursor,
12705b261ecSmrg    xnestUnrealizeCursor,
12805b261ecSmrg    xnestSetCursor,
12905b261ecSmrg    xnestMoveCursor,
1304642e01fSmrg    xnestDeviceCursorInitialize,
1314642e01fSmrg    xnestDeviceCursorCleanup
13205b261ecSmrg};
13305b261ecSmrg
13405b261ecSmrgBool
13505b261ecSmrgxnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
13605b261ecSmrg{
13705b261ecSmrg  VisualPtr visuals;
13805b261ecSmrg  DepthPtr depths;
13905b261ecSmrg  int numVisuals, numDepths;
14005b261ecSmrg  int i, j, depthIndex;
14105b261ecSmrg  unsigned long valuemask;
14205b261ecSmrg  XSetWindowAttributes attributes;
14305b261ecSmrg  XWindowAttributes gattributes;
14405b261ecSmrg  XSizeHints sizeHints;
14505b261ecSmrg  VisualID defaultVisual;
14605b261ecSmrg  int rootDepth;
1474642e01fSmrg  miPointerScreenPtr PointPriv;
14805b261ecSmrg
1494642e01fSmrg  if (!dixRequestPrivate(xnestWindowPrivateKey, sizeof(xnestPrivWin)))
1504642e01fSmrg      return False;
1514642e01fSmrg  if (!dixRequestPrivate(xnestGCPrivateKey, sizeof(xnestPrivGC)))
15205b261ecSmrg    return False;
15305b261ecSmrg
15405b261ecSmrg  visuals = (VisualPtr)xalloc(xnestNumVisuals * sizeof(VisualRec));
15505b261ecSmrg  numVisuals = 0;
15605b261ecSmrg
15705b261ecSmrg  depths = (DepthPtr)xalloc(MAXDEPTH * sizeof(DepthRec));
15805b261ecSmrg  depths[0].depth = 1;
15905b261ecSmrg  depths[0].numVids = 0;
16005b261ecSmrg  depths[0].vids = (VisualID *)xalloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
16105b261ecSmrg  numDepths = 1;
16205b261ecSmrg
16305b261ecSmrg  for (i = 0; i < xnestNumVisuals; i++) {
16405b261ecSmrg    visuals[numVisuals].class = xnestVisuals[i].class;
16505b261ecSmrg    visuals[numVisuals].bitsPerRGBValue = xnestVisuals[i].bits_per_rgb;
16605b261ecSmrg    visuals[numVisuals].ColormapEntries = xnestVisuals[i].colormap_size;
16705b261ecSmrg    visuals[numVisuals].nplanes = xnestVisuals[i].depth;
16805b261ecSmrg    visuals[numVisuals].redMask = xnestVisuals[i].red_mask;
16905b261ecSmrg    visuals[numVisuals].greenMask = xnestVisuals[i].green_mask;
17005b261ecSmrg    visuals[numVisuals].blueMask = xnestVisuals[i].blue_mask;
17105b261ecSmrg    visuals[numVisuals].offsetRed = offset(xnestVisuals[i].red_mask);
17205b261ecSmrg    visuals[numVisuals].offsetGreen = offset(xnestVisuals[i].green_mask);
17305b261ecSmrg    visuals[numVisuals].offsetBlue = offset(xnestVisuals[i].blue_mask);
17405b261ecSmrg
17505b261ecSmrg    /* Check for and remove duplicates. */
17605b261ecSmrg    for (j = 0; j < numVisuals; j++) {
17705b261ecSmrg      if (visuals[numVisuals].class           == visuals[j].class           &&
17805b261ecSmrg	  visuals[numVisuals].bitsPerRGBValue == visuals[j].bitsPerRGBValue &&
17905b261ecSmrg	  visuals[numVisuals].ColormapEntries == visuals[j].ColormapEntries &&
18005b261ecSmrg	  visuals[numVisuals].nplanes         == visuals[j].nplanes         &&
18105b261ecSmrg	  visuals[numVisuals].redMask         == visuals[j].redMask         &&
18205b261ecSmrg	  visuals[numVisuals].greenMask       == visuals[j].greenMask       &&
18305b261ecSmrg	  visuals[numVisuals].blueMask        == visuals[j].blueMask        &&
18405b261ecSmrg	  visuals[numVisuals].offsetRed       == visuals[j].offsetRed       &&
18505b261ecSmrg	  visuals[numVisuals].offsetGreen     == visuals[j].offsetGreen     &&
18605b261ecSmrg	  visuals[numVisuals].offsetBlue      == visuals[j].offsetBlue)
18705b261ecSmrg	break;
18805b261ecSmrg    }
18905b261ecSmrg    if (j < numVisuals)
19005b261ecSmrg      break;
19105b261ecSmrg
19205b261ecSmrg    visuals[numVisuals].vid = FakeClientID(0);
19305b261ecSmrg
19405b261ecSmrg    depthIndex = UNDEFINED;
19505b261ecSmrg    for (j = 0; j < numDepths; j++)
19605b261ecSmrg      if (depths[j].depth == xnestVisuals[i].depth) {
19705b261ecSmrg	depthIndex = j;
19805b261ecSmrg	break;
19905b261ecSmrg      }
20005b261ecSmrg
20105b261ecSmrg    if (depthIndex == UNDEFINED) {
20205b261ecSmrg      depthIndex = numDepths;
20305b261ecSmrg      depths[depthIndex].depth = xnestVisuals[i].depth;
20405b261ecSmrg      depths[depthIndex].numVids = 0;
20505b261ecSmrg      depths[depthIndex].vids =
20605b261ecSmrg	(VisualID *)xalloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
20705b261ecSmrg      numDepths++;
20805b261ecSmrg    }
20905b261ecSmrg    if (depths[depthIndex].numVids >= MAXVISUALSPERDEPTH) {
21005b261ecSmrg	FatalError("Visual table overflow");
21105b261ecSmrg    }
21205b261ecSmrg    depths[depthIndex].vids[depths[depthIndex].numVids] =
21305b261ecSmrg      visuals[numVisuals].vid;
21405b261ecSmrg    depths[depthIndex].numVids++;
21505b261ecSmrg
21605b261ecSmrg    numVisuals++;
21705b261ecSmrg  }
21805b261ecSmrg  visuals = (VisualPtr)xrealloc(visuals, numVisuals * sizeof(VisualRec));
21905b261ecSmrg
22005b261ecSmrg  defaultVisual = visuals[xnestDefaultVisualIndex].vid;
22105b261ecSmrg  rootDepth = visuals[xnestDefaultVisualIndex].nplanes;
22205b261ecSmrg
22305b261ecSmrg  if (xnestParentWindow != 0) {
22405b261ecSmrg    XGetWindowAttributes(xnestDisplay, xnestParentWindow, &gattributes);
22505b261ecSmrg    xnestWidth = gattributes.width;
22605b261ecSmrg    xnestHeight = gattributes.height;
22705b261ecSmrg  }
22805b261ecSmrg
22905b261ecSmrg  /* myNum */
23005b261ecSmrg  /* id */
23105b261ecSmrg  miScreenInit(pScreen, NULL, xnestWidth, xnestHeight, 1, 1, xnestWidth,
23205b261ecSmrg	       rootDepth,
23305b261ecSmrg	       numDepths, depths,
23405b261ecSmrg	       defaultVisual, /* root visual */
23505b261ecSmrg	       numVisuals, visuals);
23605b261ecSmrg
23705b261ecSmrg/*  miInitializeBackingStore(pScreen); */
23805b261ecSmrg
23905b261ecSmrg  pScreen->defColormap = (Colormap) FakeClientID(0);
24005b261ecSmrg  pScreen->minInstalledCmaps = MINCMAPS;
24105b261ecSmrg  pScreen->maxInstalledCmaps = MAXCMAPS;
24205b261ecSmrg  pScreen->backingStoreSupport = NotUseful;
24305b261ecSmrg  pScreen->saveUnderSupport = NotUseful;
24405b261ecSmrg  pScreen->whitePixel = xnestWhitePixel;
24505b261ecSmrg  pScreen->blackPixel = xnestBlackPixel;
24605b261ecSmrg  /* rgf */
24705b261ecSmrg  /* GCperDepth */
24805b261ecSmrg  /* PixmapPerDepth */
24905b261ecSmrg  pScreen->devPrivate = NULL;
25005b261ecSmrg  /* WindowPrivateLen */
25105b261ecSmrg  /* WindowPrivateSizes */
25205b261ecSmrg  /* totalWindowSize */
25305b261ecSmrg  /* GCPrivateLen */
25405b261ecSmrg  /* GCPrivateSizes */
25505b261ecSmrg  /* totalGCSize */
25605b261ecSmrg
25705b261ecSmrg  /* Random screen procedures */
25805b261ecSmrg
25905b261ecSmrg  pScreen->QueryBestSize = xnestQueryBestSize;
26005b261ecSmrg  pScreen->SaveScreen = xnestSaveScreen;
26105b261ecSmrg  pScreen->GetImage = xnestGetImage;
26205b261ecSmrg  pScreen->GetSpans = xnestGetSpans;
26305b261ecSmrg  pScreen->PointerNonInterestBox = NULL;
26405b261ecSmrg  pScreen->SourceValidate = NULL;
26505b261ecSmrg
26605b261ecSmrg  /* Window Procedures */
26705b261ecSmrg
26805b261ecSmrg  pScreen->CreateWindow = xnestCreateWindow;
26905b261ecSmrg  pScreen->DestroyWindow = xnestDestroyWindow;
27005b261ecSmrg  pScreen->PositionWindow = xnestPositionWindow;
27105b261ecSmrg  pScreen->ChangeWindowAttributes = xnestChangeWindowAttributes;
27205b261ecSmrg  pScreen->RealizeWindow = xnestRealizeWindow;
27305b261ecSmrg  pScreen->UnrealizeWindow = xnestUnrealizeWindow;
27405b261ecSmrg  pScreen->PostValidateTree = NULL;
27505b261ecSmrg  pScreen->WindowExposures = xnestWindowExposures;
27605b261ecSmrg  pScreen->CopyWindow = xnestCopyWindow;
27705b261ecSmrg  pScreen->ClipNotify = xnestClipNotify;
27805b261ecSmrg
27905b261ecSmrg  /* Pixmap procedures */
28005b261ecSmrg
28105b261ecSmrg  pScreen->CreatePixmap = xnestCreatePixmap;
28205b261ecSmrg  pScreen->DestroyPixmap = xnestDestroyPixmap;
28305b261ecSmrg
28405b261ecSmrg  /* Font procedures */
28505b261ecSmrg
28605b261ecSmrg  pScreen->RealizeFont = xnestRealizeFont;
28705b261ecSmrg  pScreen->UnrealizeFont = xnestUnrealizeFont;
28805b261ecSmrg
28905b261ecSmrg  /* GC procedures */
29005b261ecSmrg
29105b261ecSmrg  pScreen->CreateGC = xnestCreateGC;
29205b261ecSmrg
29305b261ecSmrg  /* Colormap procedures */
29405b261ecSmrg
29505b261ecSmrg  pScreen->CreateColormap = xnestCreateColormap;
29605b261ecSmrg  pScreen->DestroyColormap = xnestDestroyColormap;
29705b261ecSmrg  pScreen->InstallColormap = xnestInstallColormap;
29805b261ecSmrg  pScreen->UninstallColormap = xnestUninstallColormap;
29905b261ecSmrg  pScreen->ListInstalledColormaps = xnestListInstalledColormaps;
30005b261ecSmrg  pScreen->StoreColors = xnestStoreColors;
30105b261ecSmrg  pScreen->ResolveColor = xnestResolveColor;
30205b261ecSmrg
30305b261ecSmrg   pScreen->BitmapToRegion = xnestPixmapToRegion;
30405b261ecSmrg
30505b261ecSmrg  /* OS layer procedures */
30605b261ecSmrg
30705b261ecSmrg  pScreen->BlockHandler = (ScreenBlockHandlerProcPtr)NoopDDA;
30805b261ecSmrg  pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr)NoopDDA;
30905b261ecSmrg  pScreen->blockData = NULL;
31005b261ecSmrg  pScreen->wakeupData = NULL;
31105b261ecSmrg
3124642e01fSmrg  miDCInitialize(pScreen, &xnestPointerCursorFuncs); /* init SW rendering */
3134642e01fSmrg  PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
3144642e01fSmrg  xnestCursorFuncs.spriteFuncs = PointPriv->spriteFuncs;
3154642e01fSmrg  dixSetPrivate(&pScreen->devPrivates, xnestCursorScreenKey, &xnestCursorFuncs);
3164642e01fSmrg  PointPriv->spriteFuncs = &xnestPointerSpriteFuncs;
31705b261ecSmrg
31805b261ecSmrg  pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay,
31905b261ecSmrg		       DefaultScreen(xnestDisplay)) /
32005b261ecSmrg			 DisplayWidth(xnestDisplay,
32105b261ecSmrg			   DefaultScreen(xnestDisplay));
32205b261ecSmrg  pScreen->mmHeight = xnestHeight * DisplayHeightMM(xnestDisplay,
32305b261ecSmrg		        DefaultScreen(xnestDisplay)) /
32405b261ecSmrg			  DisplayHeight(xnestDisplay,
32505b261ecSmrg			    DefaultScreen(xnestDisplay));
32605b261ecSmrg
32705b261ecSmrg  /* overwrite miCloseScreen with our own */
32805b261ecSmrg  pScreen->CloseScreen = xnestCloseScreen;
32905b261ecSmrg
33005b261ecSmrg  if (!miScreenDevPrivateInit(pScreen, xnestWidth, NULL))
33105b261ecSmrg      return FALSE;
33205b261ecSmrg
33305b261ecSmrg  /* overwrite miSetShape with our own */
33405b261ecSmrg  pScreen->SetShape = xnestSetShape;
33505b261ecSmrg
33605b261ecSmrg  /* devPrivates */
33705b261ecSmrg
33805b261ecSmrg#define POSITION_OFFSET (pScreen->myNum * (xnestWidth + xnestHeight) / 32)
33905b261ecSmrg
34005b261ecSmrg  if (xnestDoFullGeneration) {
34105b261ecSmrg
34205b261ecSmrg    valuemask = CWBackPixel | CWEventMask | CWColormap;
34305b261ecSmrg    attributes.background_pixel = xnestWhitePixel;
34405b261ecSmrg    attributes.event_mask = xnestEventMask;
34505b261ecSmrg    attributes.colormap = xnestDefaultVisualColormap(xnestDefaultVisual(pScreen));
34605b261ecSmrg
34705b261ecSmrg    if (xnestParentWindow != 0) {
34805b261ecSmrg      xnestDefaultWindows[pScreen->myNum] = xnestParentWindow;
34905b261ecSmrg      XSelectInput (xnestDisplay, xnestDefaultWindows[pScreen->myNum],
35005b261ecSmrg		    xnestEventMask);
35105b261ecSmrg    } else
35205b261ecSmrg      xnestDefaultWindows[pScreen->myNum] =
35305b261ecSmrg	XCreateWindow(xnestDisplay,
35405b261ecSmrg		      DefaultRootWindow(xnestDisplay),
35505b261ecSmrg		      xnestX + POSITION_OFFSET,
35605b261ecSmrg		      xnestY + POSITION_OFFSET,
35705b261ecSmrg		      xnestWidth, xnestHeight,
35805b261ecSmrg		      xnestBorderWidth,
35905b261ecSmrg		      pScreen->rootDepth,
36005b261ecSmrg		      InputOutput,
36105b261ecSmrg		      xnestDefaultVisual(pScreen),
36205b261ecSmrg		      valuemask, &attributes);
36305b261ecSmrg
36405b261ecSmrg    if (!xnestWindowName)
36505b261ecSmrg      xnestWindowName = argv[0];
36605b261ecSmrg
36705b261ecSmrg    sizeHints.flags = PPosition | PSize | PMaxSize;
36805b261ecSmrg    sizeHints.x = xnestX + POSITION_OFFSET;
36905b261ecSmrg    sizeHints.y = xnestY + POSITION_OFFSET;
37005b261ecSmrg    sizeHints.width = sizeHints.max_width = xnestWidth;
37105b261ecSmrg    sizeHints.height = sizeHints.max_height = xnestHeight;
37205b261ecSmrg    if (xnestUserGeometry & XValue || xnestUserGeometry & YValue)
37305b261ecSmrg      sizeHints.flags |= USPosition;
37405b261ecSmrg    if (xnestUserGeometry & WidthValue || xnestUserGeometry & HeightValue)
37505b261ecSmrg      sizeHints.flags |= USSize;
37605b261ecSmrg    XSetStandardProperties(xnestDisplay,
37705b261ecSmrg			   xnestDefaultWindows[pScreen->myNum],
37805b261ecSmrg			   xnestWindowName,
37905b261ecSmrg			   xnestWindowName,
38005b261ecSmrg			   xnestIconBitmap,
38105b261ecSmrg			   argv, argc, &sizeHints);
38205b261ecSmrg
38305b261ecSmrg    XMapWindow(xnestDisplay, xnestDefaultWindows[pScreen->myNum]);
38405b261ecSmrg
38505b261ecSmrg    valuemask = CWBackPixmap | CWColormap;
38605b261ecSmrg    attributes.background_pixmap = xnestScreenSaverPixmap;
38705b261ecSmrg    attributes.colormap =
38805b261ecSmrg      DefaultColormap(xnestDisplay, DefaultScreen(xnestDisplay));
38905b261ecSmrg    xnestScreenSaverWindows[pScreen->myNum] =
39005b261ecSmrg      XCreateWindow(xnestDisplay,
39105b261ecSmrg		    xnestDefaultWindows[pScreen->myNum],
39205b261ecSmrg		    0, 0, xnestWidth, xnestHeight, 0,
39305b261ecSmrg		    DefaultDepth(xnestDisplay, DefaultScreen(xnestDisplay)),
39405b261ecSmrg		    InputOutput,
39505b261ecSmrg		    DefaultVisual(xnestDisplay, DefaultScreen(xnestDisplay)),
39605b261ecSmrg		    valuemask, &attributes);
39705b261ecSmrg  }
39805b261ecSmrg
39905b261ecSmrg  if (!xnestCreateDefaultColormap(pScreen)) return False;
40005b261ecSmrg
40105b261ecSmrg  return True;
40205b261ecSmrg}
40305b261ecSmrg
40405b261ecSmrgBool
40505b261ecSmrgxnestCloseScreen(int index, ScreenPtr pScreen)
40605b261ecSmrg{
40705b261ecSmrg  int i;
40805b261ecSmrg
40905b261ecSmrg  for (i = 0; i < pScreen->numDepths; i++)
41005b261ecSmrg    xfree(pScreen->allowedDepths[i].vids);
41105b261ecSmrg  xfree(pScreen->allowedDepths);
41205b261ecSmrg  xfree(pScreen->visuals);
41305b261ecSmrg  xfree(pScreen->devPrivate);
41405b261ecSmrg
41505b261ecSmrg  /*
41605b261ecSmrg    If xnestDoFullGeneration all x resources will be destroyed upon closing
41705b261ecSmrg    the display connection.  There is no need to generate extra protocol.
41805b261ecSmrg    */
41905b261ecSmrg
42005b261ecSmrg  return True;
42105b261ecSmrg}
422