compinit.c revision 05b261ec
105b261ecSmrg/*
205b261ecSmrg * Copyright © 2006 Sun Microsystems
305b261ecSmrg *
405b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its
505b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that
605b261ecSmrg * the above copyright notice appear in all copies and that both that
705b261ecSmrg * copyright notice and this permission notice appear in supporting
805b261ecSmrg * documentation, and that the name of Sun Microsystems not be used in
905b261ecSmrg * advertising or publicity pertaining to distribution of the software without
1005b261ecSmrg * specific, written prior permission.  Sun Microsystems makes no
1105b261ecSmrg * representations about the suitability of this software for any purpose.  It
1205b261ecSmrg * is provided "as is" without express or implied warranty.
1305b261ecSmrg *
1405b261ecSmrg * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1505b261ecSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
1605b261ecSmrg * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1705b261ecSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
1805b261ecSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
1905b261ecSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2005b261ecSmrg * PERFORMANCE OF THIS SOFTWARE.
2105b261ecSmrg *
2205b261ecSmrg * Copyright © 2003 Keith Packard
2305b261ecSmrg *
2405b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its
2505b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that
2605b261ecSmrg * the above copyright notice appear in all copies and that both that
2705b261ecSmrg * copyright notice and this permission notice appear in supporting
2805b261ecSmrg * documentation, and that the name of Keith Packard not be used in
2905b261ecSmrg * advertising or publicity pertaining to distribution of the software without
3005b261ecSmrg * specific, written prior permission.  Keith Packard makes no
3105b261ecSmrg * representations about the suitability of this software for any purpose.  It
3205b261ecSmrg * is provided "as is" without express or implied warranty.
3305b261ecSmrg *
3405b261ecSmrg * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
3505b261ecSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
3605b261ecSmrg * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
3705b261ecSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
3805b261ecSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
3905b261ecSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
4005b261ecSmrg * PERFORMANCE OF THIS SOFTWARE.
4105b261ecSmrg */
4205b261ecSmrg
4305b261ecSmrg#ifdef HAVE_DIX_CONFIG_H
4405b261ecSmrg#include <dix-config.h>
4505b261ecSmrg#endif
4605b261ecSmrg
4705b261ecSmrg#include "compint.h"
4805b261ecSmrg
4905b261ecSmrgint	CompScreenPrivateIndex;
5005b261ecSmrgint	CompWindowPrivateIndex;
5105b261ecSmrgint	CompSubwindowsPrivateIndex;
5205b261ecSmrgstatic int	CompGeneration;
5305b261ecSmrg
5405b261ecSmrg
5505b261ecSmrgstatic Bool
5605b261ecSmrgcompCloseScreen (int index, ScreenPtr pScreen)
5705b261ecSmrg{
5805b261ecSmrg    CompScreenPtr   cs = GetCompScreen (pScreen);
5905b261ecSmrg    Bool	    ret;
6005b261ecSmrg
6105b261ecSmrg    xfree (cs->alternateVisuals);
6205b261ecSmrg
6305b261ecSmrg    pScreen->CloseScreen = cs->CloseScreen;
6405b261ecSmrg    pScreen->BlockHandler = cs->BlockHandler;
6505b261ecSmrg    pScreen->InstallColormap = cs->InstallColormap;
6605b261ecSmrg    pScreen->ReparentWindow = cs->ReparentWindow;
6705b261ecSmrg    pScreen->MoveWindow = cs->MoveWindow;
6805b261ecSmrg    pScreen->ResizeWindow = cs->ResizeWindow;
6905b261ecSmrg    pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
7005b261ecSmrg
7105b261ecSmrg    pScreen->ClipNotify = cs->ClipNotify;
7205b261ecSmrg    pScreen->PaintWindowBackground = cs->PaintWindowBackground;
7305b261ecSmrg    pScreen->UnrealizeWindow = cs->UnrealizeWindow;
7405b261ecSmrg    pScreen->RealizeWindow = cs->RealizeWindow;
7505b261ecSmrg    pScreen->DestroyWindow = cs->DestroyWindow;
7605b261ecSmrg    pScreen->CreateWindow = cs->CreateWindow;
7705b261ecSmrg    pScreen->CopyWindow = cs->CopyWindow;
7805b261ecSmrg    pScreen->PositionWindow = cs->PositionWindow;
7905b261ecSmrg
8005b261ecSmrg    deleteCompOverlayClientsForScreen(pScreen);
8105b261ecSmrg
8205b261ecSmrg    /*
8305b261ecSmrg    ** Note: no need to call DeleteWindow; the server has
8405b261ecSmrg    ** already destroyed it.
8505b261ecSmrg    */
8605b261ecSmrg    cs->pOverlayWin = NULL;
8705b261ecSmrg
8805b261ecSmrg    xfree (cs);
8905b261ecSmrg    pScreen->devPrivates[CompScreenPrivateIndex].ptr = 0;
9005b261ecSmrg    ret = (*pScreen->CloseScreen) (index, pScreen);
9105b261ecSmrg
9205b261ecSmrg    return ret;
9305b261ecSmrg}
9405b261ecSmrg
9505b261ecSmrgstatic void
9605b261ecSmrgcompInstallColormap (ColormapPtr pColormap)
9705b261ecSmrg{
9805b261ecSmrg    VisualPtr	    pVisual = pColormap->pVisual;
9905b261ecSmrg    ScreenPtr	    pScreen = pColormap->pScreen;
10005b261ecSmrg    CompScreenPtr   cs = GetCompScreen (pScreen);
10105b261ecSmrg    int		    a;
10205b261ecSmrg
10305b261ecSmrg    for (a = 0; a < cs->numAlternateVisuals; a++)
10405b261ecSmrg	if (pVisual->vid == cs->alternateVisuals[a])
10505b261ecSmrg	    return;
10605b261ecSmrg    pScreen->InstallColormap = cs->InstallColormap;
10705b261ecSmrg    (*pScreen->InstallColormap) (pColormap);
10805b261ecSmrg    cs->InstallColormap = pScreen->InstallColormap;
10905b261ecSmrg    pScreen->InstallColormap = compInstallColormap;
11005b261ecSmrg}
11105b261ecSmrg
11205b261ecSmrgstatic void
11305b261ecSmrgcompScreenUpdate (ScreenPtr pScreen)
11405b261ecSmrg{
11505b261ecSmrg    CompScreenPtr   cs = GetCompScreen (pScreen);
11605b261ecSmrg
11705b261ecSmrg    compCheckTree (pScreen);
11805b261ecSmrg    if (cs->damaged)
11905b261ecSmrg    {
12005b261ecSmrg	compWindowUpdate (WindowTable[pScreen->myNum]);
12105b261ecSmrg	cs->damaged = FALSE;
12205b261ecSmrg    }
12305b261ecSmrg}
12405b261ecSmrg
12505b261ecSmrgstatic void
12605b261ecSmrgcompBlockHandler (int	    i,
12705b261ecSmrg		  pointer   blockData,
12805b261ecSmrg		  pointer   pTimeout,
12905b261ecSmrg		  pointer   pReadmask)
13005b261ecSmrg{
13105b261ecSmrg    ScreenPtr	    pScreen = screenInfo.screens[i];
13205b261ecSmrg    CompScreenPtr   cs = GetCompScreen (pScreen);
13305b261ecSmrg
13405b261ecSmrg    pScreen->BlockHandler = cs->BlockHandler;
13505b261ecSmrg    compScreenUpdate (pScreen);
13605b261ecSmrg    (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
13705b261ecSmrg    cs->BlockHandler = pScreen->BlockHandler;
13805b261ecSmrg    pScreen->BlockHandler = compBlockHandler;
13905b261ecSmrg}
14005b261ecSmrg
14105b261ecSmrg/*
14205b261ecSmrg * Add alternate visuals -- always expose an ARGB32 and RGB24 visual
14305b261ecSmrg */
14405b261ecSmrg
14505b261ecSmrgstatic DepthPtr
14605b261ecSmrgcompFindVisuallessDepth (ScreenPtr pScreen, int d)
14705b261ecSmrg{
14805b261ecSmrg    int		i;
14905b261ecSmrg
15005b261ecSmrg    for (i = 0; i < pScreen->numDepths; i++)
15105b261ecSmrg    {
15205b261ecSmrg	DepthPtr    depth = &pScreen->allowedDepths[i];
15305b261ecSmrg	if (depth->depth == d)
15405b261ecSmrg	{
15505b261ecSmrg	    /*
15605b261ecSmrg	     * Make sure it doesn't have visuals already
15705b261ecSmrg	     */
15805b261ecSmrg	    if (depth->numVids)
15905b261ecSmrg		return 0;
16005b261ecSmrg	    /*
16105b261ecSmrg	     * looks fine
16205b261ecSmrg	     */
16305b261ecSmrg	    return depth;
16405b261ecSmrg	}
16505b261ecSmrg    }
16605b261ecSmrg    /*
16705b261ecSmrg     * If there isn't one, then it's gonna be hard to have
16805b261ecSmrg     * an associated visual
16905b261ecSmrg     */
17005b261ecSmrg    return 0;
17105b261ecSmrg}
17205b261ecSmrg
17305b261ecSmrg/*
17405b261ecSmrg * Add a list of visual IDs to the list of visuals to implicitly redirect.
17505b261ecSmrg */
17605b261ecSmrgstatic Bool
17705b261ecSmrgcompRegisterAlternateVisuals (CompScreenPtr cs, VisualID *vids, int nVisuals)
17805b261ecSmrg{
17905b261ecSmrg    VisualID *p;
18005b261ecSmrg
18105b261ecSmrg    p = xrealloc(cs->alternateVisuals,
18205b261ecSmrg		 sizeof(VisualID) * (cs->numAlternateVisuals + nVisuals));
18305b261ecSmrg    if(p == NULL)
18405b261ecSmrg	return FALSE;
18505b261ecSmrg
18605b261ecSmrg    memcpy(&p[cs->numAlternateVisuals], vids, sizeof(VisualID) * nVisuals);
18705b261ecSmrg
18805b261ecSmrg    cs->alternateVisuals = p;
18905b261ecSmrg    cs->numAlternateVisuals += nVisuals;
19005b261ecSmrg
19105b261ecSmrg    return TRUE;
19205b261ecSmrg}
19305b261ecSmrg
19405b261ecSmrg_X_EXPORT
19505b261ecSmrgBool CompositeRegisterAlternateVisuals (ScreenPtr pScreen, VisualID *vids,
19605b261ecSmrg					int nVisuals)
19705b261ecSmrg{
19805b261ecSmrg    CompScreenPtr cs = GetCompScreen (pScreen);
19905b261ecSmrg    return compRegisterAlternateVisuals(cs, vids, nVisuals);
20005b261ecSmrg}
20105b261ecSmrg
20205b261ecSmrgtypedef struct _alternateVisual {
20305b261ecSmrg    int		depth;
20405b261ecSmrg    CARD32	format;
20505b261ecSmrg} CompAlternateVisual;
20605b261ecSmrg
20705b261ecSmrgstatic CompAlternateVisual  altVisuals[] = {
20805b261ecSmrg#if COMP_INCLUDE_RGB24_VISUAL
20905b261ecSmrg    {	24,	PICT_r8g8b8 },
21005b261ecSmrg#endif
21105b261ecSmrg    {	32,	PICT_a8r8g8b8 },
21205b261ecSmrg};
21305b261ecSmrg
21405b261ecSmrgstatic const int NUM_COMP_ALTERNATE_VISUALS = sizeof(altVisuals) /
21505b261ecSmrg					      sizeof(CompAlternateVisual);
21605b261ecSmrg
21705b261ecSmrgstatic Bool
21805b261ecSmrgcompAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
21905b261ecSmrg		       CompAlternateVisual *alt)
22005b261ecSmrg{
22105b261ecSmrg    VisualPtr	    visual, visuals;
22205b261ecSmrg    int		    i;
22305b261ecSmrg    int		    numVisuals;
22405b261ecSmrg    XID		    *installedCmaps;
22505b261ecSmrg    ColormapPtr	    installedCmap;
22605b261ecSmrg    int		    numInstalledCmaps;
22705b261ecSmrg    DepthPtr	    depth;
22805b261ecSmrg    PictFormatPtr   pPictFormat;
22905b261ecSmrg    VisualID	    *vid;
23005b261ecSmrg    unsigned long   alphaMask;
23105b261ecSmrg
23205b261ecSmrg    /*
23305b261ecSmrg     * The ARGB32 visual is always available.  Other alternate depth visuals
23405b261ecSmrg     * are only provided if their depth is less than the root window depth.
23505b261ecSmrg     * There's no deep reason for this.
23605b261ecSmrg     */
23705b261ecSmrg    if (alt->depth >= pScreen->rootDepth && alt->depth != 32)
23805b261ecSmrg	return FALSE;
23905b261ecSmrg
24005b261ecSmrg    depth = compFindVisuallessDepth (pScreen, alt->depth);
24105b261ecSmrg    if (!depth)
24205b261ecSmrg	/* alt->depth doesn't exist or already has alternate visuals. */
24305b261ecSmrg	return TRUE;
24405b261ecSmrg
24505b261ecSmrg    pPictFormat = PictureMatchFormat (pScreen, alt->depth, alt->format);
24605b261ecSmrg    if (!pPictFormat)
24705b261ecSmrg	return FALSE;
24805b261ecSmrg
24905b261ecSmrg    vid = xalloc(sizeof(VisualID));
25005b261ecSmrg    if (!vid)
25105b261ecSmrg	return FALSE;
25205b261ecSmrg
25305b261ecSmrg    /* Find the installed colormaps */
25405b261ecSmrg    installedCmaps = xalloc (pScreen->maxInstalledCmaps * sizeof (XID));
25505b261ecSmrg    if (!installedCmaps) {
25605b261ecSmrg	xfree(vid);
25705b261ecSmrg	return FALSE;
25805b261ecSmrg    }
25905b261ecSmrg    numInstalledCmaps = pScreen->ListInstalledColormaps(pScreen,
26005b261ecSmrg	    installedCmaps);
26105b261ecSmrg
26205b261ecSmrg    /* realloc the visual array to fit the new one in place */
26305b261ecSmrg    numVisuals = pScreen->numVisuals;
26405b261ecSmrg    visuals = xrealloc(pScreen->visuals, (numVisuals + 1) * sizeof(VisualRec));
26505b261ecSmrg    if (!visuals) {
26605b261ecSmrg	xfree(vid);
26705b261ecSmrg	xfree(installedCmaps);
26805b261ecSmrg	return FALSE;
26905b261ecSmrg    }
27005b261ecSmrg
27105b261ecSmrg    /*
27205b261ecSmrg     * Fix up any existing installed colormaps -- we'll assume that
27305b261ecSmrg     * the only ones created so far have been installed.  If this
27405b261ecSmrg     * isn't true, we'll have to walk the resource database looking
27505b261ecSmrg     * for all colormaps.
27605b261ecSmrg     */
27705b261ecSmrg    for (i = 0; i < numInstalledCmaps; i++) {
27805b261ecSmrg	int j;
27905b261ecSmrg
28005b261ecSmrg	installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP);
28105b261ecSmrg	if (!installedCmap)
28205b261ecSmrg	    continue;
28305b261ecSmrg	j = installedCmap->pVisual - pScreen->visuals;
28405b261ecSmrg	installedCmap->pVisual = &visuals[j];
28505b261ecSmrg    }
28605b261ecSmrg
28705b261ecSmrg    xfree(installedCmaps);
28805b261ecSmrg
28905b261ecSmrg    pScreen->visuals = visuals;
29005b261ecSmrg    visual = visuals + pScreen->numVisuals; /* the new one */
29105b261ecSmrg    pScreen->numVisuals++;
29205b261ecSmrg
29305b261ecSmrg    /* Initialize the visual */
29405b261ecSmrg    visual->vid = FakeClientID (0);
29505b261ecSmrg    visual->bitsPerRGBValue = 8;
29605b261ecSmrg    if (PICT_FORMAT_TYPE(alt->format) == PICT_TYPE_COLOR) {
29705b261ecSmrg	visual->class = PseudoColor;
29805b261ecSmrg	visual->nplanes = PICT_FORMAT_BPP(alt->format);
29905b261ecSmrg	visual->ColormapEntries = 1 << visual->nplanes;
30005b261ecSmrg    } else {
30105b261ecSmrg	DirectFormatRec *direct = &pPictFormat->direct;
30205b261ecSmrg	visual->class = TrueColor;
30305b261ecSmrg	visual->redMask   = ((unsigned long)direct->redMask) << direct->red;
30405b261ecSmrg	visual->greenMask = ((unsigned long)direct->greenMask) << direct->green;
30505b261ecSmrg	visual->blueMask  = ((unsigned long)direct->blueMask) << direct->blue;
30605b261ecSmrg	alphaMask = ((unsigned long)direct->alphaMask) << direct->alpha;
30705b261ecSmrg	visual->offsetRed   = direct->red;
30805b261ecSmrg	visual->offsetGreen = direct->green;
30905b261ecSmrg	visual->offsetBlue  = direct->blue;
31005b261ecSmrg	/*
31105b261ecSmrg	 * Include A bits in this (unlike GLX which includes only RGB)
31205b261ecSmrg	 * This lets DIX compute suitable masks for colormap allocations
31305b261ecSmrg	 */
31405b261ecSmrg	visual->nplanes = Ones (visual->redMask |
31505b261ecSmrg		visual->greenMask |
31605b261ecSmrg		visual->blueMask |
31705b261ecSmrg		alphaMask);
31805b261ecSmrg	/* find widest component */
31905b261ecSmrg	visual->ColormapEntries = (1 << max (Ones (visual->redMask),
32005b261ecSmrg		    max (Ones (visual->greenMask),
32105b261ecSmrg			Ones (visual->blueMask))));
32205b261ecSmrg    }
32305b261ecSmrg
32405b261ecSmrg    /* remember the visual ID to detect auto-update windows */
32505b261ecSmrg    compRegisterAlternateVisuals(cs, &visual->vid, 1);
32605b261ecSmrg
32705b261ecSmrg    /* Fix up the depth */
32805b261ecSmrg    *vid = visual->vid;
32905b261ecSmrg    depth->numVids = 1;
33005b261ecSmrg    depth->vids = vid;
33105b261ecSmrg    return TRUE;
33205b261ecSmrg}
33305b261ecSmrg
33405b261ecSmrgstatic Bool
33505b261ecSmrgcompAddAlternateVisuals (ScreenPtr pScreen, CompScreenPtr cs)
33605b261ecSmrg{
33705b261ecSmrg    int alt, ret = 0;
33805b261ecSmrg
33905b261ecSmrg    for (alt = 0; alt < NUM_COMP_ALTERNATE_VISUALS; alt++)
34005b261ecSmrg	ret |= compAddAlternateVisual(pScreen, cs, altVisuals + alt);
34105b261ecSmrg
34205b261ecSmrg    return !!ret;
34305b261ecSmrg}
34405b261ecSmrg
34505b261ecSmrgBool
34605b261ecSmrgcompScreenInit (ScreenPtr pScreen)
34705b261ecSmrg{
34805b261ecSmrg    CompScreenPtr   cs;
34905b261ecSmrg
35005b261ecSmrg    if (CompGeneration != serverGeneration)
35105b261ecSmrg    {
35205b261ecSmrg	CompScreenPrivateIndex = AllocateScreenPrivateIndex ();
35305b261ecSmrg	if (CompScreenPrivateIndex == -1)
35405b261ecSmrg	    return FALSE;
35505b261ecSmrg	CompWindowPrivateIndex = AllocateWindowPrivateIndex ();
35605b261ecSmrg	if (CompWindowPrivateIndex == -1)
35705b261ecSmrg	    return FALSE;
35805b261ecSmrg	CompSubwindowsPrivateIndex = AllocateWindowPrivateIndex ();
35905b261ecSmrg	if (CompSubwindowsPrivateIndex == -1)
36005b261ecSmrg	    return FALSE;
36105b261ecSmrg	CompGeneration = serverGeneration;
36205b261ecSmrg    }
36305b261ecSmrg    if (!AllocateWindowPrivate (pScreen, CompWindowPrivateIndex, 0))
36405b261ecSmrg	return FALSE;
36505b261ecSmrg
36605b261ecSmrg    if (!AllocateWindowPrivate (pScreen, CompSubwindowsPrivateIndex, 0))
36705b261ecSmrg	return FALSE;
36805b261ecSmrg
36905b261ecSmrg    if (GetCompScreen (pScreen))
37005b261ecSmrg	return TRUE;
37105b261ecSmrg    cs = (CompScreenPtr) xalloc (sizeof (CompScreenRec));
37205b261ecSmrg    if (!cs)
37305b261ecSmrg	return FALSE;
37405b261ecSmrg
37505b261ecSmrg    cs->damaged = FALSE;
37605b261ecSmrg    cs->pOverlayWin = NULL;
37705b261ecSmrg    cs->pOverlayClients = NULL;
37805b261ecSmrg
37905b261ecSmrg    cs->numAlternateVisuals = 0;
38005b261ecSmrg    cs->alternateVisuals = NULL;
38105b261ecSmrg
38205b261ecSmrg    if (!compAddAlternateVisuals (pScreen, cs))
38305b261ecSmrg    {
38405b261ecSmrg	xfree (cs);
38505b261ecSmrg	return FALSE;
38605b261ecSmrg    }
38705b261ecSmrg
38805b261ecSmrg    cs->PositionWindow = pScreen->PositionWindow;
38905b261ecSmrg    pScreen->PositionWindow = compPositionWindow;
39005b261ecSmrg
39105b261ecSmrg    cs->CopyWindow = pScreen->CopyWindow;
39205b261ecSmrg    pScreen->CopyWindow = compCopyWindow;
39305b261ecSmrg
39405b261ecSmrg    cs->CreateWindow = pScreen->CreateWindow;
39505b261ecSmrg    pScreen->CreateWindow = compCreateWindow;
39605b261ecSmrg
39705b261ecSmrg    cs->DestroyWindow = pScreen->DestroyWindow;
39805b261ecSmrg    pScreen->DestroyWindow = compDestroyWindow;
39905b261ecSmrg
40005b261ecSmrg    cs->RealizeWindow = pScreen->RealizeWindow;
40105b261ecSmrg    pScreen->RealizeWindow = compRealizeWindow;
40205b261ecSmrg
40305b261ecSmrg    cs->UnrealizeWindow = pScreen->UnrealizeWindow;
40405b261ecSmrg    pScreen->UnrealizeWindow = compUnrealizeWindow;
40505b261ecSmrg
40605b261ecSmrg    cs->PaintWindowBackground = pScreen->PaintWindowBackground;
40705b261ecSmrg    pScreen->PaintWindowBackground = compPaintWindowBackground;
40805b261ecSmrg
40905b261ecSmrg    cs->ClipNotify = pScreen->ClipNotify;
41005b261ecSmrg    pScreen->ClipNotify = compClipNotify;
41105b261ecSmrg
41205b261ecSmrg    cs->MoveWindow = pScreen->MoveWindow;
41305b261ecSmrg    pScreen->MoveWindow = compMoveWindow;
41405b261ecSmrg
41505b261ecSmrg    cs->ResizeWindow = pScreen->ResizeWindow;
41605b261ecSmrg    pScreen->ResizeWindow = compResizeWindow;
41705b261ecSmrg
41805b261ecSmrg    cs->ChangeBorderWidth = pScreen->ChangeBorderWidth;
41905b261ecSmrg    pScreen->ChangeBorderWidth = compChangeBorderWidth;
42005b261ecSmrg
42105b261ecSmrg    cs->ReparentWindow = pScreen->ReparentWindow;
42205b261ecSmrg    pScreen->ReparentWindow = compReparentWindow;
42305b261ecSmrg
42405b261ecSmrg    cs->InstallColormap = pScreen->InstallColormap;
42505b261ecSmrg    pScreen->InstallColormap = compInstallColormap;
42605b261ecSmrg
42705b261ecSmrg    cs->BlockHandler = pScreen->BlockHandler;
42805b261ecSmrg    pScreen->BlockHandler = compBlockHandler;
42905b261ecSmrg
43005b261ecSmrg    cs->CloseScreen = pScreen->CloseScreen;
43105b261ecSmrg    pScreen->CloseScreen = compCloseScreen;
43205b261ecSmrg
43305b261ecSmrg    pScreen->devPrivates[CompScreenPrivateIndex].ptr = (pointer) cs;
43405b261ecSmrg
43505b261ecSmrg    RegisterRealChildHeadProc(CompositeRealChildHead);
43605b261ecSmrg
43705b261ecSmrg    return TRUE;
43805b261ecSmrg}
439