1 /* 2 * Copyright © 2003 Keith Packard 3 * 4 * Permission to use, copy, modify, distribute, and sell this software and its 5 * documentation for any purpose is hereby granted without fee, provided that 6 * the above copyright notice appear in all copies and that both that 7 * copyright notice and this permission notice appear in supporting 8 * documentation, and that the name of Keith Packard not be used in 9 * advertising or publicity pertaining to distribution of the software without 10 * specific, written prior permission. Keith Packard makes no 11 * representations about the suitability of this software for any purpose. It 12 * is provided "as is" without express or implied warranty. 13 * 14 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 16 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR 17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 20 * PERFORMANCE OF THIS SOFTWARE. 21 */ 22 23 #ifdef HAVE_DIX_CONFIG_H 24 #include <dix-config.h> 25 #endif 26 27 #ifndef _DAMAGESTR_H_ 28 #define _DAMAGESTR_H_ 29 30 #include "damage.h" 31 #include "gcstruct.h" 32 #include "privates.h" 33 #include "picturestr.h" 34 35 typedef struct _damage { 36 DamagePtr pNext; 37 DamagePtr pNextWin; 38 RegionRec damage; 39 40 DamageReportLevel damageLevel; 41 Bool isInternal; 42 void *closure; 43 Bool isWindow; 44 DrawablePtr pDrawable; 45 46 DamageReportFunc damageReport; 47 DamageDestroyFunc damageDestroy; 48 49 Bool reportAfter; 50 RegionRec pendingDamage; /* will be flushed post submission at the latest */ 51 ScreenPtr pScreen; 52 } DamageRec; 53 54 typedef struct _damageScrPriv { 55 int internalLevel; 56 57 /* 58 * For DDXen which don't provide GetScreenPixmap, this provides 59 * a place to hook damage for windows on the screen 60 */ 61 DamagePtr pScreenDamage; 62 63 CopyWindowProcPtr CopyWindow; 64 CloseScreenProcPtr CloseScreen; 65 CreateGCProcPtr CreateGC; 66 DestroyPixmapProcPtr DestroyPixmap; 67 SetWindowPixmapProcPtr SetWindowPixmap; 68 DestroyWindowProcPtr DestroyWindow; 69 CompositeProcPtr Composite; 70 GlyphsProcPtr Glyphs; 71 AddTrapsProcPtr AddTraps; 72 73 /* Table of wrappable function pointers */ 74 DamageScreenFuncsRec funcs; 75 } DamageScrPrivRec, *DamageScrPrivPtr; 76 77 typedef struct _damageGCPriv { 78 const GCOps *ops; 79 const GCFuncs *funcs; 80 } DamageGCPrivRec, *DamageGCPrivPtr; 81 82 /* XXX should move these into damage.c, damageScrPrivateIndex is static */ 83 #define damageGetScrPriv(pScr) ((DamageScrPrivPtr) \ 84 dixLookupPrivate(&(pScr)->devPrivates, damageScrPrivateKey)) 85 86 #define damageScrPriv(pScr) \ 87 DamageScrPrivPtr pScrPriv = damageGetScrPriv(pScr) 88 89 #define damageGetPixPriv(pPix) \ 90 dixLookupPrivate(&(pPix)->devPrivates, damagePixPrivateKey) 91 92 #define damgeSetPixPriv(pPix,v) \ 93 dixSetPrivate(&(pPix)->devPrivates, damagePixPrivateKey, v) 94 95 #define damagePixPriv(pPix) \ 96 DamagePtr pDamage = damageGetPixPriv(pPix) 97 98 #define damageGetGCPriv(pGC) \ 99 dixLookupPrivate(&(pGC)->devPrivates, damageGCPrivateKey) 100 101 #define damageGCPriv(pGC) \ 102 DamageGCPrivPtr pGCPriv = damageGetGCPriv(pGC) 103 104 #define damageGetWinPriv(pWin) \ 105 ((DamagePtr)dixLookupPrivate(&(pWin)->devPrivates, damageWinPrivateKey)) 106 107 #define damageSetWinPriv(pWin,d) \ 108 dixSetPrivate(&(pWin)->devPrivates, damageWinPrivateKey, d) 109 110 #endif /* _DAMAGESTR_H_ */ 111