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