1 /* Definitions for the X window system likely to be used by applications */
2 
3 #ifndef X_H
4 #define X_H
5 
6 /***********************************************************
7 
8 Copyright 1987, 1998  The Open Group
9 
10 Permission to use, copy, modify, distribute, and sell this software and its
11 documentation for any purpose is hereby granted without fee, provided that
12 the above copyright notice appear in all copies and that both that
13 copyright notice and this permission notice appear in supporting
14 documentation.
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
22 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 
26 Except as contained in this notice, the name of The Open Group shall not be
27 used in advertising or otherwise to promote the sale, use or other dealings
28 in this Software without prior written authorization from The Open Group.
29 
30 
31 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
32 
33                         All Rights Reserved
34 
35 Permission to use, copy, modify, and distribute this software and its
36 documentation for any purpose and without fee is hereby granted,
37 provided that the above copyright notice appear in all copies and that
38 both that copyright notice and this permission notice appear in
39 supporting documentation, and that the name of Digital not be
40 used in advertising or publicity pertaining to distribution of the
41 software without specific, written prior permission.
42 
43 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
44 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
45 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
46 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
47 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
48 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
49 SOFTWARE.
50 
51 ******************************************************************/
52 
53 #define X_PROTOCOL	11		/* current protocol version */
54 #define X_PROTOCOL_REVISION 0		/* current minor version */
55 
56 /* Resources */
57 
58 #ifdef _WIN64
59 typedef unsigned __int64 XID;
60 #else
61 typedef unsigned long XID;
62 #endif
63 
64 typedef XID Window;
65 typedef XID Drawable;
66 #ifndef _XTYPEDEF_FONT
67 #  define _XTYPEDEF_FONT
68 typedef XID Font;
69 #endif
70 typedef XID Pixmap;
71 typedef XID Cursor;
72 typedef XID Colormap;
73 typedef XID GContext;
74 typedef XID KeySym;
75 
76 typedef unsigned long Mask;
77 
78 typedef unsigned long Atom;
79 
80 typedef unsigned long VisualID;
81 
82 typedef unsigned long Time;
83 
84 typedef unsigned int KeyCode;	/* In order to use IME, the Macintosh needs
85 				 * to pack 3 bytes into the keyCode field in
86 				 * the XEvent.  In the real X.h, a KeyCode is
87 				 * defined as a short, which wouldn't be big
88 				 * enough. */
89 
90 /*****************************************************************
91  * RESERVED RESOURCE AND CONSTANT DEFINITIONS
92  *****************************************************************/
93 
94 /* #define None              0L      See bug [9e31fd9449] and below */
95 
96 #define ParentRelative       1L	/* background pixmap in CreateWindow
97 				    and ChangeWindowAttributes */
98 
99 #define CopyFromParent       0L	/* border pixmap in CreateWindow
100 				       and ChangeWindowAttributes
101 				   special VisualID and special window
102 				       class passed to CreateWindow */
103 
104 #define PointerWindow        0L	/* destination window in SendEvent */
105 #define InputFocus           1L	/* destination window in SendEvent */
106 
107 #define PointerRoot          1L	/* focus window in SetInputFocus */
108 
109 #define AnyPropertyType      0L	/* special Atom, passed to GetProperty */
110 
111 #define AnyKey		     0L	/* special Key Code, passed to GrabKey */
112 
113 #define AnyButton            0L	/* special Button Code, passed to GrabButton */
114 
115 #define AllTemporary         0L	/* special Resource ID passed to KillClient */
116 
117 #define CurrentTime          0L	/* special Time */
118 
119 #define NoSymbol	     0L	/* special KeySym */
120 
121 /*****************************************************************
122  * EVENT DEFINITIONS
123  *****************************************************************/
124 
125 /* Input Event Masks. Used as event-mask window attribute and as arguments
126    to Grab requests.  Not to be confused with event names.  */
127 
128 #define NoEventMask			0L
129 #define KeyPressMask			(1L<<0)
130 #define KeyReleaseMask			(1L<<1)
131 #define ButtonPressMask			(1L<<2)
132 #define ButtonReleaseMask		(1L<<3)
133 #define EnterWindowMask			(1L<<4)
134 #define LeaveWindowMask			(1L<<5)
135 #define PointerMotionMask		(1L<<6)
136 #define PointerMotionHintMask		(1L<<7)
137 #define Button1MotionMask		(1L<<8)
138 #define Button2MotionMask		(1L<<9)
139 #define Button3MotionMask		(1L<<10)
140 #define Button4MotionMask		(1L<<11)
141 #define Button5MotionMask		(1L<<12)
142 #define ButtonMotionMask		(1L<<13)
143 #define KeymapStateMask			(1L<<14)
144 #define ExposureMask			(1L<<15)
145 #define VisibilityChangeMask		(1L<<16)
146 #define StructureNotifyMask		(1L<<17)
147 #define ResizeRedirectMask		(1L<<18)
148 #define SubstructureNotifyMask		(1L<<19)
149 #define SubstructureRedirectMask	(1L<<20)
150 #define FocusChangeMask			(1L<<21)
151 #define PropertyChangeMask		(1L<<22)
152 #define ColormapChangeMask		(1L<<23)
153 #define OwnerGrabButtonMask		(1L<<24)
154 
155 /* Event names.  Used in "type" field in XEvent structures.  Not to be
156 confused with event masks above.  They start from 2 because 0 and 1
157 are reserved in the protocol for errors and replies. */
158 
159 #define KeyPress		2
160 #define KeyRelease		3
161 #define ButtonPress		4
162 #define ButtonRelease		5
163 #define MotionNotify		6
164 #define EnterNotify		7
165 #define LeaveNotify		8
166 #define FocusIn			9
167 #define FocusOut		10
168 #define KeymapNotify		11
169 #define Expose			12
170 #define GraphicsExpose		13
171 #define NoExpose		14
172 #define VisibilityNotify	15
173 #define CreateNotify		16
174 #define DestroyNotify		17
175 #define UnmapNotify		18
176 #define MapNotify		19
177 #define MapRequest		20
178 #define ReparentNotify		21
179 #define ConfigureNotify		22
180 #define ConfigureRequest	23
181 #define GravityNotify		24
182 #define ResizeRequest		25
183 #define CirculateNotify		26
184 #define CirculateRequest	27
185 #define PropertyNotify		28
186 #define SelectionClear		29
187 #define SelectionRequest	30
188 #define SelectionNotify		31
189 #define ColormapNotify		32
190 #define ClientMessage		33
191 #define MappingNotify		34
192 #define GenericEvent		35
193 #define LASTEvent		36	/* must be bigger than any event # */
194 
195 
196 /* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
197    state in various key-, mouse-, and button-related events. */
198 
199 #define ShiftMask		(1<<0)
200 #define LockMask		(1<<1)
201 /* #define ControlMask		(1<<2) See bug [9e31fd9449] and below */
202 #define Mod1Mask		(1<<3)
203 #define Mod2Mask		(1<<4)
204 #define Mod3Mask		(1<<5)
205 #define Mod4Mask		(1<<6)
206 #define Mod5Mask		(1<<7)
207 
208 /* See bug [9e31fd9449], this way prevents conflicts with Win32 headers */
209 enum _Bug9e31fd9449 { None = 0, ControlMask = (1<<2) };
210 
211 /* modifier names.  Used to build a SetModifierMapping request or
212    to read a GetModifierMapping request.  These correspond to the
213    masks defined above. */
214 #define ShiftMapIndex		0
215 #define LockMapIndex		1
216 #define ControlMapIndex		2
217 #define Mod1MapIndex		3
218 #define Mod2MapIndex		4
219 #define Mod3MapIndex		5
220 #define Mod4MapIndex		6
221 #define Mod5MapIndex		7
222 
223 
224 /* button masks.  Used in same manner as Key masks above. Not to be confused
225    with button names below. */
226 
227 #define Button1Mask		(1<<8)
228 #define Button2Mask		(1<<9)
229 #define Button3Mask		(1<<10)
230 #define Button4Mask		(1<<11)
231 #define Button5Mask		(1<<12)
232 
233 #define AnyModifier		(1<<15)  /* used in GrabButton, GrabKey */
234 
235 
236 /* button names. Used as arguments to GrabButton and as detail in ButtonPress
237    and ButtonRelease events.  Not to be confused with button masks above.
238    Note that 0 is already defined above as "AnyButton".  */
239 
240 #define Button1			1
241 #define Button2			2
242 #define Button3			3
243 #define Button4			4
244 #define Button5			5
245 
246 /* Notify modes */
247 
248 #define NotifyNormal		0
249 #define NotifyGrab		1
250 #define NotifyUngrab		2
251 #define NotifyWhileGrabbed	3
252 
253 #define NotifyHint		1	/* for MotionNotify events */
254 
255 /* Notify detail */
256 
257 #define NotifyAncestor		0
258 #define NotifyVirtual		1
259 #define NotifyInferior		2
260 #define NotifyNonlinear		3
261 #define NotifyNonlinearVirtual	4
262 #define NotifyPointer		5
263 #define NotifyPointerRoot	6
264 #define NotifyDetailNone	7
265 
266 /* Visibility notify */
267 
268 #define VisibilityUnobscured		0
269 #define VisibilityPartiallyObscured	1
270 #define VisibilityFullyObscured		2
271 
272 /* Circulation request */
273 
274 #define PlaceOnTop		0
275 #define PlaceOnBottom		1
276 
277 /* protocol families */
278 
279 #define FamilyInternet		0	/* IPv4 */
280 #define FamilyDECnet		1
281 #define FamilyChaos		2
282 #define FamilyInternet6		6	/* IPv6 */
283 
284 /* authentication families not tied to a specific protocol */
285 #define FamilyServerInterpreted 5
286 
287 /* Property notification */
288 
289 #define PropertyNewValue	0
290 #define PropertyDelete		1
291 
292 /* Color Map notification */
293 
294 #define ColormapUninstalled	0
295 #define ColormapInstalled	1
296 
297 /* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */
298 
299 #define GrabModeSync		0
300 #define GrabModeAsync		1
301 
302 /* GrabPointer, GrabKeyboard reply status */
303 
304 #define GrabSuccess		0
305 #define AlreadyGrabbed		1
306 #define GrabInvalidTime		2
307 #define GrabNotViewable		3
308 #define GrabFrozen		4
309 
310 /* AllowEvents modes */
311 
312 #define AsyncPointer		0
313 #define SyncPointer		1
314 #define ReplayPointer		2
315 #define AsyncKeyboard		3
316 #define SyncKeyboard		4
317 #define ReplayKeyboard		5
318 #define AsyncBoth		6
319 #define SyncBoth		7
320 
321 /* Used in SetInputFocus, GetInputFocus */
322 
323 #define RevertToNone		(int)None
324 #define RevertToPointerRoot	(int)PointerRoot
325 #define RevertToParent		2
326 
327 /*****************************************************************
328  * ERROR CODES
329  *****************************************************************/
330 
331 #define Success		   0	/* everything's okay */
332 #define BadRequest	   1	/* bad request code */
333 #define BadValue	   2	/* int parameter out of range */
334 #define BadWindow	   3	/* parameter not a Window */
335 #define BadPixmap	   4	/* parameter not a Pixmap */
336 #define BadAtom		   5	/* parameter not an Atom */
337 #define BadCursor	   6	/* parameter not a Cursor */
338 #define BadFont		   7	/* parameter not a Font */
339 #define BadMatch	   8	/* parameter mismatch */
340 #define BadDrawable	   9	/* parameter not a Pixmap or Window */
341 #define BadAccess	  10	/* depending on context:
342 				 - key/button already grabbed
343 				 - attempt to free an illegal
344 				   cmap entry
345 				- attempt to store into a read-only
346 				   color map entry.
347  				- attempt to modify the access control
348 				   list from other than the local host.
349 				*/
350 #define BadAlloc	  11	/* insufficient resources */
351 #define BadColor	  12	/* no such colormap */
352 #define BadGC		  13	/* parameter not a GC */
353 #define BadIDChoice	  14	/* choice not in range or already used */
354 #define BadName		  15	/* font or color name doesn't exist */
355 #define BadLength	  16	/* Request length incorrect */
356 #define BadImplementation 17	/* server is defective */
357 
358 #define FirstExtensionError	128
359 #define LastExtensionError	255
360 
361 /*****************************************************************
362  * WINDOW DEFINITIONS
363  *****************************************************************/
364 
365 /* Window classes used by CreateWindow */
366 /* Note that CopyFromParent is already defined as 0 above */
367 
368 #define InputOutput		1
369 #define InputOnly		2
370 
371 /* Window attributes for CreateWindow and ChangeWindowAttributes */
372 
373 #define CWBackPixmap		(1L<<0)
374 #define CWBackPixel		(1L<<1)
375 #define CWBorderPixmap		(1L<<2)
376 #define CWBorderPixel           (1L<<3)
377 #define CWBitGravity		(1L<<4)
378 #define CWWinGravity		(1L<<5)
379 #define CWBackingStore          (1L<<6)
380 #define CWBackingPlanes	        (1L<<7)
381 #define CWBackingPixel	        (1L<<8)
382 #define CWOverrideRedirect	(1L<<9)
383 #define CWSaveUnder		(1L<<10)
384 #define CWEventMask		(1L<<11)
385 #define CWDontPropagate	        (1L<<12)
386 #define CWColormap		(1L<<13)
387 #define CWCursor	        (1L<<14)
388 
389 /* ConfigureWindow structure */
390 
391 #define CWX			(1<<0)
392 #define CWY			(1<<1)
393 #define CWWidth			(1<<2)
394 #define CWHeight		(1<<3)
395 #define CWBorderWidth		(1<<4)
396 #define CWSibling		(1<<5)
397 #define CWStackMode		(1<<6)
398 
399 
400 /* Bit Gravity */
401 
402 #define ForgetGravity		0
403 #define NorthWestGravity	1
404 #define NorthGravity		2
405 #define NorthEastGravity	3
406 #define WestGravity		4
407 #define CenterGravity		5
408 #define EastGravity		6
409 #define SouthWestGravity	7
410 #define SouthGravity		8
411 #define SouthEastGravity	9
412 #define StaticGravity		10
413 
414 /* Window gravity + bit gravity above */
415 
416 #define UnmapGravity		0
417 
418 /* Used in CreateWindow for backing-store hint */
419 
420 #define NotUseful               0
421 #define WhenMapped              1
422 #define Always                  2
423 
424 /* Used in GetWindowAttributes reply */
425 
426 #define IsUnmapped		0
427 #define IsUnviewable		1
428 #define IsViewable		2
429 
430 /* Used in ChangeSaveSet */
431 
432 #define SetModeInsert           0
433 #define SetModeDelete           1
434 
435 /* Used in ChangeCloseDownMode */
436 
437 #define DestroyAll              0
438 #define RetainPermanent         1
439 #define RetainTemporary         2
440 
441 /* Window stacking method (in configureWindow) */
442 
443 #define Above                   0
444 #define Below                   1
445 #define TopIf                   2
446 #define BottomIf                3
447 #define Opposite                4
448 
449 /* Circulation direction */
450 
451 #define RaiseLowest             0
452 #define LowerHighest            1
453 
454 /* Property modes */
455 
456 #define PropModeReplace         0
457 #define PropModePrepend         1
458 #define PropModeAppend          2
459 
460 /*****************************************************************
461  * GRAPHICS DEFINITIONS
462  *****************************************************************/
463 
464 /* graphics functions, as in GC.alu */
465 
466 #define	GXclear			0x0		/* 0 */
467 #define GXand			0x1		/* src AND dst */
468 #define GXandReverse		0x2		/* src AND NOT dst */
469 #define GXcopy			0x3		/* src */
470 #define GXandInverted		0x4		/* NOT src AND dst */
471 #define	GXnoop			0x5		/* dst */
472 #define GXxor			0x6		/* src XOR dst */
473 #define GXor			0x7		/* src OR dst */
474 #define GXnor			0x8		/* NOT src AND NOT dst */
475 #define GXequiv			0x9		/* NOT src XOR dst */
476 #define GXinvert		0xa		/* NOT dst */
477 #define GXorReverse		0xb		/* src OR NOT dst */
478 #define GXcopyInverted		0xc		/* NOT src */
479 #define GXorInverted		0xd		/* NOT src OR dst */
480 #define GXnand			0xe		/* NOT src OR NOT dst */
481 #define GXset			0xf		/* 1 */
482 
483 /* LineStyle */
484 
485 #define LineSolid		0
486 #define LineOnOffDash		1
487 #define LineDoubleDash		2
488 
489 /* capStyle */
490 
491 #define CapNotLast		0
492 #define CapButt			1
493 #define CapRound		2
494 #define CapProjecting		3
495 
496 /* joinStyle */
497 
498 #define JoinMiter		0
499 #define JoinRound		1
500 #define JoinBevel		2
501 
502 /* fillStyle */
503 
504 #define FillSolid		0
505 #define FillTiled		1
506 #define FillStippled		2
507 #define FillOpaqueStippled	3
508 
509 /* fillRule */
510 
511 #define EvenOddRule		0
512 #define WindingRule		1
513 
514 /* subwindow mode */
515 
516 #define ClipByChildren		0
517 #define IncludeInferiors	1
518 
519 /* SetClipRectangles ordering */
520 
521 #define Unsorted		0
522 #define YSorted			1
523 #define YXSorted		2
524 #define YXBanded		3
525 
526 /* CoordinateMode for drawing routines */
527 
528 #define CoordModeOrigin		0	/* relative to the origin */
529 #define CoordModePrevious       1	/* relative to previous point */
530 
531 /* Polygon shapes */
532 
533 #define Complex			0	/* paths may intersect */
534 #define Nonconvex		1	/* no paths intersect, but not convex */
535 #define Convex			2	/* wholly convex */
536 
537 /* Arc modes for PolyFillArc */
538 
539 #define ArcChord		0	/* join endpoints of arc */
540 #define ArcPieSlice		1	/* join endpoints to center of arc */
541 
542 /* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into
543    GC.stateChanges */
544 
545 #define GCFunction              (1L<<0)
546 #define GCPlaneMask             (1L<<1)
547 #define GCForeground            (1L<<2)
548 #define GCBackground            (1L<<3)
549 #define GCLineWidth             (1L<<4)
550 #define GCLineStyle             (1L<<5)
551 #define GCCapStyle              (1L<<6)
552 #define GCJoinStyle		(1L<<7)
553 #define GCFillStyle		(1L<<8)
554 #define GCFillRule		(1L<<9)
555 #define GCTile			(1L<<10)
556 #define GCStipple		(1L<<11)
557 #define GCTileStipXOrigin	(1L<<12)
558 #define GCTileStipYOrigin	(1L<<13)
559 #define GCFont 			(1L<<14)
560 #define GCSubwindowMode		(1L<<15)
561 #define GCGraphicsExposures     (1L<<16)
562 #define GCClipXOrigin		(1L<<17)
563 #define GCClipYOrigin		(1L<<18)
564 #define GCClipMask		(1L<<19)
565 #define GCDashOffset		(1L<<20)
566 #define GCDashList		(1L<<21)
567 #define GCArcMode		(1L<<22)
568 
569 #define GCLastBit		22
570 /*****************************************************************
571  * FONTS
572  *****************************************************************/
573 
574 /* used in QueryFont -- draw direction */
575 
576 #define FontLeftToRight		0
577 #define FontRightToLeft		1
578 
579 #define FontChange		255
580 
581 /*****************************************************************
582  *  IMAGING
583  *****************************************************************/
584 
585 /* ImageFormat -- PutImage, GetImage */
586 
587 #define XYBitmap		0	/* depth 1, XYFormat */
588 #define XYPixmap		1	/* depth == drawable depth */
589 #define ZPixmap			2	/* depth == drawable depth */
590 
591 /*****************************************************************
592  *  COLOR MAP STUFF
593  *****************************************************************/
594 
595 /* For CreateColormap */
596 
597 #define AllocNone		0	/* create map with no entries */
598 #define AllocAll		1	/* allocate entire map writeable */
599 
600 
601 /* Flags used in StoreNamedColor, StoreColors */
602 
603 #define DoRed			(1<<0)
604 #define DoGreen			(1<<1)
605 #define DoBlue			(1<<2)
606 
607 /*****************************************************************
608  * CURSOR STUFF
609  *****************************************************************/
610 
611 /* QueryBestSize Class */
612 
613 #define CursorShape		0	/* largest size that can be displayed */
614 #define TileShape		1	/* size tiled fastest */
615 #define StippleShape		2	/* size stippled fastest */
616 
617 /*****************************************************************
618  * KEYBOARD/POINTER STUFF
619  *****************************************************************/
620 
621 #define AutoRepeatModeOff	0
622 #define AutoRepeatModeOn	1
623 #define AutoRepeatModeDefault	2
624 
625 #define LedModeOff		0
626 #define LedModeOn		1
627 
628 /* masks for ChangeKeyboardControl */
629 
630 #define KBKeyClickPercent	(1L<<0)
631 #define KBBellPercent		(1L<<1)
632 #define KBBellPitch		(1L<<2)
633 #define KBBellDuration		(1L<<3)
634 #define KBLed			(1L<<4)
635 #define KBLedMode		(1L<<5)
636 #define KBKey			(1L<<6)
637 #define KBAutoRepeatMode	(1L<<7)
638 
639 #define MappingSuccess     	0
640 #define MappingBusy        	1
641 #define MappingFailed		2
642 
643 #define MappingModifier		0
644 #define MappingKeyboard		1
645 #define MappingPointer		2
646 
647 /*****************************************************************
648  * SCREEN SAVER STUFF
649  *****************************************************************/
650 
651 #define DontPreferBlanking	0
652 #define PreferBlanking		1
653 #define DefaultBlanking		2
654 
655 #define DisableScreenSaver	0
656 #define DisableScreenInterval	0
657 
658 #define DontAllowExposures	0
659 #define AllowExposures		1
660 #define DefaultExposures	2
661 
662 /* for ForceScreenSaver */
663 
664 #define ScreenSaverReset 0
665 #define ScreenSaverActive 1
666 
667 /*****************************************************************
668  * HOSTS AND CONNECTIONS
669  *****************************************************************/
670 
671 /* for ChangeHosts */
672 
673 #define HostInsert		0
674 #define HostDelete		1
675 
676 /* for ChangeAccessControl */
677 
678 #define EnableAccess		1
679 #define DisableAccess		0
680 
681 /* Display classes  used in opening the connection
682  * Note that the statically allocated ones are even numbered and the
683  * dynamically changeable ones are odd numbered */
684 
685 #define StaticGray		0
686 #define GrayScale		1
687 #define StaticColor		2
688 #define PseudoColor		3
689 #define TrueColor		4
690 #define DirectColor		5
691 
692 
693 /* Byte order  used in imageByteOrder and bitmapBitOrder */
694 
695 #define LSBFirst		0
696 #define MSBFirst		1
697 
698 #endif /* X_H */
699