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