]> git.sesse.net Git - rdpsrv/blob - Xserver/include/extensions/multibuf.h
2c8889a972c349ed0031583ea0dbda7873b62ea7
[rdpsrv] / Xserver / include / extensions / multibuf.h
1 /*
2  * $XConsortium: multibuf.h,v 1.18 94/04/17 20:11:21 dpw Exp $
3  * $XFree86: xc/include/extensions/multibuf.h,v 3.0 1996/05/06 05:52:38 dawes Exp $
4  *
5 Copyright (c) 1989  X Consortium
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
20 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
24 Except as contained in this notice, the name of the X Consortium shall not be
25 used in advertising or otherwise to promote the sale, use or other dealings
26 in this Software without prior written authorization from the X Consortium.
27  */
28
29 #ifndef _MULTIBUF_H_
30 #define _MULTIBUF_H_
31
32 #include <X11/Xfuncproto.h>
33
34 #define MULTIBUFFER_PROTOCOL_NAME "Multi-Buffering"
35
36 #define MULTIBUFFER_MAJOR_VERSION       1       /* current version numbers */
37 #define MULTIBUFFER_MINOR_VERSION       1       /* has ClearImageBufferArea */
38
39 #define X_MbufGetBufferVersion          0
40 #define X_MbufCreateImageBuffers        1
41 #define X_MbufDestroyImageBuffers       2
42 #define X_MbufDisplayImageBuffers       3
43 #define X_MbufSetMBufferAttributes      4
44 #define X_MbufGetMBufferAttributes      5
45 #define X_MbufSetBufferAttributes       6
46 #define X_MbufGetBufferAttributes       7
47 #define X_MbufGetBufferInfo             8
48 #define X_MbufCreateStereoWindow        9
49 #define X_MbufClearImageBufferArea      10
50
51 /*
52  * update_action field
53  */
54 #define MultibufferUpdateActionUndefined        0
55 #define MultibufferUpdateActionBackground       1
56 #define MultibufferUpdateActionUntouched        2
57 #define MultibufferUpdateActionCopied           3
58
59 /*
60  * update_hint field
61  */
62 #define MultibufferUpdateHintFrequent           0
63 #define MultibufferUpdateHintIntermittent       1
64 #define MultibufferUpdateHintStatic             2
65
66 /*
67  * valuemask fields
68  */
69 #define MultibufferWindowUpdateHint     (1L << 0)
70 #define MultibufferBufferEventMask      (1L << 0)
71
72 /*
73  * mono vs. stereo and left vs. right
74  */
75 #define MultibufferModeMono             0
76 #define MultibufferModeStereo           1
77 #define MultibufferSideMono             0
78 #define MultibufferSideLeft             1
79 #define MultibufferSideRight            2
80
81 /*
82  * clobber state
83  */
84 #define MultibufferUnclobbered          0
85 #define MultibufferPartiallyClobbered   1
86 #define MultibufferFullyClobbered       2
87
88 /*
89  * event stuff
90  */
91 #define MultibufferClobberNotifyMask    0x02000000
92 #define MultibufferUpdateNotifyMask     0x04000000
93
94 #define MultibufferClobberNotify        0
95 #define MultibufferUpdateNotify         1
96 #define MultibufferNumberEvents         (MultibufferUpdateNotify + 1)
97
98 #define MultibufferBadBuffer            0
99 #define MultibufferNumberErrors         (MultibufferBadBuffer + 1)
100
101
102 #ifndef _MULTIBUF_SERVER_
103 /*
104  * Extra definitions that will only be needed in the client
105  */
106 typedef XID Multibuffer;
107
108 typedef struct {
109     int type;               /* of event */
110     unsigned long serial;   /* # of last request processed by server */
111     int send_event;         /* true if this came frome a SendEvent request */
112     Display *display;       /* Display the event was read from */
113     Multibuffer buffer;     /* buffer of event */
114     int state;              /* see Clobbered constants above */
115 } XmbufClobberNotifyEvent;
116
117 typedef struct {
118     int type;               /* of event */
119     unsigned long serial;   /* # of last request processed by server */
120     int send_event;         /* true if this came frome a SendEvent request */
121     Display *display;       /* Display the event was read from */
122     Multibuffer buffer;     /* buffer of event */
123 } XmbufUpdateNotifyEvent;
124
125
126 /*
127  * per-window attributes that can be got
128  */
129 typedef struct {
130     int displayed_index;        /* which buffer is being displayed */
131     int update_action;          /* Undefined, Background, Untouched, Copied */
132     int update_hint;            /* Frequent, Intermittent, Static */
133     int window_mode;            /* Mono, Stereo */
134     int nbuffers;               /* Number of buffers */
135     Multibuffer *buffers;       /* Buffers */
136 } XmbufWindowAttributes;
137
138 /*
139  * per-window attributes that can be set
140  */
141 typedef struct {
142     int update_hint;            /* Frequent, Intermittent, Static */
143 } XmbufSetWindowAttributes;
144
145
146 /*
147  * per-buffer attributes that can be got
148  */
149 typedef struct {
150     Window window;              /* which window this belongs to */
151     unsigned long event_mask;   /* events that have been selected */
152     int buffer_index;           /* which buffer is this */
153     int side;                   /* Mono, Left, Right */
154 } XmbufBufferAttributes;
155
156 /*
157  * per-buffer attributes that can be set
158  */
159 typedef struct {
160     unsigned long event_mask;   /* events that have been selected */
161 } XmbufSetBufferAttributes;
162
163
164 /*
165  * per-screen buffer info (there will be lists of them)
166  */
167 typedef struct {
168     VisualID visualid;          /* visual usuable at this depth */
169     int max_buffers;            /* most buffers for this visual */
170     int depth;                  /* depth of buffers to be created */
171 } XmbufBufferInfo;
172
173 _XFUNCPROTOBEGIN
174
175 extern Bool XmbufQueryExtension(
176 #if NeedFunctionPrototypes
177     Display*            /* dpy */,
178     int*                /* event_base_return */,
179     int*                /* error_base_return */
180 #endif
181 );
182
183 extern Status XmbufGetVersion(
184 #if NeedFunctionPrototypes
185     Display*            /* dpy */,
186     int*                /* major_version_return */,
187     int*                /* minor_version_return */
188 #endif
189 );
190
191 extern int XmbufCreateBuffers(
192 #if NeedFunctionPrototypes
193     Display*            /* dpy */,
194     Window              /* w */,
195     int                 /* count */,
196     int                 /* update_action */,
197     int                 /* update_hint */,
198     Multibuffer*        /* buffers */
199 #endif
200 );
201
202 extern void XmbufDestroyBuffers(
203 #if NeedFunctionPrototypes
204     Display*            /* dpy */,
205     Window              /* window */
206 #endif
207 );
208
209 extern void XmbufDisplayBuffers(
210 #if NeedFunctionPrototypes
211     Display*            /* dpy */,
212     int                 /* count */,
213     Multibuffer*        /* buffers */,
214     int                 /* min_delay */,
215     int                 /* max_delay */
216 #endif
217 );
218
219 extern Status XmbufGetWindowAttributes(
220 #if NeedFunctionPrototypes
221     Display*                    /* dpy */,
222     Window                      /* w */,
223     XmbufWindowAttributes*      /* attr */
224 #endif
225 );
226
227 extern void XmbufChangeWindowAttributes(
228 #if NeedFunctionPrototypes
229     Display*                    /* dpy */,
230     Window                      /* w */,
231     unsigned long               /* valuemask */,
232     XmbufSetWindowAttributes*   /* attr */
233 #endif
234 );
235
236 extern Status XmbufGetBufferAttributes(
237 #if NeedFunctionPrototypes
238     Display*                    /* dpy */,
239     Multibuffer                 /* b */,
240     XmbufBufferAttributes*      /* attr */
241 #endif
242 );
243
244 extern void XmbufChangeBufferAttributes(
245 #if NeedFunctionPrototypes
246     Display*                    /* dpy */,
247     Multibuffer                 /* b */,
248     unsigned long               /* valuemask */,
249     XmbufSetBufferAttributes*   /* attr */
250 #endif
251 );
252
253 extern Status XmbufGetScreenInfo(
254 #if NeedFunctionPrototypes
255     Display*                    /* dpy */,
256     Drawable                    /* d */,
257     int*                        /* nmono_return */,
258     XmbufBufferInfo**           /* mono_info_return */,
259     int*                        /* nstereo_return */,
260     XmbufBufferInfo**           /* stereo_info_return */
261 #endif
262 );
263
264 extern Window XmbufCreateStereoWindow(
265 #if NeedFunctionPrototypes
266     Display*                    /* dpy */,
267     Window                      /* parent */,
268     int                         /* x */,
269     int                         /* y */,
270     unsigned int                /* width */,
271     unsigned int                /* height */,
272     unsigned int                /* border_width */,
273     int                         /* depth */,
274     unsigned int                /* class */,
275     Visual*                     /* visual */,
276     unsigned long               /* valuemask */,
277     XSetWindowAttributes*       /* attr */,
278     Multibuffer*                /* leftp */,
279     Multibuffer*                /* rightp */
280 #endif
281 );
282
283 extern void XmbufClearBufferArea(
284 #if NeedFunctionPrototypes
285     Display*                    /* dpy */,
286     Multibuffer                 /* buffer */,
287     int                         /* x */,
288     int                         /* y */,
289     unsigned int                /* width */,
290     unsigned int                /* height */,
291     Bool                        /* exposures */
292 #endif
293 );
294
295 _XFUNCPROTOEND
296
297 #else
298
299 typedef Bool    (* mbInitFunc)();
300
301 struct _mbufScreen;             /* declared in multibufst.h */
302
303 extern void     RegisterMultibufferInit(
304 #if NeedFunctionPrototypes
305     ScreenPtr                   /* pScreen */,
306     Bool (* /* bufMultibufferInit */)(
307 #if NeedNestedPrototypes
308         ScreenPtr               /* pScreen */,
309         struct _mbufScreen *    /* pMBScreen */
310 #endif
311     )
312 #endif
313 );
314
315 struct xMbufBufferInfo;         /* declared in multibufst.h */
316
317 extern void     RegisterDoubleBufferHardware(
318 #if NeedFunctionPrototypes
319     ScreenPtr                   /* pScreen */,
320     int                         /* nInfo */,
321     struct xMbufBufferInfo *    /* pInfo */,
322     DevUnion *                  /* frameBuffer */,
323     DevUnion                    /* selectPlane */,
324     void (* /* CopyBufferBitsFunc */ )(),
325     void (* /* DrawSelectPlaneFunc */ )()
326 #endif
327 );
328
329 extern int      CreateImageBuffers (
330 #if NeedFunctionPrototypes
331     WindowPtr                   /* pWin */,
332     int                         /* nbuf */,
333     XID *                       /* ids */,
334     int                         /* action */,
335     int                         /* hint */
336 #endif
337 );
338 extern void     DestroyImageBuffers (
339 #if NeedFunctionPrototypes
340     WindowPtr                   /* pWin */
341 #endif
342 );
343 extern int      DisplayImageBuffers (
344 #if NeedFunctionPrototypes
345     XID *                       /* ids */,
346     int                         /* nbuf */
347 #endif
348 );
349
350 #endif /* _MULTIBUF_SERVER_ */
351 #endif /* _MULTIBUF_H_ */