65fea56f17cd614bc8908264df980a62e1931468vboxsync/******************************************************************************
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Copyright (c) 1994, 1995 Hewlett-Packard Company
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Permission is hereby granted, free of charge, to any person obtaining
65fea56f17cd614bc8908264df980a62e1931468vboxsync * a copy of this software and associated documentation files (the
65fea56f17cd614bc8908264df980a62e1931468vboxsync * "Software"), to deal in the Software without restriction, including
65fea56f17cd614bc8908264df980a62e1931468vboxsync * without limitation the rights to use, copy, modify, merge, publish,
65fea56f17cd614bc8908264df980a62e1931468vboxsync * distribute, sublicense, and/or sell copies of the Software, and to
65fea56f17cd614bc8908264df980a62e1931468vboxsync * permit persons to whom the Software is furnished to do so, subject to
65fea56f17cd614bc8908264df980a62e1931468vboxsync * the following conditions:
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync * The above copyright notice and this permission notice shall be included
65fea56f17cd614bc8908264df980a62e1931468vboxsync * in all copies or substantial portions of the Software.
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
65fea56f17cd614bc8908264df980a62e1931468vboxsync * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
65fea56f17cd614bc8908264df980a62e1931468vboxsync * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
65fea56f17cd614bc8908264df980a62e1931468vboxsync * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
65fea56f17cd614bc8908264df980a62e1931468vboxsync * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
65fea56f17cd614bc8908264df980a62e1931468vboxsync * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
65fea56f17cd614bc8908264df980a62e1931468vboxsync * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Except as contained in this notice, the name of the Hewlett-Packard
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Company shall not be used in advertising or otherwise to promote the
65fea56f17cd614bc8908264df980a62e1931468vboxsync * sale, use or other dealings in this Software without prior written
65fea56f17cd614bc8908264df980a62e1931468vboxsync * authorization from the Hewlett-Packard Company.
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Header file for DIX-related DBE
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync *****************************************************************************/
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#ifndef DBE_STRUCT_H
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define DBE_STRUCT_H
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/* INCLUDES */
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define NEED_DBE_PROTOCOL
65fea56f17cd614bc8908264df980a62e1931468vboxsync#include <X11/extensions/dbeproto.h>
65fea56f17cd614bc8908264df980a62e1931468vboxsync#include "windowstr.h"
65fea56f17cd614bc8908264df980a62e1931468vboxsync#include "privates.h"
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsynctypedef struct {
65fea56f17cd614bc8908264df980a62e1931468vboxsync VisualID visual; /* one visual ID that supports double-buffering */
65fea56f17cd614bc8908264df980a62e1931468vboxsync int depth; /* depth of visual in bits */
65fea56f17cd614bc8908264df980a62e1931468vboxsync int perflevel; /* performance level of visual */
65fea56f17cd614bc8908264df980a62e1931468vboxsync} XdbeVisualInfo;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsynctypedef struct {
65fea56f17cd614bc8908264df980a62e1931468vboxsync int count; /* number of items in visual_depth */
65fea56f17cd614bc8908264df980a62e1931468vboxsync XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */
65fea56f17cd614bc8908264df980a62e1931468vboxsync} XdbeScreenVisualInfo;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/* DEFINES */
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey))
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync DBE_SCREEN_PRIV((pDrawable)->pScreen)
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen)
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync DBE_SCREEN_PRIV((pWindow)->drawable.pScreen)
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen)
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define DBE_SCREEN_PRIV_FROM_GC(pGC)\
65fea56f17cd614bc8908264df980a62e1931468vboxsync DBE_SCREEN_PRIV((pGC)->pScreen)
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \
65fea56f17cd614bc8908264df980a62e1931468vboxsync dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey))
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/* Initial size of the buffer ID array in the window priv. */
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define DBE_INIT_MAX_IDS 2
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/* Reallocation increment for the buffer ID array. */
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define DBE_INCR_MAX_IDS 4
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/* Marker for free elements in the buffer ID array. */
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define DBE_FREE_ID_ELEMENT 0
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/* TYPEDEFS */
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/* Record used to pass swap information between DIX and DDX swapping
65fea56f17cd614bc8908264df980a62e1931468vboxsync * procedures.
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsynctypedef struct _DbeSwapInfoRec {
65fea56f17cd614bc8908264df980a62e1931468vboxsync WindowPtr pWindow;
65fea56f17cd614bc8908264df980a62e1931468vboxsync unsigned char swapAction;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync} DbeSwapInfoRec, *DbeSwapInfoPtr;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/*
65fea56f17cd614bc8908264df980a62e1931468vboxsync ******************************************************************************
65fea56f17cd614bc8908264df980a62e1931468vboxsync ** Per-window data
65fea56f17cd614bc8908264df980a62e1931468vboxsync ******************************************************************************
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsynctypedef struct _DbeWindowPrivRec {
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* A pointer to the window with which the DBE window private (buffer) is
65fea56f17cd614bc8908264df980a62e1931468vboxsync * associated.
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync WindowPtr pWindow;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* Last known swap action for this buffer. Legal values for this field
65fea56f17cd614bc8908264df980a62e1931468vboxsync * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied.
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync unsigned char swapAction;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* Last known buffer size.
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync unsigned short width, height;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* Coordinates used for static gravity when the window is positioned.
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync short x, y;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* Number of XIDs associated with this buffer.
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync int nBufferIDs;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* Capacity of the current buffer ID array, IDs. */
65fea56f17cd614bc8908264df980a62e1931468vboxsync int maxAvailableIDs;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* Pointer to the array of buffer IDs. This initially points to initIDs.
65fea56f17cd614bc8908264df980a62e1931468vboxsync * When the static limit of the initIDs array is reached, the array is
65fea56f17cd614bc8908264df980a62e1931468vboxsync * reallocated and this pointer is set to the new array instead of initIDs.
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync XID *IDs;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* Initial array of buffer IDs. We are defining the XID array within the
65fea56f17cd614bc8908264df980a62e1931468vboxsync * window priv to optimize for data locality. In most cases, only one
65fea56f17cd614bc8908264df980a62e1931468vboxsync * buffer will be associated with a window. Having the array declared
65fea56f17cd614bc8908264df980a62e1931468vboxsync * here can prevent us from accessing the data in another memory page,
65fea56f17cd614bc8908264df980a62e1931468vboxsync * possibly resulting in a page swap and loss of performance. Initially we
65fea56f17cd614bc8908264df980a62e1931468vboxsync * will use this array to store buffer IDs. For situations where we have
65fea56f17cd614bc8908264df980a62e1931468vboxsync * more IDs than can fit in this static array, we will allocate a larger
65fea56f17cd614bc8908264df980a62e1931468vboxsync * array to use, possibly suffering a performance loss.
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync XID initIDs[DBE_INIT_MAX_IDS];
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* Pointer to a drawable that contains the contents of the back buffer.
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync PixmapPtr pBackBuffer;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* Pointer to a drawable that contains the contents of the front buffer.
65fea56f17cd614bc8908264df980a62e1931468vboxsync * This pointer is only used for the XdbeUntouched swap action. For that
65fea56f17cd614bc8908264df980a62e1931468vboxsync * swap action, we need to copy the front buffer (window) contents into
65fea56f17cd614bc8908264df980a62e1931468vboxsync * this drawable, copy the contents of current back buffer drawable (the
65fea56f17cd614bc8908264df980a62e1931468vboxsync * back buffer) into the window, swap the front and back drawable pointers,
65fea56f17cd614bc8908264df980a62e1931468vboxsync * and then swap the drawable/resource associations in the resource
65fea56f17cd614bc8908264df980a62e1931468vboxsync * database.
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync PixmapPtr pFrontBuffer;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* Device-specific private information.
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync PrivateRec *devPrivates;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync} DbeWindowPrivRec, *DbeWindowPrivPtr;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/*
65fea56f17cd614bc8908264df980a62e1931468vboxsync ******************************************************************************
65fea56f17cd614bc8908264df980a62e1931468vboxsync ** Per-screen data
65fea56f17cd614bc8908264df980a62e1931468vboxsync ******************************************************************************
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsynctypedef struct _DbeScreenPrivRec {
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* Wrapped functions
65fea56f17cd614bc8908264df980a62e1931468vboxsync * It is the responsibilty of the DDX layer to wrap PositionWindow().
65fea56f17cd614bc8908264df980a62e1931468vboxsync * DbeExtensionInit wraps DestroyWindow().
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync PositionWindowProcPtr PositionWindow;
65fea56f17cd614bc8908264df980a62e1931468vboxsync DestroyWindowProcPtr DestroyWindow;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* Per-screen DIX routines */
65fea56f17cd614bc8908264df980a62e1931468vboxsync Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync GCPtr /*pGC */
65fea56f17cd614bc8908264df980a62e1931468vboxsync );
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync /* Per-screen DDX routines */
65fea56f17cd614bc8908264df980a62e1931468vboxsync Bool (*GetVisualInfo) (ScreenPtr /*pScreen */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync XdbeScreenVisualInfo * /*pVisInfo */
65fea56f17cd614bc8908264df980a62e1931468vboxsync );
65fea56f17cd614bc8908264df980a62e1931468vboxsync int (*AllocBackBufferName) (WindowPtr /*pWin */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync XID /*bufId */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /*swapAction */
65fea56f17cd614bc8908264df980a62e1931468vboxsync );
65fea56f17cd614bc8908264df980a62e1931468vboxsync int (*SwapBuffers) (ClientPtr /*client */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync int * /*pNumWindows */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync DbeSwapInfoPtr /*swapInfo */
65fea56f17cd614bc8908264df980a62e1931468vboxsync );
65fea56f17cd614bc8908264df980a62e1931468vboxsync void (*WinPrivDelete) (DbeWindowPrivPtr /*pDbeWindowPriv */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync XID /*bufId */
65fea56f17cd614bc8908264df980a62e1931468vboxsync );
65fea56f17cd614bc8908264df980a62e1931468vboxsync} DbeScreenPrivRec, *DbeScreenPrivPtr;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#endif /* DBE_STRUCT_H */