From 7e3cb9a09ac422179be89773f7fb14a462d25434 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 25 Dec 2005 22:25:15 +0000 Subject: [PATCH] Remove unused layer module. --- ChangeLog | 9 + configure.ac | 8 +- hw/xfree86/dixmods/Makefile.am | 6 - hw/xfree86/dixmods/extmod/Makefile.am | 1 - miext/Makefile.am | 4 +- miext/layer/Makefile.am | 13 - miext/layer/layer.h | 149 -------- miext/layer/layergc.c | 194 ---------- miext/layer/layerinit.c | 363 ------------------- miext/layer/layerpict.c | 149 -------- miext/layer/layerwin.c | 487 -------------------------- 11 files changed, 14 insertions(+), 1369 deletions(-) delete mode 100644 miext/layer/Makefile.am delete mode 100644 miext/layer/layer.h delete mode 100644 miext/layer/layergc.c delete mode 100644 miext/layer/layerinit.c delete mode 100644 miext/layer/layerpict.c delete mode 100644 miext/layer/layerwin.c diff --git a/ChangeLog b/ChangeLog index 33f5f1568..44ad900d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-12-25 Adam Jackson + + * configure.ac: + * miext/Makefile.am: + * miext/layer/*: + * hw/xfree86/dixmods/Makefile.am: + * hw/xfree86/dixmods/extmod/Makefile.am: + Remove unused layer module. + 2005-12-23 Alan Coopersmith * doc/Xserver.man.pre: diff --git a/configure.ac b/configure.ac index ad4529f12..8cd714d60 100644 --- a/configure.ac +++ b/configure.ac @@ -773,7 +773,6 @@ FB_LIB='$(top_builddir)/fb/libfb.la' FB_INC='-I$(top_srcdir)/fb' MIEXT_SHADOW_INC='-I$(top_srcdir)/miext/shadow' MIEXT_SHADOW_LIB='$(top_builddir)/miext/shadow/libshadow.la' -MIEXT_LAYER_LIB='$(top_builddir)/miext/layer/liblayer.la' XPSTUBS_LIB='$(top_builddir)/dix/libxpstubs.la' CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include' @@ -863,7 +862,7 @@ AC_MSG_RESULT([$XVFB]) AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes]) if test "x$XVFB" = xyes; then - XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB" + XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB" AC_SUBST([XVFB_LIBS]) fi @@ -879,7 +878,7 @@ AC_MSG_RESULT([$XNEST]) AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes]) if test "x$XNEST" = xyes; then - XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB" + XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB" AC_SUBST([XNEST_LIBS]) fi @@ -913,7 +912,7 @@ if test "x$XORG" = xyes; then XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os' XORG_INCS="$XORG_DDXINCS $XORG_OSINCS" XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H" - XORG_LIBS="$MI_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB" + XORG_LIBS="$MI_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $LBX_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB" AC_CHECK_LIB([dl], [dlopen], XORG_LIBS="$XORG_LIBS -ldl") @@ -1393,7 +1392,6 @@ miext/Makefile miext/damage/Makefile miext/shadow/Makefile miext/cw/Makefile -miext/layer/Makefile miext/rootless/Makefile os/Makefile randr/Makefile diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am index 623006079..c258eaabd 100644 --- a/hw/xfree86/dixmods/Makefile.am +++ b/hw/xfree86/dixmods/Makefile.am @@ -21,7 +21,6 @@ module_LTLIBRARIES = libafb.la \ $(CFB24MOD) \ libcfb32.la \ libfb.la \ - liblayer.la \ libmfb.la \ libshadow.la @@ -43,7 +42,6 @@ INCLUDES = @XORG_INCS@ \ -I$(top_srcdir)/mfb \ -I$(top_srcdir)/dbe \ -I$(top_srcdir)/hw/xfree86/loader \ - -I$(top_srcdir)/miext/layer \ -I$(top_srcdir)/miext/shadow libGLcore_la_LDFLAGS = -avoid-version @@ -87,10 +85,6 @@ libglx_la_LDFLAGS = -avoid-version libglx_la_LIBADD = $(top_builddir)/GL/glx/libglx.la libglx_la_SOURCES = glxmodule.c -liblayer_la_LDFLAGS = -avoid-version -liblayer_la_LIBADD = $(top_builddir)/miext/layer/liblayer.la -liblayer_la_SOURCES = laymodule.c - libmfb_la_LDFLAGS = -avoid-version libmfb_la_LIBADD = $(top_builddir)/mfb/libmfb.la libmfb_la_SOURCES = mfbmodule.c diff --git a/hw/xfree86/dixmods/extmod/Makefile.am b/hw/xfree86/dixmods/extmod/Makefile.am index e35a71b8e..cfa15f32b 100644 --- a/hw/xfree86/dixmods/extmod/Makefile.am +++ b/hw/xfree86/dixmods/extmod/Makefile.am @@ -18,7 +18,6 @@ INCLUDES = @XORG_INCS@ \ -I$(top_srcdir)/cfb \ -I$(top_srcdir)/dbe \ -I$(top_srcdir)/hw/xfree86/loader \ - -I$(top_srcdir)/miext/layer \ -I$(top_srcdir)/miext/shadow libextmod_la_LDFLAGS = -avoid-version diff --git a/miext/Makefile.am b/miext/Makefile.am index 242a61666..4fa584b35 100644 --- a/miext/Makefile.am +++ b/miext/Makefile.am @@ -1,5 +1,5 @@ -SUBDIRS = damage shadow layer +SUBDIRS = damage shadow if COMPOSITE SUBDIRS += cw endif -DIST_SUBDIRS = damage shadow layer cw rootless +DIST_SUBDIRS = damage shadow cw rootless diff --git a/miext/layer/Makefile.am b/miext/layer/Makefile.am deleted file mode 100644 index 3c5d2d75b..000000000 --- a/miext/layer/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -noinst_LTLIBRARIES = liblayer.la - -AM_CFLAGS = $(DIX_CFLAGS) @SERVER_DEFINES@ @MODULE_DEFINES@ @LOADER_DEFINES@ - -INCLUDES = -I$(top_srcdir)/hw/xfree86/os-support - -liblayer_la_SOURCES = \ - layer.h \ - layergc.c \ - layerinit.c \ - layerpict.c \ - layerstr.h \ - layerwin.c diff --git a/miext/layer/layer.h b/miext/layer/layer.h deleted file mode 100644 index e8f3a856e..000000000 --- a/miext/layer/layer.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * $XFree86: xc/programs/Xserver/miext/layer/layer.h,v 1.4 2001/08/01 00:44:58 tsi Exp $ - * - * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#ifndef _LAYER_H_ -#define _LAYER_H_ - -#include - -#define LAYER_FB 0 -#define LAYER_SHADOW 1 - -typedef struct _LayerKind *LayerKindPtr; -typedef struct _LayerWin *LayerWinPtr; -typedef struct _LayerList *LayerListPtr; -typedef struct _LayerGC *LayerGCPtr; -typedef struct _Layer *LayerPtr; -typedef struct _LayerScreen *LayerScreenPtr; - -/* - * We'll try to work without a list of windows in each layer - * for now, this will make computing bounding boxes for each - * layer rather expensive, so that may need to change at some point. - */ - -#define LAYER_SCREEN_PIXMAP ((PixmapPtr) 1) - -typedef struct _Layer { - LayerPtr pNext; /* a list of all layers for this screen */ - LayerKindPtr pKind; /* characteristics of this layer */ - int refcnt; /* reference count, layer is freed when zero */ - int windows; /* number of windows, free pixmap when zero */ - int depth; /* window depth in this layer */ - PixmapPtr pPixmap; /* pixmap for this layer (may be frame buffer) */ - Bool freePixmap; /* whether to free this pixmap when done */ - RegionRec region; /* valid set of pPixmap for drawing */ - ShadowUpdateProc update; /* for shadow layers, update/window/closure values */ - ShadowWindowProc window; - int randr; - void *closure; -} LayerRec; - -/* - * Call this before wrapping stuff for acceleration, it - * gives layer pointers to the raw frame buffer functions - */ - -Bool -LayerStartInit (ScreenPtr pScreen); - -/* - * Initialize wrappers for each acceleration type and - * call this function, it will move the needed functions - * into a new LayerKind and replace them with the generic - * functions. - */ - -int -LayerNewKind (ScreenPtr pScreen); - -/* - * Finally, call this function and layer - * will wrap the screen functions and prepare for execution - */ - -Bool -LayerFinishInit (ScreenPtr pScreen); - -/* - * At any point after LayerStartInit, a new layer can be created. - */ -LayerPtr -LayerCreate (ScreenPtr pScreen, - int kind, - int depth, - PixmapPtr pPixmap, - ShadowUpdateProc update, - ShadowWindowProc window, - int randr, - void *closure); - -/* - * Create a layer pixmap - */ -Bool -LayerCreatePixmap (ScreenPtr pScreen, LayerPtr pLayer); - -/* - * Change a layer pixmap - */ -void -LayerSetPixmap (ScreenPtr pScreen, LayerPtr pLayer, PixmapPtr pPixmap); - -/* - * Destroy a layer pixmap - */ -void -LayerDestroyPixmap (ScreenPtr pScreen, LayerPtr pLayer); - -/* - * Change a layer kind - */ -void -LayerSetKind (ScreenPtr pScreen, LayerPtr pLayer, int kind); - -/* - * Destroy a layer. The layer must not contain any windows. - */ -void -LayerDestroy (ScreenPtr pScreen, LayerPtr layer); - -/* - * Add a window to a layer - */ -Bool -LayerWindowAdd (ScreenPtr pScreen, LayerPtr pLayer, WindowPtr pWin); - -/* - * Remove a window from a layer - */ - -void -LayerWindowRemove (ScreenPtr pScreen, LayerPtr pLayer, WindowPtr pWin); - -#endif /* _LAYER_H_ */ diff --git a/miext/layer/layergc.c b/miext/layer/layergc.c deleted file mode 100644 index 343edfcf5..000000000 --- a/miext/layer/layergc.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * $XFree86: xc/programs/Xserver/miext/layer/layergc.c,v 1.4 2001/08/27 03:55:46 keithp Exp $ - * - * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "layerstr.h" - -GCFuncs layerGCFuncs = { - layerValidateGC, layerChangeGC, layerCopyGC, layerDestroyGC, - layerChangeClip, layerDestroyClip, layerCopyClip -}; - -#if 0 -/* - * XXX dont need this until this supports - * separate clipping and multiple layers - */ -GCOps layerGCOps = { - layerFillSpans, layerSetSpans, - layerPutImage, layerCopyArea, - layerCopyPlane, layerPolyPoint, - layerPolylines, layerPolySegment, - layerPolyRectangle, layerPolyArc, - layerFillPolygon, layerPolyFillRect, - layerPolyFillArc, layerPolyText8, - layerPolyText16, layerImageText8, - layerImageText16, layerImageGlyphBlt, - layerPolyGlyphBlt, layerPushPixels, -#ifdef NEED_LINEHELPER - NULL, -#endif - {NULL} /* devPrivate */ -}; -#endif - -Bool -layerCreateGC (GCPtr pGC) -{ - Bool ret = TRUE; - LayerKindPtr pLayKind; - ScreenPtr pScreen = pGC->pScreen; - layerScrPriv(pScreen); - layerGCPriv(pGC); - - /* - * XXX assume the first layer can handle all GCs - */ - pLayKind = &pLayScr->kinds[0]; - if (pLayScr->pLayers) - pLayKind = pLayScr->pLayers->pKind; - pLayGC->pKind = pLayKind; - LayerUnwrap (pScreen,pLayGC->pKind,CreateGC); - - if (!(*pScreen->CreateGC) (pGC)) - ret = FALSE; - LayerWrap (pScreen,pLayKind,CreateGC,layerCreateGC); - - LayerWrap (pGC,pLayGC,funcs,&layerGCFuncs); - - return ret; -} - -void -layerValidateGC(GCPtr pGC, - unsigned long changes, - DrawablePtr pDraw) -{ - layerGCPriv(pGC); - LayerKindPtr pKind; - - if (pDraw->type == DRAWABLE_WINDOW) - { - layerWinPriv ((WindowPtr) pDraw); - pKind = layerWinLayer (pLayWin)->pKind; - } - else - { - /* XXX assume the first layer can handle all pixmaps */ - layerScrPriv (pDraw->pScreen); - pKind = &pLayScr->kinds[0]; - if (pLayScr->pLayers) - pKind = pLayScr->pLayers->pKind; - } - - LayerUnwrap (pGC,pLayGC,funcs); - if (pKind != pLayGC->pKind) - { - /* - * Clean up the previous user - */ - CreateGCProcPtr CreateGC; - (*pGC->funcs->DestroyGC) (pGC); - - pGC->serialNumber = GC_CHANGE_SERIAL_BIT; - - pLayGC->pKind = pKind; - - /* - * Temporarily unwrap Create GC and let - * the new code setup the GC - */ - CreateGC = pGC->pScreen->CreateGC; - LayerUnwrap (pGC->pScreen, pLayGC->pKind, CreateGC); - (*pGC->pScreen->CreateGC) (pGC); - LayerWrap (pGC->pScreen, pLayGC->pKind, CreateGC, CreateGC); - } - - (*pGC->funcs->ValidateGC) (pGC, changes, pDraw); - LayerWrap(pGC,pLayGC,funcs,&layerGCFuncs); -} - -void -layerDestroyGC(GCPtr pGC) -{ - layerGCPriv(pGC); - LayerUnwrap (pGC,pLayGC,funcs); - (*pGC->funcs->DestroyGC)(pGC); - LayerWrap(pGC,pLayGC,funcs,&layerGCFuncs); -} - -void -layerChangeGC (GCPtr pGC, - unsigned long mask) -{ - layerGCPriv(pGC); - LayerUnwrap (pGC,pLayGC,funcs); - (*pGC->funcs->ChangeGC) (pGC, mask); - LayerWrap(pGC,pLayGC,funcs,&layerGCFuncs); -} - -void -layerCopyGC (GCPtr pGCSrc, - unsigned long mask, - GCPtr pGCDst) -{ - layerGCPriv(pGCDst); - LayerUnwrap (pGCDst,pLayGC,funcs); - (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); - LayerWrap(pGCDst,pLayGC,funcs,&layerGCFuncs); -} - -void -layerChangeClip (GCPtr pGC, - int type, - pointer pvalue, - int nrects) -{ - layerGCPriv(pGC); - LayerUnwrap (pGC,pLayGC,funcs); - (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); - LayerWrap(pGC,pLayGC,funcs,&layerGCFuncs); -} - -void -layerCopyClip(GCPtr pGCDst, GCPtr pGCSrc) -{ - layerGCPriv(pGCDst); - LayerUnwrap (pGCDst,pLayGC,funcs); - (*pGCDst->funcs->CopyClip) (pGCDst, pGCSrc); - LayerWrap(pGCDst,pLayGC,funcs,&layerGCFuncs); -} - -void -layerDestroyClip(GCPtr pGC) -{ - layerGCPriv(pGC); - LayerUnwrap (pGC,pLayGC,funcs); - (*pGC->funcs->DestroyClip) (pGC); - LayerWrap(pGC,pLayGC,funcs,&layerGCFuncs); -} - diff --git a/miext/layer/layerinit.c b/miext/layer/layerinit.c deleted file mode 100644 index 994c6747c..000000000 --- a/miext/layer/layerinit.c +++ /dev/null @@ -1,363 +0,0 @@ -/* - * $XFree86: xc/programs/Xserver/miext/layer/layerinit.c,v 1.6tsi Exp $ - * - * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "layerstr.h" - -int layerScrPrivateIndex; -int layerGCPrivateIndex; -int layerWinPrivateIndex; -int layerGeneration; - -/* - * Call this before wrapping stuff for acceleration, it - * gives layer pointers to the raw frame buffer functions - */ - -extern const GCFuncs fbGCFuncs; -extern GCFuncs shadowGCFuncs; - -Bool -LayerStartInit (ScreenPtr pScreen) -{ - LayerScreenPtr pScrPriv; - - if (layerGeneration != serverGeneration) - { - layerScrPrivateIndex = AllocateScreenPrivateIndex (); - if (layerScrPrivateIndex == -1) - return FALSE; - layerGCPrivateIndex = AllocateGCPrivateIndex (); - if (layerGCPrivateIndex == -1) - return FALSE; - layerWinPrivateIndex = AllocateWindowPrivateIndex (); - if (layerWinPrivateIndex == -1) - return FALSE; - layerGeneration = serverGeneration; - } - if (!AllocateGCPrivate (pScreen, layerGCPrivateIndex, sizeof (LayerGCRec))) - return FALSE; - if (!AllocateWindowPrivate (pScreen, layerWinPrivateIndex, sizeof (LayerWinRec))) - return FALSE; - pScrPriv = (LayerScreenPtr) xalloc (sizeof (LayerScreenRec)); - if (!pScrPriv) - return FALSE; - pScrPriv->nkinds = 0; - pScrPriv->kinds = 0; - pScrPriv->pLayers = 0; - pScreen->devPrivates[layerScrPrivateIndex].ptr = (pointer) pScrPriv; - /* - * Add fb kind -- always 0 - */ - if (LayerNewKind (pScreen) < 0) - { - pScreen->devPrivates[layerScrPrivateIndex].ptr = 0; - xfree (pScrPriv); - return FALSE; - } - /* - * Add shadow kind -- always 1 - */ - if (!shadowSetup (pScreen)) - return FALSE; - if (LayerNewKind (pScreen) < 0) - { - pScreen->devPrivates[layerScrPrivateIndex].ptr = 0; - xfree (pScrPriv->kinds); - xfree (pScrPriv); - return FALSE; - } - return TRUE; -} - -/* - * Initialize wrappers for each acceleration type and - * call this function, it will move the needed functions - * into a new LayerKind and replace them with the generic - * functions. - */ - -int -LayerNewKind (ScreenPtr pScreen) -{ - layerScrPriv(pScreen); - LayerKindPtr pLayKind, pLayKinds; -#ifdef RENDER - PictureScreenPtr ps = GetPictureScreen (pScreen); -#endif - LayerPtr pLayer; - - /* - * Allocate a new kind structure - */ - if (pLayScr->kinds) - pLayKinds = (LayerKindPtr) xrealloc ((pointer) pLayScr->kinds, - (pLayScr->nkinds + 1) * sizeof (LayerKindRec)); - else - pLayKinds = (LayerKindPtr) xalloc (sizeof (LayerKindRec)); - if (!pLayKinds) - return -1; - - /* - * Fix up existing layers to point at the new kind - */ - for (pLayer = pLayScr->pLayers; pLayer; pLayer = pLayer->pNext) - { - int kind = pLayer->pKind - pLayScr->kinds; - - pLayer->pKind = &pLayKinds[kind]; - } - - pLayScr->kinds = pLayKinds; - pLayKind = &pLayScr->kinds[pLayScr->nkinds]; - pLayKind->kind = pLayScr->nkinds; - - /* - * Extract wrapped functions from screen and stick in kind - */ - pLayKind->CloseScreen = pScreen->CloseScreen; - - pLayKind->CreateWindow = pScreen->CreateWindow; - pLayKind->DestroyWindow = pScreen->DestroyWindow; - pLayKind->ChangeWindowAttributes = pScreen->ChangeWindowAttributes; - pLayKind->PaintWindowBackground = pScreen->PaintWindowBackground; - pLayKind->PaintWindowBorder = pScreen->PaintWindowBorder; - pLayKind->CopyWindow = pScreen->CopyWindow; - - pLayKind->CreatePixmap = pScreen->CreatePixmap; - pLayKind->DestroyPixmap = pScreen->DestroyPixmap; - - pLayKind->CreateGC = pScreen->CreateGC; - -#ifdef RENDER - if (ps) - { - pLayKind->Composite = ps->Composite; - pLayKind->Glyphs = ps->Glyphs; - pLayKind->CompositeRects = ps->CompositeRects; - } -#endif - /* - * If not underlying frame buffer kind, - * replace screen functions with those - */ - if (pLayKind->kind != 0) - { - pScreen->CloseScreen = pLayKinds->CloseScreen; - - pScreen->CreateWindow = pLayKinds->CreateWindow; - pScreen->DestroyWindow = pLayKinds->DestroyWindow; - pScreen->ChangeWindowAttributes = pLayKinds->ChangeWindowAttributes; - pScreen->PaintWindowBackground = pLayKinds->PaintWindowBackground; - pScreen->PaintWindowBorder = pLayKinds->PaintWindowBorder; - pScreen->CopyWindow = pLayKinds->CopyWindow; - - pScreen->CreatePixmap = pLayKinds->CreatePixmap; - pScreen->DestroyPixmap = pLayKinds->DestroyPixmap; - - pScreen->CreateGC = pLayKinds->CreateGC; - -#ifdef RENDER - if (ps) - { - ps->Composite = pLayKinds->Composite; - ps->Glyphs = pLayKinds->Glyphs; - ps->CompositeRects = pLayKinds->CompositeRects; - } -#endif - } - - pLayScr->nkinds++; - return pLayKind->kind; -} - -/* - * Finally, call this function and layer - * will wrap the screen functions and prepare for execution - */ - -Bool -LayerFinishInit (ScreenPtr pScreen) -{ -#ifdef RENDER - PictureScreenPtr ps = GetPictureScreen (pScreen); -#endif - - pScreen->CloseScreen = layerCloseScreen; - - pScreen->CreateWindow = layerCreateWindow; - pScreen->DestroyWindow = layerDestroyWindow; - pScreen->ChangeWindowAttributes = layerChangeWindowAttributes; - pScreen->PaintWindowBackground = layerPaintWindowBackground; - pScreen->PaintWindowBorder = layerPaintWindowBorder; - pScreen->CopyWindow = layerCopyWindow; - - pScreen->CreatePixmap = layerCreatePixmap; - pScreen->DestroyPixmap = layerDestroyPixmap; - - pScreen->CreateGC = layerCreateGC; - -#ifdef RENDER - if (ps) - { - ps->Composite = layerComposite; - ps->Glyphs = layerGlyphs; - ps->CompositeRects = layerCompositeRects; - } -#endif - - return TRUE; -} - -/* - * At any point after LayerStartInit, a new layer can be created. - */ -LayerPtr -LayerCreate (ScreenPtr pScreen, - int kind, - int depth, - PixmapPtr pPixmap, - ShadowUpdateProc update, - ShadowWindowProc window, - int randr, - void *closure) -{ - layerScrPriv(pScreen); - LayerPtr pLay, *pPrev; - LayerKindPtr pLayKind; - - if (kind < 0 || pLayScr->nkinds <= kind) - return 0; - pLayKind = &pLayScr->kinds[kind]; - pLay = (LayerPtr) xalloc (sizeof (LayerRec)); - if (!pLay) - return 0; - /* - * Initialize the layer - */ - pLay->pNext = 0; - pLay->pKind = pLayKind; - pLay->refcnt = 1; - pLay->windows = 0; - pLay->depth = depth; - pLay->pPixmap = pPixmap; - pLay->update = update; - pLay->window = window; - pLay->randr = randr; - pLay->closure = closure; - if (pPixmap == LAYER_SCREEN_PIXMAP) - pLay->freePixmap = FALSE; - else - { - pLay->freePixmap = TRUE; - if (pPixmap) - pPixmap->refcnt++; - } - REGION_NULL(pScreen, &pLay->region); - /* - * Hook the layer at the end of the list - */ - for (pPrev = &pLayScr->pLayers; *pPrev; pPrev = &(*pPrev)->pNext) - ; - *pPrev = pLay; - return pLay; -} - -/* - * Change a layer pixmap - */ -void -LayerSetPixmap (ScreenPtr pScreen, LayerPtr pLayer, PixmapPtr pPixmap) -{ - LayerDestroyPixmap (pScreen, pLayer); - pLayer->pPixmap = pPixmap; - if (pPixmap == LAYER_SCREEN_PIXMAP) - pLayer->freePixmap = FALSE; - else - { - if (pPixmap) - pPixmap->refcnt++; - pLayer->freePixmap = TRUE; - } -} - -/* - * Destroy a layer. The layer must not contain any windows. - */ -void -LayerDestroy (ScreenPtr pScreen, LayerPtr pLay) -{ - layerScrPriv(pScreen); - LayerPtr *pPrev; - - --pLay->refcnt; - if (pLay->refcnt > 0) - return; - /* - * Unhook the layer from the list - */ - for (pPrev = &pLayScr->pLayers; *pPrev; pPrev = &(*pPrev)->pNext) - if (*pPrev == pLay) - { - *pPrev = pLay->pNext; - break; - } - /* - * Free associated storage - */ - LayerDestroyPixmap (pScreen, pLay); - REGION_UNINIT (pScreen, &pLay->region); - xfree (pLay); -} - -/* - * CloseScreen wrapper - */ -Bool -layerCloseScreen (int index, ScreenPtr pScreen) -{ - layerScrPriv(pScreen); - int kind; - - /* XXX this is a mess -- fbCloseScreen can only be called once, - * and yet the intervening layers need to be called as well. - */ - kind = pLayScr->nkinds - 1; - pScreen->CloseScreen = pLayScr->kinds[kind].CloseScreen; - (*pScreen->CloseScreen) (index, pScreen); - - /* - * make sure the shadow layer is cleaned up as well - */ - if (kind != LAYER_SHADOW) - xfree (shadowGetScrPriv (pScreen)); - - xfree (pLayScr->kinds); - xfree (pLayScr); - pScreen->devPrivates[layerScrPrivateIndex].ptr = 0; - return TRUE; -} diff --git a/miext/layer/layerpict.c b/miext/layer/layerpict.c deleted file mode 100644 index 16e46f0ab..000000000 --- a/miext/layer/layerpict.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * $XFree86$ - * - * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "layerstr.h" - -void -layerComposite (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - LayerPtr pLayer; - LayerWinLoopRec loop; - DrawablePtr pDstDrawable = pDst->pDrawable; - ScreenPtr pScreen = pDstDrawable->pScreen; - PictureScreenPtr ps = GetPictureScreen (pScreen); - - if (pDstDrawable->type == DRAWABLE_WINDOW) - { - WindowPtr pWin = (WindowPtr) pDstDrawable; - for (pLayer = LayerWindowFirst (pWin, &loop); - pLayer; - pLayer = LayerWindowNext (pWin, &loop)) - { - LayerUnwrap (ps, pLayer->pKind, Composite); - (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, - xMask, yMask, xDst, yDst, width, height); - LayerWrap (ps, pLayer->pKind, Composite, layerComposite); - } - LayerWindowDone (pWin, &loop); - } - else - { - layerScrPriv (pScreen); - LayerUnwrap (ps, &pLayScr->kinds[LAYER_FB], Composite); - (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, - xMask, yMask, xDst, yDst, width, height); - LayerWrap (ps, &pLayScr->kinds[LAYER_FB], Composite, layerComposite); - } -} - -void -layerGlyphs (CARD8 op, - PicturePtr pSrc, - PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, - INT16 ySrc, - int nlist, - GlyphListPtr list, - GlyphPtr *glyphs) -{ - LayerPtr pLayer; - LayerWinLoopRec loop; - DrawablePtr pDstDrawable = pDst->pDrawable; - ScreenPtr pScreen = pDstDrawable->pScreen; - PictureScreenPtr ps = GetPictureScreen (pScreen); - - if (pDstDrawable->type == DRAWABLE_WINDOW) - { - WindowPtr pWin = (WindowPtr) pDstDrawable; - for (pLayer = LayerWindowFirst (pWin, &loop); - pLayer; - pLayer = LayerWindowNext (pWin, &loop)) - { - LayerUnwrap (ps, pLayer->pKind, Glyphs); - (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, - nlist, list, glyphs); - LayerWrap (ps, pLayer->pKind, Glyphs, layerGlyphs); - } - LayerWindowDone (pWin, &loop); - } - else - { - layerScrPriv (pScreen); - LayerUnwrap (ps, &pLayScr->kinds[LAYER_FB], Glyphs); - (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, - nlist, list, glyphs); - LayerWrap (ps, &pLayScr->kinds[LAYER_FB], Glyphs, layerGlyphs); - } -} - -void -layerCompositeRects (CARD8 op, - PicturePtr pDst, - xRenderColor *color, - int nRect, - xRectangle *rects) -{ - LayerPtr pLayer; - LayerWinLoopRec loop; - DrawablePtr pDstDrawable = pDst->pDrawable; - ScreenPtr pScreen = pDstDrawable->pScreen; - PictureScreenPtr ps = GetPictureScreen (pScreen); - - if (pDstDrawable->type == DRAWABLE_WINDOW) - { - WindowPtr pWin = (WindowPtr) pDstDrawable; - for (pLayer = LayerWindowFirst (pWin, &loop); - pLayer; - pLayer = LayerWindowNext (pWin, &loop)) - { - LayerUnwrap (ps, pLayer->pKind, CompositeRects); - (*ps->CompositeRects) (op, pDst, color, nRect, rects); - LayerWrap (ps, pLayer->pKind, CompositeRects, layerCompositeRects); - } - LayerWindowDone (pWin, &loop); - } - else - { - layerScrPriv (pScreen); - LayerUnwrap (ps, &pLayScr->kinds[LAYER_FB], CompositeRects); - (*ps->CompositeRects) (op, pDst, color, nRect, rects); - LayerWrap (ps, &pLayScr->kinds[LAYER_FB], CompositeRects, layerCompositeRects); - } -} diff --git a/miext/layer/layerwin.c b/miext/layer/layerwin.c deleted file mode 100644 index 7afe90ade..000000000 --- a/miext/layer/layerwin.c +++ /dev/null @@ -1,487 +0,0 @@ -/* - * $XFree86: xc/programs/Xserver/miext/layer/layerwin.c,v 1.7tsi Exp $ - * - * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "layerstr.h" - -static LayerListPtr -NewLayerList (ScreenPtr pScreen, LayerPtr pLayer) -{ - LayerListPtr pLayList; - - pLayList = (LayerListPtr) xalloc (sizeof (LayerListRec)); - if (!pLayList) - return 0; - pLayList->pNext = 0; - pLayList->pLayer = pLayer; - pLayList->inheritClip = TRUE; - REGION_NULL (pScreen, &pLayList->clipList); - REGION_NULL (pScreen, &pLayList->borderClip); - return pLayList; -} - -static void -FreeLayerList (ScreenPtr pScreen, LayerListPtr pLayList) -{ - REGION_UNINIT (pScreen, &pLayList->clipList); - REGION_UNINIT (pScreen, &pLayList->borderClip); - xfree (pLayList); -} - -/* - * Create pixmap for a layer - */ - -Bool -LayerCreatePixmap (ScreenPtr pScreen, LayerPtr pLayer) -{ - LayerKindPtr pKind = pLayer->pKind; - - LayerUnwrap (pScreen, pKind, CreatePixmap); - /* XXX create full-screen sized layers all around */ - pLayer->pPixmap = (*pScreen->CreatePixmap) (pScreen, pScreen->width, - pScreen->height, pLayer->depth); - LayerWrap (pScreen, pKind, CreatePixmap, layerCreatePixmap); - if (!pLayer->pPixmap) - return FALSE; - if (pLayer->pKind->kind == LAYER_SHADOW) - { - if (!shadowAdd (pScreen, pLayer->pPixmap, pLayer->update, - pLayer->window, pLayer->randr, - pLayer->closure)) - return FALSE; - } - return TRUE; -} - -/* - * Destroy pixmap for a layer - */ - -void -LayerDestroyPixmap (ScreenPtr pScreen, LayerPtr pLayer) -{ - if (pLayer->pPixmap) - { - if (pLayer->pKind->kind == LAYER_SHADOW) - shadowRemove (pScreen, pLayer->pPixmap); - if (pLayer->freePixmap) - { - LayerKindPtr pKind = pLayer->pKind; - - LayerUnwrap (pScreen, pKind, DestroyPixmap); - (*pScreen->DestroyPixmap) (pLayer->pPixmap); - LayerWrap (pScreen, pKind, DestroyPixmap, layerDestroyPixmap); - } - pLayer->pPixmap = 0; - } -} - -/* - * Add a window to a layer - */ -Bool -LayerWindowAdd (ScreenPtr pScreen, LayerPtr pLayer, WindowPtr pWin) -{ - layerWinPriv(pWin); - - if (pLayer->pPixmap == LAYER_SCREEN_PIXMAP) - pLayer->pPixmap = (*pScreen->GetScreenPixmap) (pScreen); - else if (!pLayer->pPixmap && !LayerCreatePixmap (pScreen, pLayer)) - return FALSE; - /* - * Add a new layer list if needed - */ - if (pLayWin->isList || pLayWin->u.pLayer) - { - LayerListPtr pPrev; - LayerListPtr pLayList; - - if (!pLayWin->isList) - { - pPrev = NewLayerList (pScreen, pLayWin->u.pLayer); - if (!pPrev) - return FALSE; - } - else - { - for (pPrev = pLayWin->u.pLayList; pPrev->pNext; pPrev = pPrev->pNext) - ; - } - pLayList = NewLayerList (pScreen, pLayer); - if (!pLayList) - { - if (!pLayWin->isList) - FreeLayerList (pScreen, pPrev); - return FALSE; - } - pPrev->pNext = pLayList; - if (!pLayWin->isList) - { - pLayWin->isList = TRUE; - pLayWin->u.pLayList = pPrev; - } - } - else - pLayWin->u.pLayer = pLayer; - /* - * XXX only one layer supported for drawing, last one wins - */ - (*pScreen->SetWindowPixmap) (pWin, pLayer->pPixmap); - pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; - pLayer->refcnt++; - pLayer->windows++; - return TRUE; -} - -/* - * Remove a window from a layer - */ - -void -LayerWindowRemove (ScreenPtr pScreen, LayerPtr pLayer, WindowPtr pWin) -{ - layerWinPriv(pWin); - - if (pLayWin->isList) - { - LayerListPtr *pPrev; - LayerListPtr pLayList; - - for (pPrev = &pLayWin->u.pLayList; (pLayList = *pPrev); pPrev = &pLayList->pNext) - { - if (pLayList->pLayer == pLayer) - { - *pPrev = pLayList->pNext; - FreeLayerList (pScreen, pLayList); - --pLayer->windows; - if (pLayer->windows <= 0) - LayerDestroyPixmap (pScreen, pLayer); - LayerDestroy (pScreen, pLayer); - break; - } - } - pLayList = pLayWin->u.pLayList; - if (!pLayList) - { - /* - * List is empty, set isList back to false - */ - pLayWin->isList = FALSE; - pLayWin->u.pLayer = 0; - } - else if (!pLayList->pNext && pLayList->inheritClip) - { - /* - * List contains a single element using the - * window clip, free the list structure and - * host the layer back to the window private - */ - pLayer = pLayList->pLayer; - FreeLayerList (pScreen, pLayList); - pLayWin->isList = FALSE; - pLayWin->u.pLayer = pLayer; - } - } - else - { - if (pLayWin->u.pLayer == pLayer) - { - --pLayer->windows; - if (pLayer->windows <= 0) - LayerDestroyPixmap (pScreen, pLayer); - LayerDestroy (pScreen, pLayer); - pLayWin->u.pLayer = 0; - } - } - pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; -} - -/* - * Looping primitives for window layering. Usage: - * - * for (pLayer = LayerWindowFirst (pWin, &loop); - * pLayer; - * pLayer = LayerWindowNext (&loop)) - * { - * ... - * } - * LayerWindowDone (pWin, &loop); - */ - -LayerPtr -LayerWindowFirst (WindowPtr pWin, LayerWinLoopPtr pLoop) -{ - layerWinPriv (pWin); - - pLoop->pLayWin = pLayWin; - if (!pLayWin->isList) - return pLayWin->u.pLayer; - - /* - * Preserve original state - */ - pLoop->clipList = pWin->clipList; - pLoop->borderClip = pWin->borderClip; - pLoop->pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin); - - /* - * Set initial list element - */ - pLoop->pLayList = pLayWin->u.pLayList; - - /* - * Return first layer - */ - return LayerWindowNext (pWin, pLoop); -} - -LayerPtr -LayerWindowNext (WindowPtr pWin, LayerWinLoopPtr pLoop) -{ - LayerPtr pLayer; - LayerWinPtr pLayWin = pLoop->pLayWin; - LayerListPtr pLayList; - - if (!pLayWin->isList) - return 0; - - pLayList = pLoop->pLayList; - pLayer = pLayList->pLayer; - /* - * Configure window for this layer - */ - (*pWin->drawable.pScreen->SetWindowPixmap) (pWin, pLayer->pPixmap); - if (!pLayList->inheritClip) - { - pWin->clipList = pLayList->clipList; - pWin->borderClip = pLayList->borderClip; - } - /* - * Step to next layer list - */ - pLoop->pLayList = pLayList->pNext; - /* - * Return layer - */ - return pLayer; -} - -void -LayerWindowDone (WindowPtr pWin, LayerWinLoopPtr pLoop) -{ - LayerWinPtr pLayWin = pLoop->pLayWin; - - if (!pLayWin->isList) - return; - /* - * clean up after the loop - */ - pWin->clipList = pLoop->clipList; - pWin->borderClip = pLoop->clipList; - (*pWin->drawable.pScreen->SetWindowPixmap) (pWin, pLoop->pPixmap); -} - -Bool -layerCreateWindow (WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - layerWinPriv(pWin); - layerScrPriv(pScreen); - LayerPtr pLayer; - Bool ret; - - pLayWin->isList = FALSE; - pLayWin->u.pLayer = 0; - - /* - * input only windows don't live in any layer - */ - if (pWin->drawable.type == UNDRAWABLE_WINDOW) - return TRUE; - /* - * Use a reasonable default layer -- the first - * layer matching the windows depth. Subsystems needing - * alternative layering semantics can override this by - * replacing this function. Perhaps a new screen function - * could be used to select the correct initial window - * layer instead. - */ - for (pLayer = pLayScr->pLayers; pLayer; pLayer = pLayer->pNext) - if (pLayer->depth == pWin->drawable.depth) - break; - ret = TRUE; - if (pLayer) - { - pScreen->CreateWindow = pLayer->pKind->CreateWindow; - ret = (*pScreen->CreateWindow) (pWin); - pLayer->pKind->CreateWindow = pScreen->CreateWindow; - pScreen->CreateWindow = layerCreateWindow; - LayerWindowAdd (pScreen, pLayer, pWin); - } - return ret; -} - -Bool -layerDestroyWindow (WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - layerWinPriv(pWin); - LayerPtr pLayer; - Bool ret = TRUE; - - while ((pLayer = layerWinLayer (pLayWin))) - { - LayerUnwrap (pScreen, pLayer->pKind, DestroyWindow); - ret = (*pScreen->DestroyWindow) (pWin); - LayerWrap (pScreen, pLayer->pKind, DestroyWindow, layerDestroyWindow); - LayerWindowRemove (pWin->drawable.pScreen, pLayer, pWin); - } - return ret; -} - -Bool -layerChangeWindowAttributes (WindowPtr pWin, unsigned long mask) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - LayerPtr pLay; - LayerWinLoopRec loop; - Bool ret = TRUE; - - for (pLay = LayerWindowFirst (pWin, &loop); - pLay; - pLay = LayerWindowNext (pWin, &loop)) - { - LayerUnwrap(pScreen,pLay->pKind,ChangeWindowAttributes); - if (!(*pScreen->ChangeWindowAttributes) (pWin, mask)) - ret = FALSE; - LayerWrap(pScreen,pLay->pKind,ChangeWindowAttributes,layerChangeWindowAttributes); - } - LayerWindowDone (pWin, &loop); - return ret; -} - -void -layerPaintWindowBackground (WindowPtr pWin, RegionPtr pRegion, int what) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - LayerPtr pLay; - LayerWinLoopRec loop; - - for (pLay = LayerWindowFirst (pWin, &loop); - pLay; - pLay = LayerWindowNext (pWin, &loop)) - { - LayerUnwrap(pScreen,pLay->pKind,PaintWindowBackground); - (*pScreen->PaintWindowBackground) (pWin, pRegion, what); - LayerWrap(pScreen,pLay->pKind,PaintWindowBackground,layerPaintWindowBackground); - } - LayerWindowDone (pWin, &loop); -} - -void -layerPaintWindowBorder (WindowPtr pWin, RegionPtr pRegion, int what) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - LayerPtr pLay; - LayerWinLoopRec loop; - - for (pLay = LayerWindowFirst (pWin, &loop); - pLay; - pLay = LayerWindowNext (pWin, &loop)) - { - LayerUnwrap(pScreen,pLay->pKind,PaintWindowBorder); - (*pScreen->PaintWindowBorder) (pWin, pRegion, what); - LayerWrap(pScreen,pLay->pKind,PaintWindowBorder,layerPaintWindowBorder); - } - LayerWindowDone (pWin, &loop); -} - -void -layerCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - LayerPtr pLay; - LayerWinLoopRec loop; - int dx = 0, dy = 0; - - for (pLay = LayerWindowFirst (pWin, &loop); - pLay; - pLay = LayerWindowNext (pWin, &loop)) - { - LayerUnwrap(pScreen,pLay->pKind,CopyWindow); - /* - * Undo the translation done within the last CopyWindow proc (sigh) - */ - if (dx || dy) - REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, dx, dy); - (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); - LayerWrap(pScreen,pLay->pKind,CopyWindow,layerCopyWindow); - /* - * Save offset to undo translation next time around - */ - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - } - LayerWindowDone (pWin, &loop); -} - -PixmapPtr -layerCreatePixmap (ScreenPtr pScreen, int width, int height, int depth) -{ - /* XXX assume the first layer can handle all pixmaps */ - layerScrPriv (pScreen); - LayerKindPtr pKind; - PixmapPtr pPixmap; - - pKind = &pLayScr->kinds[0]; - if (pLayScr->pLayers) - pKind = pLayScr->pLayers->pKind; - LayerUnwrap (pScreen, pKind, CreatePixmap); - pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, depth); - LayerWrap (pScreen,pKind,CreatePixmap,layerCreatePixmap); - return pPixmap; -} - -Bool -layerDestroyPixmap (PixmapPtr pPixmap) -{ - /* XXX assume the first layer can handle all pixmaps */ - ScreenPtr pScreen = pPixmap->drawable.pScreen; - layerScrPriv (pScreen); - LayerKindPtr pKind; - Bool ret; - - pKind = &pLayScr->kinds[0]; - if (pLayScr->pLayers) - pKind = pLayScr->pLayers->pKind; - LayerUnwrap (pScreen, pKind, DestroyPixmap); - ret = (*pScreen->DestroyPixmap) (pPixmap); - LayerWrap (pScreen,pKind,DestroyPixmap,layerDestroyPixmap); - return ret; -} -