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