diff --git a/3rdparty/X11/.gitignore b/3rdparty/X11/.gitignore new file mode 100644 index 00000000..4ac7af91 --- /dev/null +++ b/3rdparty/X11/.gitignore @@ -0,0 +1,2 @@ +*.o +*.deps diff --git a/3rdparty/X11/CHANGES b/3rdparty/X11/CHANGES new file mode 100644 index 00000000..08ea80fb --- /dev/null +++ b/3rdparty/X11/CHANGES @@ -0,0 +1,31 @@ +Release 0.12: +========== +Fixed: + X11/Xlib.h: functions which were macros in C now are D templates +Overview: + It is not necessary to compile&link with the bindings anymore, + just include them + +Release 0.11.1: (Alex Herrmann) +========== +Fixed: + X11/Xlib.d: all typedefs changed to Aliases + example/simple.d: updated to work +Added: + Makefiles to build, tested, all work +Overview: + General Updates to multiple Items + +Release 0.11 ALPHA: +========== +Added: + Full xcb bindings + +Release 0.1 ALPHA: +========== +First release of binding +Full bindings of X11/Xlib.h and X11/X.h +Todo: + More tests + Other X11 bindings + diff --git a/3rdparty/X11/COPYING b/3rdparty/X11/COPYING new file mode 100644 index 00000000..d4145f82 --- /dev/null +++ b/3rdparty/X11/COPYING @@ -0,0 +1,24 @@ +*************************************************************************** +Copyright 1985, 1986, 1987, 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. +**************************************************************************** + diff --git a/3rdparty/X11/README b/3rdparty/X11/README new file mode 100644 index 00000000..39c8404e --- /dev/null +++ b/3rdparty/X11/README @@ -0,0 +1,13 @@ +X11.d +===== + +This is a binding for Xlib for D language (version 2). + +It is extracted from the bindings project (http://www.dsource.org/projects/bindings). Original credit goes to Teissier Sylvere (sligor@free.fr). + +===== + +Contributors: +Alex Herrmann +Andrea R. + diff --git a/3rdparty/X11/TODO b/3rdparty/X11/TODO new file mode 100644 index 00000000..1fb37062 --- /dev/null +++ b/3rdparty/X11/TODO @@ -0,0 +1,6 @@ +TODO list: +---------- + +-Test test and retest ! You can share your code for a Test Suite +-Bind other X11 library extensions +-Write other example code diff --git a/3rdparty/X11/X11/X.d b/3rdparty/X11/X11/X.d new file mode 100644 index 00000000..07f6b3e2 --- /dev/null +++ b/3rdparty/X11/X11/X.d @@ -0,0 +1,749 @@ +/* Xlib binding for D language + Copyright 2007 TEISSIER Sylvere sligor(at)free.fr + version 0.1 2007/08/29 + This binding is an alpha release and need to be more tested + + This file is free software, please read licence.txt for more informations +*/ + +module X11.X; + +pragma(lib, "X11"); + +const uint X_PROTOCOL=11; /* current protocol version */ +const uint X_PROTOCOL_REVISION=0; /* current minor version */ + +/* Resources */ +alias uint XID; +alias uint Mask; +alias uint VisualID; +alias uint Time; +alias XID Atom; //alias needed because of None invariant shared for Atom and XID +alias XID Window; +alias XID Drawable; +alias XID Font; +alias XID Pixmap; +alias XID Cursor; +alias XID Colormap; +alias XID GContext; +alias XID KeySym; +alias uint KeyCode; + +/***************************************************************** + * RESERVED RESOURCE AND CONSTANT DEFINITIONS + *****************************************************************/ +const XID None=0;/* universal null resource or null atom */ +const uint ParentRelative=1; /* border pixmap in CreateWindow and ChangeWindowAttributes special VisualID and special window class passed to CreateWindow */ +const uint CopyFromParent=0; /* background pixmap in CreateWindow and ChangeWindowAttributes */ +const Window PointerWindow=0; /* destination window in SendEvent */ +const Window InputFocus=1; /* destination window in SendEvent */ +const Window PointerRoot=1; /* focus window in SetInputFocus */ +const Atom AnyPropertyType=0; /* special Atom, passed to GetProperty */ +const KeyCode AnyKey=0; /* special Key Code, passed to GrabKey */ +const uint AnyButton=0; /* special Button Code, passed to GrabButton */ +const XID AllTemporary=0; /* special Resource ID passed to KillClient */ +const Time CurrentTime=0; /* special Time */ +const KeySym NoSymbol=0; /* special KeySym */ + +/***************************************************************** + * EVENT DEFINITIONS + *****************************************************************/ + + /* Input Event Masks. Used as event-mask window attribute and as arguments + to Grab requests. Not to be confused with event names. */ + +enum:int +{ + NoEventMask =0, + KeyPressMask =1<<0, + KeyReleaseMask =1<<1, + ButtonPressMask =1<<2, + ButtonReleaseMask =1<<3, + EnterWindowMask =1<<4, + LeaveWindowMask =1<<5, + PointerMotionMask =1<<6, + PointerMotionHintMask =1<<7, + Button1MotionMask =1<<8, + Button2MotionMask =1<<9, + Button3MotionMask =1<<10, + Button4MotionMask =1<<11, + Button5MotionMask =1<<12, + ButtonMotionMask =1<<13, + KeymapStateMask =1<<14, + ExposureMask =1<<15, + VisibilityChangeMask =1<<16, + StructureNotifyMask =1<<17, + ResizeRedirectMask =1<<18, + SubstructureNotifyMask =1<<19, + SubstructureRedirectMask=1<<20, + FocusChangeMask =1<<21, + PropertyChangeMask =1<<22, + ColormapChangeMask =1<<23, + OwnerGrabButtonMask =1<<24 +}; + +/* Event names. Used in "type" field in XEvent structures. Not to be +confused with event masks above. They start from 2 because 0 and 1 +are reserved in the protocol for errors and replies. */ + +enum:int +{ + KeyPress = 2, + KeyRelease = 3, + ButtonPress = 4, + ButtonRelease = 5, + MotionNotify = 6, + EnterNotify = 7, + LeaveNotify = 8, + FocusIn = 9, + FocusOut = 10, + KeymapNotify = 11, + Expose = 12, + GraphicsExpose = 13, + NoExpose = 14, + VisibilityNotify = 15, + CreateNotify = 16, + DestroyNotify = 17, + UnmapNotify = 18, + MapNotify = 19, + MapRequest = 20, + ReparentNotify = 21, + ConfigureNotify = 22, + ConfigureRequest = 23, + GravityNotify = 24, + ResizeRequest = 25, + CirculateNotify = 26, + CirculateRequest = 27, + PropertyNotify = 28, + SelectionClear = 29, + SelectionRequest = 30, + SelectionNotify = 31, + ColormapNotify = 32, + ClientMessage = 33, + MappingNotify = 34, + LASTEvent = 35 /* must be bigger than any event # */ +}; + +/* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer, + state in various key-, mouse-, and button-related events. */ +enum KeyMask:uint +{ + ShiftMask =1<<0, + LockMask =1<<1, + ControlMask =1<<2, + Mod1Mask =1<<3, + Mod2Mask =1<<4, + Mod3Mask =1<<5, + Mod4Mask =1<<6, + Mod5Mask =1<<7, + AnyModifier =1<<15/* used in GrabButton, GrabKey */ +}; + +/* modifier names. Used to build a SetModifierMapping request or + to read a GetModifierMapping request. These correspond to the + masks defined above. */ +enum ModifierName:int +{ + ShiftMapIndex =0, + LockMapIndex =1, + ControlMapIndex =2, + Mod1MapIndex =3, + Mod2MapIndex =4, + Mod3MapIndex =5, + Mod4MapIndex =6, + Mod5MapIndex =7 +}; + +enum ButtonMask:int +{ + Button1Mask =1<<8, + Button2Mask =1<<9, + Button3Mask =1<<10, + Button4Mask =1<<11, + Button5Mask =1<<12, + AnyModifier =1<<15/* used in GrabButton, GrabKey */ +}; + +enum KeyOrButtonMask:uint +{ + ShiftMask =1<<0, + LockMask =1<<1, + ControlMask =1<<2, + Mod1Mask =1<<3, + Mod2Mask =1<<4, + Mod3Mask =1<<5, + Mod4Mask =1<<6, + Mod5Mask =1<<7, + Button1Mask =1<<8, + Button2Mask =1<<9, + Button3Mask =1<<10, + Button4Mask =1<<11, + Button5Mask =1<<12, + AnyModifier =1<<15/* used in GrabButton, GrabKey */ +}; + + +/* button names. Used as arguments to GrabButton and as detail in ButtonPress + and ButtonRelease events. Not to be confused with button masks above. + Note that 0 is already defined above as "AnyButton". */ + +enum ButtonName:int +{ + Button1 =1, + Button2 =2, + Button3 =3, + Button4 =4, + Button5 =5 +}; + +/* Notify modes */ +enum NotifyModes:int +{ + NotifyNormal =0, + NotifyGrab =1, + NotifyUngrab =2, + NotifyWhileGrabbed =3 +}; +const int NotifyHint =1; /* for MotionNotify events */ + +/* Notify detail */ +enum NotifyDetail:int +{ + NotifyAncestor =0, + NotifyVirtual =1, + NotifyInferior =2, + NotifyNonlinear =3, + NotifyNonlinearVirtual =4, + NotifyPointer =5, + NotifyPointerRoot =6, + NotifyDetailNone =7 +}; + +/* Visibility notify */ + +enum:int +{ + VisibilityUnobscured = 0, + VisibilityPartiallyObscured = 1, + VisibilityFullyObscured = 2 +}; + +/* Circulation request */ +enum CirculationRequest:int +{ + PlaceOnTop =0, + PlaceOnBottom =1 +}; +/* protocol families */ +enum ProtocolFamlily:int +{ + FamilyInternet =0, /* IPv4 */ + FamilyDECnet =1, + FamilyChaos =2, + FamilyServerInterpreted =5, /* authentication families not tied to a specific protocol */ + FamilyInternet6 =6 /* IPv6 */ +}; + +/* Property notification */ + +enum PropertyNotification:int +{ + PropertyNewValue =0, + PropertyDelete =1 +}; + +/* Color Map notification */ +enum ColorMapNotification:int +{ + ColormapUninstalled =0, + ColormapInstalled =1 +}; + +/* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */ +enum GrabMode:int +{ + GrabModeSync =0, + GrabModeAsync =1 +}; + +/* GrabPointer, GrabKeyboard reply status */ +enum GrabReplyStatus:int +{ +GrabSuccess =0, +AlreadyGrabbed =1, +GrabInvalidTime =2, +GrabNotViewable =3, +GrabFrozen =4 +}; + +/* AllowEvents modes */ + +enum AllowEventMode:int +{ +AsyncPointer =0, +SyncPointer =1, +ReplayPointer =2, +AsyncKeyboard =3, +SyncKeyboard =4, +ReplayKeyboard =5, +AsyncBoth =6, +SyncBoth =7 +}; + +/* Used in SetInputFocus, GetInputFocus */ +enum InputFocusRevertTo:int +{ +RevertToNone =None, +RevertToPointerRoot =PointerRoot, +RevertToParent =2 +}; + +/***************************************************************** + * ERROR CODES + *****************************************************************/ + +enum XErrorCode:int +{ + Success =0, /* everything's okay */ + BadRequest =1, /* bad request code */ + BadValue =2, /* int parameter out of range */ + BadWindow =3, /* parameter not a Window */ + BadPixmap =4, /* parameter not a Pixmap */ + BadAtom =5, /* parameter not an Atom */ + BadCursor =6, /* parameter not a Cursor */ + BadFont =7, /* parameter not a Font */ + BadMatch =8, /* parameter mismatch */ + BadDrawable =9, /* parameter not a Pixmap or Window */ + BadAccess =10, /* depending on context: + - key/button already grabbed + - attempt to free an illegal + cmap entry + - attempt to store into a read-only + color map entry. + - attempt to modify the access control + list from other than the local host. + */ + BadAlloc =11, /* insufficient resources */ + BadColor =12, /* no such colormap */ + BadGC =13, /* parameter not a GC */ + BadIDChoice =14, /* choice not in range or already used */ + BadName =15, /* font or color name doesn't exist */ + BadLength =16, /* Request length incorrect */ + BadImplementation =17, /* server is defective */ + + FirstExtensionError =128, + LastExtensionError =255 +}; + +/***************************************************************** + * WINDOW DEFINITIONS + *****************************************************************/ + +/* Window classes used by CreateWindow */ +/* Note that CopyFromParent is already defined as 0 above */ +enum:uint +{ + InputOutput = 1, + InputOnly = 2 +}; + +/* Window attributes for CreateWindow and ChangeWindowAttributes */ + +enum:uint +{ + CWBackPixmap =1<<0, + CWBackPixel =1<<1, + CWBorderPixmap =1<<2, + CWBorderPixel =1<<3, + CWBitGravity =1<<4, + CWWinGravity =1<<5, + CWBackingStore =1<<6, + CWBackingPlanes =1<<7, + CWBackingPixel =1<<8, + CWOverrideRedirect =1<<9, + CWSaveUnder =1<<10, + CWEventMask =1<<11, + CWDontPropagate =1<<12, + CWColormap =1<<13, + CWCursor =1<<14 +}; +/* ConfigureWindow structure */ +enum:int +{ + CWX =1<<0, + CWY =1<<1, + CWWidth =1<<2, + CWHeight =1<<3, + CWBorderWidth =1<<4, + CWSibling =1<<5, + CWStackMode =1<<6 +}; + +/* Bit Gravity */ +enum BitGravity:int +{ + ForgetGravity =0, + NorthWestGravity =1, + NorthGravity =2, + NorthEastGravity =3, + WestGravity =4, + CenterGravity =5, + EastGravity =6, + SouthWestGravity =7, + SouthGravity =8, + SouthEastGravity =9, + StaticGravity =10 +}; + +/* Window gravity + bit gravity above */ + +const uint UnmapGravity=0; + +/* Used in CreateWindow for backing-store hint */ +enum BackingStoreHint:int +{ + NotUseful =0, + WhenMapped =1, + Always =2 +}; +/* Used in GetWindowAttributes reply */ +enum MapState:int +{ + IsUnmapped =0, + IsUnviewable =1, + IsViewable =2 +}; +/* Used in ChangeSaveSet */ +enum ChangeMode:int +{ + SetModeInsert =0, + SetModeDelete =1 +}; +/* Used in ChangeCloseDownMode */ +enum CloseDownMode:int +{ + DestroyAll =0, + RetainPermanent =1, + RetainTemporary =2 +}; + +/* Window stacking method (in configureWindow) */ +enum WindowStackingMethod:int +{ + Above =0, + Below =1, + TopIf =2, + BottomIf =3, + Opposite =4 +}; + +/* Circulation direction */ +enum CircularDirection:int +{ +RaiseLowest =0, +LowerHighest =1 +}; + +/* Property modes */ +enum:int +{ +PropModeReplace =0, +PropModePrepend =1, +PropModeAppend =2 +}; + +/***************************************************************** + * GRAPHICS DEFINITIONS + *****************************************************************/ + +/* graphics functions, as in GC.alu */ +enum GraphicFunction:int +{ + GXclear =0x0, /* 0 */ + GXand =0x1, /* src AND dst */ + GXandReverse =0x2, /* src AND NOT dst */ + GXcopy =0x3, /* src */ + GXandInverted =0x4, /* NOT src AND dst */ + GXnoop =0x5, /* dst */ + GXxor =0x6, /* src XOR dst */ + GXor =0x7, /* src OR dst */ + GXnor =0x8, /* NOT src AND NOT dst */ + GXequiv =0x9, /* NOT src XOR dst */ + GXinvert =0xa, /* NOT dst */ + GXorReverse =0xb, /* src OR NOT dst */ + GXcopyInverted =0xc, /* NOT src */ + GXorInverted =0xd, /* NOT src OR dst */ + GXnand =0xe, /* NOT src OR NOT dst */ + GXset =0xf /* 1 */ +}; + +/* LineStyle */ +enum LineStyle:int +{ + LineSolid =0, + LineOnOffDash =1, + LineDoubleDash =2 +}; +/* capStyle */ +enum CapStyle:int +{ + CapNotLast =0, + CapButt =1, + CapRound =2, + CapProjecting =3 +}; +/* joinStyle */ +enum JoinStyle:int +{ + JoinMiter =0, + JoinRound =1, + JoinBevel =2 +}; +/* fillStyle */ +enum FillStyle:int +{ + FillSolid =0, + FillTiled =1, + FillStippled =2, + FillOpaqueStippled =3 +}; +/* fillRule */ +enum FillRule:int +{ + EvenOddRule =0, + WindingRule =1 +}; +/* subwindow mode */ +enum SubwindowMode:int +{ + ClipByChildren =0, + IncludeInferiors =1 +}; +/* SetClipRectangles ordering */ +enum ClipRectanglesOrdering:int +{ + Unsorted =0, + YSorted =1, + YXSorted =2, + YXBanded =3 +}; +/* CoordinateMode for drawing routines */ +enum CoordinateMode:int +{ + CoordModeOrigin =0, /* relative to the origin */ + CoordModePrevious =1 /* relative to previous point */ +}; +/* Polygon shapes */ +enum PolygonShape:int +{ + Complex =0, /* paths may intersect */ + Nonconvex =1, /* no paths intersect, but not convex */ + Convex =2 /* wholly convex */ +}; + +/* Arc modes for PolyFillArc */ +enum ArcMode:int +{ + ArcChord =0, /* join endpoints of arc */ + ArcPieSlice =1 /* join endpoints to center of arc */ +}; +/* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into + GC.stateChanges */ +enum GCMask:uint +{ + GCFunction =1<<0, + GCPlaneMask =1<<1, + GCForeground =1<<2, + GCBackground =1<<3, + GCLineWidth =1<<4, + GCLineStyle =1<<5, + GCCapStyle =1<<6, + GCJoinStyle =1<<7, + GCFillStyle =1<<8, + GCFillRule =1<<9, + GCTile =1<<10, + GCStipple =1<<11, + GCTileStipXOrigin =1<<12, + GCTileStipYOrigin =1<<13, + GCFont =1<<14, + GCSubwindowMode =1<<15, + GCGraphicsExposures =1<<16, + GCClipXOrigin =1<<17, + GCClipYOrigin =1<<18, + GCClipMask =1<<19, + GCDashOffset =1<<20, + GCDashList =1<<21, + GCArcMode =1<<22, +}; +const uint GCLastBit=22; +/***************************************************************** + * FONTS + *****************************************************************/ + +/* used in QueryFont -- draw direction */ +enum FontDrawDirection:int +{ + FontLeftToRight =0, + FontRightToLeft =1, + FontChange =255 +} +/***************************************************************** + * IMAGING + *****************************************************************/ + +/* ImageFormat -- PutImage, GetImage */ +enum ImageFormat:int +{ + XYBitmap =0, /* depth 1, XYFormat */ + XYPixmap =1, /* depth == drawable depth */ + ZPixmap =2 /* depth == drawable depth */ +}; + +/***************************************************************** + * COLOR MAP STUFF + *****************************************************************/ + +/* For CreateColormap */ +enum:int +{ + AllocNone = 0, /* create map with no entries */ + AllocAll = 1 /* allocate entire map writeable */ +}; + +/* Flags used in StoreNamedColor, StoreColors */ +enum StoreColor:int +{ + DoRed =1<<0, + DoGreen =1<<1, + DoBlue =1<<2 +}; + +/***************************************************************** + * CURSOR STUFF + *****************************************************************/ + +/* QueryBestSize Class */ +enum QueryBestSizeClass:int +{ + CursorShape =0, /* largest size that can be displayed */ + TileShape =1, /* size tiled fastest */ + StippleShape =2 /* size stippled fastest */ +}; + +/***************************************************************** + * KEYBOARD/POINTER STUFF + *****************************************************************/ + +enum AutoRepeatMode:int +{ + AutoRepeatModeOff =0, + AutoRepeatModeOn =1, + AutoRepeatModeDefault =2 +}; + +enum LedMode:int +{ + LedModeOff =0, + LedModeOn =1 +}; +/* masks for ChangeKeyboardControl */ + +enum KBMask:uint +{ + KBKeyClickPercent =1<<0, + KBBellPercent =1<<1, + KBBellPitch =1<<2, + KBBellDuration =1<<3, + KBLed =1<<4, + KBLedMode =1<<5, + KBKey =1<<6, + KBAutoRepeatMode =1<<7 +}; + +enum MappingErrorCode:int +{ + MappingSuccess =0, + MappingBusy =1, + MappingFailed =2 +}; + +enum MappingType:int +{ + MappingModifier =0, + MappingKeyboard =1, + MappingPointer =2 +}; + +/***************************************************************** + * SCREEN SAVER STUFF + *****************************************************************/ + +enum ScreenSaverBlancking:int +{ + DontPreferBlanking =0, + PreferBlanking =1, + DefaultBlanking =2 +}; + +enum ScreenSaverDisable:int +{ + DisableScreenSaver =0, + DisableScreenInterval =0 +}; + +enum ScreenSaverExposure:int +{ + DontAllowExposures =0, + AllowExposures =1, + DefaultExposures =2 +}; + +/* for ForceScreenSaver */ + +enum ScreenSaverMode:int +{ + ScreenSaverReset =0, + ScreenSaverActive =1 +}; + +/***************************************************************** + * HOSTS AND CONNECTIONS + *****************************************************************/ + +/* for ChangeHosts */ + +enum HostChange:int +{ + HostInsert =0, + HostDelete =1 +}; + +/* for ChangeAccessControl */ + +enum HostAccess:int +{ + EnableAccess =1, + DisableAccess =0 +}; + +/* Display classes used in opening the connection + * Note that the statically allocated ones are even numbered and the + * dynamically changeable ones are odd numbered */ + +enum DisplayClass:int +{ + StaticGray =0, + GrayScale =1, + StaticColor =2, + PseudoColor =3, + TrueColor =4, + DirectColor =5 +}; + +/* Byte order used in imageByteOrder and bitmapBitOrder */ + +enum ByteOrder:int +{ + LSBFirst =0, + MSBFirst =1 +}; diff --git a/3rdparty/X11/X11/Xatom.d b/3rdparty/X11/X11/Xatom.d new file mode 100644 index 00000000..e246fe70 --- /dev/null +++ b/3rdparty/X11/X11/Xatom.d @@ -0,0 +1,80 @@ +/* Xlib binding for D language + Copyright 2010 Adam Cigánek + + This file is free software, please read COPYING file for more informations +*/ + +module X11.Xatom; + +import X11.X; + +immutable Atom XA_PRIMARY = 1; +immutable Atom XA_SECONDARY = 2; +immutable Atom XA_ARC = 3; +immutable Atom XA_ATOM = 4; +immutable Atom XA_BITMAP = 5; +immutable Atom XA_CARDINAL = 6; +immutable Atom XA_COLORMAP = 7; +immutable Atom XA_CURSOR = 8; +immutable Atom XA_CUT_BUFFER0 = 9; +immutable Atom XA_CUT_BUFFER1 = 10; +immutable Atom XA_CUT_BUFFER2 = 11; +immutable Atom XA_CUT_BUFFER3 = 12; +immutable Atom XA_CUT_BUFFER4 = 13; +immutable Atom XA_CUT_BUFFER5 = 14; +immutable Atom XA_CUT_BUFFER6 = 15; +immutable Atom XA_CUT_BUFFER7 = 16; +immutable Atom XA_DRAWABLE = 17; +immutable Atom XA_FONT = 18; +immutable Atom XA_INTEGER = 19; +immutable Atom XA_PIXMAP = 20; +immutable Atom XA_POINT = 21; +immutable Atom XA_RECTANGLE = 22; +immutable Atom XA_RESOURCE_MANAGER = 23; +immutable Atom XA_RGB_COLOR_MAP = 24; +immutable Atom XA_RGB_BEST_MAP = 25; +immutable Atom XA_RGB_BLUE_MAP = 26; +immutable Atom XA_RGB_DEFAULT_MAP = 27; +immutable Atom XA_RGB_GRAY_MAP = 28; +immutable Atom XA_RGB_GREEN_MAP = 29; +immutable Atom XA_RGB_RED_MAP = 30; +immutable Atom XA_STRING = 31; +immutable Atom XA_VISUALID = 32; +immutable Atom XA_WINDOW = 33; +immutable Atom XA_WM_COMMAND = 34; +immutable Atom XA_WM_HINTS = 35; +immutable Atom XA_WM_CLIENT_MACHINE = 36; +immutable Atom XA_WM_ICON_NAME = 37; +immutable Atom XA_WM_ICON_SIZE = 38; +immutable Atom XA_WM_NAME = 39; +immutable Atom XA_WM_NORMAL_HINTS = 40; +immutable Atom XA_WM_SIZE_HINTS = 41; +immutable Atom XA_WM_ZOOM_HINTS = 42; +immutable Atom XA_MIN_SPACE = 43; +immutable Atom XA_NORM_SPACE = 44; +immutable Atom XA_MAX_SPACE = 45; +immutable Atom XA_END_SPACE = 46; +immutable Atom XA_SUPERSCRIPT_X = 47; +immutable Atom XA_SUPERSCRIPT_Y = 48; +immutable Atom XA_SUBSCRIPT_X = 49; +immutable Atom XA_SUBSCRIPT_Y = 50; +immutable Atom XA_UNDERLINE_POSITION = 51; +immutable Atom XA_UNDERLINE_THICKNESS = 52; +immutable Atom XA_STRIKEOUT_ASCENT = 53; +immutable Atom XA_STRIKEOUT_DESCENT = 54; +immutable Atom XA_ITALIC_ANGLE = 55; +immutable Atom XA_X_HEIGHT = 56; +immutable Atom XA_QUAD_WIDTH = 57; +immutable Atom XA_WEIGHT = 58; +immutable Atom XA_POINT_SIZE = 59; +immutable Atom XA_RESOLUTION = 60; +immutable Atom XA_COPYRIGHT = 61; +immutable Atom XA_NOTICE = 62; +immutable Atom XA_FONT_NAME = 63; +immutable Atom XA_FAMILY_NAME = 64; +immutable Atom XA_FULL_NAME = 65; +immutable Atom XA_CAP_HEIGHT = 66; +immutable Atom XA_WM_CLASS = 67; +immutable Atom XA_WM_TRANSIENT_FOR = 68; + +immutable Atom XA_LAST_PREDEFINED = 68; diff --git a/3rdparty/X11/X11/Xlib.d b/3rdparty/X11/X11/Xlib.d new file mode 100644 index 00000000..548ebae6 --- /dev/null +++ b/3rdparty/X11/X11/Xlib.d @@ -0,0 +1,3929 @@ +/* Xlib binding for D language + Copyright 2007 TEISSIER Sylvere sligor(at)free.fr + version 0.1 2007/08/29 + This binding is an alpha release and need to be more tested + + This file is free software, please read COPYING file for more informations +*/ + +/* This file is binding from: + $XdotOrg: lib/X11/include/X11/Xlib.h,v 1.6 2005-11-08 06:33:25 jkj Exp $ + $Xorg: Xlib.h,v 1.6 2001/02/09 02:03:38 xorgcvs Exp $ +*/ + +module X11.Xlib; + +public import X11.X; + + +const int XlibSpecificationRelease=6; +version = X_HAVE_UTF8_STRING; + +alias void* XPointer; +alias int Status ; +alias int Bool; +enum:Bool {False, True}; //xlib boolean is int type, D bool is only byte +enum QueueMode {QueuedAlready, QueuedAfterReading, QueuedAfterFlush}; + +/+ +TODO Nested struc or union verify ++/ + +int ConnectionNumber()(Displayz *dpy) {return dpy.fd;} +Window RootWindow()(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).root;} +int DefaultScreen()(Display *dpy) {return dpy.default_screen;} +Window DefaultRootWindow()(Display *dpy) {return ScreenOfDisplay(dpy,DefaultScreen(dpy)).root;} +Visual* DefaultVisual()(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).root_visual;} +GC DefaultGC()(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).default_gc;} +uint BlackPixel()(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).black_pixel;} +uint WhitePixel()(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).white_pixel;} +uint AllPlanes()() {return 0xFFFFFFFF;} +int QLength()(Display *dpy) {return dpy.qlen;} +int DisplayWidth()(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).width;} +int DisplayHeight()(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).height;} +int DisplayWidthMM()(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).mwidth;} +int DisplayHeightMM()(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).mheight;} +int DisplayPlanes()(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).root_depth;} +int DisplayCells()(Display *dpy,int scr) {return DefaultVisual(dpy,scr).map_entries;} +int ScreenCount()(Display *dpy) {return dpy.nscreens;} +char* ServerVendor()(Display *dpy) {return dpy.vendor;} +int ProtocolVersion()(Display *dpy) {return dpy.proto_major_version;} +int ProtocolRevision()(Display *dpy) {return dpy.proto_minor_version;} +int VendorRelease()(Display *dpy) {return dpy.release;} +char* DisplayString()(Display *dpy) {return dpy.display_name;} +int DefaultDepth()(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).root_depth;} +Colormap DefaultColormap()(Display *dpy,int scr) {return ScreenOfDisplay(dpy,scr).cmap;} +int BitmapUnit()(Display *dpy) {return dpy.bitmap_unit;} +int BitmapBitOrder()(Display *dpy) {return dpy.bitmap_bit_order;} +int BitmapPad()(Display *dpy) {return dpy.bitmap_pad;} +int ImageByteOrder()(Display *dpy) {return dpy.byte_order;} +uint NextRequest()(Display *dpy) {return dpy.request + 1;} +uint LastKnownRequestProcessed()(Display *dpy) {return dpy.last_request_read;} + +/* macros for screen oriented applications (toolkit) */ +Screen* ScreenOfDisplay()(Display *dpy,int scr) {return &dpy.screens[scr];} +Screen* DefaultScreenOfDisplay()(Display *dpy) {return ScreenOfDisplay(dpy,DefaultScreen(dpy));} +Display* DisplayOfScreen()(Screen s) {return s.display;} +Window RootWindowOfScreen()(Screen s) {return s.root;} +uint BlackPixelOfScreen()(Screen s) {return s.black_pixel;} +uint WhitePixelOfScreen()(Screen s) {return s.white_pixel;} +Colormap DefaultColormapOfScreen()(Screen s) {return s.cmap;} +int DefaultDepthOfScreen()(Screen s) {return s.root_depth;} +GC DefaultGCOfScreen()(Screen s) {return s.default_gc;} +Visual* DefaultVisualOfScreen()(Screen s) {return s.root_visual;} +int WidthOfScreen()(Screen s) {return s.width;} +int HeightOfScreen()(Screen s) {return s.height;} +int WidthMMOfScreen()(Screen s) {return s.mwidth;} +int HeightMMOfScreen()(Screen s) {return s.mheight;} +int PlanesOfScreen()(Screen s) {return s.root_depth;} +int CellsOfScreen()(Screen s) {return DefaultVisualOfScreen(s).map_entries;} +int MinCmapsOfScreen()(Screen s) {return s.min_maps;} +int MaxCmapsOfScreen()(Screen s) {return s.max_maps;} +Bool DoesSaveUnders()(Screen s) {return s.save_unders;} +int DoesBackingStore()(Screen s) {return s.backing_store;} +uint EventMaskOfScreen()(Screen s) {return s.root_input_mask;} + + + +/* + * Extensions need a way to hang private data on some structures. + */ +struct XExtData +{ + int number; /* number returned by XRegisterExtension */ + XExtData *next; /* next item on list of data for structure */ + int function(XExtData *extension) free_private; /* called to free private storage */ + XPointer private_data; /* data private to this extension. */ +}; + +/* + * This file contains structures used by the extension mechanism. + */ +struct XExtCodes +{ /* public to extension, cannot be changed */ + int extension; /* extension number */ + int major_opcode; /* major op-code assigned by server */ + int first_event; /* first event number for the extension */ + int first_error; /* first error number for the extension */ +}; + +/* + * Data structure for retrieving info about pixmap formats. + */ + +struct XPixmapFormatValues +{ + int depth; + int bits_per_pixel; + int scanline_pad; +}; + +struct XGCValues +{ + GraphicFunction function_; /* logical operation*/ + uint plane_mask; /* plane mask */ + uint foreground; /* foreground pixel */ + uint background; /* background pixel */ + int line_width; /* line width */ + LineStyle line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */ + CapStyle cap_style; /* CapNotLast, CapButt, CapRound, CapProjecting */ + LineStyle join_style; /* JoinMiter, JoinRound, JoinBevel */ + FillStyle fill_style; /* FillSolid, FillTiled,FillStippled, FillOpaeueStippled */ + FillRule fill_rule; /* EvenOddRule, WindingRule */ + ArcMode arc_mode; /* ArcChord, ArcPieSlice */ + Pixmap tile; /* tile pixmap for tiling operations */ + Pixmap stipple; /* stipple 1 plane pixmap for stipping */ + int ts_x_origin; /* offset for tile or stipple operations */ + int ts_y_origin; + Font font; /* default text font for text operations */ + SubwindowMode subwindow_mode; /* ClipByChildren, IncludeInferiors */ + Bool graphics_exposures; /* Boolean, should exposures be generated */ + int clip_x_origin; /* origin for clipping */ + int clip_y_origin; + Pixmap clip_mask; /* bitmap clipping; other calls for rects */ + int dash_offset; /* patterned/dashed line information */ + byte dashes; +}; + +alias void* GC; + +/* + * Visual structure; contains information about colormapping possible. + */ +struct Visual +{ + XExtData *ext_data; /* hook for extension to hang data */ + VisualID visualid; /* visual id of this visual */ + int class_; /* class of screen (monochrome, etc.) */ + uint red_mask, green_mask, blue_mask; /* mask values */ + int bits_per_rgb; /* log base 2 of distinct color values */ + int map_entries; /* color map entries */ +} ; + +/* + * Depth structure; contains information for each possible depth. + */ +struct Depth +{ + int depth; /* this depth (Z) of the depth */ + int nvisuals; /* number of Visual types at this depth */ + Visual *visuals; /* list of visuals possible at this depth */ +}; + +alias Display XDisplay; + +struct Screen{ + XExtData *ext_data; /* hook for extension to hang data */ + XDisplay *display; /* back pointer to display structure */ + Window root; /* Root window id. */ + int width, height; /* width and height of screen */ + int mwidth, mheight; /* width and height of in millimeters */ + int ndepths; /* number of depths possible */ + Depth *depths; /* list of allowable depths on the screen */ + int root_depth; /* bits per pixel */ + Visual *root_visual; /* root visual */ + GC default_gc; /* GC for the root root visual */ + Colormap cmap; /* default color map */ + uint white_pixel; + uint black_pixel; /* White and Black pixel values */ + int max_maps, min_maps; /* max and min color maps */ + int backing_store; /* Never, WhenMapped, Always */ + Bool save_unders; + int root_input_mask; /* initial root input mask */ +}; + +/* + * Format structure; describes ZFormat data the screen will understand. + */ +struct ScreenFormat +{ + XExtData *ext_data; /* hook for extension to hang data */ + int depth; /* depth of this image format */ + int bits_per_pixel; /* bits/pixel at this depth */ + int scanline_pad; /* scanline must padded to this multiple */ +}; + +/* + * Data structure for setting window attributes. + */ +struct XSetWindowAttributes +{ + Pixmap background_pixmap; /* background or None or ParentRelative */ + uint background_pixel; /* background pixel */ + Pixmap border_pixmap; /* border of the window */ + uint border_pixel; /* border pixel value */ + BitGravity bit_gravity; /* one of bit gravity values */ + BitGravity win_gravity; /* one of the window gravity values */ + BackingStoreHint backing_store; /* NotUseful, WhenMapped, Always */ + uint backing_planes; /* planes to be preseved if possible */ + uint backing_pixel; /* value to use in restoring planes */ + Bool save_under; /* should bits under be saved? (popups) */ + int event_mask; /* set of events that should be saved */ + int do_not_propagate_mask;/* set of events that should not propagate */ + Bool override_redirect; /* Boolean value for override-redirect */ + Colormap colormap; /* color map to be associated with window */ + Cursor cursor; /* cursor to be displayed (or None) */ +}; + +struct XWindowAttributes +{ + int x, y; /* location of window */ + int width, height; /* width and height of window */ + int border_width; /* border width of window */ + int depth; /* depth of window */ + Visual *visual; /* the associated visual structure */ + Window root; /* root of screen containing window */ + uint class_; /* InputOutput, InputOnly*/ + BitGravity bit_gravity; /* one of bit gravity values */ + BitGravity win_gravity; /* one of the window gravity values */ + BackingStoreHint backing_store; /* NotUseful, WhenMapped, Always */ + uint backing_planes; /* planes to be preserved if possible */ + uint backing_pixel; /* value to be used when restoring planes */ + Bool save_under; /* Boolean, should bits under be saved? */ + Colormap colormap; /* color map to be associated with window */ + Bool map_installed; /* Boolean, is color map currently installed*/ + MapState map_state; /* IsUnmapped, IsUnviewable, IsViewable */ + int all_event_masks; /* set of events all people have interest in*/ + int your_event_mask; /* my event mask */ + int do_not_propagate_mask; /* set of events that should not propagate */ + Bool override_redirect; /* Boolean value for override-redirect */ + Screen *screen; /* back pointer to correct screen */ +}; + +/* + * Data structure for host setting; getting routines. + * + */ + +struct XHostAddress +{ + ProtocolFamlily family; /* for example FamilyInternet */ + int length; /* length of address, in bytes */ + void *address; /* pointer to where to find the bytes */ +}; + +/* + * Data structure for ServerFamilyInterpreted addresses in host routines + */ +struct XServerInterpretedAddress +{ + int typelength; /* length of type string, in bytes */ + int valuelength; /* length of value string, in bytes */ + void *type; /* pointer to where to find the type string */ + void *value; /* pointer to where to find the address */ +}; + +/* + * Data structure for "image" data, used by image manipulation routines. + */ +struct XImage +{ + int width, height; /* size of image */ + int xoffset; /* number of pixels offset in X direction */ + ImageFormat format; /* XYBitmap, XYPixmap, ZPixmap */ + void *data; /* pointer to image data */ + ByteOrder byte_order; /* data byte order, LSBFirst, MSBFirst */ + int bitmap_unit; /* quant. of scanline 8, 16, 32 */ + int bitmap_bit_order; /* LSBFirst, MSBFirst */ + int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */ + int depth; /* depth of image */ + int bytes_per_line; /* accelarator to next line */ + int bits_per_pixel; /* bits per pixel (ZPixmap) */ + uint red_mask; /* bits in z arrangment */ + uint green_mask; + uint blue_mask; + XPointer obdata; /* hook for the object routines to hang on */ + struct f { /* image manipulation routines */ + XImage* function( + XDisplay* /* display */, + Visual* /* visual */, + uint /* depth */, + int /* format */, + int /* offset */, + byte* /* data */, + uint /* width */, + uint /* height */, + int /* bitmap_pad */, + int /* bytes_per_line */) create_image; + int function(XImage *)destroy_image; + uint function(XImage *, int, int)get_pixel; + int function(XImage *, int, int, uint)put_pixel; + XImage function(XImage *, int, int, uint, uint)sub_image; + int function(XImage *, int)add_pixel; + }; +}; + +/* + * Data structure for XReconfigureWindow + */ +struct XWindowChanges{ + int x, y; + int width, height; + int border_width; + Window sibling; + WindowStackingMethod stack_mode; +}; + +/* + * Data structure used by color operations + */ +struct XColor +{ + uint pixel; + ushort red, green, blue; + StoreColor flags; /* do_red, do_green, do_blue */ + byte pad; +}; + +/* + * Data structures for graphics operations. On most machines, these are + * congruent with the wire protocol structures, so reformatting the data + * can be avoided on these architectures. + */ +struct XSegment +{ + short x1, y1, x2, y2; +}; + +struct XPoint +{ + short x, y; +}; + +struct XRectangle +{ + short x, y; + ushort width, height; +}; + +struct XArc +{ + short x, y; + ushort width, height; + short angle1, angle2; +}; + + +/* Data structure for XChangeKeyboardControl */ + +struct XKeyboardControl +{ + int key_click_percent; + int bell_percent; + int bell_pitch; + int bell_duration; + int led; + LedMode led_mode; + int key; + AutoRepeatMode auto_repeat_mode; /* On, Off, Default */ +}; + +/* Data structure for XGetKeyboardControl */ + +struct XKeyboardState +{ + int key_click_percent; + int bell_percent; + uint bell_pitch, bell_duration; + uint led_mask; + int global_auto_repeat; + byte auto_repeats[32]; +}; + +struct XTimeCoord +{ + Time time; + short x, y; +}; + +/* Data structure for X{Set,Get}ModifierMapping */ + +struct XModifierKeymap +{ + int max_keypermod; /* The server's max # of keys per modifier */ + KeyCode *modifiermap; /* An 8 by max_keypermod array of modifiers */ +}; + + +/+ todo Verify Here+/ +/* + * Display datatype maintaining display specific data. + * The contents of this structure are implementation dependent. + * A Display should be treated as opaque by application code. + */ + +struct _XPrivate{} /* Forward declare before use for C++ */ +struct _XrmHashBucketRec{} + +struct Display +{ + XExtData *ext_data; /* hook for extension to hang data */ + _XPrivate *private1; + int fd; /* Network socket. */ + int private2; + int proto_major_version;/* major version of server's X protocol */ + int proto_minor_version;/* minor version of servers X protocol */ + char *vendor; /* vendor of the server hardware */ + XID private3; + XID private4; + XID private5; + int private6; + XID function(Display*)resource_alloc;/* allocator function */ + ByteOrder byte_order; /* screen byte order, LSBFirst, MSBFirst */ + int bitmap_unit; /* padding and data requirements */ + int bitmap_pad; /* padding requirements on bitmaps */ + ByteOrder bitmap_bit_order; /* LeastSignificant or MostSignificant */ + int nformats; /* number of pixmap formats in list */ + ScreenFormat *pixmap_format; /* pixmap format list */ + int private8; + int release; /* release of the server */ + _XPrivate *private9; + _XPrivate *private10; + int qlen; /* Length of input event queue */ + uint last_request_read; /* seq number of last event read */ + uint request; /* sequence number of last request. */ + XPointer private11; + XPointer private12; + XPointer private13; + XPointer private14; + uint max_request_size; /* maximum number 32 bit words in request*/ + _XrmHashBucketRec *db; + int function (Display*)private15; + char *display_name; /* "host:display" string used on this connect*/ + int default_screen; /* default screen for operations */ + int nscreens; /* number of screens on this server*/ + Screen *screens; /* pointer to list of screens */ + uint motion_buffer; /* size of motion buffer */ + uint private16; + int min_keycode; /* minimum defined keycode */ + int max_keycode; /* maximum defined keycode */ + XPointer private17; + XPointer private18; + int private19; + byte *xdefaults; /* contents of defaults from server */ + /* there is more to this structure, but it is private to Xlib */ +} + +alias Display *_XPrivDisplay; +struct XrmHashBucketRec{}; + + +/* + * Definitions of specific events. + */ +struct XKeyEvent +{ + int type; /* of event */ + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* "event" window it is reported relative to */ + Window root; /* root window that the event occurred on */ + Window subwindow; /* child window */ + Time time; /* milliseconds */ + int x, y; /* pointer x, y coordinates in event window */ + int x_root, y_root; /* coordinates relative to root */ + KeyOrButtonMask state; /* key or button mask */ + uint keycode; /* detail */ + Bool same_screen; /* same screen flag */ +}; +alias XKeyEvent XKeyPressedEvent; +alias XKeyEvent XKeyReleasedEvent; + +struct XButtonEvent +{ + int type; /* of event */ + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* "event" window it is reported relative to */ + Window root; /* root window that the event occurred on */ + Window subwindow; /* child window */ + Time time; /* milliseconds */ + int x, y; /* pointer x, y coordinates in event window */ + int x_root, y_root; /* coordinates relative to root */ + KeyOrButtonMask state; /* key or button mask */ + uint button; /* detail */ + Bool same_screen; /* same screen flag */ +}; +alias XButtonEvent XButtonPressedEvent; +alias XButtonEvent XButtonReleasedEvent; + +struct XMotionEvent{ + int type; /* of event */ + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* "event" window reported relative to */ + Window root; /* root window that the event occurred on */ + Window subwindow; /* child window */ + Time time; /* milliseconds */ + int x, y; /* pointer x, y coordinates in event window */ + int x_root, y_root; /* coordinates relative to root */ + KeyOrButtonMask state; /* key or button mask */ + byte is_hint; /* detail */ + Bool same_screen; /* same screen flag */ +}; +alias XMotionEvent XPointerMovedEvent; + +struct XCrossingEvent{ + int type; /* of event */ + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* "event" window reported relative to */ + Window root; /* root window that the event occurred on */ + Window subwindow; /* child window */ + Time time; /* milliseconds */ + int x, y; /* pointer x, y coordinates in event window */ + int x_root, y_root; /* coordinates relative to root */ + NotifyModes mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */ + NotifyDetail detail; + /* + * NotifyAncestor, NotifyVirtual, NotifyInferior, + * NotifyNonlinear,NotifyNonlinearVirtual + */ + Bool same_screen; /* same screen flag */ + Bool focus; /* Boolean focus */ + KeyOrButtonMask state; /* key or button mask */ +}; +alias XCrossingEvent XEnterWindowEvent; +alias XCrossingEvent XLeaveWindowEvent; + +struct XFocusChangeEvent{ + int type; /* FocusIn or FocusOut */ + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* window of event */ + NotifyModes mode; /* NotifyNormal, NotifyWhileGrabbed, + NotifyGrab, NotifyUngrab */ + NotifyDetail detail; + /* + * NotifyAncestor, NotifyVirtual, NotifyInferior, + * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer, + * NotifyPointerRoot, NotifyDetailNone + */ +}; +alias XFocusChangeEvent XFocusInEvent; +alias XFocusChangeEvent XFocusOutEvent; + +/* generated on EnterWindow and FocusIn when KeyMapState selected */ +struct XKeymapEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + byte key_vector[32]; +}; + +struct XExposeEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + int x, y; + int width, height; + int count; /* if non-zero, at least this many more */ +}; + +struct XGraphicsExposeEvent{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Drawable drawable; + int x, y; + int width, height; + int count; /* if non-zero, at least this many more */ + int major_code; /* core is CopyArea or CopyPlane */ + int minor_code; /* not defined in the core */ +}; + +struct XNoExposeEvent{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Drawable drawable; + int major_code; /* core is CopyArea or CopyPlane */ + int minor_code; /* not defined in the core */ +}; + +struct XVisibilityEvent{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + int state; /* Visibility state */ +}; + +struct XCreateWindowEvent{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window parent; /* parent of the window */ + Window window; /* window id of window created */ + int x, y; /* window location */ + int width, height; /* size of window */ + int border_width; /* border width */ + Bool override_redirect; /* creation should be overridden */ +}; + +struct XDestroyWindowEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window event; + Window window; +}; + +struct XUnmapEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window event; + Window window; + Bool from_configure; +}; + +struct XMapEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window event; + Window window; + Bool override_redirect; /* Boolean, is override set... */ +}; + +struct XMapRequestEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window parent; + Window window; +}; + +struct XReparentEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window event; + Window window; + Window parent; + int x, y; + Bool override_redirect; +}; + +struct XConfigureEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window event; + Window window; + int x, y; + int width, height; + int border_width; + Window above; + Bool override_redirect; +}; + +struct XGravityEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window event; + Window window; + int x, y; +}; + +struct XResizeRequestEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + int width, height; +}; + +struct XConfigureRequestEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window parent; + Window window; + int x, y; + int width, height; + int border_width; + Window above; + WindowStackingMethod detail; /* Above, Below, TopIf, BottomIf, Opposite */ + uint value_mask; +}; + +struct XCirculateEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window event; + Window window; + CirculationRequest place; /* PlaceOnTop, PlaceOnBottom */ +}; + +struct XCirculateRequestEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window parent; + Window window; + CirculationRequest place; /* PlaceOnTop, PlaceOnBottom */ +}; + +struct XPropertyEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + Atom atom; + Time time; + PropertyNotification state; /* NewValue, Deleted */ +}; + +struct XSelectionClearEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + Atom selection; + Time time; +}; + +struct XSelectionRequestEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window owner; + Window requestor; + Atom selection; + Atom target; + Atom property; + Time time; +}; + +struct XSelectionEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window requestor; + Atom selection; + Atom target; + Atom property; /* ATOM or None */ + Time time; +} ; + +struct XColormapEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + Colormap colormap; /* COLORMAP or None */ + Bool new_; /* C++ */ + ColorMapNotification state; /* ColormapInstalled, ColormapUninstalled */ +}; + +struct XClientMessageEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + Atom message_type; + int format; + + union /* data */ { + byte b[20]; + short s[10]; + int l[5]; + }; +}; + +struct XMappingEvent +{ + int type; + uint serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* unused */ + MappingType request; /* one of MappingModifier, MappingKeyboard, + MappingPointer */ + int first_keycode; /* first keycode */ + int count; /* defines range of change w. first_keycode*/ +}; + +struct XErrorEvent +{ + int type; + Display *display; /* Display the event was read from */ + XID resourceid; /* resource id */ + uint serial; /* serial number of failed request */ + uint error_code; /* error code of failed request */ + ubyte request_code; /* Major op-code of failed request */ + ubyte minor_code; /* Minor op-code of failed request */ +}; + +struct XAnyEvent +{ + int type; + ubyte serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display;/* Display the event was read from */ + Window window; /* window on which event was requested in event mask */ +}; + +/* + * this union is defined so Xlib can always use the same sized + * event structure internally, to avoid memory fragmentation. + */ +union XEvent{ + int type; /* must not be changed; first element */ + XAnyEvent xany; + XKeyEvent xkey; + XButtonEvent xbutton; + XMotionEvent xmotion; + XCrossingEvent xcrossing; + XFocusChangeEvent xfocus; + XExposeEvent xexpose; + XGraphicsExposeEvent xgraphicsexpose; + XNoExposeEvent xnoexpose; + XVisibilityEvent xvisibility; + XCreateWindowEvent xcreatewindow; + XDestroyWindowEvent xdestroywindow; + XUnmapEvent xunmap; + XMapEvent xmap; + XMapRequestEvent xmaprequest; + XReparentEvent xreparent; + XConfigureEvent xconfigure; + XGravityEvent xgravity; + XResizeRequestEvent xresizerequest; + XConfigureRequestEvent xconfigurerequest; + XCirculateEvent xcirculate; + XCirculateRequestEvent xcirculaterequest; + XPropertyEvent xproperty; + XSelectionClearEvent xselectionclear; + XSelectionRequestEvent xselectionrequest; + XSelectionEvent xselection; + XColormapEvent xcolormap; + XClientMessageEvent xclient; + XMappingEvent xmapping; + XErrorEvent xerror; + XKeymapEvent xkeymap; + int pad[24]; +}; + + +uint XAllocID()(Display* dpy) {return dpy.resource_alloc(dpy);} + + +/* + * per character font metric information. + */ +struct XCharStruct +{ + short lbearing; /* origin to left edge of raster */ + short rbearing; /* origin to right edge of raster */ + short width; /* advance to next char's origin */ + short ascent; /* baseline to top edge of raster */ + short descent; /* baseline to bottom edge of raster */ + short attributes; /* per char flags (not predefined) */ +}; + +/* + * To allow arbitrary information with fonts, there are additional properties + * returned. + */ +struct XFontProp +{ + Atom name; + uint card32; +}; + +struct XFontStruct{ + XExtData *ext_data; /* hook for extension to hang data */ + Font fid; /* Font id for this font */ + FontDrawDirection direction; /* hint about direction the font is painted */ + uint min_char_or_byte2; /* first character */ + uint max_char_or_byte2; /* last character */ + uint min_byte1; /* first row that exists */ + uint max_byte1; /* last row that exists */ + Bool all_chars_exist; /* flag if all characters have non-zero size*/ + uint default_char; /* char to print for undefined character */ + int n_properties; /* how many properties there are */ + XFontProp *properties; /* pointer to array of additional properties*/ + XCharStruct min_bounds; /* minimum bounds over all existing char*/ + XCharStruct max_bounds; /* maximum bounds over all existing char*/ + XCharStruct *per_char; /* first_char to last_char information */ + int ascent; /* log. extent above baseline for spacing */ + int descent; /* log. descent below baseline for spacing */ +}; + +/* + * PolyText routines take these as arguments. + */ +struct XTextItem{ + char *chars; /* pointer to string */ + int nchars; /* number of characters */ + int delta; /* delta between strings */ + Font font; /* font to print it in, None don't change */ +}; + +struct XChar2b +{ /* normal 16 bit characters are two bytes */ +align(1): + ubyte byte1; + ubyte byte2; +}; + + +struct XTextItem16 +{ + XChar2b *chars; /* two byte characters */ + int nchars; /* number of characters */ + int delta; /* delta between strings */ + Font font; /* font to print it in, None don't change */ +} + + +union XEDataObject +{ + Display *display; + GC gc; + Visual *visual; + Screen *screen; + ScreenFormat *pixmap_format; + XFontStruct *font; +} ; + +struct XFontSetExtents{ + XRectangle max_ink_extent; + XRectangle max_logical_extent; +}; + +/* unused: +alias void (*XOMProc)(); + */ + +struct _XOM{} +struct _XOC{} +alias _XOM *XOM; +alias _XOC *XOC; +alias _XOC *XFontSet; +struct XmbTextItem{ + byte *chars; + int nchars; + int delta; + XFontSet font_set; +}; + +struct XwcTextItem{ + wchar *chars; + int nchars; + int delta; + XFontSet font_set; +} ; + + +string XNRequiredCharSet ="requiredCharSet"; +string XNQueryOrientation ="queryOrientation"; +string XNBaseFontName ="baseFontName"; +string XNOMAutomatic ="omAutomatic"; +string XNMissingCharSet ="missingCharSet"; +string XNDefaultString ="defaultString"; +string XNOrientation ="orientation"; +string XNDirectionalDependentDrawing ="directionalDependentDrawing"; +string XNContextualDrawing ="contextualDrawing"; +string XNFontInfo ="fontInfo"; + + +struct XOMCharSetList +{ + int charset_count; + byte **charset_list; +}; + +enum XOrientation +{ + XOMOrientation_LTR_TTB, + XOMOrientation_RTL_TTB, + XOMOrientation_TTB_LTR, + XOMOrientation_TTB_RTL, + XOMOrientation_Context +}; + +struct XOMOrientation{ + int num_orientation; + XOrientation *orientation; /* Input Text description */ +}; + +struct XOMFontInfo{ + int num_font; + XFontStruct **font_struct_list; + byte **font_name_list; +} ; + +struct _XIM{} +struct _XIC{} +alias _XIM *XIM; +alias _XIC *XIC; + + +alias void function( + XIM, + XPointer, + XPointer +) XIMProc; + +alias Bool function( + XIC, + XPointer, + XPointer +)XICProc; + +alias void function( + Display*, + XPointer, + XPointer +)XIDProc; + +enum XIMStyle:uint +{ + XIMPreeditArea =0x0001L, + XIMPreeditCallbacks =0x0002L, + XIMPreeditPosition =0x0004L, + XIMPreeditNothing =0x0008L, + XIMPreeditNone =0x0010L, + XIMStatusArea =0x0100L, + XIMStatusCallbacks =0x0200L, + XIMStatusNothing =0x0400L, + XIMStatusNone =0x0800L +} + +struct XIMStyles{ + ushort count_styles; + XIMStyle *supported_styles; +}; + +const char[] XNVaNestedList ="XNVaNestedList"; +const char[] XNQueryInputStyle ="queryInputStyle"; +const char[] XNClientWindow ="clientWindow"; +const char[] XNInputStyle ="inputStyle"; +const char[] XNFocusWindow ="focusWindow"; +const char[] XNResourceName ="resourceName"; +const char[] XNResourceClass ="resourceClass"; +const char[] XNGeometryCallback ="geometryCallback"; +const char[] XNDestroyCallback ="destroyCallback"; +const char[] XNFilterEvents ="filterEvents"; +const char[] XNPreeditStartCallback ="preeditStartCallback"; +const char[] XNPreeditDoneCallback ="preeditDoneCallback"; +const char[] XNPreeditDrawCallback ="preeditDrawCallback"; +const char[] XNPreeditCaretCallback ="preeditCaretCallback"; +const char[] XNPreeditStateNotifyCallback ="preeditStateNotifyCallback"; +const char[] XNPreeditAttributes ="preeditAttributes"; +const char[] XNStatusStartCallback ="statusStartCallback"; +const char[] XNStatusDoneCallback ="statusDoneCallback"; +const char[] XNStatusDrawCallback ="statusDrawCallback"; +const char[] XNStatusAttributes ="statusAttributes"; +const char[] XNArea ="area"; +const char[] XNAreaNeeded ="areaNeeded"; +const char[] XNSpotLocation ="spotLocation"; +const char[] XNColormap ="colorMap"; +const char[] XNStdColormap ="stdColorMap"; +const char[] XNForeground ="foreground"; +const char[] XNBackground ="background"; +const char[] XNBackgroundPixmap ="backgroundPixmap"; +const char[] XNFontSet ="fontSet"; +const char[] XNLineSpace ="lineSpace"; +const char[] XNCursor ="cursor"; + +const char[] XNQueryIMValuesList ="queryIMValuesList"; +const char[] XNQueryICValuesList ="queryICValuesList"; +const char[] XNVisiblePosition ="visiblePosition"; +const char[] XNR6PreeditCallback ="r6PreeditCallback"; +const char[] XNStringConversionCallback ="stringConversionCallback"; +const char[] XNStringConversion ="stringConversion"; +const char[] XNResetState ="resetState"; +const char[] XNHotKey ="hotKey"; +const char[] XNHotKeyState ="hotKeyState"; +const char[] XNPreeditState ="preeditState"; +const char[] XNSeparatorofNestedList ="separatorofNestedList"; + +const int XBufferOverflow= -1; +const int XLookupNone= 1; +const int XLookupChars= 2; +const int XLookupKeySym= 3; +const int XLookupBoth = 4; + + +alias void *XVaNestedList; + +struct XIMCallback{ + XPointer client_data; + XIMProc callback; +}; + +struct XICCallback{ + XPointer client_data; + XICProc callback; +}; + +enum XIMFeedback:uint +{ + XIMReverse =1, + XIMUnderline =1<<1, + XIMHighlight =1<<2, + XIMPrimary =1<<5, + XIMSecondary =1<<6, + XIMTertiary =1<<7, + XIMVisibleToForward =1<<8, + XIMVisibleToBackword=1<<9, + XIMVisibleToCenter =1<<10 +} + +struct XIMText { + ushort length; + XIMFeedback *feedback; + Bool encoding_is_wchar; + union string + { + byte *multi_byte; + wchar *wide_char; + }; +}; + +enum XIMPreeditState:uint +{ + XIMPreeditUnKnown =0L, + XIMPreeditEnable =1L, + XIMPreeditDisable =1L<<1 +} + +struct XIMPreeditStateNotifyCallbackStruct +{ + XIMPreeditState state; +} + +enum XIMResetState:uint +{ + XIMInitialState =1L, + XIMPreserveState =1L<<1 +} + +enum XIMStringConversionFeedback:uint +{ + XIMStringConversionLeftEdge =0x00000001, + XIMStringConversionRightEdge =0x00000002, + XIMStringConversionTopEdge =0x00000004, + XIMStringConversionBottomEdge =0x00000008, + XIMStringConversionConcealed =0x00000010, + XIMStringConversionWrapped =0x00000020 +} + +struct XIMStringConversionText { + uint length; + XIMStringConversionFeedback *feedback; + Bool encoding_is_wchar; + union string + { + byte *mbs; + wchar *wcs; + }; +}; + +alias ushort XIMStringConversionPosition; + +enum XIMStringConversionType:ushort +{ + XIMStringConversionBuffer =0x0001, + XIMStringConversionLine =0x0002, + XIMStringConversionWord =0x0003, + XIMStringConversionChar =0x0004 +} + +enum XIMStringConversionOperation:ushort +{ + XIMStringConversionSubstitution =0x0001, + XIMStringConversionRetrieval =0x0002 +} + +enum XIMCaretDirection:int{ + XIMForwardChar, XIMBackwardChar, + XIMForwardWord, XIMBackwardWord, + XIMCaretUp, XIMCaretDown, + XIMNextLine, XIMPreviousLine, + XIMLineStart, XIMLineEnd, + XIMAbsolutePosition, + XIMDontChange +}; + +struct XIMStringConversionCallbackStruct { + XIMStringConversionPosition position; + XIMCaretDirection direction; + XIMStringConversionOperation operation; + ushort factor; + XIMStringConversionText *text; +}; + +struct XIMPreeditDrawCallbackStruct { + int caret; /* Cursor offset within pre-edit string */ + int chg_first; /* Starting change position */ + int chg_length; /* Length of the change in character count */ + XIMText *text; +} ; + +enum XIMCaretStyle{ + XIMIsInvisible, /* Disable caret feedback */ + XIMIsPrimary, /* UI defined caret feedback */ + XIMIsSecondary /* UI defined caret feedback */ +}; + +struct XIMPreeditCaretCallbackStruct { + int position; /* Caret offset within pre-edit string */ + XIMCaretDirection direction; /* Caret moves direction */ + XIMCaretStyle style; /* Feedback of the caret */ +}; + +enum XIMStatusDataType{ + XIMTextType, + XIMBitmapType +}; + +struct XIMStatusDrawCallbackStruct { + XIMStatusDataType type; + union data{ + XIMText *text; + Pixmap bitmap; + } ; +}; + +struct XIMHotKeyTrigger { + KeySym keysym; + int modifier; + int modifier_mask; +} ; + +struct XIMHotKeyTriggers { + int num_hot_key; + XIMHotKeyTrigger *key; +}; + +enum XIMHotKeyState:uint +{ + XIMHotKeyStateON =0x0001L, + XIMHotKeyStateOFF =0x0002L +} + +struct XIMValuesList{ + ushort count_values; + byte **supported_values; +}; + +/* FUNCTION PROTOTYPES*/ +extern (C) +{ + +extern int _Xdebug; + +extern XFontStruct *XLoadQueryFont( + Display* /* display */, + byte* /* name */ +); + +extern XFontStruct *XQueryFont( + Display* /* display */, + XID /* font_ID */ +); + + +extern XTimeCoord *XGetMotionEvents( + Display* /* display */, + Window /* w */, + Time /* start */, + Time /* stop */, + int* /* nevents_return */ +); + +extern XModifierKeymap *XDeleteModifiermapEntry( + XModifierKeymap* /* modmap */, + KeyCode /* keycode_entry */, + int /* modifier */ +); + +extern XModifierKeymap *XGetModifierMapping( + Display* /* display */ +); + +extern XModifierKeymap *XInsertModifiermapEntry( + XModifierKeymap* /* modmap */, + KeyCode /* keycode_entry */, + int /* modifier */ +); + +extern XModifierKeymap *XNewModifiermap( + int /* max_keys_per_mod */ +); + +extern XImage *XCreateImage( + Display* /* display */, + Visual* /* visual */, + uint /* depth */, + int /* format */, + int /* offset */, + byte* /* data */, + uint /* width */, + uint /* height */, + int /* bitmap_pad */, + int /* bytes_per_line */ +); +extern Status XInitImage( + XImage* /* image */ +); +extern XImage *XGetImage( + Display* /* display */, + Drawable /* d */, + int /* x */, + int /* y */, + uint /* width */, + uint /* height */, + uint /* plane_mask */, + ImageFormat /* format */ +); +extern XImage *XGetSubImage( + Display* /* display */, + Drawable /* d */, + int /* x */, + int /* y */, + uint /* width */, + uint /* height */, + uint /* plane_mask */, + int /* format */, + XImage* /* dest_image */, + int /* dest_x */, + int /* dest_y */ +); + +/* + * X function declarations. + */ +extern Display *XOpenDisplay( + char* /* display_name */ +); + +extern void XrmInitialize(); + +extern byte *XFetchBytes( + Display* /* display */, + int* /* nbytes_return */ +); +extern byte *XFetchBuffer( + Display* /* display */, + int* /* nbytes_return */, + int /* buffer */ +); +extern byte *XGetAtomName( + Display* /* display */, + Atom /* atom */ +); +extern Status XGetAtomNames( + Display* /* dpy */, + Atom* /* atoms */, + int /* count */, + byte** /* names_return */ +); +extern byte *XGetDefault( + Display* /* display */, + byte* /* program */, + byte* /* option */ +); +extern char *XDisplayName( + char* /* string */ +); +extern char *XKeysymToString( + KeySym /* keysym */ +); + + +extern int function(Display*/* display */,Bool /* onoff */)XSynchronize( + Display* /* display */ +); +extern int function( + Display* /* display */, + int function( + Display* /* display */ + ) /* procedure */ +)XSetAfterFunction( + Display* /* display */ +); + + +extern Atom XInternAtom( + Display* /* display */, + byte* /* atom_name */, + Bool /* only_if_exists */ +); + +extern Status XInternAtoms( + Display* /* dpy */, + byte** /* names */, + int /* count */, + Bool /* onlyIfExists */, + Atom* /* atoms_return */ +); +extern Colormap XCopyColormapAndFree( + Display* /* display */, + Colormap /* colormap */ +); +extern Colormap XCreateColormap( + Display* /* display */, + Window /* w */, + Visual* /* visual */, + int /* alloc */ +); +extern Cursor XCreatePixmapCursor( + Display* /* display */, + Pixmap /* source */, + Pixmap /* mask */, + XColor* /* foreground_color */, + XColor* /* background_color */, + uint /* x */, + uint /* y */ +); +extern Cursor XCreateGlyphCursor( + Display* /* display */, + Font /* source_font */, + Font /* mask_font */, + uint /* source_char */, + uint /* mask_char */, + XColor* /* foreground_color */, + XColor* /* background_color */ +); +extern Cursor XCreateFontCursor( + Display* /* display */, + uint /* shape */ +); +extern Font XLoadFont( + Display* /* display */, + byte* /* name */ +); +extern GC XCreateGC( + Display* /* display */, + Drawable /* d */, + uint /* valuemask */, + XGCValues* /* values */ +); +extern GContext XGContextFromGC( + GC /* gc */ +); +extern void XFlushGC( + Display* /* display */, + GC /* gc */ +); +extern Pixmap XCreatePixmap( + Display* /* display */, + Drawable /* d */, + uint /* width */, + uint /* height */, + uint /* depth */ +); +extern Pixmap XCreateBitmapFromData( + Display* /* display */, + Drawable /* d */, + byte* /* data */, + uint /* width */, + uint /* height */ +); +extern Pixmap XCreatePixmapFromBitmapData( + Display* /* display */, + Drawable /* d */, + byte* /* data */, + uint /* width */, + uint /* height */, + uint /* fg */, + uint /* bg */, + uint /* depth */ +); +extern Window XCreateSimpleWindow( + Display* /* display */, + Window /* parent */, + int /* x */, + int /* y */, + uint /* width */, + uint /* height */, + uint /* border_width */, + uint /* border */, + uint /* background */ +); +extern Window XGetSelectionOwner( + Display* /* display */, + Atom /* selection */ +); +extern Window XCreateWindow( + Display* /* display */, + Window /* parent */, + int /* x */, + int /* y */, + uint /* width */, + uint /* height */, + uint /* border_width */, + int /* depth */, + uint /* class */, + Visual* /* visual */, + uint /* valuemask */, + XSetWindowAttributes* /* attributes */ +); +extern Colormap *XListInstalledColormaps( + Display* /* display */, + Window /* w */, + int* /* num_return */ +); +extern byte **XListFonts( + Display* /* display */, + byte* /* pattern */, + int /* maxnames */, + int* /* actual_count_return */ +); +extern byte **XListFontsWithInfo( + Display* /* display */, + byte* /* pattern */, + int /* maxnames */, + int* /* count_return */, + XFontStruct** /* info_return */ +); +extern byte **XGetFontPath( + Display* /* display */, + int* /* npaths_return */ +); +extern byte **XListExtensions( + Display* /* display */, + int* /* nextensions_return */ +); +extern Atom *XListProperties( + Display* /* display */, + Window /* w */, + int* /* num_prop_return */ +); +extern XHostAddress *XListHosts( + Display* /* display */, + int* /* nhosts_return */, + Bool* /* state_return */ +); +extern KeySym XKeycodeToKeysym( + Display* /* display */, + KeyCode /* keycode */, + int /* index */ +); +extern KeySym XLookupKeysym( + XKeyEvent* /* key_event */, + int /* index */ +); +extern KeySym *XGetKeyboardMapping( + Display* /* display */, + KeyCode /* first_keycode */, + int /* keycode_count */, + int* /* keysyms_per_keycode_return */ +); +extern KeySym XStringToKeysym( + char* /* string */ +); +extern int XMaxRequestSize( + Display* /* display */ +); +extern int XExtendedMaxRequestSize( + Display* /* display */ +); +extern char *XResourceManagerString( + Display* /* display */ +); +extern char *XScreenResourceString( + Screen* /* screen */ +); +extern uint XDisplayMotionBufferSize( + Display* /* display */ +); +extern VisualID XVisualIDFromVisual( + Visual* /* visual */ +); + +/* multithread routines */ + +extern Status XInitThreads(); + +extern void XLockDisplay( + Display* /* display */ +); + +extern void XUnlockDisplay( + Display* /* display */ +); + +/* routines for dealing with extensions */ + +extern XExtCodes *XInitExtension( + Display* /* display */, + byte* /* name */ +); + +extern XExtCodes *XAddExtension( + Display* /* display */ +); +extern XExtData *XFindOnExtensionList( + XExtData** /* structure */, + int /* number */ +); +extern XExtData **XEHeadOfExtensionList( + XEDataObject /* object */ +); + +/* these are routines for which there are also macros */ +extern Window XRootWindow( + Display* /* display */, + int /* screen_number */ +); +extern Window XDefaultRootWindow( + Display* /* display */ +); +extern Window XRootWindowOfScreen( + Screen* /* screen */ +); +extern Visual *XDefaultVisual( + Display* /* display */, + int /* screen_number */ +); +extern Visual *XDefaultVisualOfScreen( + Screen* /* screen */ +); +extern GC XDefaultGC( + Display* /* display */, + int /* screen_number */ +); +extern GC XDefaultGCOfScreen( + Screen* /* screen */ +); +extern uint XBlackPixel( + Display* /* display */, + int /* screen_number */ +); +extern uint XWhitePixel( + Display* /* display */, + int /* screen_number */ +); +extern uint XAllPlanes(); +extern uint XBlackPixelOfScreen( + Screen* /* screen */ +); +extern uint XWhitePixelOfScreen( + Screen* /* screen */ +); +extern uint XNextRequest( + Display* /* display */ +); +extern uint XLastKnownRequestProcessed( + Display* /* display */ +); +extern char *XServerVendor( + Display* /* display */ +); +extern char *XDisplayString( + Display* /* display */ +); +extern Colormap XDefaultColormap( + Display* /* display */, + int /* screen_number */ +); +extern Colormap XDefaultColormapOfScreen( + Screen* /* screen */ +); +extern Display *XDisplayOfScreen( + Screen* /* screen */ +); +extern Screen *XScreenOfDisplay( + Display* /* display */, + int /* screen_number */ +); +extern Screen *XDefaultScreenOfDisplay( + Display* /* display */ +); +extern int XEventMaskOfScreen( + Screen* /* screen */ +); + +extern int XScreenNumberOfScreen( + Screen* /* screen */ +); + +// WARNING, this type not in Xlib spec +alias int function(Display* /* display */, + XErrorEvent* /* error_event */) XErrorHandler; + +extern XErrorHandler XSetErrorHandler ( + XErrorHandler /* handler */ +); + +// WARNING, this type not in Xlib spec +alias int function(Display* /* display */) XIOErrorHandler; + +extern XIOErrorHandler XSetIOErrorHandler ( + XIOErrorHandler /* handler */ +); + +extern XPixmapFormatValues *XListPixmapFormats( + Display* /* display */, + int* /* count_return */ +); +extern int *XListDepths( + Display* /* display */, + int /* screen_number */, + int* /* count_return */ +); + +/* ICCCM routines for things that don't require special include files; */ +/* other declarations are given in Xutil.h */ +extern Status XReconfigureWMWindow( + Display* /* display */, + Window /* w */, + int /* screen_number */, + int /* mask */, + XWindowChanges* /* changes */ +); + +extern Status XGetWMProtocols( + Display* /* display */, + Window /* w */, + Atom** /* protocols_return */, + int* /* count_return */ +); +extern Status XSetWMProtocols( + Display* /* display */, + Window /* w */, + Atom* /* protocols */, + int /* count */ +); +extern Status XIconifyWindow( + Display* /* display */, + Window /* w */, + int /* screen_number */ +); +extern Status XWithdrawWindow( + Display* /* display */, + Window /* w */, + int /* screen_number */ +); +extern Status XGetCommand( + Display* /* display */, + Window /* w */, + byte*** /* argv_return */, + int* /* argc_return */ +); +extern Status XGetWMColormapWindows( + Display* /* display */, + Window /* w */, + Window** /* windows_return */, + int* /* count_return */ +); +extern Status XSetWMColormapWindows( + Display* /* display */, + Window /* w */, + Window* /* colormap_windows */, + int /* count */ +); +extern void XFreeStringList( + char** /* list */ +); +extern int XSetTransientForHint( + Display* /* display */, + Window /* w */, + Window /* prop_window */ +); + +/* The following are given in alphabetical order */ + +extern int XActivateScreenSaver( + Display* /* display */ +); + +extern int XAddHost( + Display* /* display */, + XHostAddress* /* host */ +); + +extern int XAddHosts( + Display* /* display */, + XHostAddress* /* hosts */, + int /* num_hosts */ +); + +extern int XAddToExtensionList( + XExtData** /* structure */, + XExtData* /* ext_data */ +); + +extern int XAddToSaveSet( + Display* /* display */, + Window /* w */ +); + +extern Status XAllocColor( + Display* /* display */, + Colormap /* colormap */, + XColor* /* screen_in_out */ +); + +extern Status XAllocColorCells( + Display* /* display */, + Colormap /* colormap */, + Bool /* contig */, + uint* /* plane_masks_return */, + uint /* nplanes */, + uint* /* pixels_return */, + uint /* npixels */ +); + +extern Status XAllocColorPlanes( + Display* /* display */, + Colormap /* colormap */, + Bool /* contig */, + uint* /* pixels_return */, + int /* ncolors */, + int /* nreds */, + int /* ngreens */, + int /* nblues */, + uint* /* rmask_return */, + uint* /* gmask_return */, + uint* /* bmask_return */ +); + +extern Status XAllocNamedColor( + Display* /* display */, + Colormap /* colormap */, + byte* /* color_name */, + XColor* /* screen_def_return */, + XColor* /* exact_def_return */ +); + +extern int XAllowEvents( + Display* /* display */, + int /* event_mode */, + Time /* time */ +); + +extern int XAutoRepeatOff( + Display* /* display */ +); + +extern int XAutoRepeatOff( + Display* /* display */ +); + +extern int XAutoRepeatOn( + Display* /* display */ +); + +extern int XBell( + Display* /* display */, + int /* percent */ +); + +extern int XBitmapBitOrder( + Display* /* display */ +); + +extern int XBitmapPad( + Display* /* display */ +); + +extern int XBitmapUnit( + Display* /* display */ +); + +extern int XCellsOfScreen( + Screen* /* screen */ +); + +extern int XChangeActivePointerGrab( + Display* /* display */, + int /* event_mask */, + Cursor /* cursor */, + Time /* time */ +); + +extern int XChangeGC( + Display* /* display */, + GC /* gc */, + GCMask /* valuemask */, + XGCValues* /* values */ +); + +extern int XChangeKeyboardControl( + Display* /* display */, + KBMask /* value_mask */, + XKeyboardControl* /* values */ +); + +extern int XChangeKeyboardMapping( + Display* /* display */, + int /* first_keycode */, + int /* keysyms_per_keycode */, + KeySym* /* keysyms */, + int /* num_codes */ +); + +extern int XChangePointerControl( + Display* /* display */, + Bool /* do_accel */, + Bool /* do_threshold */, + int /* accel_numerator */, + int /* accel_denominator */, + int /* threshold */ +); + +extern int XChangeProperty( + Display* /* display */, + Window /* w */, + Atom /* property */, + Atom /* type */, + int /* format */, + int /* mode */, + ubyte* /* data */, + int /* nelements */ +); + +extern int XChangeSaveSet( + Display* /* display */, + Window /* w */, + ChangeMode /* change_mode */ +); + +extern int XChangeWindowAttributes( + Display* /* display */, + Window /* w */, + uint /* valuemask */, + XSetWindowAttributes* /* attributes */ +); + +extern Bool XCheckIfEvent( + Display* /* display */, + XEvent* /* event_return */, + Bool function( + Display* /* display */, + XEvent* /* event */, + XPointer /* arg */ + ) /* predicate */, + XPointer /* arg */ +); + +extern Bool XCheckMaskEvent( + Display* /* display */, + int /* event_mask */, + XEvent* /* event_return */ +); + +extern Bool XCheckTypedEvent( + Display* /* display */, + int /* event_type */, + XEvent* /* event_return */ +); + +extern Bool XCheckTypedWindowEvent( + Display* /* display */, + Window /* w */, + int /* event_type */, + XEvent* /* event_return */ +); + +extern Bool XCheckWindowEvent( + Display* /* display */, + Window /* w */, + int /* event_mask */, + XEvent* /* event_return */ +); + +extern int XCirculateSubwindows( + Display* /* display */, + Window /* w */, + CircularDirection /* direction */ +); + +extern int XCirculateSubwindowsDown( + Display* /* display */, + Window /* w */ +); + +extern int XCirculateSubwindowsUp( + Display* /* display */, + Window /* w */ +); + +extern int XClearArea( + Display* /* display */, + Window /* w */, + int /* x */, + int /* y */, + uint /* width */, + uint /* height */, + Bool /* exposures */ +); + +extern int XClearWindow( + Display* /* display */, + Window /* w */ +); + +extern int XCloseDisplay( + Display* /* display */ +); + +extern int XConfigureWindow( + Display* /* display */, + Window /* w */, + uint /* value_mask */, + XWindowChanges* /* values */ +); + +extern int XConnectionNumber( + Display* /* display */ +); + +extern int XConvertSelection( + Display* /* display */, + Atom /* selection */, + Atom /* target */, + Atom /* property */, + Window /* requestor */, + Time /* time */ +); + +extern int XCopyArea( + Display* /* display */, + Drawable /* src */, + Drawable /* dest */, + GC /* gc */, + int /* src_x */, + int /* src_y */, + uint /* width */, + uint /* height */, + int /* dest_x */, + int /* dest_y */ +); + +extern int XCopyGC( + Display* /* display */, + GC /* src */, + GCMask /* valuemask */, + GC /* dest */ +); + +extern int XCopyPlane( + Display* /* display */, + Drawable /* src */, + Drawable /* dest */, + GC /* gc */, + int /* src_x */, + int /* src_y */, + uint /* width */, + uint /* height */, + int /* dest_x */, + int /* dest_y */, + uint /* plane */ +); + +extern int XDefaultDepth( + Display* /* display */, + int /* screen_number */ +); + +extern int XDefaultDepthOfScreen( + Screen* /* screen */ +); + +extern int XDefaultScreen( + Display* /* display */ +); + +extern int XDefineCursor( + Display* /* display */, + Window /* w */, + Cursor /* cursor */ +); + +extern int XDeleteProperty( + Display* /* display */, + Window /* w */, + Atom /* property */ +); + +extern int XDestroyWindow( + Display* /* display */, + Window /* w */ +); + +extern int XDestroySubwindows( + Display* /* display */, + Window /* w */ +); + +extern int XDoesBackingStore( + Screen* /* screen */ +); + +extern Bool XDoesSaveUnders( + Screen* /* screen */ +); + +extern int XDisableAccessControl( + Display* /* display */ +); + + +extern int XDisplayCells( + Display* /* display */, + int /* screen_number */ +); + +extern int XDisplayHeight( + Display* /* display */, + int /* screen_number */ +); + +extern int XDisplayHeightMM( + Display* /* display */, + int /* screen_number */ +); + +extern int XDisplayKeycodes( + Display* /* display */, + int* /* min_keycodes_return */, + int* /* max_keycodes_return */ +); + +extern int XDisplayPlanes( + Display* /* display */, + int /* screen_number */ +); + +extern int XDisplayWidth( + Display* /* display */, + int /* screen_number */ +); + +extern int XDisplayWidthMM( + Display* /* display */, + int /* screen_number */ +); + +extern int XDrawArc( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + uint /* width */, + uint /* height */, + int /* angle1 */, + int /* angle2 */ +); + +extern int XDrawArcs( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XArc* /* arcs */, + int /* narcs */ +); + +extern int XDrawImageString( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + char* /* string */, + int /* length */ +); + +extern int XDrawImageString16( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + XChar2b* /* string */, + int /* length */ +); + +extern int XDrawLine( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x1 */, + int /* y1 */, + int /* x2 */, + int /* y2 */ +); + +extern int XDrawLines( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XPoint* /* points */, + int /* npoints */, + CoordinateMode /* mode */ +); + +extern int XDrawPoint( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */ +); + +extern int XDrawPoints( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XPoint* /* points */, + int /* npoints */, + CoordinateMode /* mode */ +); + +extern int XDrawRectangle( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + uint /* width */, + uint /* height */ +); + +extern int XDrawRectangles( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XRectangle* /* rectangles */, + int /* nrectangles */ +); + +extern int XDrawSegments( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XSegment* /* segments */, + int /* nsegments */ +); + +extern int XDrawString( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + char* /* string */, + int /* length */ +); + +extern int XDrawString16( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + XChar2b* /* string */, + int /* length */ +); + +extern int XDrawText( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + XTextItem* /* items */, + int /* nitems */ +); + +extern int XDrawText16( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + XTextItem16*/* items */, + int /* nitems */ +); + +extern int XEnableAccessControl( + Display* /* display */ +); + +extern int XEventsQueued( + Display* /* display */, + QueueMode /* mode */ +); + +extern Status XFetchName( + Display* /* display */, + Window /* w */, + byte** /* window_name_return */ +); + +extern int XFillArc( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + uint /* width */, + uint /* height */, + int /* angle1 */, + int /* angle2 */ +); + +extern int XFillArcs( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XArc* /* arcs */, + int /* narcs */ +); + +extern int XFillPolygon( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XPoint* /* points */, + int /* npoints */, + int /* shape */, + CoordinateMode /* mode */ +); + +extern int XFillRectangle( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + uint /* width */, + uint /* height */ +); + +extern int XFillRectangles( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XRectangle* /* rectangles */, + int /* nrectangles */ +); + +extern int XFlush( + Display* /* display */ +); + +extern int XForceScreenSaver( + Display* /* display */, + ScreenSaverMode /* mode */ +); + +extern int XFree( + void* /* data */ +); + +extern int XFreeColormap( + Display* /* display */, + Colormap /* colormap */ +); + +extern int XFreeColors( + Display* /* display */, + Colormap /* colormap */, + uint* /* pixels */, + int /* npixels */, + uint /* planes */ +); + +extern int XFreeCursor( + Display* /* display */, + Cursor /* cursor */ +); + +extern int XFreeExtensionList( + byte** /* list */ +); + +extern int XFreeFont( + Display* /* display */, + XFontStruct*/* font_struct */ +); + +extern int XFreeFontInfo( + byte** /* names */, + XFontStruct*/* free_info */, + int /* actual_count */ +); + +extern int XFreeFontNames( + byte** /* list */ +); + +extern int XFreeFontPath( + byte** /* list */ +); + +extern int XFreeGC( + Display* /* display */, + GC /* gc */ +); + +extern int XFreeModifiermap( + XModifierKeymap* /* modmap */ +); + +extern int XFreePixmap( + Display* /* display */, + Pixmap /* pixmap */ +); + +extern int XGeometry( + Display* /* display */, + int /* screen */, + byte* /* position */, + byte* /* default_position */, + uint /* bwidth */, + uint /* fwidth */, + uint /* fheight */, + int /* xadder */, + int /* yadder */, + int* /* x_return */, + int* /* y_return */, + int* /* width_return */, + int* /* height_return */ +); + +extern int XGetErrorDatabaseText( + Display* /* display */, + char* /* name */, + char* /* message */, + char* /* default_string */, + byte* /* buffer_return */, + int /* length */ +); + +extern int XGetErrorText( + Display* /* display */, + XErrorCode /* code */, + byte* /* buffer_return */, + int /* length */ +); + +extern Bool XGetFontProperty( + XFontStruct*/* font_struct */, + Atom /* atom */, + uint* /* value_return */ +); + +extern Status XGetGCValues( + Display* /* display */, + GC /* gc */, + GCMask /* valuemask */, + XGCValues* /* values_return */ +); + +extern Status XGetGeometry( + Display* /* display */, + Drawable /* d */, + Window* /* root_return */, + int* /* x_return */, + int* /* y_return */, + uint* /* width_return */, + uint* /* height_return */, + uint* /* border_width_return */, + uint* /* depth_return */ +); + +extern Status XGetIconName( + Display* /* display */, + Window /* w */, + byte** /* icon_name_return */ +); + +extern int XGetInputFocus( + Display* /* display */, + Window* /* focus_return */, + int* /* revert_to_return */ +); + +extern int XGetKeyboardControl( + Display* /* display */, + XKeyboardState* /* values_return */ +); + +extern int XGetPointerControl( + Display* /* display */, + int* /* accel_numerator_return */, + int* /* accel_denominator_return */, + int* /* threshold_return */ +); + +extern int XGetPointerMapping( + Display* /* display */, + ubyte* /* map_return */, + int /* nmap */ +); + +extern int XGetScreenSaver( + Display* /* display */, + int* /* timeout_return */, + int* /* interval_return */, + int* /* prefer_blanking_return */, + int* /* allow_exposures_return */ +); + +extern Status XGetTransientForHint( + Display* /* display */, + Window /* w */, + Window* /* prop_window_return */ +); + +extern int XGetWindowProperty( + Display* /* display */, + Window /* w */, + Atom /* property */, + int /* long_offset */, + int /* long_length */, + Bool /* delete */, + Atom /* req_type */, + Atom* /* actual_type_return */, + int* /* actual_format_return */, + uint* /* nitems_return */, + uint* /* bytes_after_return */, + ubyte** /* prop_return */ +); + +extern Status XGetWindowAttributes( + Display* /* display */, + Window /* w */, + XWindowAttributes* /* window_attributes_return */ +); + +extern int XGrabButton( + Display* /* display */, + uint /* button */, + uint /* modifiers */, + Window /* grab_window */, + Bool /* owner_events */, + int /* event_mask */, + GrabMode /* pointer_mode */, + GrabMode /* keyboard_mode */, + Window /* confine_to */, + Cursor /* cursor */ +); + +extern int XGrabKey( + Display* /* display */, + int /* keycode */, + KeyMask /* modifiers */, + Window /* grab_window */, + Bool /* owner_events */, + GrabMode /* pointer_mode */, + GrabMode /* keyboard_mode */ +); + +extern int XGrabKeyboard( + Display* /* display */, + Window /* grab_window */, + Bool /* owner_events */, + GrabMode /* pointer_mode */, + GrabMode /* keyboard_mode */, + Time /* time */ +); + +extern int XGrabPointer( + Display* /* display */, + Window /* grab_window */, + Bool /* owner_events */, + int /* event_mask */, + GrabMode /* pointer_mode */, + GrabMode /* keyboard_mode */, + Window /* confine_to */, + Cursor /* cursor */, + Time /* time */ +); + +extern int XGrabServer( + Display* /* display */ +); + +extern int XHeightMMOfScreen( + Screen* /* screen */ +); + +extern int XHeightOfScreen( + Screen* /* screen */ +); + +extern int XIfEvent( + Display* /* display */, + XEvent* /* event_return */, + Bool function( + Display* /* display */, + XEvent* /* event */, + XPointer /* arg */ + ) /* predicate */, + XPointer /* arg */ +); + +extern int XImageByteOrder( + Display* /* display */ +); + +extern int XInstallColormap( + Display* /* display */, + Colormap /* colormap */ +); + +extern KeyCode XKeysymToKeycode( + Display* /* display */, + KeySym /* keysym */ +); + +extern int XKillClient( + Display* /* display */, + XID /* resource */ +); + +extern Status XLookupColor( + Display* /* display */, + Colormap /* colormap */, + byte* /* color_name */, + XColor* /* exact_def_return */, + XColor* /* screen_def_return */ +); + +extern int XLowerWindow( + Display* /* display */, + Window /* w */ +); + +extern int XMapRaised( + Display* /* display */, + Window /* w */ +); + +extern int XMapSubwindows( + Display* /* display */, + Window /* w */ +); + +extern int XMapWindow( + Display* /* display */, + Window /* w */ +); + +extern int XMaskEvent( + Display* /* display */, + int /* event_mask */, + XEvent* /* event_return */ +); + +extern int XMaxCmapsOfScreen( + Screen* /* screen */ +); + +extern int XMinCmapsOfScreen( + Screen* /* screen */ +); + +extern int XMoveResizeWindow( + Display* /* display */, + Window /* w */, + int /* x */, + int /* y */, + uint /* width */, + uint /* height */ +); + +extern int XMoveWindow( + Display* /* display */, + Window /* w */, + int /* x */, + int /* y */ +); + +extern int XNextEvent( + Display* /* display */, + XEvent* /* event_return */ +); + +extern int XNoOp( + Display* /* display */ +); + +extern Status XParseColor( + Display* /* display */, + Colormap /* colormap */, + ubyte* /* spec */, + XColor* /* exact_def_return */ +); + +extern int XParseGeometry( + char* /* parsestring */, + int* /* x_return */, + int* /* y_return */, + uint* /* width_return */, + uint* /* height_return */ +); + +extern int XPeekEvent( + Display* /* display */, + XEvent* /* event_return */ +); + +extern int XPeekIfEvent( + Display* /* display */, + XEvent* /* event_return */, + Bool function ( + Display* /* display */, + XEvent* /* event */, + XPointer /* arg */ + ) /* predicate */, + XPointer /* arg */ +); + +extern int XPending( + Display* /* display */ +); + +extern int XPlanesOfScreen( + Screen* /* screen */ +); + +extern int XProtocolRevision( + Display* /* display */ +); + +extern int XProtocolVersion( + Display* /* display */ +); + + +extern int XPutBackEvent( + Display* /* display */, + XEvent* /* event */ +); + +extern int XPutImage( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XImage* /* image */, + int /* src_x */, + int /* src_y */, + int /* dest_x */, + int /* dest_y */, + uint /* width */, + uint /* height */ +); + +extern int XQLength( + Display* /* display */ +); + +extern Status XQueryBestCursor( + Display* /* display */, + Drawable /* d */, + uint /* width */, + uint /* height */, + uint* /* width_return */, + uint* /* height_return */ +); + +extern Status XQueryBestSize( + Display* /* display */, + int /* class */, + Drawable /* which_screen */, + uint /* width */, + uint /* height */, + uint* /* width_return */, + uint* /* height_return */ +); + +extern Status XQueryBestStipple( + Display* /* display */, + Drawable /* which_screen */, + uint /* width */, + uint /* height */, + uint* /* width_return */, + uint* /* height_return */ +); + +extern Status XQueryBestTile( + Display* /* display */, + Drawable /* which_screen */, + uint /* width */, + uint /* height */, + uint* /* width_return */, + uint* /* height_return */ +); + +extern int XQueryColor( + Display* /* display */, + Colormap /* colormap */, + XColor* /* def_in_out */ +); + +extern int XQueryColors( + Display* /* display */, + Colormap /* colormap */, + XColor* /* defs_in_out */, + int /* ncolors */ +); + +extern Bool XQueryExtension( + Display* /* display */, + byte* /* name */, + int* /* major_opcode_return */, + int* /* first_event_return */, + int* /* first_error_return */ +); + +extern int XQueryKeymap( + Display* /* display */, + byte [32] /* keys_return */ +); + +extern Bool XQueryPointer( + Display* /* display */, + Window /* w */, + Window* /* root_return */, + Window* /* child_return */, + int* /* root_x_return */, + int* /* root_y_return */, + int* /* win_x_return */, + int* /* win_y_return */, + uint* /* mask_return */ +); + +extern int XQueryTextExtents( + Display* /* display */, + XID /* font_ID */, + char* /* string */, + int /* nchars */, + FontDrawDirection* /* direction_return */, + int* /* font_ascent_return */, + int* /* font_descent_return */, + XCharStruct*/* overall_return */ +); + +extern int XQueryTextExtents16( + Display* /* display */, + XID /* font_ID */, + XChar2b* /* string */, + int /* nchars */, + FontDrawDirection* /* direction_return */, + int* /* font_ascent_return */, + int* /* font_descent_return */, + XCharStruct*/* overall_return */ +); + +extern Status XQueryTree( + Display* /* display */, + Window /* w */, + Window* /* root_return */, + Window* /* parent_return */, + Window** /* children_return */, + uint* /* nchildren_return */ +); + +extern int XRaiseWindow( + Display* /* display */, + Window /* w */ +); + +extern int XReadBitmapFile( + Display* /* display */, + Drawable /* d */, + ubyte* /* filename */, + uint* /* width_return */, + uint* /* height_return */, + Pixmap* /* bitmap_return */, + int* /* x_hot_return */, + int* /* y_hot_return */ +); + +extern int XReadBitmapFileData( + byte* /* filename */, + uint* /* width_return */, + uint* /* height_return */, + ubyte** /* data_return */, + int* /* x_hot_return */, + int* /* y_hot_return */ +); + +extern int XRebindKeysym( + Display* /* display */, + KeySym /* keysym */, + KeySym* /* list */, + int /* mod_count */, + char* /* string */, + int /* bytes_string */ +); + +extern int XRecolorCursor( + Display* /* display */, + Cursor /* cursor */, + XColor* /* foreground_color */, + XColor* /* background_color */ +); + +extern int XRefreshKeyboardMapping( + XMappingEvent* /* event_map */ +); + +extern int XRemoveFromSaveSet( + Display* /* display */, + Window /* w */ +); + +extern int XRemoveHost( + Display* /* display */, + XHostAddress* /* host */ +); + +extern int XRemoveHosts( + Display* /* display */, + XHostAddress* /* hosts */, + int /* num_hosts */ +); + +extern int XReparentWindow( + Display* /* display */, + Window /* w */, + Window /* parent */, + int /* x */, + int /* y */ +); + +extern int XResetScreenSaver( + Display* /* display */ +); + +extern int XResizeWindow( + Display* /* display */, + Window /* w */, + uint /* width */, + uint /* height */ +); + +extern int XRestackWindows( + Display* /* display */, + Window* /* windows */, + int /* nwindows */ +); + +extern int XRotateBuffers( + Display* /* display */, + int /* rotate */ +); + +extern int XRotateWindowProperties( + Display* /* display */, + Window /* w */, + Atom* /* properties */, + int /* num_prop */, + int /* npositions */ +); + +extern int XScreenCount( + Display* /* display */ +); + +extern int XSelectInput( + Display* /* display */, + Window /* w */, + int /* event_mask */ +); + +extern Status XSendEvent( + Display* /* display */, + Window /* w */, + Bool /* propagate */, + int /* event_mask */, + XEvent* /* event_send */ +); + +extern int XSetAccessControl( + Display* /* display */, + HostAccess /* mode */ +); + +extern int XSetArcMode( + Display* /* display */, + GC /* gc */, + ArcMode /* arc_mode */ +); + +extern int XSetBackground( + Display* /* display */, + GC /* gc */, + uint /* background */ +); + +extern int XSetClipMask( + Display* /* display */, + GC /* gc */, + Pixmap /* pixmap */ +); + +extern int XSetClipOrigin( + Display* /* display */, + GC /* gc */, + int /* clip_x_origin */, + int /* clip_y_origin */ +); + +extern int XSetClipRectangles( + Display* /* display */, + GC /* gc */, + int /* clip_x_origin */, + int /* clip_y_origin */, + XRectangle* /* rectangles */, + int /* n */, + int /* ordering */ +); + +extern int XSetCloseDownMode( + Display* /* display */, + int /* close_mode */ +); + +extern int XSetCommand( + Display* /* display */, + Window /* w */, + byte** /* argv */, + int /* argc */ +); + +extern int XSetDashes( + Display* /* display */, + GC /* gc */, + int /* dash_offset */, + byte* /* dash_list */, + int /* n */ +); + +extern int XSetFillRule( + Display* /* display */, + GC /* gc */, + FillRule /* fill_rule */ +); + +extern int XSetFillStyle( + Display* /* display */, + GC /* gc */, + FillStyle /* fill_style */ +); + +extern int XSetFont( + Display* /* display */, + GC /* gc */, + Font /* font */ +); + +extern int XSetFontPath( + Display* /* display */, + byte** /* directories */, + int /* ndirs */ +); + +extern int XSetForeground( + Display* /* display */, + GC /* gc */, + uint /* foreground */ +); + +extern int XSetFunction( + Display* /* display */, + GC /* gc */, + int /* function */ +); + +extern int XSetGraphicsExposures( + Display* /* display */, + GC /* gc */, + Bool /* graphics_exposures */ +); + +extern int XSetIconName( + Display* /* display */, + Window /* w */, + byte* /* icon_name */ +); + +extern int XSetInputFocus( + Display* /* display */, + Window /* focus */, + int /* revert_to */, + Time /* time */ +); + +extern int XSetLineAttributes( + Display* /* display */, + GC /* gc */, + uint /* line_width */, + LineStyle /* line_style */, + CapStyle /* cap_style */, + JoinStyle /* join_style */ +); + +extern int XSetModifierMapping( + Display* /* display */, + XModifierKeymap*/* modmap */ +); + +extern int XSetPlaneMask( + Display* /* display */, + GC /* gc */, + uint /* plane_mask */ +); + +extern int XSetPointerMapping( + Display* /* display */, + ubyte* /* map */, + int /* nmap */ +); + +extern int XSetScreenSaver( + Display* /* display */, + int /* timeout */, + int /* interval */, + int /* prefer_blanking */, + int /* allow_exposures */ +); + +extern int XSetSelectionOwner( + Display* /* display */, + Atom /* selection */, + Window /* owner */, + Time /* time */ +); + +extern int XSetState( + Display* /* display */, + GC /* gc */, + uint /* foreground */, + uint /* background */, + GraphicFunction /* function */, + uint /* plane_mask */ +); + +extern int XSetStipple( + Display* /* display */, + GC /* gc */, + Pixmap /* stipple */ +); + +extern int XSetSubwindowMode( + Display* /* display */, + GC /* gc */, + int /* subwindow_mode */ +); + +extern int XSetTSOrigin( + Display* /* display */, + GC /* gc */, + int /* ts_x_origin */, + int /* ts_y_origin */ +); + +extern int XSetTile( + Display* /* display */, + GC /* gc */, + Pixmap /* tile */ +); + +extern int XSetWindowBackground( + Display* /* display */, + Window /* w */, + uint /* background_pixel */ +); + +extern int XSetWindowBackgroundPixmap( + Display* /* display */, + Window /* w */, + Pixmap /* background_pixmap */ +); + +extern int XSetWindowBorder( + Display* /* display */, + Window /* w */, + uint /* border_pixel */ +); + +extern int XSetWindowBorderPixmap( + Display* /* display */, + Window /* w */, + Pixmap /* border_pixmap */ +); + +extern int XSetWindowBorderWidth( + Display* /* display */, + Window /* w */, + uint /* width */ +); + +extern int XSetWindowColormap( + Display* /* display */, + Window /* w */, + Colormap /* colormap */ +); + +extern int XStoreBuffer( + Display* /* display */, + byte* /* bytes */, + int /* nbytes */, + int /* buffer */ +); + +extern int XStoreBytes( + Display* /* display */, + byte* /* bytes */, + int /* nbytes */ +); + +extern int XStoreColor( + Display* /* display */, + Colormap /* colormap */, + XColor* /* color */ +); + +extern int XStoreColors( + Display* /* display */, + Colormap /* colormap */, + XColor* /* color */, + int /* ncolors */ +); + +extern int XStoreName( + Display* /* display */, + Window /* w */, + char* /* window_name */ +); + +extern int XStoreNamedColor( + Display* /* display */, + Colormap /* colormap */, + char* /* color */, + uint /* pixel */, + StoreColor /* flags */ +); + +extern int XSync( + Display* /* display */, + Bool /* discard */ +); + +extern int XTextExtents( + XFontStruct* /* font_struct */, + char* /* string */, + int /* nchars */, + int* /* direction_return */, + int* /* font_ascent_return */, + int* /* font_descent_return */, + XCharStruct* /* overall_return */ +); + +extern int XTextExtents16( + XFontStruct* /* font_struct */, + XChar2b* /* string */, + int /* nchars */, + FontDrawDirection* /* direction_return */, + int* /* font_ascent_return */, + int* /* font_descent_return */, + XCharStruct* /* overall_return */ +); + +extern int XTextWidth( + XFontStruct* /* font_struct */, + char* /* string */, + int /* count */ +); + +extern int XTextWidth16( + XFontStruct* /* font_struct */, + XChar2b* /* string */, + int /* count */ +); + +extern Bool XTranslateCoordinates( + Display* /* display */, + Window /* src_w */, + Window /* dest_w */, + int /* src_x */, + int /* src_y */, + int* /* dest_x_return */, + int* /* dest_y_return */, + Window* /* child_return */ +); + +extern int XUndefineCursor( + Display* /* display */, + Window /* w */ +); + +extern int XUngrabButton( + Display* /* display */, + uint /* button */, + KeyMask /* modifiers */, + Window /* grab_window */ +); + +extern int XUngrabKey( + Display* /* display */, + int /* keycode */, + KeyMask /* modifiers */, + Window /* grab_window */ +); + +extern int XUngrabKeyboard( + Display* /* display */, + Time /* time */ +); + +extern int XUngrabPointer( + Display* /* display */, + Time /* time */ +); + +extern int XUngrabServer( + Display* /* display */ +); + +extern int XUninstallColormap( + Display* /* display */, + Colormap /* colormap */ +); + +extern int XUnloadFont( + Display* /* display */, + Font /* font */ +); + +extern int XUnmapSubwindows( + Display* /* display */, + Window /* w */ +); + +extern int XUnmapWindow( + Display* /* display */, + Window /* w */ +); + +extern int XVendorRelease( + Display* /* display */ +); + +extern int XWarpPointer( + Display* /* display */, + Window /* src_w */, + Window /* dest_w */, + int /* src_x */, + int /* src_y */, + uint /* src_width */, + uint /* src_height */, + int /* dest_x */, + int /* dest_y */ +); + +extern int XWidthMMOfScreen( + Screen* /* screen */ +); + +extern int XWidthOfScreen( + Screen* /* screen */ +); + +extern int XWindowEvent( + Display* /* display */, + Window /* w */, + int /* event_mask */, + XEvent* /* event_return */ +); + +extern int XWriteBitmapFile( + Display* /* display */, + byte* /* filename */, + Pixmap /* bitmap */, + uint /* width */, + uint /* height */, + int /* x_hot */, + int /* y_hot */ +); + +extern Bool XSupportsLocale (); + +extern byte *XSetLocaleModifiers( + byte* /* modifier_list */ +); + +extern XOM XOpenOM( + Display* /* display */, + XrmHashBucketRec* /* rdb */, + byte* /* res_name */, + byte* /* res_class */ +); + +extern Status XCloseOM( + XOM /* om */ +); + +/+todo +extern byte *XSetOMValues( + XOM /* om */, + ... +) _X_SENTINEL(0); + +extern byte *XGetOMValues( + XOM /* om */, + ... +) _X_SENTINEL(0); ++/ + +extern Display *XDisplayOfOM( + XOM /* om */ +); + +extern byte *XLocaleOfOM( + XOM /* om */ +); + +/+todo +extern XOC XCreateOC( + XOM /* om */, + ... +) _X_SENTINEL(0); ++/ + +extern void XDestroyOC( + XOC /* oc */ +); + +extern XOM XOMOfOC( + XOC /* oc */ +); + +/+todo +extern byte *XSetOCValues( + XOC /* oc */, + ... +) _X_SENTINEL(0); + + +extern byte *XGetOCValues( + XOC /* oc */, + ... +) _X_SENTINEL(0); ++/ + +extern XFontSet XCreateFontSet( + Display* /* display */, + byte* /* base_font_name_list */, + byte*** /* missing_charset_list */, + int* /* missing_charset_count */, + char** /* def_string */ +); + +extern void XFreeFontSet( + Display* /* display */, + XFontSet /* font_set */ +); + +extern int XFontsOfFontSet( + XFontSet /* font_set */, + XFontStruct*** /* font_struct_list */, + byte*** /* font_name_list */ +); + +extern byte *XBaseFontNameListOfFontSet( + XFontSet /* font_set */ +); + +extern byte *XLocaleOfFontSet( + XFontSet /* font_set */ +); + +extern Bool XContextDependentDrawing( + XFontSet /* font_set */ +); + +extern Bool XDirectionalDependentDrawing( + XFontSet /* font_set */ +); + +extern Bool XContextualDrawing( + XFontSet /* font_set */ +); + +extern XFontSetExtents *XExtentsOfFontSet( + XFontSet /* font_set */ +); + +extern int XmbTextEscapement( + XFontSet /* font_set */, + byte* /* text */, + int /* bytes_text */ +); + +extern int XwcTextEscapement( + XFontSet /* font_set */, + wchar* /* text */, + int /* num_wchars */ +); + +extern int Xutf8TextEscapement( + XFontSet /* font_set */, + char* /* text */, + int /* bytes_text */ +); + +extern int XmbTextExtents( + XFontSet /* font_set */, + byte* /* text */, + int /* bytes_text */, + XRectangle* /* overall_ink_return */, + XRectangle* /* overall_logical_return */ +); + +extern int XwcTextExtents( + XFontSet /* font_set */, + wchar* /* text */, + int /* num_wchars */, + XRectangle* /* overall_ink_return */, + XRectangle* /* overall_logical_return */ +); + +extern int Xutf8TextExtents( + XFontSet /* font_set */, + char* /* text */, + int /* bytes_text */, + XRectangle* /* overall_ink_return */, + XRectangle* /* overall_logical_return */ +); + +extern Status XmbTextPerCharExtents( + XFontSet /* font_set */, + byte* /* text */, + int /* bytes_text */, + XRectangle* /* ink_extents_buffer */, + XRectangle* /* logical_extents_buffer */, + int /* buffer_size */, + int* /* num_chars */, + XRectangle* /* overall_ink_return */, + XRectangle* /* overall_logical_return */ +); + +extern Status XwcTextPerCharExtents( + XFontSet /* font_set */, + wchar* /* text */, + int /* num_wchars */, + XRectangle* /* ink_extents_buffer */, + XRectangle* /* logical_extents_buffer */, + int /* buffer_size */, + int* /* num_chars */, + XRectangle* /* overall_ink_return */, + XRectangle* /* overall_logical_return */ +); + +extern Status Xutf8TextPerCharExtents( + XFontSet /* font_set */, + char* /* text */, + int /* bytes_text */, + XRectangle* /* ink_extents_buffer */, + XRectangle* /* logical_extents_buffer */, + int /* buffer_size */, + int* /* num_chars */, + XRectangle* /* overall_ink_return */, + XRectangle* /* overall_logical_return */ +); + +extern void XmbDrawText( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + XmbTextItem* /* text_items */, + int /* nitems */ +); + +extern void XwcDrawText( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + XwcTextItem* /* text_items */, + int /* nitems */ +); + +extern void Xutf8DrawText( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + XmbTextItem* /* text_items */, + int /* nitems */ +); + +extern void XmbDrawString( + Display* /* display */, + Drawable /* d */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + char* /* text */, + int /* bytes_text */ +); + +extern void XwcDrawString( + Display* /* display */, + Drawable /* d */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + wchar* /* text */, + int /* num_wchars */ +); + +extern void Xutf8DrawString( + Display* /* display */, + Drawable /* d */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + char* /* text */, + int /* bytes_text */ +); + +extern void XmbDrawImageString( + Display* /* display */, + Drawable /* d */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + char* /* text */, + int /* bytes_text */ +); + +extern void XwcDrawImageString( + Display* /* display */, + Drawable /* d */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + wchar* /* text */, + int /* num_wchars */ +); + +extern void Xutf8DrawImageString( + Display* /* display */, + Drawable /* d */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + char* /* text */, + int /* bytes_text */ +); + +extern XIM XOpenIM( + Display* /* dpy */, + XrmHashBucketRec* /* rdb */, + byte* /* res_name */, + byte* /* res_class */ +); + +extern Status XCloseIM( + XIM /* im */ +); + +/+todo +extern byte *XGetIMValues( + XIM /* im */, ... +) _X_SENTINEL(0); + +extern byte *XSetIMValues( + XIM /* im */, ... +) _X_SENTINEL(0); + ++/ +extern Display *XDisplayOfIM( + XIM /* im */ +); + +extern byte *XLocaleOfIM( + XIM /* im*/ +); + +/+todo +extern XIC XCreateIC( + XIM /* im */, ... +) _X_SENTINEL(0); ++/ + +extern void XDestroyIC( + XIC /* ic */ +); + +extern void XSetICFocus( + XIC /* ic */ +); + +extern void XUnsetICFocus( + XIC /* ic */ +); + +extern wchar *XwcResetIC( + XIC /* ic */ +); + +extern byte *XmbResetIC( + XIC /* ic */ +); + +extern byte *Xutf8ResetIC( + XIC /* ic */ +); + +/+todo +extern byte *XSetICValues( + XIC /* ic */, ... +) _X_SENTINEL(0); + +extern byte *XGetICValues( + XIC /* ic */, ... +) _X_SENTINEL(0); ++/ +extern XIM XIMOfIC( + XIC /* ic */ +); + +extern Bool XFilterEvent( + XEvent* /* event */, + Window /* window */ +); + +extern int XmbLookupString( + XIC /* ic */, + XKeyPressedEvent* /* event */, + char* /* buffer_return */, + int /* bytes_buffer */, + KeySym* /* keysym_return */, + Status* /* status_return */ +); + +extern int XwcLookupString( + XIC /* ic */, + XKeyPressedEvent* /* event */, + wchar* /* buffer_return */, + int /* wchars_buffer */, + KeySym* /* keysym_return */, + Status* /* status_return */ +); + +extern int Xutf8LookupString( + XIC /* ic */, + XKeyPressedEvent* /* event */, + char* /* buffer_return */, + int /* bytes_buffer */, + KeySym* /* keysym_return */, + Status* /* status_return */ +); + +/+todo +extern XVaNestedList XVaCreateNestedList( + int /*unused*/, ... +) _X_SENTINEL(0); ++/ +/* internal connections for IMs */ + +extern Bool XRegisterIMInstantiateCallback( + Display* /* dpy */, + XrmHashBucketRec* /* rdb */, + byte* /* res_name */, + byte* /* res_class */, + XIDProc /* callback */, + XPointer /* client_data */ +); + +extern Bool XUnregisterIMInstantiateCallback( + Display* /* dpy */, + XrmHashBucketRec* /* rdb */, + byte* /* res_name */, + byte* /* res_class */, + XIDProc /* callback */, + XPointer /* client_data */ +); + +alias void function( + Display* /* dpy */, + XPointer /* client_data */, + int /* fd */, + Bool /* opening */, /* open or close flag */ + XPointer* /* watch_data */ /* open sets, close uses */ +)XConnectionWatchProc; + + +extern Status XInternalConnectionNumbers( + Display* /* dpy */, + int** /* fd_return */, + int* /* count_return */ +); + +extern void XProcessInternalConnection( + Display* /* dpy */, + int /* fd */ +); + +extern Status XAddConnectionWatch( + Display* /* dpy */, + XConnectionWatchProc /* callback */, + XPointer /* client_data */ +); + +extern void XRemoveConnectionWatch( + Display* /* dpy */, + XConnectionWatchProc /* callback */, + XPointer /* client_data */ +); + +extern void XSetAuthorization( + byte * /* name */, + int /* namelen */, + byte * /* data */, + int /* datalen */ +); + +extern int _Xmbtowc( + wchar * /* wstr */, + byte * /* str */, + int /* len */ +); + +extern int _Xwctomb( + byte * /* str */, + wchar /* wc */ +); + + +} diff --git a/3rdparty/X11/X11/Xutil.d b/3rdparty/X11/X11/Xutil.d new file mode 100644 index 00000000..dae89c06 --- /dev/null +++ b/3rdparty/X11/X11/Xutil.d @@ -0,0 +1,834 @@ + +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +// TODO: [D-bidings]: So far only the Region type is defined, finish the rest. + +module X11.Xutil; + +import X11.X; +// import X11.keysym; + +/* + * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding + * value (x, y, width, height) was found in the parsed string. + */ +enum { + NoValue = 0x0000, + XValue = 0x0001, + YValue = 0x0002, + WidthValue = 0x0004, + HeightValue = 0x0008, + AllValues = 0x000F, + XNegative = 0x0010, + YNegative = 0x0020 +} + +/+ + +/* + * new version containing base_width, base_height, and win_gravity fields; + * used with WM_NORMAL_HINTS. + */ +typedef struct { + long flags; /* marks which fields in this structure are defined */ + int x, y; /* obsolete for new window mgrs, but clients */ + int width, height; /* should set so old wm's don't mess up */ + int min_width, min_height; + int max_width, max_height; + int width_inc, height_inc; + struct { + int x; /* numerator */ + int y; /* denominator */ + } min_aspect, max_aspect; + int base_width, base_height; /* added by ICCCM version 1 */ + int win_gravity; /* added by ICCCM version 1 */ +} XSizeHints; + +/* + * The next block of definitions are for window manager properties that + * clients and applications use for communication. + */ + +/* flags argument in size hints */ +#define USPosition (1L << 0) /* user specified x, y */ +#define USSize (1L << 1) /* user specified width, height */ + +#define PPosition (1L << 2) /* program specified position */ +#define PSize (1L << 3) /* program specified size */ +#define PMinSize (1L << 4) /* program specified minimum size */ +#define PMaxSize (1L << 5) /* program specified maximum size */ +#define PResizeInc (1L << 6) /* program specified resize increments */ +#define PAspect (1L << 7) /* program specified min and max aspect ratios */ +#define PBaseSize (1L << 8) /* program specified base for incrementing */ +#define PWinGravity (1L << 9) /* program specified window gravity */ + +/* obsolete */ +#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect) + + + +typedef struct { + long flags; /* marks which fields in this structure are defined */ + Bool input; /* does this application rely on the window manager to + get keyboard input? */ + int initial_state; /* see below */ + Pixmap icon_pixmap; /* pixmap to be used as icon */ + Window icon_window; /* window to be used as icon */ + int icon_x, icon_y; /* initial position of icon */ + Pixmap icon_mask; /* icon mask bitmap */ + XID window_group; /* id of related window group */ + /* this structure may be extended in the future */ +} XWMHints; + +/* definition for flags of XWMHints */ + +#define InputHint (1L << 0) +#define StateHint (1L << 1) +#define IconPixmapHint (1L << 2) +#define IconWindowHint (1L << 3) +#define IconPositionHint (1L << 4) +#define IconMaskHint (1L << 5) +#define WindowGroupHint (1L << 6) +#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \ +IconPositionHint|IconMaskHint|WindowGroupHint) +#define XUrgencyHint (1L << 8) + +/* definitions for initial window state */ +#define WithdrawnState 0 /* for windows that are not mapped */ +#define NormalState 1 /* most applications want to start this way */ +#define IconicState 3 /* application wants to start as an icon */ + +/* + * Obsolete states no longer defined by ICCCM + */ +#define DontCareState 0 /* don't know or care */ +#define ZoomState 2 /* application wants to start zoomed */ +#define InactiveState 4 /* application believes it is seldom used; */ + /* some wm's may put it on inactive menu */ + + +/* + * new structure for manipulating TEXT properties; used with WM_NAME, + * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND. + */ +typedef struct { + unsigned char *value; /* same as Property routines */ + Atom encoding; /* prop type */ + int format; /* prop data format: 8, 16, or 32 */ + unsigned long nitems; /* number of data items in value */ +} XTextProperty; + +#define XNoMemory -1 +#define XLocaleNotSupported -2 +#define XConverterNotFound -3 + +typedef enum { + XStringStyle, /* STRING */ + XCompoundTextStyle, /* COMPOUND_TEXT */ + XTextStyle, /* text in owner's encoding (current locale)*/ + XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */ + /* The following is an XFree86 extension, introduced in November 2000 */ + XUTF8StringStyle /* UTF8_STRING */ +} XICCEncodingStyle; + +typedef struct { + int min_width, min_height; + int max_width, max_height; + int width_inc, height_inc; +} XIconSize; + +typedef struct { + char *res_name; + char *res_class; +} XClassHint; + +#ifdef XUTIL_DEFINE_FUNCTIONS +extern int XDestroyImage( + XImage *ximage); +extern unsigned long XGetPixel( + XImage *ximage, + int x, int y); +extern int XPutPixel( + XImage *ximage, + int x, int y, + unsigned long pixel); +extern XImage *XSubImage( + XImage *ximage, + int x, int y, + unsigned int width, unsigned int height); +extern int XAddPixel( + XImage *ximage, + long value); +#else +/* + * These macros are used to give some sugar to the image routines so that + * naive people are more comfortable with them. + */ +#define XDestroyImage(ximage) \ + ((*((ximage)->f.destroy_image))((ximage))) +#define XGetPixel(ximage, x, y) \ + ((*((ximage)->f.get_pixel))((ximage), (x), (y))) +#define XPutPixel(ximage, x, y, pixel) \ + ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel))) +#define XSubImage(ximage, x, y, width, height) \ + ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height))) +#define XAddPixel(ximage, value) \ + ((*((ximage)->f.add_pixel))((ximage), (value))) +#endif + +/* + * Compose sequence status structure, used in calling XLookupString. + */ +typedef struct _XComposeStatus { + XPointer compose_ptr; /* state table pointer */ + int chars_matched; /* match state */ +} XComposeStatus; + +/* + * Keysym macros, used on Keysyms to test for classes of symbols + */ +#define IsKeypadKey(keysym) \ + (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal)) + +#define IsPrivateKeypadKey(keysym) \ + (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF)) + +#define IsCursorKey(keysym) \ + (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select)) + +#define IsPFKey(keysym) \ + (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4)) + +#define IsFunctionKey(keysym) \ + (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35)) + +#define IsMiscFunctionKey(keysym) \ + (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break)) + +#ifdef XK_XKB_KEYS +#define IsModifierKey(keysym) \ + ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \ + || (((KeySym)(keysym) >= XK_ISO_Lock) && \ + ((KeySym)(keysym) <= XK_ISO_Last_Group_Lock)) \ + || ((KeySym)(keysym) == XK_Mode_switch) \ + || ((KeySym)(keysym) == XK_Num_Lock)) +#else +#define IsModifierKey(keysym) \ + ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \ + || ((KeySym)(keysym) == XK_Mode_switch) \ + || ((KeySym)(keysym) == XK_Num_Lock)) +#endif + ++/ + +/* + * opaque reference to Region data type + */ +struct _XRegion {} +alias _XRegion* Region; + +/+ + +/* Return values from XRectInRegion() */ +#define RectangleOut 0 +#define RectangleIn 1 +#define RectanglePart 2 + + +/* + * Information used by the visual utility routines to find desired visual + * type from the many visuals a display may support. + */ + +typedef struct { + Visual *visual; + VisualID visualid; + int screen; + int depth; +#if defined(__cplusplus) || defined(c_plusplus) + int c_class; /* C++ */ +#else + int class; +#endif + unsigned long red_mask; + unsigned long green_mask; + unsigned long blue_mask; + int colormap_size; + int bits_per_rgb; +} XVisualInfo; + +#define VisualNoMask 0x0 +#define VisualIDMask 0x1 +#define VisualScreenMask 0x2 +#define VisualDepthMask 0x4 +#define VisualClassMask 0x8 +#define VisualRedMaskMask 0x10 +#define VisualGreenMaskMask 0x20 +#define VisualBlueMaskMask 0x40 +#define VisualColormapSizeMask 0x80 +#define VisualBitsPerRGBMask 0x100 +#define VisualAllMask 0x1FF + +/* + * This defines a window manager property that clients may use to + * share standard color maps of type RGB_COLOR_MAP: + */ +typedef struct { + Colormap colormap; + unsigned long red_max; + unsigned long red_mult; + unsigned long green_max; + unsigned long green_mult; + unsigned long blue_max; + unsigned long blue_mult; + unsigned long base_pixel; + VisualID visualid; /* added by ICCCM version 1 */ + XID killid; /* added by ICCCM version 1 */ +} XStandardColormap; + +#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */ + + +/* + * return codes for XReadBitmapFile and XWriteBitmapFile + */ +#define BitmapSuccess 0 +#define BitmapOpenFailed 1 +#define BitmapFileInvalid 2 +#define BitmapNoMemory 3 + +/**************************************************************** + * + * Context Management + * + ****************************************************************/ + + +/* Associative lookup table return codes */ + +#define XCSUCCESS 0 /* No error. */ +#define XCNOMEM 1 /* Out of memory */ +#define XCNOENT 2 /* No entry in table */ + +typedef int XContext; + +#define XUniqueContext() ((XContext) XrmUniqueQuark()) +#define XStringToContext(string) ((XContext) XrmStringToQuark(string)) + +_XFUNCPROTOBEGIN + +/* The following declarations are alphabetized. */ + +extern XClassHint *XAllocClassHint ( + void +); + +extern XIconSize *XAllocIconSize ( + void +); + +extern XSizeHints *XAllocSizeHints ( + void +); + +extern XStandardColormap *XAllocStandardColormap ( + void +); + +extern XWMHints *XAllocWMHints ( + void +); + +extern int XClipBox( + Region /* r */, + XRectangle* /* rect_return */ +); + +extern Region XCreateRegion( + void +); + +extern const char *XDefaultString (void); + +extern int XDeleteContext( + Display* /* display */, + XID /* rid */, + XContext /* context */ +); + +extern int XDestroyRegion( + Region /* r */ +); + +extern int XEmptyRegion( + Region /* r */ +); + +extern int XEqualRegion( + Region /* r1 */, + Region /* r2 */ +); + +extern int XFindContext( + Display* /* display */, + XID /* rid */, + XContext /* context */, + XPointer* /* data_return */ +); + +extern Status XGetClassHint( + Display* /* display */, + Window /* w */, + XClassHint* /* class_hints_return */ +); + +extern Status XGetIconSizes( + Display* /* display */, + Window /* w */, + XIconSize** /* size_list_return */, + int* /* count_return */ +); + +extern Status XGetNormalHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints_return */ +); + +extern Status XGetRGBColormaps( + Display* /* display */, + Window /* w */, + XStandardColormap** /* stdcmap_return */, + int* /* count_return */, + Atom /* property */ +); + +extern Status XGetSizeHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints_return */, + Atom /* property */ +); + +extern Status XGetStandardColormap( + Display* /* display */, + Window /* w */, + XStandardColormap* /* colormap_return */, + Atom /* property */ +); + +extern Status XGetTextProperty( + Display* /* display */, + Window /* window */, + XTextProperty* /* text_prop_return */, + Atom /* property */ +); + +extern XVisualInfo *XGetVisualInfo( + Display* /* display */, + long /* vinfo_mask */, + XVisualInfo* /* vinfo_template */, + int* /* nitems_return */ +); + +extern Status XGetWMClientMachine( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop_return */ +); + +extern XWMHints *XGetWMHints( + Display* /* display */, + Window /* w */ +); + +extern Status XGetWMIconName( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop_return */ +); + +extern Status XGetWMName( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop_return */ +); + +extern Status XGetWMNormalHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints_return */, + long* /* supplied_return */ +); + +extern Status XGetWMSizeHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints_return */, + long* /* supplied_return */, + Atom /* property */ +); + +extern Status XGetZoomHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* zhints_return */ +); + +extern int XIntersectRegion( + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +); + +extern void XConvertCase( + KeySym /* sym */, + KeySym* /* lower */, + KeySym* /* upper */ +); + +extern int XLookupString( + XKeyEvent* /* event_struct */, + char* /* buffer_return */, + int /* bytes_buffer */, + KeySym* /* keysym_return */, + XComposeStatus* /* status_in_out */ +); + +extern Status XMatchVisualInfo( + Display* /* display */, + int /* screen */, + int /* depth */, + int /* class */, + XVisualInfo* /* vinfo_return */ +); + +extern int XOffsetRegion( + Region /* r */, + int /* dx */, + int /* dy */ +); + +extern Bool XPointInRegion( + Region /* r */, + int /* x */, + int /* y */ +); + +extern Region XPolygonRegion( + XPoint* /* points */, + int /* n */, + int /* fill_rule */ +); + +extern int XRectInRegion( + Region /* r */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */ +); + +extern int XSaveContext( + Display* /* display */, + XID /* rid */, + XContext /* context */, + _Xconst char* /* data */ +); + +extern int XSetClassHint( + Display* /* display */, + Window /* w */, + XClassHint* /* class_hints */ +); + +extern int XSetIconSizes( + Display* /* display */, + Window /* w */, + XIconSize* /* size_list */, + int /* count */ +); + +extern int XSetNormalHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints */ +); + +extern void XSetRGBColormaps( + Display* /* display */, + Window /* w */, + XStandardColormap* /* stdcmaps */, + int /* count */, + Atom /* property */ +); + +extern int XSetSizeHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints */, + Atom /* property */ +); + +extern int XSetStandardProperties( + Display* /* display */, + Window /* w */, + _Xconst char* /* window_name */, + _Xconst char* /* icon_name */, + Pixmap /* icon_pixmap */, + char** /* argv */, + int /* argc */, + XSizeHints* /* hints */ +); + +extern void XSetTextProperty( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop */, + Atom /* property */ +); + +extern void XSetWMClientMachine( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop */ +); + +extern int XSetWMHints( + Display* /* display */, + Window /* w */, + XWMHints* /* wm_hints */ +); + +extern void XSetWMIconName( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop */ +); + +extern void XSetWMName( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop */ +); + +extern void XSetWMNormalHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints */ +); + +extern void XSetWMProperties( + Display* /* display */, + Window /* w */, + XTextProperty* /* window_name */, + XTextProperty* /* icon_name */, + char** /* argv */, + int /* argc */, + XSizeHints* /* normal_hints */, + XWMHints* /* wm_hints */, + XClassHint* /* class_hints */ +); + +extern void XmbSetWMProperties( + Display* /* display */, + Window /* w */, + _Xconst char* /* window_name */, + _Xconst char* /* icon_name */, + char** /* argv */, + int /* argc */, + XSizeHints* /* normal_hints */, + XWMHints* /* wm_hints */, + XClassHint* /* class_hints */ +); + +extern void Xutf8SetWMProperties( + Display* /* display */, + Window /* w */, + _Xconst char* /* window_name */, + _Xconst char* /* icon_name */, + char** /* argv */, + int /* argc */, + XSizeHints* /* normal_hints */, + XWMHints* /* wm_hints */, + XClassHint* /* class_hints */ +); + +extern void XSetWMSizeHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints */, + Atom /* property */ +); + +extern int XSetRegion( + Display* /* display */, + GC /* gc */, + Region /* r */ +); + +extern void XSetStandardColormap( + Display* /* display */, + Window /* w */, + XStandardColormap* /* colormap */, + Atom /* property */ +); + +extern int XSetZoomHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* zhints */ +); + +extern int XShrinkRegion( + Region /* r */, + int /* dx */, + int /* dy */ +); + +extern Status XStringListToTextProperty( + char** /* list */, + int /* count */, + XTextProperty* /* text_prop_return */ +); + +extern int XSubtractRegion( + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +); + +extern int XmbTextListToTextProperty( + Display* display, + char** list, + int count, + XICCEncodingStyle style, + XTextProperty* text_prop_return +); + +extern int XwcTextListToTextProperty( + Display* display, + wchar_t** list, + int count, + XICCEncodingStyle style, + XTextProperty* text_prop_return +); + +extern int Xutf8TextListToTextProperty( + Display* display, + char** list, + int count, + XICCEncodingStyle style, + XTextProperty* text_prop_return +); + +extern void XwcFreeStringList( + wchar_t** list +); + +extern Status XTextPropertyToStringList( + XTextProperty* /* text_prop */, + char*** /* list_return */, + int* /* count_return */ +); + +extern int XmbTextPropertyToTextList( + Display* display, + const XTextProperty* text_prop, + char*** list_return, + int* count_return +); + +extern int XwcTextPropertyToTextList( + Display* display, + const XTextProperty* text_prop, + wchar_t*** list_return, + int* count_return +); + +extern int Xutf8TextPropertyToTextList( + Display* display, + const XTextProperty* text_prop, + char*** list_return, + int* count_return +); + +extern int XUnionRectWithRegion( + XRectangle* /* rectangle */, + Region /* src_region */, + Region /* dest_region_return */ +); + +extern int XUnionRegion( + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +); + +extern int XWMGeometry( + Display* /* display */, + int /* screen_number */, + _Xconst char* /* user_geometry */, + _Xconst char* /* default_geometry */, + unsigned int /* border_width */, + XSizeHints* /* hints */, + int* /* x_return */, + int* /* y_return */, + int* /* width_return */, + int* /* height_return */, + int* /* gravity_return */ +); + +extern int XXorRegion( + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +); + +_XFUNCPROTOEND ++/ diff --git a/3rdparty/X11/X11/extensions/Xrender.d b/3rdparty/X11/X11/extensions/Xrender.d new file mode 100644 index 00000000..79149385 --- /dev/null +++ b/3rdparty/X11/X11/extensions/Xrender.d @@ -0,0 +1,510 @@ +/* + * + * Copyright © 2000 SuSE, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of SuSE not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. SuSE makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, SuSE, Inc. + * Author of this D binding: Adam Cigánek + */ +module X11.extensions.Xrender; + +pragma(lib, "Xrender"); + +import X11.Xlib; +// import X11.Xosdefs; +import X11.Xutil; + +import X11.extensions.render; + +struct XRenderDirectFormat { + short red; + short redMask; + short green; + short greenMask; + short blue; + short blueMask; + short alpha; + short alphaMask; +} + +struct XRenderPictFormat { + PictFormat id; + int type; + int depth; + XRenderDirectFormat direct; + Colormap colormap; +} + +enum { + PictFormatID = 1 << 0, + PictFormatType = 1 << 1, + PictFormatDepth = 1 << 2, + PictFormatRed = 1 << 3, + PictFormatRedMask = 1 << 4, + PictFormatGreen = 1 << 5, + PictFormatGreenMask = 1 << 6, + PictFormatBlue = 1 << 7, + PictFormatBlueMask = 1 << 8, + PictFormatAlpha = 1 << 9, + PictFormatAlphaMask = 1 << 10, + PictFormatColormap = 1 << 11} + +struct XRenderPictureAttributes { + int repeat; + Picture alpha_map; + int alpha_x_origin; + int alpha_y_origin; + int clip_x_origin; + int clip_y_origin; + Pixmap clip_mask; + Bool graphics_exposures; + int subwindow_mode; + int poly_edge; + int poly_mode; + Atom dither; + Bool component_alpha; +} + +struct XRenderColor { + ushort red; + ushort green; + ushort blue; + ushort alpha; +} + +struct XGlyphInfo { + ushort width; + ushort height; + short x; + short y; + short xOff; + short yOff; +} + +struct XGlyphElt8 { + GlyphSet glyphset; + const char* chars; + int nchars; + int xOff; + int yOff; +} + +struct XGlyphElt16 { + GlyphSet glyphset; + const ushort* chars; + int nchars; + int xOff; + int yOff; +} + +struct XGlyphElt32 { + GlyphSet glyphset; + const uint* chars; + int nchars; + int xOff; + int yOff; +} + +alias double XDouble; + +struct XPointDouble { + XDouble x, y; +} + +XFixed XDoubleToFixed(XDouble f) { return cast(XFixed) (f * 65536); } +XDouble XFixedToDouble(XFixed f) { return cast(XDouble) (f / 65536); } + +alias int XFixed; + +struct XPointFixed { + XFixed x, y; +} + +struct XLineFixed { + XPointFixed p1, p2; +} + +struct XTriangle { + XPointFixed p1, p2, p3; +} + +struct XCircle { + XFixed x; + XFixed y; + XFixed radius; +} + +struct XTrapezoid { + XFixed top, bottom; + XLineFixed left, right; +} + +struct XTransform { + XFixed matrix[3][3]; +} + +struct XFilters { + int nfilter; + char** filter; + int nalias; + short* _alias; // [D-binding]: This was called alias, but that is a keyword in D. +} + +struct XIndexValue { + uint pixel; + ushort red, green, blue, alpha; +} + +struct XAnimCursor { + Cursor cursor; + uint delay; +} + +struct XSpanFix { + XFixed left, right, y; +} + +struct XTrap { + XSpanFix top, bottom; +} + +struct XLinearGradient { + XPointFixed p1; + XPointFixed p2; +} + +struct XRadialGradient { + XCircle inner; + XCircle outer; +} + +struct XConicalGradient { + XPointFixed center; + XFixed angle; // in degrees +} + +extern(C) Bool XRenderQueryExtension( + Display* dpy, + int* event_basep, + int* error_basep); + +extern(C) Status XRenderQueryVersion( + Display* dpy, + int* major_versionp, + int* minor_versionp); + +extern(C) Status XRenderQueryFormats( + Display* dpy); + +extern(C) int XRenderQuerySubpixelOrder( + Display* dpy, + int screen); + +extern(C) Bool XRenderSetSubpixelOrder( + Display* dpy, + int screen, + int subpixel); + +extern(C) XRenderPictFormat* XRenderFindVisualFormat( + Display* dpy, + const Visual* visual); + +extern(C) XRenderPictFormat* XRenderFindFormat( + Display* dpy, + uint mask, + const XRenderPictFormat* templ, + int count); + +enum { + PictStandardARGB32 = 0, + PictStandardRGB24 = 1, + PictStandardA8 = 2, + PictStandardA4 = 3, + PictStandardA1 = 4, + PictStandardNUM = 5} + +extern(C) XRenderPictFormat* XRenderFindStandardFormat( + Display* dpy, + int format); + +extern(C) XIndexValue* XRenderQueryPictIndexValues( + Display* dpy, + const XRenderPictFormat* format, + int* num); + +extern(C) Picture XRenderCreatePicture( + Display* dpy, + Drawable drawable, + const XRenderPictFormat* format, + uint valuemask, + const XRenderPictureAttributes* attributes); + +extern(C) void XRenderChangePicture( + Display* dpy, + Picture picture, + uint valuemask, + const XRenderPictureAttributes *attributes); + +extern(C) void XRenderSetPictureClipRectangles( + Display* dpy, + Picture picture, + int xOrigin, + int yOrigin, + const XRectangle* rects, + int n); + +extern(C) void XRenderSetPictureClipRegion( + Display* dpy, + Picture picture, + Region r); + +extern(C) void XRenderSetPictureTransform( + Display* dpy, + Picture picture, + XTransform* transform); + +extern(C) void XRenderFreePicture(Display* dpy, + Picture picture); + +extern(C) void XRenderComposite(Display* dpy, + int op, + Picture src, + Picture mask, + Picture dst, + int src_x, + int src_y, + int mask_x, + int mask_y, + int dst_x, + int dst_y, + uint width, + uint height); + +extern(C) GlyphSet XRenderCreateGlyphSet(Display* dpy, const XRenderPictFormat *format); + +extern(C) GlyphSet XRenderReferenceGlyphSet(Display* dpy, GlyphSet existing); + +extern(C) void XRenderFreeGlyphSet(Display* dpy, GlyphSet glyphset); + +extern(C) void XRenderAddGlyphs(Display* dpy, + GlyphSet glyphset, + const Glyph *gids, + const XGlyphInfo *glyphs, + int nglyphs, + const char *images, + int nbyte_images); + +extern(C) void XRenderFreeGlyphs(Display* dpy, + GlyphSet glyphset, + const Glyph *gids, + int nglyphs); + +extern(C) void XRenderCompositeString8(Display* dpy, + int op, + Picture src, + Picture dst, + const XRenderPictFormat *maskFormat, + GlyphSet glyphset, + int xSrc, + int ySrc, + int xDst, + int yDst, + const char *string, + int nchar); + +extern(C) void XRenderCompositeString16(Display* dpy, + int op, + Picture src, + Picture dst, + const XRenderPictFormat *maskFormat, + GlyphSet glyphset, + int xSrc, + int ySrc, + int xDst, + int yDst, + const ushort *string, + int nchar); + +extern(C) void XRenderCompositeString32(Display* dpy, + int op, + Picture src, + Picture dst, + const XRenderPictFormat *maskFormat, + GlyphSet glyphset, + int xSrc, + int ySrc, + int xDst, + int yDst, + const uint *string, + int nchar); + +extern(C) void XRenderCompositeText8(Display* dpy, + int op, + Picture src, + Picture dst, + const XRenderPictFormat *maskFormat, + int xSrc, + int ySrc, + int xDst, + int yDst, + const XGlyphElt8 *elts, + int nelt); + +extern(C) void XRenderCompositeText16(Display* dpy, + int op, + Picture src, + Picture dst, + const XRenderPictFormat *maskFormat, + int xSrc, + int ySrc, + int xDst, + int yDst, + const XGlyphElt16 *elts, + int nelt); + +extern(C) void XRenderCompositeText32(Display* dpy, + int op, + Picture src, + Picture dst, + const XRenderPictFormat *maskFormat, + int xSrc, + int ySrc, + int xDst, + int yDst, + const XGlyphElt32 *elts, + int nelt); + +extern(C) void XRenderFillRectangle(Display* dpy, + int op, + Picture dst, + const XRenderColor *color, + int x, + int y, + uint width, + uint height); + +extern(C) void XRenderFillRectangles(Display* dpy, + int op, + Picture dst, + const XRenderColor *color, + const XRectangle *rectangles, + int n_rects); + +extern(C) void XRenderCompositeTrapezoids(Display* dpy, + int op, + Picture src, + Picture dst, + const XRenderPictFormat *maskFormat, + int xSrc, + int ySrc, + const XTrapezoid *traps, + int ntrap); + +extern(C) void XRenderCompositeTriangles(Display* dpy, + int op, + Picture src, + Picture dst, + const XRenderPictFormat *maskFormat, + int xSrc, + int ySrc, + const XTriangle *triangles, + int ntriangle); + +extern(C) void XRenderCompositeTriStrip(Display* dpy, + int op, + Picture src, + Picture dst, + const XRenderPictFormat *maskFormat, + int xSrc, + int ySrc, + const XPointFixed *points, + int npoint); + +extern(C) void XRenderCompositeTriFan(Display* dpy, + int op, + Picture src, + Picture dst, + const XRenderPictFormat *maskFormat, + int xSrc, + int ySrc, + const XPointFixed *points, + int npoint); + +extern(C) void XRenderCompositeDoublePoly(Display* dpy, + int op, + Picture src, + Picture dst, + const XRenderPictFormat *maskFormat, + int xSrc, + int ySrc, + int xDst, + int yDst, + const XPointDouble *fpoints, + int npoints, + int winding); + +extern(C) Status XRenderParseColor(Display* dpy, + char *spec, + XRenderColor *def); + +extern(C) Cursor XRenderCreateCursor(Display* dpy, + Picture source, + uint x, + uint y); + +extern(C) XFilters * XRenderQueryFilters(Display* dpy, Drawable drawable); + +extern(C) void XRenderSetPictureFilter(Display* dpy, + Picture picture, + const char *filter, + XFixed *params, + int nparams); + +extern(C) Cursor XRenderCreateAnimCursor(Display* dpy, + int ncursor, + XAnimCursor *cursors); + + +extern(C) void XRenderAddTraps(Display* dpy, + Picture picture, + int xOff, + int yOff, + const XTrap *traps, + int ntrap); + +extern(C) Picture XRenderCreateSolidFill(Display* dpy, + const XRenderColor *color); + +extern(C) Picture XRenderCreateLinearGradient(Display* dpy, + const XLinearGradient *gradient, + const XFixed *stops, + const XRenderColor *colors, + int nstops); + +extern(C) Picture XRenderCreateRadialGradient(Display* dpy, + const XRadialGradient *gradient, + const XFixed *stops, + const XRenderColor *colors, + int nstops); + +extern(C) Picture XRenderCreateConicalGradient(Display* dpy, + const XConicalGradient *gradient, + const XFixed *stops, + const XRenderColor *colors, + int nstops); diff --git a/3rdparty/X11/X11/extensions/render.d b/3rdparty/X11/X11/extensions/render.d new file mode 100644 index 00000000..f67dba17 --- /dev/null +++ b/3rdparty/X11/X11/extensions/render.d @@ -0,0 +1,230 @@ +/* + * $XFree86: xc/include/extensions/render.h,v 1.10 2002/11/06 22:47:49 keithp Exp $ + * + * Copyright © 2000 SuSE, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of SuSE not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. SuSE makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, SuSE, Inc. + * Author of this D binding: Adam Cigánek + */ +module X11.extensions.render; + +import X11.X; + +alias XID Glyph; +alias XID GlyphSet; +alias XID Picture; +alias XID PictFormat; + +const RENDER_NAME = "RENDER"; +const RENDER_MAJOR = 0; +const RENDER_MINOR = 11; + +enum { + X_RenderQueryVersion = 0, + X_RenderQueryPictFormats = 1, + X_RenderQueryPictIndexValues = 2, // 0.7 + X_RenderQueryDithers = 3, + X_RenderCreatePicture = 4, + X_RenderChangePicture = 5, + X_RenderSetPictureClipRectangles = 6, + X_RenderFreePicture = 7, + X_RenderComposite = 8, + X_RenderScale = 9, + X_RenderTrapezoids = 10, + X_RenderTriangles = 11, + X_RenderTriStrip = 12, + X_RenderTriFan = 13, + X_RenderColorTrapezoids = 14, + X_RenderColorTriangles = 15, +// X_RenderTransform = 16, + X_RenderCreateGlyphSet = 17, + X_RenderReferenceGlyphSet = 18, + X_RenderFreeGlyphSet = 19, + X_RenderAddGlyphs = 20, + X_RenderAddGlyphsFromPicture = 21, + X_RenderFreeGlyphs = 22, + X_RenderCompositeGlyphs8 = 23, + X_RenderCompositeGlyphs16 = 24, + X_RenderCompositeGlyphs32 = 25, + X_RenderFillRectangles = 26, + // 0.5 + X_RenderCreateCursor = 27, + // 0.6 + X_RenderSetPictureTransform = 28, + X_RenderQueryFilters = 29, + X_RenderSetPictureFilter = 30, + // 0.8 + X_RenderCreateAnimCursor = 31, + // 0.9 + X_RenderAddTraps = 32, + // 0.10 + X_RenderCreateSolidFill = 33, + X_RenderCreateLinearGradient = 34, + X_RenderCreateRadialGradient = 35, + X_RenderCreateConicalGradient = 36, + RenderNumberRequests = X_RenderCreateConicalGradient + 1 +} + +enum { + BadPictFormat = 0, + BadPicture = 1, + BadPictOp = 2, + BadGlyphSet = 3, + BadGlyph = 4, + RenderNumberErrors = BadGlyph + 1 +} + +enum { + PictTypeIndexed = 0, + PictTypeDirect = 1 +} + +enum { + PictOpMinimum = 0, + PictOpClear = 0, + PictOpSrc = 1, + PictOpDst = 2, + PictOpOver = 3, + PictOpOverReverse = 4, + PictOpIn = 5, + PictOpInReverse = 6, + PictOpOut = 7, + PictOpOutReverse = 8, + PictOpAtop = 9, + PictOpAtopReverse = 10, + PictOpXor = 11, + PictOpAdd = 12, + PictOpSaturate = 13, + PictOpMaximum = 13, + + /* + * Operators only available in version 0.2 + */ + PictOpDisjointMinimum = 0x10, + PictOpDisjointClear = 0x10, + PictOpDisjointSrc = 0x11, + PictOpDisjointDst = 0x12, + PictOpDisjointOver = 0x13, + PictOpDisjointOverReverse = 0x14, + PictOpDisjointIn = 0x15, + PictOpDisjointInReverse = 0x16, + PictOpDisjointOut = 0x17, + PictOpDisjointOutReverse = 0x18, + PictOpDisjointAtop = 0x19, + PictOpDisjointAtopReverse = 0x1a, + PictOpDisjointXor = 0x1b, + PictOpDisjointMaximum = 0x1b, + + PictOpConjointMinimum = 0x20, + PictOpConjointClear = 0x20, + PictOpConjointSrc = 0x21, + PictOpConjointDst = 0x22, + PictOpConjointOver = 0x23, + PictOpConjointOverReverse = 0x24, + PictOpConjointIn = 0x25, + PictOpConjointInReverse = 0x26, + PictOpConjointOut = 0x27, + PictOpConjointOutReverse = 0x28, + PictOpConjointAtop = 0x29, + PictOpConjointAtopReverse = 0x2a, + PictOpConjointXor = 0x2b, + PictOpConjointMaximum = 0x2b, + + /* + * Operators only available in version 0.11 + */ + PictOpBlendMinimum = 0x30, + PictOpMultiply = 0x30, + PictOpScreen = 0x31, + PictOpOverlay = 0x32, + PictOpDarken = 0x33, + PictOpLighten = 0x34, + PictOpColorDodge = 0x35, + PictOpColorBurn = 0x36, + PictOpHardLight = 0x37, + PictOpSoftLight = 0x38, + PictOpDifference = 0x39, + PictOpExclusion = 0x3a, + PictOpHSLHue = 0x3b, + PictOpHSLSaturation = 0x3c, + PictOpHSLColor = 0x3d, + PictOpHSLLuminosity = 0x3e, + PictOpBlendMaximum = 0x3e +} + +enum { + PolyEdgeSharp = 0, + PolyEdgeSmooth = 1 +} + +enum { + PolyModePrecise = 0, + PolyModeImprecise = 1 +} + +enum { + CPRepeat = 1 << 0, + CPAlphaMap = 1 << 1, + CPAlphaXOrigin = 1 << 2, + CPAlphaYOrigin = 1 << 3, + CPClipXOrigin = 1 << 4, + CPClipYOrigin = 1 << 5, + CPClipMask = 1 << 6, + CPGraphicsExposure = 1 << 7, + CPSubwindowMode = 1 << 8, + CPPolyEdge = 1 << 9, + CPPolyMode = 1 << 10, + CPDither = 1 << 11, + CPComponentAlpha = 1 << 12, + CPLastBit = 12 +} + +enum { + /* Filters included in 0.6 */ + FilterNearest = "nearest", + FilterBilinear = "bilinear", + /* Filters included in 0.10 */ + FilterConvolution = "convolution", + + FilterFast = "fast", + FilterGood = "good", + FilterBest = "best" +} + +enum FilterAliasNone = -1; + +enum { + /* Subpixel orders included in 0.6 */ + SubPixelUnknown = 0, + SubPixelHorizontalRGB = 1, + SubPixelHorizontalBGR = 2, + SubPixelVerticalRGB = 3, + SubPixelVerticalBGR = 4, + SubPixelNone = 5 +} + +enum { + /* Extended repeat attributes included in 0.10 */ + RepeatNone = 0, + RepeatNormal = 1, + RepeatPad = 2, + RepeatReflect = 3 +} + diff --git a/3rdparty/X11/examples/Makefile b/3rdparty/X11/examples/Makefile new file mode 100644 index 00000000..c38cc61a --- /dev/null +++ b/3rdparty/X11/examples/Makefile @@ -0,0 +1,19 @@ +DC = dmd -c $(INCS) +DLINK = dmd $(LIBS) + +INCS = -I.. +LIBS = -L-lX11 + +RM = rm + +%.o: %.d + $(DC) $(<) + +all: simple + +simple: simple.o + $(DLINK) $< + +clean: + $(RM) *.o simple + diff --git a/3rdparty/X11/examples/simple.d b/3rdparty/X11/examples/simple.d new file mode 100644 index 00000000..446435f4 --- /dev/null +++ b/3rdparty/X11/examples/simple.d @@ -0,0 +1,44 @@ +// This an example for the X11 binding. +// +// Build/run with rdmd: +// rdmd -I.. simple.d + + +module simple; + +import X11.Xlib; +import std.c.stdio; +import std.string; + +int main(char[][] args) +{ + Display* display = XOpenDisplay(null); //Open default display + Window window = XCreateSimpleWindow( //create a simple windows + display, // display + DefaultRootWindow(display), // parent window + 0, 0, 200, 100, // x, y, w, h + 0,0x0,0x000000FF // border_width,boder_color,back_color + ); + XMapWindow(display, window); //map the window + XRaiseWindow(display, window); //show the window + XStoreName(display,window, cast(char*) "Hello Window"); //set window name + XFlush(display); // flush X server + + //wait for a enter pressed (in fact you need to wait for MapNotify event before drawing...) + printf("press enter to show window content\0"); + getchar(); + + XGCValues values; + values.foreground=0xFFFFFF; + values.background=0x00FF00; + GC gc=XCreateGC(display,window, 3<<3 , &values); //create zone for drawing + XDrawString(display, window,gc, 30,50, cast(char*)"hello world", 11); //draw string + XDrawRectangle(display,window,gc,20,20,150,50); //draw rectangle + XFlush(display); //flush X server + printf("press enter to close program\0"); + getchar(); //wait for a enter pressed to close program + XUnmapWindow(display, window); // unmap the window + XDestroyWindow(display, window); //destroy the window + XCloseDisplay(display); //close the display + return 0; +};