compinit.c revision 35c4bbdf
105b261ecSmrg/* 29ace9065Smrg * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 305b261ecSmrg * 46747b715Smrg * Permission is hereby granted, free of charge, to any person obtaining a 56747b715Smrg * copy of this software and associated documentation files (the "Software"), 66747b715Smrg * to deal in the Software without restriction, including without limitation 76747b715Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 86747b715Smrg * and/or sell copies of the Software, and to permit persons to whom the 96747b715Smrg * Software is furnished to do so, subject to the following conditions: 1005b261ecSmrg * 116747b715Smrg * The above copyright notice and this permission notice (including the next 126747b715Smrg * paragraph) shall be included in all copies or substantial portions of the 136747b715Smrg * Software. 146747b715Smrg * 156747b715Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 166747b715Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 176747b715Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 186747b715Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 196747b715Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 206747b715Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 216747b715Smrg * DEALINGS IN THE SOFTWARE. 2205b261ecSmrg * 2305b261ecSmrg * Copyright © 2003 Keith Packard 2405b261ecSmrg * 2505b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its 2605b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that 2705b261ecSmrg * the above copyright notice appear in all copies and that both that 2805b261ecSmrg * copyright notice and this permission notice appear in supporting 2905b261ecSmrg * documentation, and that the name of Keith Packard not be used in 3005b261ecSmrg * advertising or publicity pertaining to distribution of the software without 3105b261ecSmrg * specific, written prior permission. Keith Packard makes no 3205b261ecSmrg * representations about the suitability of this software for any purpose. It 3305b261ecSmrg * is provided "as is" without express or implied warranty. 3405b261ecSmrg * 3505b261ecSmrg * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 3605b261ecSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 3705b261ecSmrg * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR 3805b261ecSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 3905b261ecSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 4005b261ecSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 4105b261ecSmrg * PERFORMANCE OF THIS SOFTWARE. 4205b261ecSmrg */ 4305b261ecSmrg 4405b261ecSmrg#ifdef HAVE_DIX_CONFIG_H 4505b261ecSmrg#include <dix-config.h> 4605b261ecSmrg#endif 4705b261ecSmrg 4805b261ecSmrg#include "compint.h" 496747b715Smrg#include "compositeext.h" 5005b261ecSmrg 516747b715SmrgDevPrivateKeyRec CompScreenPrivateKeyRec; 526747b715SmrgDevPrivateKeyRec CompWindowPrivateKeyRec; 536747b715SmrgDevPrivateKeyRec CompSubwindowsPrivateKeyRec; 5405b261ecSmrg 5505b261ecSmrgstatic Bool 5635c4bbdfSmrgcompCloseScreen(ScreenPtr pScreen) 5705b261ecSmrg{ 5835c4bbdfSmrg CompScreenPtr cs = GetCompScreen(pScreen); 5935c4bbdfSmrg Bool ret; 6005b261ecSmrg 616747b715Smrg free(cs->alternateVisuals); 6205b261ecSmrg 6305b261ecSmrg pScreen->CloseScreen = cs->CloseScreen; 6405b261ecSmrg pScreen->InstallColormap = cs->InstallColormap; 654642e01fSmrg pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes; 6605b261ecSmrg pScreen->ReparentWindow = cs->ReparentWindow; 676747b715Smrg pScreen->ConfigNotify = cs->ConfigNotify; 6805b261ecSmrg pScreen->MoveWindow = cs->MoveWindow; 6905b261ecSmrg pScreen->ResizeWindow = cs->ResizeWindow; 7005b261ecSmrg pScreen->ChangeBorderWidth = cs->ChangeBorderWidth; 7135c4bbdfSmrg 7205b261ecSmrg pScreen->ClipNotify = cs->ClipNotify; 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 809ace9065Smrg pScreen->GetImage = cs->GetImage; 8135c4bbdfSmrg pScreen->GetSpans = cs->GetSpans; 829ace9065Smrg pScreen->SourceValidate = cs->SourceValidate; 839ace9065Smrg 846747b715Smrg free(cs); 854642e01fSmrg dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL); 8635c4bbdfSmrg ret = (*pScreen->CloseScreen) (pScreen); 8705b261ecSmrg 8805b261ecSmrg return ret; 8905b261ecSmrg} 9005b261ecSmrg 9105b261ecSmrgstatic void 9235c4bbdfSmrgcompInstallColormap(ColormapPtr pColormap) 9305b261ecSmrg{ 9435c4bbdfSmrg VisualPtr pVisual = pColormap->pVisual; 9535c4bbdfSmrg ScreenPtr pScreen = pColormap->pScreen; 9635c4bbdfSmrg CompScreenPtr cs = GetCompScreen(pScreen); 9735c4bbdfSmrg int a; 9805b261ecSmrg 9905b261ecSmrg for (a = 0; a < cs->numAlternateVisuals; a++) 10035c4bbdfSmrg if (pVisual->vid == cs->alternateVisuals[a]) 10135c4bbdfSmrg return; 10205b261ecSmrg pScreen->InstallColormap = cs->InstallColormap; 10305b261ecSmrg (*pScreen->InstallColormap) (pColormap); 10405b261ecSmrg cs->InstallColormap = pScreen->InstallColormap; 10505b261ecSmrg pScreen->InstallColormap = compInstallColormap; 10605b261ecSmrg} 10705b261ecSmrg 10835c4bbdfSmrgstatic void 10935c4bbdfSmrgcompCheckBackingStore(WindowPtr pWin) 11035c4bbdfSmrg{ 11135c4bbdfSmrg if (pWin->backingStore != NotUseful && !pWin->backStorage) { 11235c4bbdfSmrg compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic); 11335c4bbdfSmrg pWin->backStorage = TRUE; 11435c4bbdfSmrg } 11535c4bbdfSmrg else if (pWin->backingStore == NotUseful && pWin->backStorage) { 11635c4bbdfSmrg compUnredirectWindow(serverClient, pWin, 11735c4bbdfSmrg CompositeRedirectAutomatic); 11835c4bbdfSmrg pWin->backStorage = FALSE; 11935c4bbdfSmrg } 12035c4bbdfSmrg} 12135c4bbdfSmrg 1224642e01fSmrg/* Fake backing store via automatic redirection */ 1234642e01fSmrgstatic Bool 1244642e01fSmrgcompChangeWindowAttributes(WindowPtr pWin, unsigned long mask) 1254642e01fSmrg{ 1264642e01fSmrg ScreenPtr pScreen = pWin->drawable.pScreen; 12735c4bbdfSmrg CompScreenPtr cs = GetCompScreen(pScreen); 1284642e01fSmrg Bool ret; 1294642e01fSmrg 1304642e01fSmrg pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes; 1314642e01fSmrg ret = pScreen->ChangeWindowAttributes(pWin, mask); 1324642e01fSmrg 1334642e01fSmrg if (ret && (mask & CWBackingStore) && 13435c4bbdfSmrg pScreen->backingStoreSupport != NotUseful) 13535c4bbdfSmrg compCheckBackingStore(pWin); 1364642e01fSmrg 1374642e01fSmrg pScreen->ChangeWindowAttributes = compChangeWindowAttributes; 1384642e01fSmrg 1394642e01fSmrg return ret; 1404642e01fSmrg} 1414642e01fSmrg 14205b261ecSmrgstatic void 14335c4bbdfSmrgcompGetImage(DrawablePtr pDrawable, 14435c4bbdfSmrg int sx, int sy, 14535c4bbdfSmrg int w, int h, 14635c4bbdfSmrg unsigned int format, unsigned long planemask, char *pdstLine) 14705b261ecSmrg{ 1489ace9065Smrg ScreenPtr pScreen = pDrawable->pScreen; 14935c4bbdfSmrg CompScreenPtr cs = GetCompScreen(pScreen); 15005b261ecSmrg 1519ace9065Smrg pScreen->GetImage = cs->GetImage; 1529ace9065Smrg if (pDrawable->type == DRAWABLE_WINDOW) 15335c4bbdfSmrg compPaintChildrenToWindow((WindowPtr) pDrawable); 1549ace9065Smrg (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); 1559ace9065Smrg cs->GetImage = pScreen->GetImage; 1569ace9065Smrg pScreen->GetImage = compGetImage; 15705b261ecSmrg} 15805b261ecSmrg 15935c4bbdfSmrgstatic void 16035c4bbdfSmrgcompGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, 16135c4bbdfSmrg int nspans, char *pdstStart) 16235c4bbdfSmrg{ 16335c4bbdfSmrg ScreenPtr pScreen = pDrawable->pScreen; 16435c4bbdfSmrg CompScreenPtr cs = GetCompScreen(pScreen); 16535c4bbdfSmrg 16635c4bbdfSmrg pScreen->GetSpans = cs->GetSpans; 16735c4bbdfSmrg if (pDrawable->type == DRAWABLE_WINDOW) 16835c4bbdfSmrg compPaintChildrenToWindow((WindowPtr) pDrawable); 16935c4bbdfSmrg (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); 17035c4bbdfSmrg cs->GetSpans = pScreen->GetSpans; 17135c4bbdfSmrg pScreen->GetSpans = compGetSpans; 17235c4bbdfSmrg} 17335c4bbdfSmrg 17435c4bbdfSmrgstatic void 17535c4bbdfSmrgcompSourceValidate(DrawablePtr pDrawable, 17635c4bbdfSmrg int x, int y, 17735c4bbdfSmrg int width, int height, unsigned int subWindowMode) 17805b261ecSmrg{ 1799ace9065Smrg ScreenPtr pScreen = pDrawable->pScreen; 18035c4bbdfSmrg CompScreenPtr cs = GetCompScreen(pScreen); 18105b261ecSmrg 1829ace9065Smrg pScreen->SourceValidate = cs->SourceValidate; 1839ace9065Smrg if (pDrawable->type == DRAWABLE_WINDOW && subWindowMode == IncludeInferiors) 18435c4bbdfSmrg compPaintChildrenToWindow((WindowPtr) pDrawable); 1859ace9065Smrg if (pScreen->SourceValidate) 18635c4bbdfSmrg (*pScreen->SourceValidate) (pDrawable, x, y, width, height, 18735c4bbdfSmrg subWindowMode); 1889ace9065Smrg cs->SourceValidate = pScreen->SourceValidate; 1899ace9065Smrg pScreen->SourceValidate = compSourceValidate; 19005b261ecSmrg} 19105b261ecSmrg 19205b261ecSmrg/* 19305b261ecSmrg * Add alternate visuals -- always expose an ARGB32 and RGB24 visual 19405b261ecSmrg */ 19505b261ecSmrg 19605b261ecSmrgstatic DepthPtr 19735c4bbdfSmrgcompFindVisuallessDepth(ScreenPtr pScreen, int d) 19805b261ecSmrg{ 19935c4bbdfSmrg int i; 20035c4bbdfSmrg 20135c4bbdfSmrg for (i = 0; i < pScreen->numDepths; i++) { 20235c4bbdfSmrg DepthPtr depth = &pScreen->allowedDepths[i]; 20335c4bbdfSmrg 20435c4bbdfSmrg if (depth->depth == d) { 20535c4bbdfSmrg /* 20635c4bbdfSmrg * Make sure it doesn't have visuals already 20735c4bbdfSmrg */ 20835c4bbdfSmrg if (depth->numVids) 20935c4bbdfSmrg return 0; 21035c4bbdfSmrg /* 21135c4bbdfSmrg * looks fine 21235c4bbdfSmrg */ 21335c4bbdfSmrg return depth; 21435c4bbdfSmrg } 21505b261ecSmrg } 21605b261ecSmrg /* 21735c4bbdfSmrg * If there isn't one, then it's gonna be hard to have 21805b261ecSmrg * an associated visual 21905b261ecSmrg */ 22005b261ecSmrg return 0; 22105b261ecSmrg} 22205b261ecSmrg 22305b261ecSmrg/* 22405b261ecSmrg * Add a list of visual IDs to the list of visuals to implicitly redirect. 22505b261ecSmrg */ 22605b261ecSmrgstatic Bool 22735c4bbdfSmrgcompRegisterAlternateVisuals(CompScreenPtr cs, VisualID * vids, int nVisuals) 22805b261ecSmrg{ 22905b261ecSmrg VisualID *p; 23005b261ecSmrg 23135c4bbdfSmrg p = reallocarray(cs->alternateVisuals, 23235c4bbdfSmrg cs->numAlternateVisuals + nVisuals, sizeof(VisualID)); 23335c4bbdfSmrg if (p == NULL) 23435c4bbdfSmrg return FALSE; 23505b261ecSmrg 23605b261ecSmrg memcpy(&p[cs->numAlternateVisuals], vids, sizeof(VisualID) * nVisuals); 23705b261ecSmrg 23805b261ecSmrg cs->alternateVisuals = p; 23905b261ecSmrg cs->numAlternateVisuals += nVisuals; 24005b261ecSmrg 24105b261ecSmrg return TRUE; 24205b261ecSmrg} 24305b261ecSmrg 24435c4bbdfSmrgBool 24535c4bbdfSmrgCompositeRegisterAlternateVisuals(ScreenPtr pScreen, VisualID * vids, 24635c4bbdfSmrg int nVisuals) 24705b261ecSmrg{ 24835c4bbdfSmrg CompScreenPtr cs = GetCompScreen(pScreen); 24935c4bbdfSmrg 25005b261ecSmrg return compRegisterAlternateVisuals(cs, vids, nVisuals); 25105b261ecSmrg} 25205b261ecSmrg 25335c4bbdfSmrgBool 25435c4bbdfSmrgCompositeRegisterImplicitRedirectionException(ScreenPtr pScreen, 25535c4bbdfSmrg VisualID parentVisual, 25635c4bbdfSmrg VisualID winVisual) 25735c4bbdfSmrg{ 25835c4bbdfSmrg CompScreenPtr cs = GetCompScreen(pScreen); 25935c4bbdfSmrg CompImplicitRedirectException *p; 26035c4bbdfSmrg 26135c4bbdfSmrg p = reallocarray(cs->implicitRedirectExceptions, 26235c4bbdfSmrg cs->numImplicitRedirectExceptions + 1, sizeof(p[0])); 26335c4bbdfSmrg if (p == NULL) 26435c4bbdfSmrg return FALSE; 26535c4bbdfSmrg 26635c4bbdfSmrg p[cs->numImplicitRedirectExceptions].parentVisual = parentVisual; 26735c4bbdfSmrg p[cs->numImplicitRedirectExceptions].winVisual = winVisual; 26835c4bbdfSmrg 26935c4bbdfSmrg cs->implicitRedirectExceptions = p; 27035c4bbdfSmrg cs->numImplicitRedirectExceptions++; 27135c4bbdfSmrg 27235c4bbdfSmrg return TRUE; 27335c4bbdfSmrg} 27435c4bbdfSmrg 27505b261ecSmrgtypedef struct _alternateVisual { 27635c4bbdfSmrg int depth; 27735c4bbdfSmrg CARD32 format; 27805b261ecSmrg} CompAlternateVisual; 27905b261ecSmrg 28035c4bbdfSmrgstatic CompAlternateVisual altVisuals[] = { 28105b261ecSmrg#if COMP_INCLUDE_RGB24_VISUAL 28235c4bbdfSmrg {24, PICT_r8g8b8}, 28305b261ecSmrg#endif 28435c4bbdfSmrg {32, PICT_a8r8g8b8}, 28505b261ecSmrg}; 28605b261ecSmrg 28705b261ecSmrgstatic const int NUM_COMP_ALTERNATE_VISUALS = sizeof(altVisuals) / 28835c4bbdfSmrg sizeof(CompAlternateVisual); 28905b261ecSmrg 29005b261ecSmrgstatic Bool 29105b261ecSmrgcompAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs, 29235c4bbdfSmrg CompAlternateVisual * alt) 29305b261ecSmrg{ 29435c4bbdfSmrg VisualPtr visual; 29535c4bbdfSmrg DepthPtr depth; 29635c4bbdfSmrg PictFormatPtr pPictFormat; 29735c4bbdfSmrg unsigned long alphaMask; 29805b261ecSmrg 29905b261ecSmrg /* 30005b261ecSmrg * The ARGB32 visual is always available. Other alternate depth visuals 30105b261ecSmrg * are only provided if their depth is less than the root window depth. 30205b261ecSmrg * There's no deep reason for this. 30305b261ecSmrg */ 30405b261ecSmrg if (alt->depth >= pScreen->rootDepth && alt->depth != 32) 30535c4bbdfSmrg return FALSE; 30605b261ecSmrg 30735c4bbdfSmrg depth = compFindVisuallessDepth(pScreen, alt->depth); 30805b261ecSmrg if (!depth) 30935c4bbdfSmrg /* alt->depth doesn't exist or already has alternate visuals. */ 31035c4bbdfSmrg return TRUE; 31105b261ecSmrg 31235c4bbdfSmrg pPictFormat = PictureMatchFormat(pScreen, alt->depth, alt->format); 31305b261ecSmrg if (!pPictFormat) 31435c4bbdfSmrg return FALSE; 31505b261ecSmrg 3166747b715Smrg if (ResizeVisualArray(pScreen, 1, depth) == FALSE) { 3176747b715Smrg return FALSE; 31805b261ecSmrg } 31905b261ecSmrg 32035c4bbdfSmrg visual = pScreen->visuals + (pScreen->numVisuals - 1); /* the new one */ 32105b261ecSmrg 32205b261ecSmrg /* Initialize the visual */ 32305b261ecSmrg visual->bitsPerRGBValue = 8; 32405b261ecSmrg if (PICT_FORMAT_TYPE(alt->format) == PICT_TYPE_COLOR) { 32535c4bbdfSmrg visual->class = PseudoColor; 32635c4bbdfSmrg visual->nplanes = PICT_FORMAT_BPP(alt->format); 32735c4bbdfSmrg visual->ColormapEntries = 1 << visual->nplanes; 32835c4bbdfSmrg } 32935c4bbdfSmrg else { 33035c4bbdfSmrg DirectFormatRec *direct = &pPictFormat->direct; 33135c4bbdfSmrg 33235c4bbdfSmrg visual->class = TrueColor; 33335c4bbdfSmrg visual->redMask = ((unsigned long) direct->redMask) << direct->red; 33435c4bbdfSmrg visual->greenMask = 33535c4bbdfSmrg ((unsigned long) direct->greenMask) << direct->green; 33635c4bbdfSmrg visual->blueMask = ((unsigned long) direct->blueMask) << direct->blue; 33735c4bbdfSmrg alphaMask = ((unsigned long) direct->alphaMask) << direct->alpha; 33835c4bbdfSmrg visual->offsetRed = direct->red; 33935c4bbdfSmrg visual->offsetGreen = direct->green; 34035c4bbdfSmrg visual->offsetBlue = direct->blue; 34135c4bbdfSmrg /* 34235c4bbdfSmrg * Include A bits in this (unlike GLX which includes only RGB) 34335c4bbdfSmrg * This lets DIX compute suitable masks for colormap allocations 34435c4bbdfSmrg */ 34535c4bbdfSmrg visual->nplanes = Ones(visual->redMask | 34635c4bbdfSmrg visual->greenMask | 34735c4bbdfSmrg visual->blueMask | alphaMask); 34835c4bbdfSmrg /* find widest component */ 34935c4bbdfSmrg visual->ColormapEntries = (1 << max(Ones(visual->redMask), 35035c4bbdfSmrg max(Ones(visual->greenMask), 35135c4bbdfSmrg Ones(visual->blueMask)))); 35205b261ecSmrg } 35305b261ecSmrg 35405b261ecSmrg /* remember the visual ID to detect auto-update windows */ 35505b261ecSmrg compRegisterAlternateVisuals(cs, &visual->vid, 1); 35605b261ecSmrg 35705b261ecSmrg return TRUE; 35805b261ecSmrg} 35905b261ecSmrg 36005b261ecSmrgstatic Bool 36135c4bbdfSmrgcompAddAlternateVisuals(ScreenPtr pScreen, CompScreenPtr cs) 36205b261ecSmrg{ 36305b261ecSmrg int alt, ret = 0; 36405b261ecSmrg 36505b261ecSmrg for (alt = 0; alt < NUM_COMP_ALTERNATE_VISUALS; alt++) 36635c4bbdfSmrg ret |= compAddAlternateVisual(pScreen, cs, altVisuals + alt); 36705b261ecSmrg 36835c4bbdfSmrg return ! !ret; 36905b261ecSmrg} 37005b261ecSmrg 37105b261ecSmrgBool 37235c4bbdfSmrgcompScreenInit(ScreenPtr pScreen) 37305b261ecSmrg{ 37435c4bbdfSmrg CompScreenPtr cs; 37505b261ecSmrg 3766747b715Smrg if (!dixRegisterPrivateKey(&CompScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) 37735c4bbdfSmrg return FALSE; 3786747b715Smrg if (!dixRegisterPrivateKey(&CompWindowPrivateKeyRec, PRIVATE_WINDOW, 0)) 37935c4bbdfSmrg return FALSE; 3806747b715Smrg if (!dixRegisterPrivateKey(&CompSubwindowsPrivateKeyRec, PRIVATE_WINDOW, 0)) 38135c4bbdfSmrg return FALSE; 3826747b715Smrg 38335c4bbdfSmrg if (GetCompScreen(pScreen)) 38435c4bbdfSmrg return TRUE; 38535c4bbdfSmrg cs = (CompScreenPtr) malloc(sizeof(CompScreenRec)); 38605b261ecSmrg if (!cs) 38735c4bbdfSmrg return FALSE; 38805b261ecSmrg 3894642e01fSmrg cs->overlayWid = FakeClientID(0); 39005b261ecSmrg cs->pOverlayWin = NULL; 39105b261ecSmrg cs->pOverlayClients = NULL; 39205b261ecSmrg 39305b261ecSmrg cs->numAlternateVisuals = 0; 39405b261ecSmrg cs->alternateVisuals = NULL; 39535c4bbdfSmrg cs->numImplicitRedirectExceptions = 0; 39635c4bbdfSmrg cs->implicitRedirectExceptions = NULL; 39705b261ecSmrg 39835c4bbdfSmrg if (!compAddAlternateVisuals(pScreen, cs)) { 39935c4bbdfSmrg free(cs); 40035c4bbdfSmrg return FALSE; 40105b261ecSmrg } 40205b261ecSmrg 40335c4bbdfSmrg if (!disableBackingStore) 40435c4bbdfSmrg pScreen->backingStoreSupport = WhenMapped; 40535c4bbdfSmrg 40605b261ecSmrg cs->PositionWindow = pScreen->PositionWindow; 40705b261ecSmrg pScreen->PositionWindow = compPositionWindow; 40805b261ecSmrg 40905b261ecSmrg cs->CopyWindow = pScreen->CopyWindow; 41005b261ecSmrg pScreen->CopyWindow = compCopyWindow; 41105b261ecSmrg 41205b261ecSmrg cs->CreateWindow = pScreen->CreateWindow; 41305b261ecSmrg pScreen->CreateWindow = compCreateWindow; 41405b261ecSmrg 41505b261ecSmrg cs->DestroyWindow = pScreen->DestroyWindow; 41605b261ecSmrg pScreen->DestroyWindow = compDestroyWindow; 41705b261ecSmrg 41805b261ecSmrg cs->RealizeWindow = pScreen->RealizeWindow; 41905b261ecSmrg pScreen->RealizeWindow = compRealizeWindow; 42005b261ecSmrg 42105b261ecSmrg cs->UnrealizeWindow = pScreen->UnrealizeWindow; 42205b261ecSmrg pScreen->UnrealizeWindow = compUnrealizeWindow; 42305b261ecSmrg 42405b261ecSmrg cs->ClipNotify = pScreen->ClipNotify; 42505b261ecSmrg pScreen->ClipNotify = compClipNotify; 42605b261ecSmrg 4276747b715Smrg cs->ConfigNotify = pScreen->ConfigNotify; 4286747b715Smrg pScreen->ConfigNotify = compConfigNotify; 4296747b715Smrg 43005b261ecSmrg cs->MoveWindow = pScreen->MoveWindow; 43105b261ecSmrg pScreen->MoveWindow = compMoveWindow; 43205b261ecSmrg 43305b261ecSmrg cs->ResizeWindow = pScreen->ResizeWindow; 43405b261ecSmrg pScreen->ResizeWindow = compResizeWindow; 43505b261ecSmrg 43605b261ecSmrg cs->ChangeBorderWidth = pScreen->ChangeBorderWidth; 43705b261ecSmrg pScreen->ChangeBorderWidth = compChangeBorderWidth; 43805b261ecSmrg 43905b261ecSmrg cs->ReparentWindow = pScreen->ReparentWindow; 44005b261ecSmrg pScreen->ReparentWindow = compReparentWindow; 44105b261ecSmrg 44205b261ecSmrg cs->InstallColormap = pScreen->InstallColormap; 44305b261ecSmrg pScreen->InstallColormap = compInstallColormap; 44405b261ecSmrg 4454642e01fSmrg cs->ChangeWindowAttributes = pScreen->ChangeWindowAttributes; 4464642e01fSmrg pScreen->ChangeWindowAttributes = compChangeWindowAttributes; 4474642e01fSmrg 4489ace9065Smrg cs->BlockHandler = NULL; 44905b261ecSmrg 45005b261ecSmrg cs->CloseScreen = pScreen->CloseScreen; 45105b261ecSmrg pScreen->CloseScreen = compCloseScreen; 45205b261ecSmrg 4539ace9065Smrg cs->GetImage = pScreen->GetImage; 4549ace9065Smrg pScreen->GetImage = compGetImage; 4559ace9065Smrg 45635c4bbdfSmrg cs->GetSpans = pScreen->GetSpans; 45735c4bbdfSmrg pScreen->GetSpans = compGetSpans; 45835c4bbdfSmrg 4599ace9065Smrg cs->SourceValidate = pScreen->SourceValidate; 4609ace9065Smrg pScreen->SourceValidate = compSourceValidate; 4619ace9065Smrg 4624642e01fSmrg dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, cs); 46305b261ecSmrg 46405b261ecSmrg RegisterRealChildHeadProc(CompositeRealChildHead); 46505b261ecSmrg 46605b261ecSmrg return TRUE; 46705b261ecSmrg} 468