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
27/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
28
29#ifndef _SHMPROTO_H_
30#define _SHMPROTO_H_
31
32#include <X11/extensions/shm.h>
33
34#define ShmSeg CARD32
35#define Drawable CARD32
36#define VisualID CARD32
37#define GContext CARD32
38#define Pixmap CARD32
39
40#define X_ShmQueryVersion 0
41#define X_ShmAttach 1
42#define X_ShmDetach 2
43#define X_ShmPutImage 3
44#define X_ShmGetImage 4
45#define X_ShmCreatePixmap 5
46#define X_ShmAttachFd 6
47#define X_ShmCreateSegment 7
48
49typedef struct _ShmQueryVersion {
50 CARD8 reqType; /* always ShmReqCode */
51 CARD8 shmReqType; /* always X_ShmQueryVersion */
52 CARD16 length B16;
53} xShmQueryVersionReq;
54#define sz_xShmQueryVersionReq 4
55
56typedef struct {
57 BYTE type; /* X_Reply */
58 BOOL sharedPixmaps;
59 CARD16 sequenceNumber B16;
60 CARD32 length B32;
61 CARD16 majorVersion B16; /* major version of SHM protocol */
62 CARD16 minorVersion B16; /* minor version of SHM protocol */
63 CARD16 uid B16;
64 CARD16 gid B16;
65 CARD8 pixmapFormat;
66 CARD8 pad0;
67 CARD16 pad1 B16;
68 CARD32 pad2 B32;
69 CARD32 pad3 B32;
70 CARD32 pad4 B32;
71} xShmQueryVersionReply;
72#define sz_xShmQueryVersionReply 32
73
74typedef struct _ShmAttach {
75 CARD8 reqType; /* always ShmReqCode */
76 CARD8 shmReqType; /* always X_ShmAttach */
77 CARD16 length B16;
78 ShmSeg shmseg B32;
79 CARD32 shmid B32;
80 BOOL readOnly;
81 BYTE pad0;
82 CARD16 pad1 B16;
83} xShmAttachReq;
84#define sz_xShmAttachReq 16
85
86typedef struct _ShmDetach {
87 CARD8 reqType; /* always ShmReqCode */
88 CARD8 shmReqType; /* always X_ShmDetach */
89 CARD16 length B16;
90 ShmSeg shmseg B32;
91} xShmDetachReq;
92#define sz_xShmDetachReq 8
93
94typedef struct _ShmPutImage {
95 CARD8 reqType; /* always ShmReqCode */
96 CARD8 shmReqType; /* always X_ShmPutImage */
97 CARD16 length B16;
98 Drawable drawable B32;
99 GContext gc B32;
100 CARD16 totalWidth B16;
101 CARD16 totalHeight B16;
102 CARD16 srcX B16;
103 CARD16 srcY B16;
104 CARD16 srcWidth B16;
105 CARD16 srcHeight B16;
106 INT16 dstX B16;
107 INT16 dstY B16;
108 CARD8 depth;
109 CARD8 format;
110 CARD8 sendEvent;
111 CARD8 bpad;
112 ShmSeg shmseg B32;
113 CARD32 offset B32;
114} xShmPutImageReq;
115#define sz_xShmPutImageReq 40
116
117typedef struct _ShmGetImage {
118 CARD8 reqType; /* always ShmReqCode */
119 CARD8 shmReqType; /* always X_ShmGetImage */
120 CARD16 length B16;
121 Drawable drawable B32;
122 INT16 x B16;
123 INT16 y B16;
124 CARD16 width B16;
125 CARD16 height B16;
126 CARD32 planeMask B32;
127 CARD8 format;
128 CARD8 pad0;
129 CARD8 pad1;
130 CARD8 pad2;
131 ShmSeg shmseg B32;
132 CARD32 offset B32;
133} xShmGetImageReq;
134#define sz_xShmGetImageReq 32
135
136typedef struct _ShmGetImageReply {
137 BYTE type; /* X_Reply */
138 CARD8 depth;
139 CARD16 sequenceNumber B16;
140 CARD32 length B32;
141 VisualID visual B32;
142 CARD32 size B32;
143 CARD32 pad0 B32;
144 CARD32 pad1 B32;
145 CARD32 pad2 B32;
146 CARD32 pad3 B32;
147} xShmGetImageReply;
148#define sz_xShmGetImageReply 32
149
150typedef struct _ShmCreatePixmap {
151 CARD8 reqType; /* always ShmReqCode */
152 CARD8 shmReqType; /* always X_ShmCreatePixmap */
153 CARD16 length B16;
154 Pixmap pid B32;
155 Drawable drawable B32;
156 CARD16 width B16;
157 CARD16 height B16;
158 CARD8 depth;
159 CARD8 pad0;
160 CARD8 pad1;
161 CARD8 pad2;
162 ShmSeg shmseg B32;
163 CARD32 offset B32;
164} xShmCreatePixmapReq;
165#define sz_xShmCreatePixmapReq 28
166
167typedef struct _ShmCompletion {
168 BYTE type; /* always eventBase + ShmCompletion */
169 BYTE bpad0;
170 CARD16 sequenceNumber B16;
171 Drawable drawable B32;
172 CARD16 minorEvent B16;
173 BYTE majorEvent;
174 BYTE bpad1;
175 ShmSeg shmseg B32;
176 CARD32 offset B32;
177 CARD32 pad0 B32;
178 CARD32 pad1 B32;
179 CARD32 pad2 B32;
180} xShmCompletionEvent;
181#define sz_xShmCompletionEvent 32
182
183/* Version 1.2 additions */
184typedef struct _ShmAttachFd {
185 CARD8 reqType; /* always ShmReqCode */
186 CARD8 shmReqType; /* always X_ShmAttachFd */
187 CARD16 length B16;
188 ShmSeg shmseg B32;
189 BOOL readOnly;
190 BYTE pad0;
191 CARD16 pad1 B16;
192} xShmAttachFdReq;
193/* File descriptor is passed with this request */
194#define sz_xShmAttachFdReq 12
195
196typedef struct _ShmCreateSegment {
197 CARD8 reqType; /* always ShmReqCode */
198 CARD8 shmReqType; /* always X_ShmAttachFd */
199 CARD16 length B16;
200 ShmSeg shmseg B32;
201 CARD32 size B32;
202 BOOL readOnly;
203 BYTE pad0;
204 CARD16 pad1 B16;
205} xShmCreateSegmentReq;
206#define sz_xShmCreateSegmentReq 16
207
208typedef struct {
209 CARD8 type; /* must be X_Reply */
210 CARD8 nfd; /* must be 1 */
211 CARD16 sequenceNumber B16; /* last sequence number */
212 CARD32 length B32; /* 0 */
213 CARD32 pad2 B32; /* unused */
214 CARD32 pad3 B32; /* unused */
215 CARD32 pad4 B32; /* unused */
216 CARD32 pad5 B32; /* unused */
217 CARD32 pad6 B32; /* unused */
218 CARD32 pad7 B32; /* unused */
219} xShmCreateSegmentReply;
220/* File descriptor is passed with this reply */
221#define sz_xShmCreateSegmentReply 32
222
223#undef ShmSeg
224#undef Drawable
225#undef VisualID
226#undef GContext
227#undef Pixmap
228
229#endif /* _SHMPROTO_H_ */
230