dbestruct.h revision 05b261ec
105b261ecSmrg/****************************************************************************** 205b261ecSmrg * 305b261ecSmrg * Copyright (c) 1994, 1995 Hewlett-Packard Company 405b261ecSmrg * 505b261ecSmrg * Permission is hereby granted, free of charge, to any person obtaining 605b261ecSmrg * a copy of this software and associated documentation files (the 705b261ecSmrg * "Software"), to deal in the Software without restriction, including 805b261ecSmrg * without limitation the rights to use, copy, modify, merge, publish, 905b261ecSmrg * distribute, sublicense, and/or sell copies of the Software, and to 1005b261ecSmrg * permit persons to whom the Software is furnished to do so, subject to 1105b261ecSmrg * the following conditions: 1205b261ecSmrg * 1305b261ecSmrg * The above copyright notice and this permission notice shall be included 1405b261ecSmrg * in all copies or substantial portions of the Software. 1505b261ecSmrg * 1605b261ecSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1705b261ecSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 1805b261ecSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 1905b261ecSmrg * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, 2005b261ecSmrg * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 2105b261ecSmrg * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 2205b261ecSmrg * THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2305b261ecSmrg * 2405b261ecSmrg * Except as contained in this notice, the name of the Hewlett-Packard 2505b261ecSmrg * Company shall not be used in advertising or otherwise to promote the 2605b261ecSmrg * sale, use or other dealings in this Software without prior written 2705b261ecSmrg * authorization from the Hewlett-Packard Company. 2805b261ecSmrg * 2905b261ecSmrg * Header file for DIX-related DBE 3005b261ecSmrg * 3105b261ecSmrg *****************************************************************************/ 3205b261ecSmrg 3305b261ecSmrg#ifndef DBE_STRUCT_H 3405b261ecSmrg#define DBE_STRUCT_H 3505b261ecSmrg 3605b261ecSmrg 3705b261ecSmrg/* INCLUDES */ 3805b261ecSmrg 3905b261ecSmrg#define NEED_DBE_PROTOCOL 4005b261ecSmrg#include <X11/extensions/Xdbeproto.h> 4105b261ecSmrg#include "windowstr.h" 4205b261ecSmrg 4305b261ecSmrg 4405b261ecSmrg/* DEFINES */ 4505b261ecSmrg 4605b261ecSmrg#define DBE_SCREEN_PRIV(pScreen) \ 4705b261ecSmrg ((dbeScreenPrivIndex < 0) ? \ 4805b261ecSmrg NULL : \ 4905b261ecSmrg ((DbeScreenPrivPtr)((pScreen)->devPrivates[dbeScreenPrivIndex].ptr))) 5005b261ecSmrg 5105b261ecSmrg#define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \ 5205b261ecSmrg DBE_SCREEN_PRIV((pDrawable)->pScreen) 5305b261ecSmrg 5405b261ecSmrg#define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \ 5505b261ecSmrg DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen) 5605b261ecSmrg 5705b261ecSmrg#define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \ 5805b261ecSmrg DBE_SCREEN_PRIV((pWindow)->drawable.pScreen) 5905b261ecSmrg 6005b261ecSmrg#define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \ 6105b261ecSmrg DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen) 6205b261ecSmrg 6305b261ecSmrg#define DBE_SCREEN_PRIV_FROM_GC(pGC)\ 6405b261ecSmrg DBE_SCREEN_PRIV((pGC)->pScreen) 6505b261ecSmrg 6605b261ecSmrg#define DBE_WINDOW_PRIV(pWindow)\ 6705b261ecSmrg ((dbeWindowPrivIndex < 0) ? \ 6805b261ecSmrg NULL : \ 6905b261ecSmrg ((DbeWindowPrivPtr)(pWindow->devPrivates[dbeWindowPrivIndex].ptr))) 7005b261ecSmrg 7105b261ecSmrg/* Initial size of the buffer ID array in the window priv. */ 7205b261ecSmrg#define DBE_INIT_MAX_IDS 2 7305b261ecSmrg 7405b261ecSmrg/* Reallocation increment for the buffer ID array. */ 7505b261ecSmrg#define DBE_INCR_MAX_IDS 4 7605b261ecSmrg 7705b261ecSmrg/* Marker for free elements in the buffer ID array. */ 7805b261ecSmrg#define DBE_FREE_ID_ELEMENT 0 7905b261ecSmrg 8005b261ecSmrg 8105b261ecSmrg/* TYPEDEFS */ 8205b261ecSmrg 8305b261ecSmrg/* Record used to pass swap information between DIX and DDX swapping 8405b261ecSmrg * procedures. 8505b261ecSmrg */ 8605b261ecSmrgtypedef struct _DbeSwapInfoRec 8705b261ecSmrg{ 8805b261ecSmrg WindowPtr pWindow; 8905b261ecSmrg unsigned char swapAction; 9005b261ecSmrg 9105b261ecSmrg} DbeSwapInfoRec, *DbeSwapInfoPtr; 9205b261ecSmrg 9305b261ecSmrg/* 9405b261ecSmrg ****************************************************************************** 9505b261ecSmrg ** Per-window data 9605b261ecSmrg ****************************************************************************** 9705b261ecSmrg */ 9805b261ecSmrg 9905b261ecSmrgtypedef struct _DbeWindowPrivRec 10005b261ecSmrg{ 10105b261ecSmrg /* A pointer to the window with which the DBE window private (buffer) is 10205b261ecSmrg * associated. 10305b261ecSmrg */ 10405b261ecSmrg WindowPtr pWindow; 10505b261ecSmrg 10605b261ecSmrg /* Last known swap action for this buffer. Legal values for this field 10705b261ecSmrg * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied. 10805b261ecSmrg */ 10905b261ecSmrg unsigned char swapAction; 11005b261ecSmrg 11105b261ecSmrg /* Last known buffer size. 11205b261ecSmrg */ 11305b261ecSmrg unsigned short width, height; 11405b261ecSmrg 11505b261ecSmrg /* Coordinates used for static gravity when the window is positioned. 11605b261ecSmrg */ 11705b261ecSmrg short x, y; 11805b261ecSmrg 11905b261ecSmrg /* Number of XIDs associated with this buffer. 12005b261ecSmrg */ 12105b261ecSmrg int nBufferIDs; 12205b261ecSmrg 12305b261ecSmrg /* Capacity of the current buffer ID array, IDs. */ 12405b261ecSmrg int maxAvailableIDs; 12505b261ecSmrg 12605b261ecSmrg /* Pointer to the array of buffer IDs. This initially points to initIDs. 12705b261ecSmrg * When the static limit of the initIDs array is reached, the array is 12805b261ecSmrg * reallocated and this pointer is set to the new array instead of initIDs. 12905b261ecSmrg */ 13005b261ecSmrg XID *IDs; 13105b261ecSmrg 13205b261ecSmrg /* Initial array of buffer IDs. We are defining the XID array within the 13305b261ecSmrg * window priv to optimize for data locality. In most cases, only one 13405b261ecSmrg * buffer will be associated with a window. Having the array declared 13505b261ecSmrg * here can prevent us from accessing the data in another memory page, 13605b261ecSmrg * possibly resulting in a page swap and loss of performance. Initially we 13705b261ecSmrg * will use this array to store buffer IDs. For situations where we have 13805b261ecSmrg * more IDs than can fit in this static array, we will allocate a larger 13905b261ecSmrg * array to use, possibly suffering a performance loss. 14005b261ecSmrg */ 14105b261ecSmrg XID initIDs[DBE_INIT_MAX_IDS]; 14205b261ecSmrg 14305b261ecSmrg /* Device-specific private information. 14405b261ecSmrg */ 14505b261ecSmrg DevUnion *devPrivates; 14605b261ecSmrg 14705b261ecSmrg} DbeWindowPrivRec, *DbeWindowPrivPtr; 14805b261ecSmrg 14905b261ecSmrg 15005b261ecSmrg/* 15105b261ecSmrg ****************************************************************************** 15205b261ecSmrg ** Per-screen data 15305b261ecSmrg ****************************************************************************** 15405b261ecSmrg */ 15505b261ecSmrg 15605b261ecSmrgtypedef struct _DbeScreenPrivRec 15705b261ecSmrg{ 15805b261ecSmrg /* Info for creating window privs */ 15905b261ecSmrg int winPrivPrivLen; /* Length of privs in DbeWindowPrivRec */ 16005b261ecSmrg unsigned int *winPrivPrivSizes; /* Array of private record sizes */ 16105b261ecSmrg unsigned int totalWinPrivSize; /* PrivRec + size of all priv priv ptrs */ 16205b261ecSmrg 16305b261ecSmrg /* Resources created by DIX to be used by DDX */ 16405b261ecSmrg RESTYPE dbeDrawableResType; 16505b261ecSmrg RESTYPE dbeWindowPrivResType; 16605b261ecSmrg 16705b261ecSmrg /* Private indices created by DIX to be used by DDX */ 16805b261ecSmrg int dbeScreenPrivIndex; 16905b261ecSmrg int dbeWindowPrivIndex; 17005b261ecSmrg 17105b261ecSmrg /* Wrapped functions 17205b261ecSmrg * It is the responsibilty of the DDX layer to wrap PositionWindow(). 17305b261ecSmrg * DbeExtensionInit wraps DestroyWindow(). 17405b261ecSmrg */ 17505b261ecSmrg PositionWindowProcPtr PositionWindow; 17605b261ecSmrg DestroyWindowProcPtr DestroyWindow; 17705b261ecSmrg 17805b261ecSmrg /* Per-screen DIX routines */ 17905b261ecSmrg Bool (*SetupBackgroundPainter)( 18005b261ecSmrg WindowPtr /*pWin*/, 18105b261ecSmrg GCPtr /*pGC*/ 18205b261ecSmrg); 18305b261ecSmrg DbeWindowPrivPtr (*AllocWinPriv)( 18405b261ecSmrg ScreenPtr /*pScreen*/ 18505b261ecSmrg); 18605b261ecSmrg int (*AllocWinPrivPrivIndex)( 18705b261ecSmrg void 18805b261ecSmrg); 18905b261ecSmrg Bool (*AllocWinPrivPriv)( 19005b261ecSmrg ScreenPtr /*pScreen*/, 19105b261ecSmrg int /*index*/, 19205b261ecSmrg unsigned /*amount*/ 19305b261ecSmrg); 19405b261ecSmrg 19505b261ecSmrg /* Per-screen DDX routines */ 19605b261ecSmrg Bool (*GetVisualInfo)( 19705b261ecSmrg ScreenPtr /*pScreen*/, 19805b261ecSmrg XdbeScreenVisualInfo * /*pVisInfo*/ 19905b261ecSmrg); 20005b261ecSmrg int (*AllocBackBufferName)( 20105b261ecSmrg WindowPtr /*pWin*/, 20205b261ecSmrg XID /*bufId*/, 20305b261ecSmrg int /*swapAction*/ 20405b261ecSmrg); 20505b261ecSmrg int (*SwapBuffers)( 20605b261ecSmrg ClientPtr /*client*/, 20705b261ecSmrg int * /*pNumWindows*/, 20805b261ecSmrg DbeSwapInfoPtr /*swapInfo*/ 20905b261ecSmrg); 21005b261ecSmrg void (*BeginIdiom)( 21105b261ecSmrg ClientPtr /*client*/ 21205b261ecSmrg); 21305b261ecSmrg void (*EndIdiom)( 21405b261ecSmrg ClientPtr /*client*/ 21505b261ecSmrg); 21605b261ecSmrg void (*WinPrivDelete)( 21705b261ecSmrg DbeWindowPrivPtr /*pDbeWindowPriv*/, 21805b261ecSmrg XID /*bufId*/ 21905b261ecSmrg); 22005b261ecSmrg void (*ResetProc)( 22105b261ecSmrg ScreenPtr /*pScreen*/ 22205b261ecSmrg); 22305b261ecSmrg 22405b261ecSmrg /* Device-specific private information. 22505b261ecSmrg */ 22605b261ecSmrg DevUnion *devPrivates; 22705b261ecSmrg 22805b261ecSmrg} DbeScreenPrivRec, *DbeScreenPrivPtr; 22905b261ecSmrg 23005b261ecSmrg#endif /* DBE_STRUCT_H */ 231