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