added X11 binding

This commit is contained in:
Vadim Lopatin 2014-03-13 12:24:18 +04:00
parent d6d36a21a1
commit f3cd071904
13 changed files with 6471 additions and 0 deletions

2
3rdparty/X11/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.o
*.deps

31
3rdparty/X11/CHANGES vendored Normal file
View File

@ -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

24
3rdparty/X11/COPYING vendored Normal file
View File

@ -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.
****************************************************************************

13
3rdparty/X11/README vendored Normal file
View File

@ -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.

6
3rdparty/X11/TODO vendored Normal file
View File

@ -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

749
3rdparty/X11/X11/X.d vendored Normal file
View File

@ -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
};

80
3rdparty/X11/X11/Xatom.d vendored Normal file
View File

@ -0,0 +1,80 @@
/* Xlib binding for D language
Copyright 2010 Adam Cigánek <adam.ciganek@gmail.com>
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;

3929
3rdparty/X11/X11/Xlib.d vendored Normal file

File diff suppressed because it is too large Load Diff

834
3rdparty/X11/X11/Xutil.d vendored Normal file
View File

@ -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
+/

510
3rdparty/X11/X11/extensions/Xrender.d vendored Normal file
View File

@ -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 <adam.ciganek@gmail.com>
*/
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);

230
3rdparty/X11/X11/extensions/render.d vendored Normal file
View File

@ -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 <adam.ciganek@gmail.com>
*/
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
}

19
3rdparty/X11/examples/Makefile vendored Normal file
View File

@ -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

44
3rdparty/X11/examples/simple.d vendored Normal file
View File

@ -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;
};