117ca54c3Smrg/************************************************************
217ca54c3Smrg
317ca54c3SmrgCopyright 1989, 1998  The Open Group
417ca54c3Smrg
517ca54c3SmrgPermission to use, copy, modify, distribute, and sell this software and its
617ca54c3Smrgdocumentation for any purpose is hereby granted without fee, provided that
717ca54c3Smrgthe above copyright notice appear in all copies and that both that
817ca54c3Smrgcopyright notice and this permission notice appear in supporting
917ca54c3Smrgdocumentation.
1017ca54c3Smrg
1117ca54c3SmrgThe above copyright notice and this permission notice shall be included in
1217ca54c3Smrgall copies or substantial portions of the Software.
1317ca54c3Smrg
1417ca54c3SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1517ca54c3SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1617ca54c3SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
1717ca54c3SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
1817ca54c3SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1917ca54c3SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2017ca54c3Smrg
2117ca54c3SmrgExcept as contained in this notice, the name of The Open Group shall not be
2217ca54c3Smrgused in advertising or otherwise to promote the sale, use or other dealings
2317ca54c3Smrgin this Software without prior written authorization from The Open Group.
2417ca54c3Smrg
2517ca54c3Smrg********************************************************/
2617ca54c3Smrg
2717ca54c3Smrg/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
2817ca54c3Smrg
2917ca54c3Smrg#ifndef _SHMPROTO_H_
3017ca54c3Smrg#define _SHMPROTO_H_
3117ca54c3Smrg
3217ca54c3Smrg#include <X11/extensions/shm.h>
3317ca54c3Smrg
3417ca54c3Smrg#define ShmSeg CARD32
3517ca54c3Smrg#define Drawable CARD32
3617ca54c3Smrg#define VisualID CARD32
3717ca54c3Smrg#define GContext CARD32
3817ca54c3Smrg#define Pixmap CARD32
3917ca54c3Smrg
4017ca54c3Smrg#define X_ShmQueryVersion		0
4117ca54c3Smrg#define X_ShmAttach			1
4217ca54c3Smrg#define X_ShmDetach			2
4317ca54c3Smrg#define X_ShmPutImage			3
4417ca54c3Smrg#define X_ShmGetImage			4
4517ca54c3Smrg#define X_ShmCreatePixmap		5
4617ca54c3Smrg#define X_ShmAttachFd                   6
4717ca54c3Smrg#define X_ShmCreateSegment              7
4817ca54c3Smrg
4917ca54c3Smrgtypedef struct _ShmQueryVersion {
5017ca54c3Smrg    CARD8	reqType;		/* always ShmReqCode */
5117ca54c3Smrg    CARD8	shmReqType;		/* always X_ShmQueryVersion */
52ea1d6981Smrg    CARD16	length;
5317ca54c3Smrg} xShmQueryVersionReq;
5417ca54c3Smrg#define sz_xShmQueryVersionReq	4
5517ca54c3Smrg
5617ca54c3Smrgtypedef struct {
5717ca54c3Smrg    BYTE	type;			/* X_Reply */
5817ca54c3Smrg    BOOL	sharedPixmaps;
59ea1d6981Smrg    CARD16	sequenceNumber;
60ea1d6981Smrg    CARD32	length;
61ea1d6981Smrg    CARD16	majorVersion;		/* major version of SHM protocol */
62ea1d6981Smrg    CARD16	minorVersion;		/* minor version of SHM protocol */
63ea1d6981Smrg    CARD16	uid;
64ea1d6981Smrg    CARD16	gid;
6517ca54c3Smrg    CARD8	pixmapFormat;
6617ca54c3Smrg    CARD8	pad0;
67ea1d6981Smrg    CARD16	pad1;
68ea1d6981Smrg    CARD32	pad2;
69ea1d6981Smrg    CARD32	pad3;
70ea1d6981Smrg    CARD32	pad4;
7117ca54c3Smrg} xShmQueryVersionReply;
7217ca54c3Smrg#define sz_xShmQueryVersionReply	32
7317ca54c3Smrg
7417ca54c3Smrgtypedef struct _ShmAttach {
7517ca54c3Smrg    CARD8	reqType;	/* always ShmReqCode */
7617ca54c3Smrg    CARD8	shmReqType;	/* always X_ShmAttach */
77ea1d6981Smrg    CARD16	length;
78ea1d6981Smrg    ShmSeg	shmseg;
79ea1d6981Smrg    CARD32	shmid;
8017ca54c3Smrg    BOOL	readOnly;
8117ca54c3Smrg    BYTE	pad0;
82ea1d6981Smrg    CARD16	pad1;
8317ca54c3Smrg} xShmAttachReq;
8417ca54c3Smrg#define sz_xShmAttachReq	16
8517ca54c3Smrg
8617ca54c3Smrgtypedef struct _ShmDetach {
8717ca54c3Smrg    CARD8	reqType;	/* always ShmReqCode */
8817ca54c3Smrg    CARD8	shmReqType;	/* always X_ShmDetach */
89ea1d6981Smrg    CARD16	length;
90ea1d6981Smrg    ShmSeg	shmseg;
9117ca54c3Smrg} xShmDetachReq;
9217ca54c3Smrg#define sz_xShmDetachReq	8
9317ca54c3Smrg
9417ca54c3Smrgtypedef struct _ShmPutImage {
9517ca54c3Smrg    CARD8	reqType;	/* always ShmReqCode */
9617ca54c3Smrg    CARD8	shmReqType;	/* always X_ShmPutImage */
97ea1d6981Smrg    CARD16	length;
98ea1d6981Smrg    Drawable	drawable;
99ea1d6981Smrg    GContext	gc;
100ea1d6981Smrg    CARD16	totalWidth;
101ea1d6981Smrg    CARD16	totalHeight;
102ea1d6981Smrg    CARD16	srcX;
103ea1d6981Smrg    CARD16	srcY;
104ea1d6981Smrg    CARD16	srcWidth;
105ea1d6981Smrg    CARD16	srcHeight;
106ea1d6981Smrg    INT16	dstX;
107ea1d6981Smrg    INT16	dstY;
10817ca54c3Smrg    CARD8	depth;
10917ca54c3Smrg    CARD8	format;
11017ca54c3Smrg    CARD8	sendEvent;
11117ca54c3Smrg    CARD8	bpad;
112ea1d6981Smrg    ShmSeg	shmseg;
113ea1d6981Smrg    CARD32	offset;
11417ca54c3Smrg} xShmPutImageReq;
11517ca54c3Smrg#define sz_xShmPutImageReq	40
11617ca54c3Smrg
11717ca54c3Smrgtypedef struct _ShmGetImage {
11817ca54c3Smrg    CARD8	reqType;	/* always ShmReqCode */
11917ca54c3Smrg    CARD8	shmReqType;	/* always X_ShmGetImage */
120ea1d6981Smrg    CARD16	length;
121ea1d6981Smrg    Drawable	drawable;
122ea1d6981Smrg    INT16	x;
123ea1d6981Smrg    INT16	y;
124ea1d6981Smrg    CARD16	width;
125ea1d6981Smrg    CARD16	height;
126ea1d6981Smrg    CARD32	planeMask;
12717ca54c3Smrg    CARD8	format;
12817ca54c3Smrg    CARD8	pad0;
12917ca54c3Smrg    CARD8	pad1;
13017ca54c3Smrg    CARD8	pad2;
131ea1d6981Smrg    ShmSeg	shmseg;
132ea1d6981Smrg    CARD32	offset;
13317ca54c3Smrg} xShmGetImageReq;
13417ca54c3Smrg#define sz_xShmGetImageReq	32
13517ca54c3Smrg
13617ca54c3Smrgtypedef struct _ShmGetImageReply {
13717ca54c3Smrg    BYTE	type;  /* X_Reply */
13817ca54c3Smrg    CARD8	depth;
139ea1d6981Smrg    CARD16	sequenceNumber;
140ea1d6981Smrg    CARD32	length;
141ea1d6981Smrg    VisualID	visual;
142ea1d6981Smrg    CARD32	size;
143ea1d6981Smrg    CARD32	pad0;
144ea1d6981Smrg    CARD32	pad1;
145ea1d6981Smrg    CARD32	pad2;
146ea1d6981Smrg    CARD32	pad3;
14717ca54c3Smrg} xShmGetImageReply;
14817ca54c3Smrg#define sz_xShmGetImageReply	32
14917ca54c3Smrg
15017ca54c3Smrgtypedef struct _ShmCreatePixmap {
15117ca54c3Smrg    CARD8	reqType;	/* always ShmReqCode */
15217ca54c3Smrg    CARD8	shmReqType;	/* always X_ShmCreatePixmap */
153ea1d6981Smrg    CARD16	length;
154ea1d6981Smrg    Pixmap	pid;
155ea1d6981Smrg    Drawable	drawable;
156ea1d6981Smrg    CARD16	width;
157ea1d6981Smrg    CARD16	height;
15817ca54c3Smrg    CARD8	depth;
15917ca54c3Smrg    CARD8	pad0;
16017ca54c3Smrg    CARD8	pad1;
16117ca54c3Smrg    CARD8	pad2;
162ea1d6981Smrg    ShmSeg	shmseg;
163ea1d6981Smrg    CARD32	offset;
16417ca54c3Smrg} xShmCreatePixmapReq;
16517ca54c3Smrg#define sz_xShmCreatePixmapReq 28
16617ca54c3Smrg
16717ca54c3Smrgtypedef struct _ShmCompletion {
16817ca54c3Smrg    BYTE	type;		/* always eventBase + ShmCompletion */
16917ca54c3Smrg    BYTE	bpad0;
170ea1d6981Smrg    CARD16	sequenceNumber;
171ea1d6981Smrg    Drawable	drawable;
172ea1d6981Smrg    CARD16	minorEvent;
17317ca54c3Smrg    BYTE	majorEvent;
17417ca54c3Smrg    BYTE	bpad1;
175ea1d6981Smrg    ShmSeg	shmseg;
176ea1d6981Smrg    CARD32	offset;
177ea1d6981Smrg    CARD32	pad0;
178ea1d6981Smrg    CARD32	pad1;
179ea1d6981Smrg    CARD32	pad2;
18017ca54c3Smrg} xShmCompletionEvent;
18117ca54c3Smrg#define sz_xShmCompletionEvent	32
18217ca54c3Smrg
18317ca54c3Smrg/* Version 1.2 additions */
18417ca54c3Smrgtypedef struct _ShmAttachFd {
18517ca54c3Smrg    CARD8	reqType;	/* always ShmReqCode */
18617ca54c3Smrg    CARD8	shmReqType;	/* always X_ShmAttachFd */
187ea1d6981Smrg    CARD16	length;
188ea1d6981Smrg    ShmSeg	shmseg;
18917ca54c3Smrg    BOOL	readOnly;
19017ca54c3Smrg    BYTE	pad0;
191ea1d6981Smrg    CARD16	pad1;
19217ca54c3Smrg} xShmAttachFdReq;
19317ca54c3Smrg/* File descriptor is passed with this request */
19417ca54c3Smrg#define sz_xShmAttachFdReq	12
19517ca54c3Smrg
19617ca54c3Smrgtypedef struct _ShmCreateSegment {
19717ca54c3Smrg    CARD8	reqType;	/* always ShmReqCode */
19817ca54c3Smrg    CARD8	shmReqType;	/* always X_ShmAttachFd */
199ea1d6981Smrg    CARD16	length;
200ea1d6981Smrg    ShmSeg	shmseg;
201ea1d6981Smrg    CARD32	size;
20217ca54c3Smrg    BOOL	readOnly;
20317ca54c3Smrg    BYTE	pad0;
204ea1d6981Smrg    CARD16	pad1;
20517ca54c3Smrg} xShmCreateSegmentReq;
20617ca54c3Smrg#define sz_xShmCreateSegmentReq 16
20717ca54c3Smrg
20817ca54c3Smrgtypedef struct {
20917ca54c3Smrg    CARD8	type;			/* must be X_Reply */
21017ca54c3Smrg    CARD8	nfd;			/* must be 1	*/
211ea1d6981Smrg    CARD16	sequenceNumber;		/* last sequence number */
212ea1d6981Smrg    CARD32	length;			/* 0 */
213ea1d6981Smrg    CARD32	pad2;			/* unused */
214ea1d6981Smrg    CARD32	pad3;			/* unused */
215ea1d6981Smrg    CARD32	pad4;			/* unused */
216ea1d6981Smrg    CARD32	pad5;			/* unused */
217ea1d6981Smrg    CARD32	pad6;			/* unused */
218ea1d6981Smrg    CARD32	pad7;			/* unused */
21917ca54c3Smrg} xShmCreateSegmentReply;
22017ca54c3Smrg/* File descriptor is passed with this reply */
22117ca54c3Smrg#define sz_xShmCreateSegmentReply	32
22217ca54c3Smrg
22317ca54c3Smrg#undef ShmSeg
22417ca54c3Smrg#undef Drawable
22517ca54c3Smrg#undef VisualID
22617ca54c3Smrg#undef GContext
22717ca54c3Smrg#undef Pixmap
22817ca54c3Smrg
22917ca54c3Smrg#endif /* _SHMPROTO_H_ */
230