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