65fea56f17cd614bc8908264df980a62e1931468vboxsync/*
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Copyright © 2003 Keith Packard
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Permission to use, copy, modify, distribute, and sell this software and its
65fea56f17cd614bc8908264df980a62e1931468vboxsync * documentation for any purpose is hereby granted without fee, provided that
65fea56f17cd614bc8908264df980a62e1931468vboxsync * the above copyright notice appear in all copies and that both that
65fea56f17cd614bc8908264df980a62e1931468vboxsync * copyright notice and this permission notice appear in supporting
65fea56f17cd614bc8908264df980a62e1931468vboxsync * documentation, and that the name of Keith Packard not be used in
65fea56f17cd614bc8908264df980a62e1931468vboxsync * advertising or publicity pertaining to distribution of the software without
65fea56f17cd614bc8908264df980a62e1931468vboxsync * specific, written prior permission. Keith Packard makes no
65fea56f17cd614bc8908264df980a62e1931468vboxsync * representations about the suitability of this software for any purpose. It
65fea56f17cd614bc8908264df980a62e1931468vboxsync * is provided "as is" without express or implied warranty.
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
65fea56f17cd614bc8908264df980a62e1931468vboxsync * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
65fea56f17cd614bc8908264df980a62e1931468vboxsync * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
65fea56f17cd614bc8908264df980a62e1931468vboxsync * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
65fea56f17cd614bc8908264df980a62e1931468vboxsync * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
65fea56f17cd614bc8908264df980a62e1931468vboxsync * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
65fea56f17cd614bc8908264df980a62e1931468vboxsync * PERFORMANCE OF THIS SOFTWARE.
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#ifdef HAVE_DIX_CONFIG_H
65fea56f17cd614bc8908264df980a62e1931468vboxsync#include <dix-config.h>
65fea56f17cd614bc8908264df980a62e1931468vboxsync#endif
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#ifndef _DAMAGESTR_H_
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define _DAMAGESTR_H_
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#include "damage.h"
65fea56f17cd614bc8908264df980a62e1931468vboxsync#include "gcstruct.h"
65fea56f17cd614bc8908264df980a62e1931468vboxsync#include "privates.h"
65fea56f17cd614bc8908264df980a62e1931468vboxsync#include "picturestr.h"
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsynctypedef struct _damage {
65fea56f17cd614bc8908264df980a62e1931468vboxsync DamagePtr pNext;
65fea56f17cd614bc8908264df980a62e1931468vboxsync DamagePtr pNextWin;
65fea56f17cd614bc8908264df980a62e1931468vboxsync RegionRec damage;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync DamageReportLevel damageLevel;
65fea56f17cd614bc8908264df980a62e1931468vboxsync Bool isInternal;
65fea56f17cd614bc8908264df980a62e1931468vboxsync void *closure;
65fea56f17cd614bc8908264df980a62e1931468vboxsync Bool isWindow;
65fea56f17cd614bc8908264df980a62e1931468vboxsync DrawablePtr pDrawable;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync DamageReportFunc damageReport;
65fea56f17cd614bc8908264df980a62e1931468vboxsync DamageDestroyFunc damageDestroy;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync Bool reportAfter;
65fea56f17cd614bc8908264df980a62e1931468vboxsync RegionRec pendingDamage; /* will be flushed post submission at the latest */
65fea56f17cd614bc8908264df980a62e1931468vboxsync ScreenPtr pScreen;
65fea56f17cd614bc8908264df980a62e1931468vboxsync PrivateRec *devPrivates;
65fea56f17cd614bc8908264df980a62e1931468vboxsync} DamageRec;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsynctypedef struct _damageScrPriv {
65fea56f17cd614bc8908264df980a62e1931468vboxsync int internalLevel;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync /*
65fea56f17cd614bc8908264df980a62e1931468vboxsync * For DDXen which don't provide GetScreenPixmap, this provides
65fea56f17cd614bc8908264df980a62e1931468vboxsync * a place to hook damage for windows on the screen
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync DamagePtr pScreenDamage;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync CopyWindowProcPtr CopyWindow;
65fea56f17cd614bc8908264df980a62e1931468vboxsync CloseScreenProcPtr CloseScreen;
65fea56f17cd614bc8908264df980a62e1931468vboxsync CreateGCProcPtr CreateGC;
65fea56f17cd614bc8908264df980a62e1931468vboxsync DestroyPixmapProcPtr DestroyPixmap;
65fea56f17cd614bc8908264df980a62e1931468vboxsync SetWindowPixmapProcPtr SetWindowPixmap;
65fea56f17cd614bc8908264df980a62e1931468vboxsync DestroyWindowProcPtr DestroyWindow;
65fea56f17cd614bc8908264df980a62e1931468vboxsync CompositeProcPtr Composite;
65fea56f17cd614bc8908264df980a62e1931468vboxsync GlyphsProcPtr Glyphs;
65fea56f17cd614bc8908264df980a62e1931468vboxsync AddTrapsProcPtr AddTraps;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* Table of wrappable function pointers */
65fea56f17cd614bc8908264df980a62e1931468vboxsync DamageScreenFuncsRec funcs;
65fea56f17cd614bc8908264df980a62e1931468vboxsync} DamageScrPrivRec, *DamageScrPrivPtr;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsynctypedef struct _damageGCPriv {
65fea56f17cd614bc8908264df980a62e1931468vboxsync GCOps *ops;
65fea56f17cd614bc8908264df980a62e1931468vboxsync GCFuncs *funcs;
65fea56f17cd614bc8908264df980a62e1931468vboxsync} DamageGCPrivRec, *DamageGCPrivPtr;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/* XXX should move these into damage.c, damageScrPrivateIndex is static */
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define damageGetScrPriv(pScr) ((DamageScrPrivPtr) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync dixLookupPrivate(&(pScr)->devPrivates, damageScrPrivateKey))
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define damageScrPriv(pScr) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync DamageScrPrivPtr pScrPriv = damageGetScrPriv(pScr)
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define damageGetPixPriv(pPix) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync dixLookupPrivate(&(pPix)->devPrivates, damagePixPrivateKey)
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define damgeSetPixPriv(pPix,v) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync dixSetPrivate(&(pPix)->devPrivates, damagePixPrivateKey, v)
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define damagePixPriv(pPix) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync DamagePtr pDamage = damageGetPixPriv(pPix)
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define damageGetGCPriv(pGC) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync dixLookupPrivate(&(pGC)->devPrivates, damageGCPrivateKey)
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define damageGCPriv(pGC) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync DamageGCPrivPtr pGCPriv = damageGetGCPriv(pGC)
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define damageGetWinPriv(pWin) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync ((DamagePtr)dixLookupPrivate(&(pWin)->devPrivates, damageWinPrivateKey))
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define damageSetWinPriv(pWin,d) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync dixSetPrivate(&(pWin)->devPrivates, damageWinPrivateKey, d)
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#endif /* _DAMAGESTR_H_ */