dbestruct.h revision 684baedf
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 40684baedfSmrg#include <X11/extensions/Xdbe.h> 41684baedfSmrg#include <X11/extensions/dbeproto.h> 4205b261ecSmrg#include "windowstr.h" 434642e01fSmrg#include "privates.h" 4405b261ecSmrg 4505b261ecSmrg 4605b261ecSmrg/* DEFINES */ 4705b261ecSmrg 484642e01fSmrg#define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \ 494642e01fSmrg dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey)) 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 664642e01fSmrg#define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \ 674642e01fSmrg dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey)) 6805b261ecSmrg 6905b261ecSmrg/* Initial size of the buffer ID array in the window priv. */ 7005b261ecSmrg#define DBE_INIT_MAX_IDS 2 7105b261ecSmrg 7205b261ecSmrg/* Reallocation increment for the buffer ID array. */ 7305b261ecSmrg#define DBE_INCR_MAX_IDS 4 7405b261ecSmrg 7505b261ecSmrg/* Marker for free elements in the buffer ID array. */ 7605b261ecSmrg#define DBE_FREE_ID_ELEMENT 0 7705b261ecSmrg 784642e01fSmrgextern void DbeExtensionInit (void); 7905b261ecSmrg 8005b261ecSmrg/* TYPEDEFS */ 8105b261ecSmrg 8205b261ecSmrg/* Record used to pass swap information between DIX and DDX swapping 8305b261ecSmrg * procedures. 8405b261ecSmrg */ 8505b261ecSmrgtypedef struct _DbeSwapInfoRec 8605b261ecSmrg{ 8705b261ecSmrg WindowPtr pWindow; 8805b261ecSmrg unsigned char swapAction; 8905b261ecSmrg 9005b261ecSmrg} DbeSwapInfoRec, *DbeSwapInfoPtr; 9105b261ecSmrg 9205b261ecSmrg/* 9305b261ecSmrg ****************************************************************************** 9405b261ecSmrg ** Per-window data 9505b261ecSmrg ****************************************************************************** 9605b261ecSmrg */ 9705b261ecSmrg 9805b261ecSmrgtypedef struct _DbeWindowPrivRec 9905b261ecSmrg{ 10005b261ecSmrg /* A pointer to the window with which the DBE window private (buffer) is 10105b261ecSmrg * associated. 10205b261ecSmrg */ 10305b261ecSmrg WindowPtr pWindow; 10405b261ecSmrg 10505b261ecSmrg /* Last known swap action for this buffer. Legal values for this field 10605b261ecSmrg * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied. 10705b261ecSmrg */ 10805b261ecSmrg unsigned char swapAction; 10905b261ecSmrg 11005b261ecSmrg /* Last known buffer size. 11105b261ecSmrg */ 11205b261ecSmrg unsigned short width, height; 11305b261ecSmrg 11405b261ecSmrg /* Coordinates used for static gravity when the window is positioned. 11505b261ecSmrg */ 11605b261ecSmrg short x, y; 11705b261ecSmrg 11805b261ecSmrg /* Number of XIDs associated with this buffer. 11905b261ecSmrg */ 12005b261ecSmrg int nBufferIDs; 12105b261ecSmrg 12205b261ecSmrg /* Capacity of the current buffer ID array, IDs. */ 12305b261ecSmrg int maxAvailableIDs; 12405b261ecSmrg 12505b261ecSmrg /* Pointer to the array of buffer IDs. This initially points to initIDs. 12605b261ecSmrg * When the static limit of the initIDs array is reached, the array is 12705b261ecSmrg * reallocated and this pointer is set to the new array instead of initIDs. 12805b261ecSmrg */ 12905b261ecSmrg XID *IDs; 13005b261ecSmrg 13105b261ecSmrg /* Initial array of buffer IDs. We are defining the XID array within the 13205b261ecSmrg * window priv to optimize for data locality. In most cases, only one 13305b261ecSmrg * buffer will be associated with a window. Having the array declared 13405b261ecSmrg * here can prevent us from accessing the data in another memory page, 13505b261ecSmrg * possibly resulting in a page swap and loss of performance. Initially we 13605b261ecSmrg * will use this array to store buffer IDs. For situations where we have 13705b261ecSmrg * more IDs than can fit in this static array, we will allocate a larger 13805b261ecSmrg * array to use, possibly suffering a performance loss. 13905b261ecSmrg */ 14005b261ecSmrg XID initIDs[DBE_INIT_MAX_IDS]; 14105b261ecSmrg 14205b261ecSmrg /* Device-specific private information. 14305b261ecSmrg */ 1444642e01fSmrg PrivateRec *devPrivates; 14505b261ecSmrg 14605b261ecSmrg} DbeWindowPrivRec, *DbeWindowPrivPtr; 14705b261ecSmrg 14805b261ecSmrg 14905b261ecSmrg/* 15005b261ecSmrg ****************************************************************************** 15105b261ecSmrg ** Per-screen data 15205b261ecSmrg ****************************************************************************** 15305b261ecSmrg */ 15405b261ecSmrg 15505b261ecSmrgtypedef struct _DbeScreenPrivRec 15605b261ecSmrg{ 15705b261ecSmrg /* Resources created by DIX to be used by DDX */ 15805b261ecSmrg RESTYPE dbeDrawableResType; 15905b261ecSmrg RESTYPE dbeWindowPrivResType; 16005b261ecSmrg 16105b261ecSmrg /* Private indices created by DIX to be used by DDX */ 1624642e01fSmrg DevPrivateKey dbeScreenPrivKey; 1634642e01fSmrg DevPrivateKey dbeWindowPrivKey; 16405b261ecSmrg 16505b261ecSmrg /* Wrapped functions 16605b261ecSmrg * It is the responsibilty of the DDX layer to wrap PositionWindow(). 16705b261ecSmrg * DbeExtensionInit wraps DestroyWindow(). 16805b261ecSmrg */ 16905b261ecSmrg PositionWindowProcPtr PositionWindow; 17005b261ecSmrg DestroyWindowProcPtr DestroyWindow; 17105b261ecSmrg 17205b261ecSmrg /* Per-screen DIX routines */ 17305b261ecSmrg Bool (*SetupBackgroundPainter)( 17405b261ecSmrg WindowPtr /*pWin*/, 17505b261ecSmrg GCPtr /*pGC*/ 17605b261ecSmrg); 17705b261ecSmrg 17805b261ecSmrg /* Per-screen DDX routines */ 17905b261ecSmrg Bool (*GetVisualInfo)( 18005b261ecSmrg ScreenPtr /*pScreen*/, 18105b261ecSmrg XdbeScreenVisualInfo * /*pVisInfo*/ 18205b261ecSmrg); 18305b261ecSmrg int (*AllocBackBufferName)( 18405b261ecSmrg WindowPtr /*pWin*/, 18505b261ecSmrg XID /*bufId*/, 18605b261ecSmrg int /*swapAction*/ 18705b261ecSmrg); 18805b261ecSmrg int (*SwapBuffers)( 18905b261ecSmrg ClientPtr /*client*/, 19005b261ecSmrg int * /*pNumWindows*/, 19105b261ecSmrg DbeSwapInfoPtr /*swapInfo*/ 19205b261ecSmrg); 19305b261ecSmrg void (*BeginIdiom)( 19405b261ecSmrg ClientPtr /*client*/ 19505b261ecSmrg); 19605b261ecSmrg void (*EndIdiom)( 19705b261ecSmrg ClientPtr /*client*/ 19805b261ecSmrg); 19905b261ecSmrg void (*WinPrivDelete)( 20005b261ecSmrg DbeWindowPrivPtr /*pDbeWindowPriv*/, 20105b261ecSmrg XID /*bufId*/ 20205b261ecSmrg); 20305b261ecSmrg void (*ResetProc)( 20405b261ecSmrg ScreenPtr /*pScreen*/ 20505b261ecSmrg); 20605b261ecSmrg 20705b261ecSmrg /* Device-specific private information. 20805b261ecSmrg */ 2094642e01fSmrg PrivateRec *devPrivates; 21005b261ecSmrg 21105b261ecSmrg} DbeScreenPrivRec, *DbeScreenPrivPtr; 21205b261ecSmrg 21305b261ecSmrg#endif /* DBE_STRUCT_H */ 214