1/*
2 *
3Copyright 1989, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24 */
25
26#ifndef _MULTIBUF_H_
27#define _MULTIBUF_H_
28
29#include <X11/Xfuncproto.h>
30
31#include <X11/extensions/multibufconst.h>
32
33#if !defined(UNIXCPP) || defined(ANSICPP)
34#define MbufGetReq(name,req,info) GetReq (name, req); \
35	req->reqType = info->codes->major_opcode; \
36	req->mbufReqType = X_##name;
37#else
38#define MbufGetReq(name,req,info) GetReq (name, req); \
39	req->reqType = info->codes->major_opcode; \
40	req->mbufReqType = X_/**/name;
41#endif
42
43/*
44 * Extra definitions that will only be needed in the client
45 */
46typedef XID Multibuffer;
47
48typedef struct {
49    int	type;		    /* of event */
50    unsigned long serial;   /* # of last request processed by server */
51    int send_event;	    /* true if this came frome a SendEvent request */
52    Display *display;	    /* Display the event was read from */
53    Multibuffer buffer;	    /* buffer of event */
54    int	state;		    /* see Clobbered constants above */
55} XmbufClobberNotifyEvent;
56
57typedef struct {
58    int	type;		    /* of event */
59    unsigned long serial;   /* # of last request processed by server */
60    int send_event;	    /* true if this came frome a SendEvent request */
61    Display *display;	    /* Display the event was read from */
62    Multibuffer buffer;	    /* buffer of event */
63} XmbufUpdateNotifyEvent;
64
65
66/*
67 * per-window attributes that can be got
68 */
69typedef struct {
70    int displayed_index;	/* which buffer is being displayed */
71    int update_action;		/* Undefined, Background, Untouched, Copied */
72    int update_hint;		/* Frequent, Intermittent, Static */
73    int window_mode;		/* Mono, Stereo */
74    int nbuffers;		/* Number of buffers */
75    Multibuffer *buffers;	/* Buffers */
76} XmbufWindowAttributes;
77
78/*
79 * per-window attributes that can be set
80 */
81typedef struct {
82    int update_hint;		/* Frequent, Intermittent, Static */
83} XmbufSetWindowAttributes;
84
85
86/*
87 * per-buffer attributes that can be got
88 */
89typedef struct {
90    Window window;		/* which window this belongs to */
91    unsigned long event_mask;	/* events that have been selected */
92    int buffer_index;		/* which buffer is this */
93    int side;			/* Mono, Left, Right */
94} XmbufBufferAttributes;
95
96/*
97 * per-buffer attributes that can be set
98 */
99typedef struct {
100    unsigned long event_mask;	/* events that have been selected */
101} XmbufSetBufferAttributes;
102
103
104/*
105 * per-screen buffer info (there will be lists of them)
106 */
107typedef struct {
108    VisualID visualid;		/* visual usuable at this depth */
109    int max_buffers;		/* most buffers for this visual */
110    int depth;			/* depth of buffers to be created */
111} XmbufBufferInfo;
112
113_XFUNCPROTOBEGIN
114
115extern Bool XmbufQueryExtension(
116    Display*		/* dpy */,
117    int*		/* event_base_return */,
118    int*		/* error_base_return */
119);
120
121extern Status XmbufGetVersion(
122    Display*		/* dpy */,
123    int*		/* major_version_return */,
124    int*		/* minor_version_return */
125);
126
127extern int XmbufCreateBuffers(
128    Display*		/* dpy */,
129    Window		/* w */,
130    int			/* count */,
131    int			/* update_action */,
132    int			/* update_hint */,
133    Multibuffer*	/* buffers */
134);
135
136extern void XmbufDestroyBuffers(
137    Display*		/* dpy */,
138    Window		/* window */
139);
140
141extern void XmbufDisplayBuffers(
142    Display*		/* dpy */,
143    int			/* count */,
144    Multibuffer*	/* buffers */,
145    int			/* min_delay */,
146    int			/* max_delay */
147);
148
149extern Status XmbufGetWindowAttributes(
150    Display*			/* dpy */,
151    Window			/* w */,
152    XmbufWindowAttributes*	/* attr */
153);
154
155extern void XmbufChangeWindowAttributes(
156    Display*			/* dpy */,
157    Window			/* w */,
158    unsigned long		/* valuemask */,
159    XmbufSetWindowAttributes*	/* attr */
160);
161
162extern Status XmbufGetBufferAttributes(
163    Display*			/* dpy */,
164    Multibuffer			/* b */,
165    XmbufBufferAttributes*	/* attr */
166);
167
168extern void XmbufChangeBufferAttributes(
169    Display*			/* dpy */,
170    Multibuffer			/* b */,
171    unsigned long		/* valuemask */,
172    XmbufSetBufferAttributes*	/* attr */
173);
174
175extern Status XmbufGetScreenInfo(
176    Display*			/* dpy */,
177    Drawable			/* d */,
178    int*			/* nmono_return */,
179    XmbufBufferInfo**		/* mono_info_return */,
180    int*			/* nstereo_return */,
181    XmbufBufferInfo**		/* stereo_info_return */
182);
183
184extern Window XmbufCreateStereoWindow(
185    Display*			/* dpy */,
186    Window			/* parent */,
187    int				/* x */,
188    int				/* y */,
189    unsigned int		/* width */,
190    unsigned int		/* height */,
191    unsigned int		/* border_width */,
192    int				/* depth */,
193    unsigned int		/* class */,
194    Visual*			/* visual */,
195    unsigned long		/* valuemask */,
196    XSetWindowAttributes*	/* attr */,
197    Multibuffer*		/* leftp */,
198    Multibuffer*		/* rightp */
199);
200
201extern void XmbufClearBufferArea(
202    Display*			/* dpy */,
203    Multibuffer			/* buffer */,
204    int				/* x */,
205    int				/* y */,
206    unsigned int		/* width */,
207    unsigned int		/* height */,
208    Bool			/* exposures */
209);
210
211_XFUNCPROTOEND
212
213#endif /* _MULTIBUF_H_ */
214