1485f0483Smrg/*
2485f0483Smrg *
3485f0483SmrgCopyright 1989, 1998  The Open Group
4485f0483Smrg
5485f0483SmrgPermission to use, copy, modify, distribute, and sell this software and its
6485f0483Smrgdocumentation for any purpose is hereby granted without fee, provided that
7485f0483Smrgthe above copyright notice appear in all copies and that both that
8485f0483Smrgcopyright notice and this permission notice appear in supporting
9485f0483Smrgdocumentation.
10485f0483Smrg
11485f0483SmrgThe above copyright notice and this permission notice shall be included in
12485f0483Smrgall copies or substantial portions of the Software.
13485f0483Smrg
14485f0483SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15485f0483SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16485f0483SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17485f0483SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18485f0483SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19485f0483SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20485f0483Smrg
21485f0483SmrgExcept as contained in this notice, the name of The Open Group shall not be
22485f0483Smrgused in advertising or otherwise to promote the sale, use or other dealings
23485f0483Smrgin this Software without prior written authorization from The Open Group.
24485f0483Smrg */
25485f0483Smrg
26485f0483Smrg#ifndef _MULTIBUF_H_
27485f0483Smrg#define _MULTIBUF_H_
28485f0483Smrg
29485f0483Smrg#include <X11/Xfuncproto.h>
30485f0483Smrg
31485f0483Smrg#include <X11/extensions/multibufconst.h>
32485f0483Smrg
33485f0483Smrg#define MbufGetReq(name,req,info) GetReq (name, req); \
34485f0483Smrg	req->reqType = info->codes->major_opcode; \
35485f0483Smrg	req->mbufReqType = X_##name;
36485f0483Smrg
37485f0483Smrg/*
38485f0483Smrg * Extra definitions that will only be needed in the client
39485f0483Smrg */
40485f0483Smrgtypedef XID Multibuffer;
41485f0483Smrg
42485f0483Smrgtypedef struct {
43485f0483Smrg    int	type;		    /* of event */
44485f0483Smrg    unsigned long serial;   /* # of last request processed by server */
450760f5d2Smrg    int send_event;	    /* true if this came from a SendEvent request */
46485f0483Smrg    Display *display;	    /* Display the event was read from */
47485f0483Smrg    Multibuffer buffer;	    /* buffer of event */
48485f0483Smrg    int	state;		    /* see Clobbered constants above */
49485f0483Smrg} XmbufClobberNotifyEvent;
50485f0483Smrg
51485f0483Smrgtypedef struct {
52485f0483Smrg    int	type;		    /* of event */
53485f0483Smrg    unsigned long serial;   /* # of last request processed by server */
540760f5d2Smrg    int send_event;	    /* true if this came from a SendEvent request */
55485f0483Smrg    Display *display;	    /* Display the event was read from */
56485f0483Smrg    Multibuffer buffer;	    /* buffer of event */
57485f0483Smrg} XmbufUpdateNotifyEvent;
58485f0483Smrg
59485f0483Smrg
60485f0483Smrg/*
61485f0483Smrg * per-window attributes that can be got
62485f0483Smrg */
63485f0483Smrgtypedef struct {
64485f0483Smrg    int displayed_index;	/* which buffer is being displayed */
65485f0483Smrg    int update_action;		/* Undefined, Background, Untouched, Copied */
66485f0483Smrg    int update_hint;		/* Frequent, Intermittent, Static */
67485f0483Smrg    int window_mode;		/* Mono, Stereo */
68485f0483Smrg    int nbuffers;		/* Number of buffers */
69485f0483Smrg    Multibuffer *buffers;	/* Buffers */
70485f0483Smrg} XmbufWindowAttributes;
71485f0483Smrg
72485f0483Smrg/*
73485f0483Smrg * per-window attributes that can be set
74485f0483Smrg */
75485f0483Smrgtypedef struct {
76485f0483Smrg    int update_hint;		/* Frequent, Intermittent, Static */
77485f0483Smrg} XmbufSetWindowAttributes;
78485f0483Smrg
79485f0483Smrg
80485f0483Smrg/*
81485f0483Smrg * per-buffer attributes that can be got
82485f0483Smrg */
83485f0483Smrgtypedef struct {
84485f0483Smrg    Window window;		/* which window this belongs to */
85485f0483Smrg    unsigned long event_mask;	/* events that have been selected */
86485f0483Smrg    int buffer_index;		/* which buffer is this */
87485f0483Smrg    int side;			/* Mono, Left, Right */
88485f0483Smrg} XmbufBufferAttributes;
89485f0483Smrg
90485f0483Smrg/*
91485f0483Smrg * per-buffer attributes that can be set
92485f0483Smrg */
93485f0483Smrgtypedef struct {
94485f0483Smrg    unsigned long event_mask;	/* events that have been selected */
95485f0483Smrg} XmbufSetBufferAttributes;
96485f0483Smrg
97485f0483Smrg
98485f0483Smrg/*
99485f0483Smrg * per-screen buffer info (there will be lists of them)
100485f0483Smrg */
101485f0483Smrgtypedef struct {
1020760f5d2Smrg    VisualID visualid;		/* visual usable at this depth */
103485f0483Smrg    int max_buffers;		/* most buffers for this visual */
104485f0483Smrg    int depth;			/* depth of buffers to be created */
105485f0483Smrg} XmbufBufferInfo;
106485f0483Smrg
107485f0483Smrg_XFUNCPROTOBEGIN
108485f0483Smrg
109485f0483Smrgextern Bool XmbufQueryExtension(
110485f0483Smrg    Display*		/* dpy */,
111485f0483Smrg    int*		/* event_base_return */,
112485f0483Smrg    int*		/* error_base_return */
113485f0483Smrg);
114485f0483Smrg
115485f0483Smrgextern Status XmbufGetVersion(
116485f0483Smrg    Display*		/* dpy */,
117485f0483Smrg    int*		/* major_version_return */,
118485f0483Smrg    int*		/* minor_version_return */
119485f0483Smrg);
120485f0483Smrg
121485f0483Smrgextern int XmbufCreateBuffers(
122485f0483Smrg    Display*		/* dpy */,
123485f0483Smrg    Window		/* w */,
124485f0483Smrg    int			/* count */,
125485f0483Smrg    int			/* update_action */,
126485f0483Smrg    int			/* update_hint */,
127485f0483Smrg    Multibuffer*	/* buffers */
128485f0483Smrg);
129485f0483Smrg
130485f0483Smrgextern void XmbufDestroyBuffers(
131485f0483Smrg    Display*		/* dpy */,
132485f0483Smrg    Window		/* window */
133485f0483Smrg);
134485f0483Smrg
135485f0483Smrgextern void XmbufDisplayBuffers(
136485f0483Smrg    Display*		/* dpy */,
137485f0483Smrg    int			/* count */,
138485f0483Smrg    Multibuffer*	/* buffers */,
139485f0483Smrg    int			/* min_delay */,
140485f0483Smrg    int			/* max_delay */
141485f0483Smrg);
142485f0483Smrg
143485f0483Smrgextern Status XmbufGetWindowAttributes(
144485f0483Smrg    Display*			/* dpy */,
145485f0483Smrg    Window			/* w */,
146485f0483Smrg    XmbufWindowAttributes*	/* attr */
147485f0483Smrg);
148485f0483Smrg
149485f0483Smrgextern void XmbufChangeWindowAttributes(
150485f0483Smrg    Display*			/* dpy */,
151485f0483Smrg    Window			/* w */,
152485f0483Smrg    unsigned long		/* valuemask */,
153485f0483Smrg    XmbufSetWindowAttributes*	/* attr */
154485f0483Smrg);
155485f0483Smrg
156485f0483Smrgextern Status XmbufGetBufferAttributes(
157485f0483Smrg    Display*			/* dpy */,
158485f0483Smrg    Multibuffer			/* b */,
159485f0483Smrg    XmbufBufferAttributes*	/* attr */
160485f0483Smrg);
161485f0483Smrg
162485f0483Smrgextern void XmbufChangeBufferAttributes(
163485f0483Smrg    Display*			/* dpy */,
164485f0483Smrg    Multibuffer			/* b */,
165485f0483Smrg    unsigned long		/* valuemask */,
166485f0483Smrg    XmbufSetBufferAttributes*	/* attr */
167485f0483Smrg);
168485f0483Smrg
169485f0483Smrgextern Status XmbufGetScreenInfo(
170485f0483Smrg    Display*			/* dpy */,
171485f0483Smrg    Drawable			/* d */,
172485f0483Smrg    int*			/* nmono_return */,
173485f0483Smrg    XmbufBufferInfo**		/* mono_info_return */,
174485f0483Smrg    int*			/* nstereo_return */,
175485f0483Smrg    XmbufBufferInfo**		/* stereo_info_return */
176485f0483Smrg);
177485f0483Smrg
178485f0483Smrgextern Window XmbufCreateStereoWindow(
179485f0483Smrg    Display*			/* dpy */,
180485f0483Smrg    Window			/* parent */,
181485f0483Smrg    int				/* x */,
182485f0483Smrg    int				/* y */,
183485f0483Smrg    unsigned int		/* width */,
184485f0483Smrg    unsigned int		/* height */,
185485f0483Smrg    unsigned int		/* border_width */,
186485f0483Smrg    int				/* depth */,
187485f0483Smrg    unsigned int		/* class */,
188485f0483Smrg    Visual*			/* visual */,
189485f0483Smrg    unsigned long		/* valuemask */,
190485f0483Smrg    XSetWindowAttributes*	/* attr */,
191485f0483Smrg    Multibuffer*		/* leftp */,
192485f0483Smrg    Multibuffer*		/* rightp */
193485f0483Smrg);
194485f0483Smrg
195485f0483Smrgextern void XmbufClearBufferArea(
196485f0483Smrg    Display*			/* dpy */,
197485f0483Smrg    Multibuffer			/* buffer */,
198485f0483Smrg    int				/* x */,
199485f0483Smrg    int				/* y */,
200485f0483Smrg    unsigned int		/* width */,
201485f0483Smrg    unsigned int		/* height */,
202485f0483Smrg    Bool			/* exposures */
203485f0483Smrg);
204485f0483Smrg
205485f0483Smrg_XFUNCPROTOEND
206485f0483Smrg
207485f0483Smrg#endif /* _MULTIBUF_H_ */
208