Commit | Line | Data |
---|---|---|
a09e091a JB |
1 | /****************************************************************************** |
2 | * | |
3 | * Copyright (c) 1994, 1995 Hewlett-Packard Company | |
4 | * | |
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: | |
12 | * | |
13 | * The above copyright notice and this permission notice shall be included | |
14 | * in all copies or substantial portions of the Software. | |
15 | * | |
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. | |
23 | * | |
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. | |
28 | * | |
29 | * Header file for DIX-related DBE | |
30 | * | |
31 | *****************************************************************************/ | |
32 | ||
33 | #ifndef DBE_STRUCT_H | |
34 | #define DBE_STRUCT_H | |
35 | ||
36 | /* INCLUDES */ | |
37 | ||
38 | #define NEED_DBE_PROTOCOL | |
39 | #include <X11/extensions/dbeproto.h> | |
40 | #include "windowstr.h" | |
41 | #include "privates.h" | |
42 | ||
43 | typedef struct { | |
44 | VisualID visual; /* one visual ID that supports double-buffering */ | |
45 | int depth; /* depth of visual in bits */ | |
46 | int perflevel; /* performance level of visual */ | |
47 | } XdbeVisualInfo; | |
48 | ||
49 | typedef struct { | |
50 | int count; /* number of items in visual_depth */ | |
51 | XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */ | |
52 | } XdbeScreenVisualInfo; | |
53 | ||
54 | /* DEFINES */ | |
55 | ||
56 | #define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \ | |
57 | dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey)) | |
58 | ||
59 | #define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \ | |
60 | DBE_SCREEN_PRIV((pDrawable)->pScreen) | |
61 | ||
62 | #define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \ | |
63 | DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen) | |
64 | ||
65 | #define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \ | |
66 | DBE_SCREEN_PRIV((pWindow)->drawable.pScreen) | |
67 | ||
68 | #define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \ | |
69 | DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen) | |
70 | ||
71 | #define DBE_SCREEN_PRIV_FROM_GC(pGC)\ | |
72 | DBE_SCREEN_PRIV((pGC)->pScreen) | |
73 | ||
74 | #define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \ | |
75 | dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey)) | |
76 | ||
77 | /* Initial size of the buffer ID array in the window priv. */ | |
78 | #define DBE_INIT_MAX_IDS 2 | |
79 | ||
80 | /* Reallocation increment for the buffer ID array. */ | |
81 | #define DBE_INCR_MAX_IDS 4 | |
82 | ||
83 | /* Marker for free elements in the buffer ID array. */ | |
84 | #define DBE_FREE_ID_ELEMENT 0 | |
85 | ||
86 | /* TYPEDEFS */ | |
87 | ||
88 | /* Record used to pass swap information between DIX and DDX swapping | |
89 | * procedures. | |
90 | */ | |
91 | typedef struct _DbeSwapInfoRec { | |
92 | WindowPtr pWindow; | |
93 | unsigned char swapAction; | |
94 | ||
95 | } DbeSwapInfoRec, *DbeSwapInfoPtr; | |
96 | ||
97 | /* | |
98 | ****************************************************************************** | |
99 | ** Per-window data | |
100 | ****************************************************************************** | |
101 | */ | |
102 | ||
103 | typedef struct _DbeWindowPrivRec { | |
104 | /* A pointer to the window with which the DBE window private (buffer) is | |
105 | * associated. | |
106 | */ | |
107 | WindowPtr pWindow; | |
108 | ||
109 | /* Last known swap action for this buffer. Legal values for this field | |
110 | * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied. | |
111 | */ | |
112 | unsigned char swapAction; | |
113 | ||
114 | /* Last known buffer size. | |
115 | */ | |
116 | unsigned short width, height; | |
117 | ||
118 | /* Coordinates used for static gravity when the window is positioned. | |
119 | */ | |
120 | short x, y; | |
121 | ||
122 | /* Number of XIDs associated with this buffer. | |
123 | */ | |
124 | int nBufferIDs; | |
125 | ||
126 | /* Capacity of the current buffer ID array, IDs. */ | |
127 | int maxAvailableIDs; | |
128 | ||
129 | /* Pointer to the array of buffer IDs. This initially points to initIDs. | |
130 | * When the static limit of the initIDs array is reached, the array is | |
131 | * reallocated and this pointer is set to the new array instead of initIDs. | |
132 | */ | |
133 | XID *IDs; | |
134 | ||
135 | /* Initial array of buffer IDs. We are defining the XID array within the | |
136 | * window priv to optimize for data locality. In most cases, only one | |
137 | * buffer will be associated with a window. Having the array declared | |
138 | * here can prevent us from accessing the data in another memory page, | |
139 | * possibly resulting in a page swap and loss of performance. Initially we | |
140 | * will use this array to store buffer IDs. For situations where we have | |
141 | * more IDs than can fit in this static array, we will allocate a larger | |
142 | * array to use, possibly suffering a performance loss. | |
143 | */ | |
144 | XID initIDs[DBE_INIT_MAX_IDS]; | |
145 | ||
146 | /* Pointer to a drawable that contains the contents of the back buffer. | |
147 | */ | |
148 | PixmapPtr pBackBuffer; | |
149 | ||
150 | /* Pointer to a drawable that contains the contents of the front buffer. | |
151 | * This pointer is only used for the XdbeUntouched swap action. For that | |
152 | * swap action, we need to copy the front buffer (window) contents into | |
153 | * this drawable, copy the contents of current back buffer drawable (the | |
154 | * back buffer) into the window, swap the front and back drawable pointers, | |
155 | * and then swap the drawable/resource associations in the resource | |
156 | * database. | |
157 | */ | |
158 | PixmapPtr pFrontBuffer; | |
159 | ||
160 | /* Device-specific private information. | |
161 | */ | |
162 | PrivateRec *devPrivates; | |
163 | ||
164 | } DbeWindowPrivRec, *DbeWindowPrivPtr; | |
165 | ||
166 | /* | |
167 | ****************************************************************************** | |
168 | ** Per-screen data | |
169 | ****************************************************************************** | |
170 | */ | |
171 | ||
172 | typedef struct _DbeScreenPrivRec { | |
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) (WindowPtr /*pWin */ , | |
182 | GCPtr /*pGC */ | |
183 | ); | |
184 | ||
185 | /* Per-screen DDX routines */ | |
186 | Bool (*GetVisualInfo) (ScreenPtr /*pScreen */ , | |
187 | XdbeScreenVisualInfo * /*pVisInfo */ | |
188 | ); | |
189 | int (*AllocBackBufferName) (WindowPtr /*pWin */ , | |
190 | XID /*bufId */ , | |
191 | int /*swapAction */ | |
192 | ); | |
193 | int (*SwapBuffers) (ClientPtr /*client */ , | |
194 | int * /*pNumWindows */ , | |
195 | DbeSwapInfoPtr /*swapInfo */ | |
196 | ); | |
197 | void (*WinPrivDelete) (DbeWindowPrivPtr /*pDbeWindowPriv */ , | |
198 | XID /*bufId */ | |
199 | ); | |
200 | } DbeScreenPrivRec, *DbeScreenPrivPtr; | |
201 | ||
202 | #endif /* DBE_STRUCT_H */ |