1 /******************************************************************************
3 * Copyright (c) 1994, 1995 Hewlett-Packard Company
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * Except as contained in this notice, the name of the Hewlett-Packard
25 * Company shall not be used in advertising or otherwise to promote the
26 * sale, use or other dealings in this Software without prior written
27 * authorization from the Hewlett-Packard Company.
29 * Header file for DIX-related DBE
31 *****************************************************************************/
39 #define NEED_DBE_PROTOCOL
40 #include <X11/extensions/Xdbeproto.h>
41 #include "windowstr.h"
46 #define DBE_SCREEN_PRIV(pScreen) \
47 ((dbeScreenPrivIndex < 0) ? \
49 ((DbeScreenPrivPtr)((pScreen)->devPrivates[dbeScreenPrivIndex].ptr)))
51 #define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \
52 DBE_SCREEN_PRIV((pDrawable)->pScreen)
54 #define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \
55 DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen)
57 #define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \
58 DBE_SCREEN_PRIV((pWindow)->drawable.pScreen)
60 #define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \
61 DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen)
63 #define DBE_SCREEN_PRIV_FROM_GC(pGC)\
64 DBE_SCREEN_PRIV((pGC)->pScreen)
66 #define DBE_WINDOW_PRIV(pWindow)\
67 ((dbeWindowPrivIndex < 0) ? \
69 ((DbeWindowPrivPtr)(pWindow->devPrivates[dbeWindowPrivIndex].ptr)))
71 /* Initial size of the buffer ID array in the window priv. */
72 #define DBE_INIT_MAX_IDS 2
74 /* Reallocation increment for the buffer ID array. */
75 #define DBE_INCR_MAX_IDS 4
77 /* Marker for free elements in the buffer ID array. */
78 #define DBE_FREE_ID_ELEMENT 0
83 /* Record used to pass swap information between DIX and DDX swapping
86 typedef struct _DbeSwapInfoRec
89 unsigned char swapAction
;
91 } DbeSwapInfoRec
, *DbeSwapInfoPtr
;
94 ******************************************************************************
96 ******************************************************************************
99 typedef struct _DbeWindowPrivRec
101 /* A pointer to the window with which the DBE window private (buffer) is
106 /* Last known swap action for this buffer. Legal values for this field
107 * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied.
109 unsigned char swapAction
;
111 /* Last known buffer size.
113 unsigned short width
, height
;
115 /* Coordinates used for static gravity when the window is positioned.
119 /* Number of XIDs associated with this buffer.
123 /* Capacity of the current buffer ID array, IDs. */
126 /* Pointer to the array of buffer IDs. This initially points to initIDs.
127 * When the static limit of the initIDs array is reached, the array is
128 * reallocated and this pointer is set to the new array instead of initIDs.
132 /* Initial array of buffer IDs. We are defining the XID array within the
133 * window priv to optimize for data locality. In most cases, only one
134 * buffer will be associated with a window. Having the array declared
135 * here can prevent us from accessing the data in another memory page,
136 * possibly resulting in a page swap and loss of performance. Initially we
137 * will use this array to store buffer IDs. For situations where we have
138 * more IDs than can fit in this static array, we will allocate a larger
139 * array to use, possibly suffering a performance loss.
141 XID initIDs
[DBE_INIT_MAX_IDS
];
143 /* Device-specific private information.
145 DevUnion
*devPrivates
;
147 } DbeWindowPrivRec
, *DbeWindowPrivPtr
;
151 ******************************************************************************
153 ******************************************************************************
156 typedef struct _DbeScreenPrivRec
158 /* Info for creating window privs */
159 int winPrivPrivLen
; /* Length of privs in DbeWindowPrivRec */
160 unsigned int *winPrivPrivSizes
; /* Array of private record sizes */
161 unsigned int totalWinPrivSize
; /* PrivRec + size of all priv priv ptrs */
163 /* Resources created by DIX to be used by DDX */
164 RESTYPE dbeDrawableResType
;
165 RESTYPE dbeWindowPrivResType
;
167 /* Private indices created by DIX to be used by DDX */
168 int dbeScreenPrivIndex
;
169 int dbeWindowPrivIndex
;
172 * It is the responsibilty of the DDX layer to wrap PositionWindow().
173 * DbeExtensionInit wraps DestroyWindow().
175 PositionWindowProcPtr PositionWindow
;
176 DestroyWindowProcPtr DestroyWindow
;
178 /* Per-screen DIX routines */
179 Bool (*SetupBackgroundPainter
)(
183 DbeWindowPrivPtr (*AllocWinPriv
)(
184 ScreenPtr
/*pScreen*/
186 int (*AllocWinPrivPrivIndex
)(
189 Bool (*AllocWinPrivPriv
)(
190 ScreenPtr
/*pScreen*/,
195 /* Per-screen DDX routines */
196 Bool (*GetVisualInfo
)(
197 ScreenPtr
/*pScreen*/,
198 XdbeScreenVisualInfo
* /*pVisInfo*/
200 int (*AllocBackBufferName
)(
206 ClientPtr
/*client*/,
207 int * /*pNumWindows*/,
208 DbeSwapInfoPtr
/*swapInfo*/
216 void (*WinPrivDelete
)(
217 DbeWindowPrivPtr
/*pDbeWindowPriv*/,
221 ScreenPtr
/*pScreen*/
224 /* Device-specific private information.
226 DevUnion
*devPrivates
;
228 } DbeScreenPrivRec
, *DbeScreenPrivPtr
;
230 #endif /* DBE_STRUCT_H */