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