1 | /* $Xorg: dbestruct.h,v 1.3 2000/08/17 19:48:16 cpqbld Exp $ */
|
---|
2 | /******************************************************************************
|
---|
3 | *
|
---|
4 | * Copyright (c) 1994, 1995 Hewlett-Packard Company
|
---|
5 | *
|
---|
6 | * Permission is hereby granted, free of charge, to any person obtaining
|
---|
7 | * a copy of this software and associated documentation files (the
|
---|
8 | * "Software"), to deal in the Software without restriction, including
|
---|
9 | * without limitation the rights to use, copy, modify, merge, publish,
|
---|
10 | * distribute, sublicense, and/or sell copies of the Software, and to
|
---|
11 | * permit persons to whom the Software is furnished to do so, subject to
|
---|
12 | * the following conditions:
|
---|
13 | *
|
---|
14 | * The above copyright notice and this permission notice shall be included
|
---|
15 | * in all copies or substantial portions of the Software.
|
---|
16 | *
|
---|
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
---|
18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
---|
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
---|
20 | * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
|
---|
21 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
---|
22 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
---|
23 | * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
24 | *
|
---|
25 | * Except as contained in this notice, the name of the Hewlett-Packard
|
---|
26 | * Company shall not be used in advertising or otherwise to promote the
|
---|
27 | * sale, use or other dealings in this Software without prior written
|
---|
28 | * authorization from the Hewlett-Packard Company.
|
---|
29 | *
|
---|
30 | * Header file for DIX-related DBE
|
---|
31 | *
|
---|
32 | *****************************************************************************/
|
---|
33 | /* $XFree86$ */
|
---|
34 |
|
---|
35 | #ifndef DBE_STRUCT_H
|
---|
36 | #define DBE_STRUCT_H
|
---|
37 |
|
---|
38 |
|
---|
39 | /* INCLUDES */
|
---|
40 |
|
---|
41 | #define NEED_DBE_PROTOCOL
|
---|
42 | #include <X11/extensions/Xdbeproto.h>
|
---|
43 | #include "windowstr.h"
|
---|
44 |
|
---|
45 |
|
---|
46 | /* DEFINES */
|
---|
47 |
|
---|
48 | #define DBE_SCREEN_PRIV(pScreen) \
|
---|
49 | ((dbeScreenPrivIndex < 0) ? \
|
---|
50 | NULL : \
|
---|
51 | ((DbeScreenPrivPtr)((pScreen)->devPrivates[dbeScreenPrivIndex].ptr)))
|
---|
52 |
|
---|
53 | #define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \
|
---|
54 | DBE_SCREEN_PRIV((pDrawable)->pScreen)
|
---|
55 |
|
---|
56 | #define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \
|
---|
57 | DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen)
|
---|
58 |
|
---|
59 | #define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \
|
---|
60 | DBE_SCREEN_PRIV((pWindow)->drawable.pScreen)
|
---|
61 |
|
---|
62 | #define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \
|
---|
63 | DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen)
|
---|
64 |
|
---|
65 | #define DBE_SCREEN_PRIV_FROM_GC(pGC)\
|
---|
66 | DBE_SCREEN_PRIV((pGC)->pScreen)
|
---|
67 |
|
---|
68 | #define DBE_WINDOW_PRIV(pWindow)\
|
---|
69 | ((dbeWindowPrivIndex < 0) ? \
|
---|
70 | NULL : \
|
---|
71 | ((DbeWindowPrivPtr)(pWindow->devPrivates[dbeWindowPrivIndex].ptr)))
|
---|
72 |
|
---|
73 | /* Initial size of the buffer ID array in the window priv. */
|
---|
74 | #define DBE_INIT_MAX_IDS 2
|
---|
75 |
|
---|
76 | /* Reallocation increment for the buffer ID array. */
|
---|
77 | #define DBE_INCR_MAX_IDS 4
|
---|
78 |
|
---|
79 | /* Marker for free elements in the buffer ID array. */
|
---|
80 | #define DBE_FREE_ID_ELEMENT 0
|
---|
81 |
|
---|
82 |
|
---|
83 | /* TYPEDEFS */
|
---|
84 |
|
---|
85 | /* Record used to pass swap information between DIX and DDX swapping
|
---|
86 | * procedures.
|
---|
87 | */
|
---|
88 | typedef struct _DbeSwapInfoRec
|
---|
89 | {
|
---|
90 | WindowPtr pWindow;
|
---|
91 | unsigned char swapAction;
|
---|
92 |
|
---|
93 | } DbeSwapInfoRec, *DbeSwapInfoPtr;
|
---|
94 |
|
---|
95 | /*
|
---|
96 | ******************************************************************************
|
---|
97 | ** Per-window data
|
---|
98 | ******************************************************************************
|
---|
99 | */
|
---|
100 |
|
---|
101 | typedef struct _DbeWindowPrivRec
|
---|
102 | {
|
---|
103 | /* A pointer to the window with which the DBE window private (buffer) is
|
---|
104 | * associated.
|
---|
105 | */
|
---|
106 | WindowPtr pWindow;
|
---|
107 |
|
---|
108 | /* Last known swap action for this buffer. Legal values for this field
|
---|
109 | * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied.
|
---|
110 | */
|
---|
111 | unsigned char swapAction;
|
---|
112 |
|
---|
113 | /* Last known buffer size.
|
---|
114 | */
|
---|
115 | unsigned short width, height;
|
---|
116 |
|
---|
117 | /* Coordinates used for static gravity when the window is positioned.
|
---|
118 | */
|
---|
119 | short x, y;
|
---|
120 |
|
---|
121 | /* Number of XIDs associated with this buffer.
|
---|
122 | */
|
---|
123 | int nBufferIDs;
|
---|
124 |
|
---|
125 | /* Capacity of the current buffer ID array, IDs. */
|
---|
126 | int maxAvailableIDs;
|
---|
127 |
|
---|
128 | /* Pointer to the array of buffer IDs. This initially points to initIDs.
|
---|
129 | * When the static limit of the initIDs array is reached, the array is
|
---|
130 | * reallocated and this pointer is set to the new array instead of initIDs.
|
---|
131 | */
|
---|
132 | XID *IDs;
|
---|
133 |
|
---|
134 | /* Initial array of buffer IDs. We are defining the XID array within the
|
---|
135 | * window priv to optimize for data locality. In most cases, only one
|
---|
136 | * buffer will be associated with a window. Having the array declared
|
---|
137 | * here can prevent us from accessing the data in another memory page,
|
---|
138 | * possibly resulting in a page swap and loss of performance. Initially we
|
---|
139 | * will use this array to store buffer IDs. For situations where we have
|
---|
140 | * more IDs than can fit in this static array, we will allocate a larger
|
---|
141 | * array to use, possibly suffering a performance loss.
|
---|
142 | */
|
---|
143 | XID initIDs[DBE_INIT_MAX_IDS];
|
---|
144 |
|
---|
145 | /* Device-specific private information.
|
---|
146 | */
|
---|
147 | DevUnion *devPrivates;
|
---|
148 |
|
---|
149 | } DbeWindowPrivRec, *DbeWindowPrivPtr;
|
---|
150 |
|
---|
151 |
|
---|
152 | /*
|
---|
153 | ******************************************************************************
|
---|
154 | ** Per-screen data
|
---|
155 | ******************************************************************************
|
---|
156 | */
|
---|
157 |
|
---|
158 | typedef struct _DbeScreenPrivRec
|
---|
159 | {
|
---|
160 | /* Info for creating window privs */
|
---|
161 | int winPrivPrivLen; /* Length of privs in DbeWindowPrivRec */
|
---|
162 | unsigned int *winPrivPrivSizes; /* Array of private record sizes */
|
---|
163 | unsigned int totalWinPrivSize; /* PrivRec + size of all priv priv ptrs */
|
---|
164 |
|
---|
165 | /* Resources created by DIX to be used by DDX */
|
---|
166 | RESTYPE dbeDrawableResType;
|
---|
167 | RESTYPE dbeWindowPrivResType;
|
---|
168 |
|
---|
169 | /* Private indices created by DIX to be used by DDX */
|
---|
170 | int dbeScreenPrivIndex;
|
---|
171 | int dbeWindowPrivIndex;
|
---|
172 |
|
---|
173 | /* Wrapped functions
|
---|
174 | * It is the responsibilty of the DDX layer to wrap PositionWindow().
|
---|
175 | * DbeExtensionInit wraps DestroyWindow().
|
---|
176 | */
|
---|
177 | PositionWindowProcPtr PositionWindow;
|
---|
178 | DestroyWindowProcPtr DestroyWindow;
|
---|
179 |
|
---|
180 | /* Per-screen DIX routines */
|
---|
181 | Bool (*SetupBackgroundPainter)(
|
---|
182 | WindowPtr /*pWin*/,
|
---|
183 | GCPtr /*pGC*/
|
---|
184 | );
|
---|
185 | DbeWindowPrivPtr (*AllocWinPriv)(
|
---|
186 | ScreenPtr /*pScreen*/
|
---|
187 | );
|
---|
188 | int (*AllocWinPrivPrivIndex)(
|
---|
189 | void
|
---|
190 | );
|
---|
191 | Bool (*AllocWinPrivPriv)(
|
---|
192 | ScreenPtr /*pScreen*/,
|
---|
193 | int /*index*/,
|
---|
194 | unsigned /*amount*/
|
---|
195 | );
|
---|
196 |
|
---|
197 | /* Per-screen DDX routines */
|
---|
198 | Bool (*GetVisualInfo)(
|
---|
199 | ScreenPtr /*pScreen*/,
|
---|
200 | XdbeScreenVisualInfo * /*pVisInfo*/
|
---|
201 | );
|
---|
202 | int (*AllocBackBufferName)(
|
---|
203 | WindowPtr /*pWin*/,
|
---|
204 | XID /*bufId*/,
|
---|
205 | int /*swapAction*/
|
---|
206 | );
|
---|
207 | int (*SwapBuffers)(
|
---|
208 | ClientPtr /*client*/,
|
---|
209 | int * /*pNumWindows*/,
|
---|
210 | DbeSwapInfoPtr /*swapInfo*/
|
---|
211 | );
|
---|
212 | void (*BeginIdiom)(
|
---|
213 | ClientPtr /*client*/
|
---|
214 | );
|
---|
215 | void (*EndIdiom)(
|
---|
216 | ClientPtr /*client*/
|
---|
217 | );
|
---|
218 | void (*WinPrivDelete)(
|
---|
219 | DbeWindowPrivPtr /*pDbeWindowPriv*/,
|
---|
220 | XID /*bufId*/
|
---|
221 | );
|
---|
222 | void (*ResetProc)(
|
---|
223 | ScreenPtr /*pScreen*/
|
---|
224 | );
|
---|
225 | void (*ValidateBuffer)(
|
---|
226 | WindowPtr /*pWin*/,
|
---|
227 | XID /*bufId*/,
|
---|
228 | Bool /*dstbuffer*/
|
---|
229 | );
|
---|
230 |
|
---|
231 | /* Device-specific private information.
|
---|
232 | */
|
---|
233 | DevUnion *devPrivates;
|
---|
234 |
|
---|
235 | } DbeScreenPrivRec, *DbeScreenPrivPtr;
|
---|
236 |
|
---|
237 | #endif /* DBE_STRUCT_H */
|
---|