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