1 /*
2  * Copyright 1992 Network Computing Devices
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and its
5  * documentation for any purpose is hereby granted without fee, provided that
6  * the above copyright notice appear in all copies and that both that
7  * copyright notice and this permission notice appear in supporting
8  * documentation, and that the name of NCD. not be used in advertising or
9  * publicity pertaining to distribution of the software without specific,
10  * written prior permission.  NCD. makes no representations about the
11  * suitability of this software for any purpose.  It is provided "as is"
12  * without express or implied warranty.
13  *
14  * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
16  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
18  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
19  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  *
21  */
22 
23 #ifndef _LBXPROTO_H_
24 #define _LBXPROTO_H_
25 
26 #include <X11/extensions/lbx.h>
27 /*
28  * NOTE:  any changes or additions to the opcodes needs to be reflected
29  * in the lbxCacheable array in Xserver/lbx/lbxmain.c
30  */
31 
32 #define X_LbxQueryVersion		0
33 #define X_LbxStartProxy			1
34 #define X_LbxStopProxy			2
35 #define X_LbxSwitch			3
36 #define X_LbxNewClient			4
37 #define X_LbxCloseClient		5
38 #define X_LbxModifySequence		6
39 #define X_LbxAllowMotion		7
40 #define X_LbxIncrementPixel		8
41 #define X_LbxDelta			9
42 #define	X_LbxGetModifierMapping		10
43 #define	X_LbxInvalidateTag		12
44 #define X_LbxPolyPoint			13
45 #define X_LbxPolyLine			14
46 #define X_LbxPolySegment		15
47 #define X_LbxPolyRectangle		16
48 #define X_LbxPolyArc			17
49 #define X_LbxFillPoly			18
50 #define X_LbxPolyFillRectangle		19
51 #define X_LbxPolyFillArc		20
52 #define	X_LbxGetKeyboardMapping		21
53 #define	X_LbxQueryFont			22
54 #define	X_LbxChangeProperty		23
55 #define	X_LbxGetProperty		24
56 #define	X_LbxTagData			25
57 
58 #define X_LbxCopyArea			26
59 #define X_LbxCopyPlane			27
60 #define X_LbxPolyText8			28
61 #define X_LbxPolyText16			29
62 #define X_LbxImageText8			30
63 #define X_LbxImageText16		31
64 
65 #define X_LbxQueryExtension		32
66 #define X_LbxPutImage			33
67 #define X_LbxGetImage			34
68 
69 #define X_LbxBeginLargeRequest		35
70 #define X_LbxLargeRequestData		36
71 #define X_LbxEndLargeRequest		37
72 
73 #define X_LbxInternAtoms		38
74 #define X_LbxGetWinAttrAndGeom		39
75 
76 #define X_LbxGrabCmap			40
77 #define X_LbxReleaseCmap		41
78 #define X_LbxAllocColor			42
79 
80 #define X_LbxSync			43
81 
82 /*
83  * Redefine some basic types used by structures defined herein.  This removes
84  * any possibility on 64-bit architectures of one entity viewing communicated
85  * data as 32-bit quantities and another entity viewing the same data as 64-bit
86  * quantities.
87  */
88 #define XID CARD32
89 #define Atom CARD32
90 #define Colormap CARD32
91 #define Drawable CARD32
92 #define VisualID CARD32
93 #define Window CARD32
94 
95 typedef struct {
96     BOOL	success;		/* TRUE */
97     BOOL	changeType;
98     CARD16	majorVersion,
99 		minorVersion;
100     CARD16	length;			/* 1/4 additional bytes in setup info */
101     CARD32	tag;
102 } xLbxConnSetupPrefix;
103 
104 typedef struct _LbxQueryVersion {
105     CARD8	reqType;		/* always LbxReqCode */
106     CARD8	lbxReqType;		/* always X_LbxQueryVersion */
107     CARD16	length;
108 } xLbxQueryVersionReq;
109 #define sz_xLbxQueryVersionReq	4
110 
111 typedef struct {
112     BYTE	type;			/* X_Reply */
113     CARD8	unused;
114     CARD16	sequenceNumber;
115     CARD32	length;
116     CARD16	majorVersion;		/* major version of LBX protocol */
117     CARD16	minorVersion;		/* minor version of LBX protocol */
118     CARD32	pad0;
119     CARD32	pad1;
120     CARD32	pad2;
121     CARD32	pad3;
122     CARD32	pad4;
123 } xLbxQueryVersionReply;
124 #define sz_xLbxQueryVersionReply	32
125 
126 typedef struct _LbxStartProxy {
127     CARD8	reqType;	/* always LbxReqCode */
128     CARD8	lbxReqType;	/* always X_LbxStartProxy */
129     CARD16	length;
130 } xLbxStartProxyReq;
131 #define sz_xLbxStartProxyReq	    4
132 
133 typedef struct _LbxStopProxy {
134     CARD8	reqType;	/* always LbxReqCode */
135     CARD8	lbxReqType;	/* always X_LbxStopProxy */
136     CARD16	length;
137 } xLbxStopProxyReq;
138 #define sz_xLbxStopProxyReq	    4
139 
140 typedef struct _LbxSwitch {
141     CARD8	reqType;	/* always LbxReqCode */
142     CARD8	lbxReqType;	/* always X_LbxSwitch */
143     CARD16	length;
144     CARD32	client;		/* new client */
145 } xLbxSwitchReq;
146 #define sz_xLbxSwitchReq	8
147 
148 typedef struct _LbxNewClient {
149     CARD8	reqType;	/* always LbxReqCode */
150     CARD8	lbxReqType;	/* always X_LbxNewClient */
151     CARD16	length;
152     CARD32	client;		/* new client */
153 } xLbxNewClientReq;
154 #define sz_xLbxNewClientReq	8
155 
156 typedef struct _LbxCloseClient {
157     CARD8	reqType;	/* always LbxReqCode */
158     CARD8	lbxReqType;	/* always X_LbxCloseClient */
159     CARD16	length;
160     CARD32	client;		/* new client */
161 } xLbxCloseClientReq;
162 #define sz_xLbxCloseClientReq	8
163 
164 typedef struct _LbxModifySequence {
165     CARD8	reqType;	/* always LbxReqCode */
166     CARD8	lbxReqType;	/* always X_LbxModifySequence */
167     CARD16	length;
168     CARD32	adjust;
169 } xLbxModifySequenceReq;
170 #define sz_xLbxModifySequenceReq    8
171 
172 typedef struct _LbxAllowMotion {
173     CARD8	reqType;	/* always LbxReqCode */
174     CARD8	lbxReqType;	/* always X_LbxAllowMotion */
175     CARD16	length;
176     CARD32	num;
177 } xLbxAllowMotionReq;
178 #define sz_xLbxAllowMotionReq    8
179 
180 typedef struct {
181     CARD8	reqType;	/* always LbxReqCode */
182     CARD8	lbxReqType;	/* always X_LbxGrabCmap */
183     CARD16	length;
184     Colormap	cmap;
185 } xLbxGrabCmapReq;
186 #define sz_xLbxGrabCmapReq	8
187 
188 #define LBX_SMART_GRAB		0x80
189 #define LBX_AUTO_RELEASE	0x40
190 #define LBX_3CHANNELS		0x20
191 #define LBX_2BYTE_PIXELS	0x10
192 #define LBX_RGB_BITS_MASK	0x0f
193 
194 #define LBX_LIST_END		0
195 #define LBX_PIXEL_PRIVATE	1
196 #define LBX_PIXEL_SHARED	2
197 #define LBX_PIXEL_RANGE_PRIVATE	3
198 #define LBX_PIXEL_RANGE_SHARED	4
199 #define LBX_NEXT_CHANNEL	5
200 
201 typedef struct {
202     BYTE	type;			/* X_Reply */
203     CARD8	flags;
204     CARD16	sequenceNumber;
205     CARD32	length;
206     CARD32	pad0;
207     CARD32	pad1;
208     CARD32	pad2;
209     CARD32	pad3;
210     CARD32	pad4;
211     CARD32	pad5;
212 } xLbxGrabCmapReply;
213 #define sz_xLbxGrabCmapReply	32
214 #define sz_xLbxGrabCmapReplyHdr	8
215 
216 
217 typedef struct {
218     CARD8	reqType;	/* always LbxReqCode */
219     CARD8	lbxReqType;	/* always X_LbxReleaseCmap */
220     CARD16	length;
221     Colormap	cmap;
222 } xLbxReleaseCmapReq;
223 #define sz_xLbxReleaseCmapReq	8
224 
225 typedef struct {
226     CARD8	reqType;	/* always LbxReqCode */
227     CARD8	lbxReqType;	/* always X_LbxAllocColor */
228     CARD16	length;
229     Colormap	cmap;
230     CARD32	pixel;
231     CARD16	red, green, blue;
232     CARD16	pad;
233 } xLbxAllocColorReq;
234 #define sz_xLbxAllocColorReq	20
235 
236 typedef struct _LbxIncrementPixel {
237     CARD8	reqType;	/* always LbxReqCode */
238     CARD8	lbxReqType;	/* always X_LbxIncrementPixel */
239     CARD16	length;
240     CARD32	cmap;
241     CARD32	pixel;
242 } xLbxIncrementPixelReq;
243 #define sz_xLbxIncrementPixelReq    12
244 
245 typedef struct _LbxDelta {
246     CARD8	reqType;	/* always LbxReqCode */
247     CARD8	lbxReqType;	/* always X_LbxDelta */
248     CARD16	length;
249     CARD8	diffs;		/* number of diffs */
250     CARD8	cindex;		/* cache index */
251 				/* list of diffs follows */
252 } xLbxDeltaReq;
253 #define sz_xLbxDeltaReq    6
254 
255 typedef struct _LbxGetModifierMapping {
256     CARD8	reqType;	/* always LbxReqCode */
257     CARD8	lbxReqType;	/* always X_LbxGetModifierMapping */
258     CARD16	length;
259 } xLbxGetModifierMappingReq;
260 #define	sz_xLbxGetModifierMappingReq	4
261 
262 typedef struct {
263     BYTE	type;			/* X_Reply */
264     CARD8	keyspermod;
265     CARD16	sequenceNumber;
266     CARD32	length;
267     CARD32	tag;
268     CARD32	pad0;
269     CARD32	pad1;
270     CARD32	pad2;
271     CARD32	pad3;
272     CARD32	pad4;
273 } xLbxGetModifierMappingReply;
274 #define sz_xLbxGetModifierMappingReply	32
275 
276 typedef struct _LbxGetKeyboardMapping {
277     CARD8	reqType;	/* always LbxReqCode */
278     CARD8	lbxReqType;	/* always X_LbxGetKeyboardMapping */
279     CARD16	length;
280     KeyCode	firstKeyCode;
281     CARD8	count;
282     CARD16	pad1;
283 } xLbxGetKeyboardMappingReq;
284 #define	sz_xLbxGetKeyboardMappingReq	8
285 
286 typedef struct {
287     BYTE	type;			/* X_Reply */
288     CARD8	keysperkeycode;
289     CARD16	sequenceNumber;
290     CARD32	length;
291     CARD32	tag;
292     CARD32	pad0;
293     CARD32	pad1;
294     CARD32	pad2;
295     CARD32	pad3;
296     CARD32	pad4;
297 } xLbxGetKeyboardMappingReply;
298 #define sz_xLbxGetKeyboardMappingReply	32
299 
300 typedef struct _LbxQueryFont {
301     CARD8	reqType;	/* always LbxReqCode */
302     CARD8	lbxReqType;	/* always X_LbxQueryFont */
303     CARD16	length;
304     CARD32	fid;
305 } xLbxQueryFontReq;
306 #define	sz_xLbxQueryFontReq	8
307 
308 typedef struct _LbxInternAtoms {
309     CARD8	reqType;	/* always LbxReqCode */
310     CARD8	lbxReqType;	/* always X_LbxInternAtoms */
311     CARD16	length;
312     CARD16	num;
313 } xLbxInternAtomsReq;
314 #define sz_xLbxInternAtomsReq	6
315 
316 typedef struct {
317     BYTE	type;		/* X_Reply */
318     CARD8	unused;
319     CARD16	sequenceNumber;
320     CARD32	length;
321     CARD32	atomsStart;
322     CARD32	pad0;
323     CARD32	pad1;
324     CARD32	pad2;
325     CARD32	pad3;
326     CARD32	pad4;
327 } xLbxInternAtomsReply;
328 #define sz_xLbxInternAtomsReply		32
329 #define sz_xLbxInternAtomsReplyHdr	8
330 
331 
332 typedef struct _LbxGetWinAttrAndGeom {
333     CARD8	reqType;	/* always LbxReqCode */
334     CARD8	lbxReqType;	/* always X_LbxGetWinAttrAndGeom */
335     CARD16	length;
336     CARD32	id;		/* window id */
337 } xLbxGetWinAttrAndGeomReq;
338 #define sz_xLbxGetWinAttrAndGeomReq 8
339 
340 typedef struct {
341     BYTE type;  /* X_Reply */
342     CARD8 backingStore;
343     CARD16 sequenceNumber;
344     CARD32 length;		/* NOT 0; this is an extra-large reply */
345     VisualID visualID;
346 #if defined(__cplusplus) || defined(c_plusplus)
347     CARD16 c_class;
348 #else
349     CARD16 class;
350 #endif
351     CARD8 bitGravity;
352     CARD8 winGravity;
353     CARD32 backingBitPlanes;
354     CARD32 backingPixel;
355     BOOL saveUnder;
356     BOOL mapInstalled;
357     CARD8 mapState;
358     BOOL override;
359     Colormap colormap;
360     CARD32 allEventMasks;
361     CARD32 yourEventMask;
362     CARD16 doNotPropagateMask;
363     CARD16 pad1;
364     Window root;
365     INT16 x, y;
366     CARD16 width, height;
367     CARD16 borderWidth;
368     CARD8 depth;
369     CARD8 pad2;
370 } xLbxGetWinAttrAndGeomReply;
371 #define sz_xLbxGetWinAttrAndGeomReply 60
372 
373 
374 typedef struct {
375     CARD8	reqType;	/* always LbxReqCode */
376     CARD8	lbxReqType;	/* always X_LbxSync */
377     CARD16	length;
378 } xLbxSyncReq;
379 #define sz_xLbxSyncReq	4
380 
381 typedef struct {
382     BYTE	type;			/* X_Reply */
383     CARD8	pad0;
384     CARD16	sequenceNumber;
385     CARD32	length;
386     CARD32	pad1;
387     CARD32	pad2;
388     CARD32	pad3;
389     CARD32	pad4;
390     CARD32	pad5;
391     CARD32	pad6;
392 } xLbxSyncReply;
393 #define sz_xLbxSyncReply 32
394 
395 
396 /* an LBX squished charinfo packs the data in a CARD32 as follows */
397 #define	LBX_WIDTH_SHIFT		26
398 #define	LBX_LEFT_SHIFT		20
399 #define	LBX_RIGHT_SHIFT		13
400 #define	LBX_ASCENT_SHIFT	7
401 #define	LBX_DESCENT_SHIFT	0
402 
403 #define	LBX_WIDTH_BITS		6
404 #define	LBX_LEFT_BITS		6
405 #define	LBX_RIGHT_BITS		7
406 #define	LBX_ASCENT_BITS		6
407 #define	LBX_DESCENT_BITS	7
408 
409 #define	LBX_WIDTH_MASK		0xfc000000
410 #define	LBX_LEFT_MASK		0x03f00000
411 #define	LBX_RIGHT_MASK		0x000fe000
412 #define	LBX_ASCENT_MASK		0x00001f80
413 #define	LBX_DESCENT_MASK	0x0000007f
414 
415 #define	LBX_MASK_BITS(val, n)	((unsigned int) ((val) & ((1 << (n)) - 1)))
416 
417 typedef struct {
418     CARD32	metrics;
419 } xLbxCharInfo;
420 
421 /* note that this is identical to xQueryFontReply except for missing
422  * first 2 words
423  */
424 typedef struct {
425     xCharInfo minBounds;
426 /* XXX do we need to leave this gunk? */
427 #ifndef WORD64
428     CARD32 walign1;
429 #endif
430     xCharInfo maxBounds;
431 #ifndef WORD64
432     CARD32 walign2;
433 #endif
434     CARD16 minCharOrByte2, maxCharOrByte2;
435     CARD16 defaultChar;
436     CARD16 nFontProps;	/* followed by this many xFontProp structures */
437     CARD8 drawDirection;
438     CARD8 minByte1, maxByte1;
439     BOOL allCharsExist;
440     INT16 fontAscent, fontDescent;
441     CARD32 nCharInfos;	/* followed by this many xLbxCharInfo structures */
442 } xLbxFontInfo;
443 
444 typedef struct {
445     BYTE	type;			/* X_Reply */
446     CARD8	compression;
447     CARD16	sequenceNumber;
448     CARD32	length;
449     CARD32	tag;
450     CARD32	pad0;
451     CARD32	pad1;
452     CARD32	pad2;
453     CARD32	pad3;
454     CARD32	pad4;
455     /* X_QueryFont sticks much of the data in the base reply packet,
456      * but we hope that it won't be needed, (and it won't fit in 32 bytes
457      * with the tag anyways)
458      *
459      * if any additional data is needed, its sent in a xLbxFontInfo
460      */
461 } xLbxQueryFontReply;
462 #define sz_xLbxQueryFontReply	32
463 
464 typedef struct _LbxChangeProperty {
465     CARD8	reqType;	/* always LbxReqCode */
466     CARD8	lbxReqType;	/* always X_LbxChangeProperty */
467     CARD16	length;
468     Window	window;
469     Atom	property;
470     Atom	type;
471     CARD8	format;
472     CARD8	mode;
473     BYTE	pad[2];
474     CARD32	nUnits;
475 } xLbxChangePropertyReq;
476 #define	sz_xLbxChangePropertyReq	24
477 
478 typedef struct {
479     BYTE	type;			/* X_Reply */
480     CARD8	pad;
481     CARD16	sequenceNumber;
482     CARD32	length;
483     CARD32	tag;
484     CARD32	pad0;
485     CARD32	pad1;
486     CARD32	pad2;
487     CARD32	pad3;
488     CARD32	pad4;
489 } xLbxChangePropertyReply;
490 #define sz_xLbxChangePropertyReply	32
491 
492 typedef struct _LbxGetProperty {
493     CARD8	reqType;	/* always LbxReqCode */
494     CARD8	lbxReqType;	/* always X_LbxGetProperty */
495     CARD16	length;
496     Window	window;
497     Atom	property;
498     Atom	type;
499     CARD8	delete;
500     BYTE	pad[3];
501     CARD32	longOffset;
502     CARD32	longLength;
503 } xLbxGetPropertyReq;
504 #define	sz_xLbxGetPropertyReq	28
505 
506 typedef struct {
507     BYTE	type;			/* X_Reply */
508     CARD8	format;
509     CARD16	sequenceNumber;
510     CARD32	length;
511     Atom	propertyType;
512     CARD32	bytesAfter;
513     CARD32	nItems;
514     CARD32	tag;
515     CARD32	pad1;
516     CARD32	pad2;
517 } xLbxGetPropertyReply;
518 #define sz_xLbxGetPropertyReply	32
519 
520 typedef struct _LbxTagData {
521     CARD8	reqType;	/* always LbxReqCode */
522     CARD8	lbxReqType;	/* always X_LbxTagData */
523     CARD16	length;
524     XID 	tag;
525     CARD32	real_length;
526     /* data */
527 } xLbxTagDataReq;
528 #define	sz_xLbxTagDataReq	12
529 
530 typedef struct _LbxInvalidateTag {
531     CARD8	reqType;	/* always LbxReqCode */
532     CARD8	lbxReqType;	/* always X_LbxInvalidateTag */
533     CARD16	length;
534     CARD32	tag;
535 } xLbxInvalidateTagReq;
536 #define	sz_xLbxInvalidateTagReq	8
537 
538 typedef struct _LbxPutImage {
539     CARD8	reqType;	/* always LbxReqCode */
540     CARD8	lbxReqType;	/* always X_LbxPutImage */
541     CARD16	length;
542     CARD8	compressionMethod;
543     CARD8	cacheEnts;
544     CARD8	bitPacked;
545     /* rest is variable */
546 } xLbxPutImageReq;
547 #define sz_xLbxPutImageReq	7
548 
549 typedef struct {
550     CARD8	reqType;	/* always LbxReqCode */
551     CARD8	lbxReqType;	/* always X_LbxGetImage */
552     CARD16	length;
553     Drawable	drawable;
554     INT16	x, y;
555     CARD16	width, height;
556     CARD32	planeMask;
557     CARD8	format;
558     CARD8	pad1;
559     CARD16	pad2;
560 } xLbxGetImageReq;
561 
562 #define sz_xLbxGetImageReq 24
563 
564 typedef struct {
565     BYTE type;			/* X_Reply */
566     CARD8 depth;
567     CARD16 sequenceNumber;
568     CARD32 lbxLength;
569     CARD32 xLength;
570     VisualID visual;
571     CARD8 compressionMethod;
572     CARD8 pad1;
573     CARD16 pad2;
574     CARD32 pad3;
575     CARD32 pad4;
576     CARD32 pad5;
577 } xLbxGetImageReply;
578 
579 #define sz_xLbxGetImageReply 32
580 
581 /* Following used for LbxPolyPoint, LbxPolyLine, LbxPolySegment,
582    LbxPolyRectangle, LbxPolyArc, LbxPolyFillRectangle and LbxPolyFillArc */
583 
584 #define GFX_CACHE_SIZE  15
585 
586 #define GFXdCacheEnt(e)	    ((e) & 0xf)
587 #define GFXgCacheEnt(e)	    (((e) >> 4) & 0xf)
588 #define GFXCacheEnts(d,g)   (((d) & 0xf) | (((g) & 0xf) << 4))
589 
590 #define GFXCacheNone   0xf
591 
592 typedef struct _LbxPolyPoint {
593     CARD8	reqType;	/* always LbxReqCode */
594     CARD8	lbxReqType;
595     CARD16	length;
596     CARD8	cacheEnts;
597     CARD8	padBytes;
598 } xLbxPolyPointReq;
599 
600 #define sz_xLbxPolyPointReq	6
601 
602 typedef xLbxPolyPointReq xLbxPolyLineReq;
603 typedef xLbxPolyPointReq xLbxPolySegmentReq;
604 typedef xLbxPolyPointReq xLbxPolyRectangleReq;
605 typedef xLbxPolyPointReq xLbxPolyArcReq;
606 typedef xLbxPolyPointReq xLbxPolyFillRectangleReq;
607 typedef xLbxPolyPointReq xLbxPolyFillArcReq;
608 
609 #define sz_xLbxPolyLineReq		sz_xLbxPolyPointReq
610 #define sz_xLbxPolySegmentReq		sz_xLbxPolyPointReq
611 #define sz_xLbxPolyRectangleReq		sz_xLbxPolyPointReq
612 #define sz_xLbxPolyArcReq		sz_xLbxPolyPointReq
613 #define sz_xLbxPolyFillRectangleReq	sz_xLbxPolyPointReq
614 #define sz_xLbxPolyFillArc		sz_xLbxPolyPointReq
615 
616 typedef struct _LbxFillPoly {
617     CARD8	reqType;	/* always LbxReqCode */
618     CARD8	lbxReqType;
619     CARD16	length;
620     CARD8	cacheEnts;
621     BYTE	shape;
622     CARD8	padBytes;
623 } xLbxFillPolyReq;
624 #define sz_xLbxFillPolyReq	7
625 
626 typedef struct _LbxCopyArea {
627     CARD8	reqType;	/* always LbxReqCode */
628     CARD8	lbxReqType;
629     CARD16	length;
630     CARD8	srcCache;	/* source drawable */
631     CARD8	cacheEnts;	/* dest drawable and gc */
632     /* followed by encoded src x, src y, dst x, dst y, width, height */
633 } xLbxCopyAreaReq;
634 
635 #define sz_xLbxCopyAreaReq  6
636 
637 typedef struct _LbxCopyPlane {
638     CARD8	reqType;	/* always LbxReqCode */
639     CARD8	lbxReqType;
640     CARD16	length;
641     CARD32	bitPlane;
642     CARD8	srcCache;	/* source drawable */
643     CARD8	cacheEnts;	/* dest drawable and gc */
644     /* followed by encoded src x, src y, dst x, dst y, width, height */
645 } xLbxCopyPlaneReq;
646 
647 #define sz_xLbxCopyPlaneReq  10
648 
649 typedef struct _LbxPolyText {
650     CARD8	reqType;	/* always LbxReqCode */
651     CARD8	lbxReqType;
652     CARD16	length;
653     CARD8	cacheEnts;
654     /* followed by encoded src x, src y coordinates and text elts */
655 } xLbxPolyTextReq;
656 
657 #define sz_xLbxPolyTextReq  5
658 
659 typedef xLbxPolyTextReq xLbxPolyText8Req;
660 typedef xLbxPolyTextReq xLbxPolyText16Req;
661 
662 #define sz_xLbxPolyTextReq	5
663 #define sz_xLbxPolyText8Req	5
664 #define sz_xLbxPolyText16Req	5
665 
666 typedef struct _LbxImageText {
667     CARD8	reqType;	/* always LbxReqCode */
668     CARD8	lbxReqType;
669     CARD16	length;
670     CARD8	cacheEnts;
671     CARD8	nChars;
672     /* followed by encoded src x, src y coordinates and string */
673 } xLbxImageTextReq;
674 
675 typedef xLbxImageTextReq xLbxImageText8Req;
676 typedef xLbxImageTextReq xLbxImageText16Req;
677 
678 #define sz_xLbxImageTextReq	6
679 #define sz_xLbxImageText8Req	6
680 #define sz_xLbxImageText16Req	6
681 
682 typedef struct {
683     CARD8       offset;
684     CARD8       diff;
685 } xLbxDiffItem;
686 #define sz_xLbxDiffItem    2
687 
688 typedef struct {
689     BYTE	type;		/* X_Reply */
690     CARD8	nOpts;
691     CARD16	sequenceNumber;
692     CARD32	length;
693     CARD32	optDataStart;
694     CARD32	pad0;
695     CARD32	pad1;
696     CARD32	pad2;
697     CARD32	pad3;
698     CARD32	pad4;
699 } xLbxStartReply;
700 #define sz_xLbxStartReply	32
701 #define sz_xLbxStartReplyHdr	8
702 
703 typedef struct _LbxQueryExtension {
704     CARD8	reqType;	/* always LbxReqCode */
705     CARD8	lbxReqType;	/* always X_LbxQueryExtension */
706     CARD16	length;
707     CARD32	nbytes;
708 } xLbxQueryExtensionReq;
709 #define	sz_xLbxQueryExtensionReq	8
710 
711 typedef struct _LbxQueryExtensionReply {
712     BYTE	type;			/* X_Reply */
713     CARD8	numReqs;
714     CARD16	sequenceNumber;
715     CARD32	length;
716     BOOL	present;
717     CARD8	major_opcode;
718     CARD8	first_event;
719     CARD8	first_error;
720     CARD32	pad0;
721     CARD32	pad1;
722     CARD32	pad2;
723     CARD32	pad3;
724     CARD32	pad4;
725 
726     /* reply & event generating requests */
727 } xLbxQueryExtensionReply;
728 #define sz_xLbxQueryExtensionReply	32
729 
730 
731 typedef struct _LbxBeginLargeRequest {
732     CARD8	reqType;	/* always LbxReqCode */
733     CARD8	lbxReqType;	/* always X_LbxBeginLargeRequest */
734     CARD16	length;
735     CARD32	largeReqLength;
736 } xLbxBeginLargeRequestReq;
737 #define	sz_BeginLargeRequestReq 8
738 
739 typedef struct _LbxLargeRequestData {
740     CARD8	reqType;	/* always LbxReqCode */
741     CARD8	lbxReqType;	/* always X_LbxLargeRequestData */
742     CARD16	length;
743     /* followed by LISTofCARD8 data */
744 } xLbxLargeRequestDataReq;
745 #define	sz_LargeRequestDataReq 4
746 
747 typedef struct _LbxEndLargeRequest {
748     CARD8	reqType;	/* always LbxReqCode */
749     CARD8	lbxReqType;	/* always X_LbxEndLargeRequest */
750     CARD16	length;
751 } xLbxEndLargeRequestReq;
752 #define	sz_EndLargeRequestReq 4
753 
754 
755 
756 typedef struct _LbxSwitchEvent {
757     BYTE	type;		/* always eventBase + LbxEvent */
758     BYTE	lbxType;	/* LbxSwitchEvent */
759     CARD16	pad;
760     CARD32	client;
761 } xLbxSwitchEvent;
762 #define sz_xLbxSwitchEvent	8
763 
764 typedef struct _LbxCloseEvent {
765     BYTE	type;		/* always eventBase + LbxEvent */
766     BYTE	lbxType;	/* LbxCloseEvent */
767     CARD16	sequenceNumber;
768     CARD32	client;
769     CARD32	pad1;
770     CARD32	pad2;
771     CARD32	pad3;
772     CARD32	pad4;
773     CARD32	pad5;
774     CARD32	pad6;
775 } xLbxCloseEvent;
776 #define sz_xLbxCloseEvent	32
777 
778 typedef struct _LbxInvalidateTagEvent {
779     BYTE	type;		/* always eventBase + LbxEvent */
780     BYTE	lbxType;	/* LbxInvalidateTagEvent */
781     CARD16	sequenceNumber;
782     CARD32	tag;
783     CARD32	tagType;
784     CARD32	pad1;
785     CARD32	pad2;
786     CARD32	pad3;
787     CARD32	pad4;
788     CARD32	pad5;
789 } xLbxInvalidateTagEvent;
790 #define sz_xLbxInvalidateTagEvent 32
791 
792 typedef struct _LbxSendTagDataEvent {
793     BYTE	type;		/* always eventBase + LbxEvent */
794     BYTE	lbxType;	/* LbxSendTagDataEvent */
795     CARD16	sequenceNumber;
796     CARD32	tag;
797     CARD32	tagType;
798     CARD32	pad1;
799     CARD32	pad2;
800     CARD32	pad3;
801     CARD32	pad4;
802     CARD32	pad5;
803 } xLbxSendTagDataEvent;
804 #define sz_xLbxSendTagDataEvent 32
805 
806 typedef struct _LbxListenToOneEvent {
807     BYTE	type;		/* always eventBase + LbxEvent */
808     BYTE	lbxType;	/* LbxListenToOneEvent */
809     CARD16	sequenceNumber;
810     CARD32	client;
811     CARD32	pad1;
812     CARD32	pad2;
813     CARD32	pad3;
814     CARD32	pad4;
815     CARD32	pad5;
816     CARD32	pad6;
817 } xLbxListenToOneEvent;
818 #define sz_xLbxListenToOneEvent 32
819 
820 typedef struct _LbxListenToAllEvent {
821     BYTE	type;		/* always eventBase + LbxEvent */
822     BYTE	lbxType;	/* LbxListenToAllEvent */
823     CARD16	sequenceNumber;
824     CARD32	pad1;
825     CARD32	pad2;
826     CARD32	pad3;
827     CARD32	pad4;
828     CARD32	pad5;
829     CARD32	pad6;
830     CARD32	pad7;
831 } xLbxListenToAllEvent;
832 #define sz_xLbxListenToOneEvent 32
833 
834 typedef struct _LbxReleaseCmapEvent {
835     BYTE	type;		/* always eventBase + LbxEvent */
836     BYTE	lbxType;	/* LbxReleaseCmapEvent */
837     CARD16	sequenceNumber;
838     Colormap	colormap;
839     CARD32	pad1;
840     CARD32	pad2;
841     CARD32	pad3;
842     CARD32	pad4;
843     CARD32	pad5;
844     CARD32	pad6;
845 } xLbxReleaseCmapEvent;
846 #define sz_xLbxReleaseCmapEvent	32
847 
848 
849 typedef struct _LbxFreeCellsEvent {
850     BYTE	type;		/* always eventBase + LbxEvent */
851     BYTE	lbxType;	/* LbxFreeCellsEvent */
852     CARD16	sequenceNumber;
853     Colormap	colormap;
854     CARD32	pixelStart;
855     CARD32	pixelEnd;
856     CARD32	pad1;
857     CARD32	pad2;
858     CARD32	pad3;
859     CARD32	pad4;
860 } xLbxFreeCellsEvent;
861 #define sz_xLbxFreeCellsEvent	32
862 
863 
864 /*
865  * squished X event sizes.  If these change, be sure to update lbxquish.c
866  * and unsquish.c appropriately
867  *
868  * lbxsz_* is the padded squished length
869  * lbxupsz_* is the unpadded squished length
870  */
871 
872 #define	  lbxsz_KeyButtonEvent		32
873 #define	lbxupsz_KeyButtonEvent		31
874 
875 #define	  lbxsz_EnterLeaveEvent		32
876 #define	lbxupsz_EnterLeaveEvent		32
877 
878 #define	  lbxsz_FocusEvent		12
879 #define	lbxupsz_FocusEvent		9
880 
881 #define	  lbxsz_KeymapEvent		32
882 #define	lbxupsz_KeymapEvent		32
883 
884 #define	  lbxsz_ExposeEvent		20
885 #define	lbxupsz_ExposeEvent		18
886 
887 #define	  lbxsz_GfxExposeEvent		24
888 #define	lbxupsz_GfxExposeEvent		21
889 
890 #define	  lbxsz_NoExposeEvent		12
891 #define	lbxupsz_NoExposeEvent		11
892 
893 #define	  lbxsz_VisibilityEvent		12
894 #define	lbxupsz_VisibilityEvent		9
895 
896 #define	  lbxsz_CreateNotifyEvent	24
897 #define	lbxupsz_CreateNotifyEvent	23
898 
899 #define	  lbxsz_DestroyNotifyEvent	12
900 #define	lbxupsz_DestroyNotifyEvent	12
901 
902 #define	  lbxsz_UnmapNotifyEvent	16
903 #define	lbxupsz_UnmapNotifyEvent	13
904 
905 #define	  lbxsz_MapNotifyEvent		16
906 #define	lbxupsz_MapNotifyEvent		13
907 
908 #define	  lbxsz_MapRequestEvent		12
909 #define	lbxupsz_MapRequestEvent		12
910 
911 #define	  lbxsz_ReparentEvent		24
912 #define	lbxupsz_ReparentEvent		21
913 
914 #define	  lbxsz_ConfigureNotifyEvent	28
915 #define	lbxupsz_ConfigureNotifyEvent	27
916 
917 #define	  lbxsz_ConfigureRequestEvent	28
918 #define	lbxupsz_ConfigureRequestEvent	28
919 
920 #define	  lbxsz_GravityEvent		16
921 #define	lbxupsz_GravityEvent		16
922 
923 #define	  lbxsz_ResizeRequestEvent	12
924 #define	lbxupsz_ResizeRequestEvent	12
925 
926 #define	  lbxsz_CirculateEvent		20
927 #define	lbxupsz_CirculateEvent		17
928 
929 #define	  lbxsz_PropertyEvent		20
930 #define	lbxupsz_PropertyEvent		17
931 
932 #define	  lbxsz_SelectionClearEvent	16
933 #define	lbxupsz_SelectionClearEvent	16
934 
935 #define	  lbxsz_SelectionRequestEvent	28
936 #define	lbxupsz_SelectionRequestEvent	28
937 
938 #define	  lbxsz_SelectionNotifyEvent	24
939 #define	lbxupsz_SelectionNotifyEvent	24
940 
941 #define	  lbxsz_ColormapEvent		16
942 #define	lbxupsz_ColormapEvent		14
943 
944 #define	  lbxsz_MappingNotifyEvent	8
945 #define	lbxupsz_MappingNotifyEvent	7
946 
947 #define	  lbxsz_ClientMessageEvent	32
948 #define	lbxupsz_ClientMessageEvent	32
949 
950 #define	lbxsz_UnknownEvent		32
951 
952 #ifdef DEBUG
953 
954 #define DBG_SWITCH	0x00000001
955 #define DBG_CLOSE	0x00000002
956 #define DBG_IO		0x00000004
957 #define DBG_READ_REQ	0x00000008
958 #define DBG_LEN		0x00000010
959 #define DBG_BLOCK	0x00000020
960 #define DBG_CLIENT	0x00000040
961 #define DBG_DELTA	0x00000080
962 #endif
963 /*
964  * Cancel the previous redefinition of the basic types, thus restoring their
965  * X.h definitions.
966  */
967 
968 #undef XID
969 #undef Atom
970 #undef Colormap
971 #undef Drawable
972 #undef VisualID
973 #undef Window
974 
975 #endif	/* _LBXPROTO_H_ */
976