/// The XSelectInput() function requests that the X server report the events associated
/// with the specified event mask.
/// </summary>
/// <param name="display">Specifies the connection to the X server.</param>
/// <param name="w">Specifies the window whose events you are interested in.</param>
/// <param name="event_mask">Specifies the event mask.</param>
/// <remarks>
/// Initially, X will not report any of these events.
/// Events are reported relative to a window.
/// If a window is not interested in a device event,
/// it usually propagates to the closest ancestor that is interested,
/// unless the do_not_propagate mask prohibits it.
/// Setting the event-mask attribute of a window overrides any previous call for the same window but not for other clients. Multiple clients can select for the same events on the same window with the following restrictions:
/// <para>Multiple clients can select events on the same window because their event masks are disjoint. When the X server generates an event, it reports it to all interested clients. </para>
/// <para>Only one client at a time can select CirculateRequest, ConfigureRequest, or MapRequest events, which are associated with the event mask SubstructureRedirectMask. </para>
/// <para>Only one client at a time can select a ResizeRequest event, which is associated with the event mask ResizeRedirectMask. </para>
/// <para>Only one client at a time can select a ButtonPress event, which is associated with the event mask ButtonPressMask. </para>
/// <para>The server reports the event to all interested clients. </para>
/// <para>XSelectInput() can generate a BadWindow error.</para>
/// When the predicate procedure finds a match, XCheckIfEvent() copies the matched event into the client-supplied XEvent structure and returns True. (This event is removed from the queue.) If the predicate procedure finds no match, XCheckIfEvent() returns False, and the output buffer will have been flushed. All earlier events stored in the queue are not discarded.
/// </summary>
/// <param name="display">Specifies the connection to the X server.</param>
/// <param name="event_return">Returns a copy of the matched event's associated structure.</param>
/// <param name="predicate">Specifies the procedure that is to be called to determine if the next event in the queue matches what you want</param>
/// <param name="arg">Specifies the user-supplied argument that will be passed to the predicate procedure.</param>
/// <returns>true if the predicate returns true for some event, false otherwise</returns>
/// The XGetKeyboardMapping() function returns the symbols for the specified number of KeyCodes starting with first_keycode.
/// </summary>
/// <param name="display">Specifies the connection to the X server.</param>
/// <param name="first_keycode">Specifies the first KeyCode that is to be returned.</param>
/// <param name="keycode_count">Specifies the number of KeyCodes that are to be returned</param>
/// <param name="keysyms_per_keycode_return">Returns the number of KeySyms per KeyCode.</param>
/// <returns></returns>
/// <remarks>
/// <para>The value specified in first_keycode must be greater than or equal to min_keycode as returned by XDisplayKeycodes(), or a BadValue error results. In addition, the following expression must be less than or equal to max_keycode as returned by XDisplayKeycodes(): </para>
/// <para>KeySym number N, counting from zero, for KeyCode K has the following index in the list, counting from zero: </para>
/// <para> (K - first_code) * keysyms_per_code_return + N </para>
/// <para>The X server arbitrarily chooses the keysyms_per_keycode_return value to be large enough to report all requested symbols. A special KeySym value of NoSymbol is used to fill in unused elements for individual KeyCodes. To free the storage returned by XGetKeyboardMapping(), use XFree(). </para>
/// <para>XGetKeyboardMapping() can generate a BadValue error.</para>
/// <para>Diagnostics:</para>
/// <para>BadValue: Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument defined as a set of alternatives can generate this error.</para>
/// The XDisplayKeycodes() function returns the min-keycodes and max-keycodes supported by the specified display.
/// </summary>
/// <param name="display">Specifies the connection to the X server.</param>
/// <param name="min_keycodes_return">Returns the minimum number of KeyCodes</param>
/// <param name="max_keycodes_return">Returns the maximum number of KeyCodes.</param>
/// <remarks> The minimum number of KeyCodes returned is never less than 8, and the maximum number of KeyCodes returned is never greater than 255. Not all KeyCodes in this range are required to have corresponding keys.</remarks>
bracketleft=0x005b,/* U+005B LEFT SQUARE BRACKET */
backslash=0x005c,/* U+005C REVERSE SOLIDUS */
bracketright=0x005d,/* U+005D RIGHT SQUARE BRACKET */
asciicircum=0x005e,/* U+005E CIRCUMFLEX ACCENT */
underscore=0x005f,/* U+005F LOW LINE */
grave=0x0060,/* U+0060 GRAVE ACCENT */
quoteleft=0x0060,/* deprecated */
a=0x0061,/* U+0061 LATIN SMALL LETTER A */
b=0x0062,/* U+0062 LATIN SMALL LETTER B */
c=0x0063,/* U+0063 LATIN SMALL LETTER C */
d=0x0064,/* U+0064 LATIN SMALL LETTER D */
e=0x0065,/* U+0065 LATIN SMALL LETTER E */
f=0x0066,/* U+0066 LATIN SMALL LETTER F */
g=0x0067,/* U+0067 LATIN SMALL LETTER G */
h=0x0068,/* U+0068 LATIN SMALL LETTER H */
i=0x0069,/* U+0069 LATIN SMALL LETTER I */
j=0x006a,/* U+006A LATIN SMALL LETTER J */
k=0x006b,/* U+006B LATIN SMALL LETTER K */
l=0x006c,/* U+006C LATIN SMALL LETTER L */
m=0x006d,/* U+006D LATIN SMALL LETTER M */
n=0x006e,/* U+006E LATIN SMALL LETTER N */
o=0x006f,/* U+006F LATIN SMALL LETTER O */
p=0x0070,/* U+0070 LATIN SMALL LETTER P */
q=0x0071,/* U+0071 LATIN SMALL LETTER Q */
r=0x0072,/* U+0072 LATIN SMALL LETTER R */
s=0x0073,/* U+0073 LATIN SMALL LETTER S */
t=0x0074,/* U+0074 LATIN SMALL LETTER T */
u=0x0075,/* U+0075 LATIN SMALL LETTER U */
v=0x0076,/* U+0076 LATIN SMALL LETTER V */
w=0x0077,/* U+0077 LATIN SMALL LETTER W */
x=0x0078,/* U+0078 LATIN SMALL LETTER X */
y=0x0079,/* U+0079 LATIN SMALL LETTER Y */
z=0x007a,/* U+007A LATIN SMALL LETTER Z */
braceleft=0x007b,/* U+007B LEFT CURLY BRACKET */
bar=0x007c,/* U+007C VERTICAL LINE */
braceright=0x007d,/* U+007D RIGHT CURLY BRACKET */
asciitilde=0x007e,/* U+007E TILDE */
}
#endregion
publicenumXVisualClass:int
{
StaticGray=0,
GrayScale=1,
StaticColor=2,
PseudoColor=3,
TrueColor=4,
DirectColor=5,
}
[Flags]
publicenumXVisualInfoMask
{
No=0x0,
ID=0x1,
Screen=0x2,
Depth=0x4,
Class=0x8,
Red=0x10,
Green=0x20,
Blue=0x40,
ColormapSize=0x80,
BitsPerRGB=0x100,
All=0x1FF,
}
#regionpublicenumMouseMask
publicenumMouseMask
{
Button1MotionMask=(1<<8),
Button2MotionMask=(1<<9),
Button3MotionMask=(1<<10),
Button4MotionMask=(1<<11),
Button5MotionMask=(1<<12),
Button1Mask=(1<<8),
Button2Mask=(1<<9),
Button3Mask=(1<<10),
Button4Mask=(1<<11),
Button5Mask=(1<<12),
Button6Mask=(1<<13),
Button7Mask=(1<<14),
Button8Mask=(1<<15),
ShiftMask=(1<<0),
LockMask=(1<<1),
ControlMask=(1<<2),
Mod1Mask=(1<<3),
Mod2Mask=(1<<4),
Mod3Mask=(1<<5),
Mod4Mask=(1<<6),
Mod5Mask=(1<<7),
}
#endregion
#endregion
internalstaticpartialclassFunctions
{
internalconststringX11Library="libX11";
#regionXCreateWindow
/// <summary>
/// The XCreateWindow function creates an unmapped subwindow for a specified parent window, returns the window ID of the created window, and causes the X server to generate a CreateNotify event. The created window is placed on top in the stacking order with respect to siblings.
/// </summary>
/// <param name="display">Specifies the connection to the X server.</param>
/// <param name="parent">Specifies the parent window.</param>
/// <param name="x">Specify the x coordinates, which are the top-left outside corner of the window's borders and are relative to the inside of the parent window's borders.</param>
/// <param name="y">Specify the y coordinates, which are the top-left outside corner of the window's borders and are relative to the inside of the parent window's borders.</param>
/// <param name="width">Specify the width, which is the created window's inside dimensions and do not include the created window's borders.</param>
/// <param name="height">Specify the height, which is the created window's inside dimensions and do not include the created window's borders.</param>
/// <param name="border_width">Specifies the width of the created window's border in pixels.</param>
/// <param name="depth">Specifies the window's depth. A depth of CopyFromParent means the depth is taken from the parent.</param>
/// <param name="class">Specifies the created window's class. You can pass InputOutput, InputOnly, or CopyFromParent. A class of CopyFromParent means the class is taken from the parent.</param>
/// <param name="visual">Specifies the visual type. A visual of CopyFromParent means the visual type is taken from the parent.</param>
/// <param name="valuemask">Specifies which window attributes are defined in the attributes argument. This mask is the bitwise inclusive OR of the valid attribute mask bits. If valuemask is zero, the attributes are ignored and are not referenced.</param>
/// <param name="attributes">Specifies the structure from which the values (as specified by the value mask) are to be taken. The value mask should have the appropriate bits set to indicate which attributes have been set in the structure.</param>
/// <returns>The window ID of the created window.</returns>
/// <remarks>
/// The coordinate system has the X axis horizontal and the Y axis vertical with the origin [0, 0] at the upper-left corner. Coordinates are integral, in terms of pixels, and coincide with pixel centers. Each window and pixmap has its own coordinate system. For a window, the origin is inside the border at the inside, upper-left corner.
/// <para>The border_width for an InputOnly window must be zero, or a BadMatch error results. For class InputOutput, the visual type and depth must be a combination supported for the screen, or a BadMatch error results. The depth need not be the same as the parent, but the parent must not be a window of class InputOnly, or a BadMatch error results. For an InputOnly window, the depth must be zero, and the visual must be one supported by the screen. If either condition is not met, a BadMatch error results. The parent window, however, may have any depth and class. If you specify any invalid window attribute for a window, a BadMatch error results. </para>
/// <para>The created window is not yet displayed (mapped) on the user's display. To display the window, call XMapWindow(). The new window initially uses the same cursor as its parent. A new cursor can be defined for the new window by calling XDefineCursor(). The window will not be visible on the screen unless it and all of its ancestors are mapped and it is not obscured by any of its ancestors. </para>
/// <para>XCreateWindow can generate BadAlloc BadColor, BadCursor, BadMatch, BadPixmap, BadValue, and BadWindow errors. </para>
/// <para>The XCreateSimpleWindow function creates an unmapped InputOutput subwindow for a specified parent window, returns the window ID of the created window, and causes the X server to generate a CreateNotify event. The created window is placed on top in the stacking order with respect to siblings. Any part of the window that extends outside its parent window is clipped. The border_width for an InputOnly window must be zero, or a BadMatch error results. XCreateSimpleWindow inherits its depth, class, and visual from its parent. All other window attributes, except background and border, have their default values. </para>
/// <para>XCreateSimpleWindow can generate BadAlloc, BadMatch, BadValue, and BadWindow errors.</para>
/// The XQueryKeymap() function returns a bit vector for the logical state of the keyboard, where each bit set to 1 indicates that the corresponding key is currently pressed down. The vector is represented as 32 bytes. Byte N (from 0) contains the bits for keys 8N to 8N + 7 with the least-significant bit in the byte representing key 8N.
/// </summary>
/// <param name="display">Specifies the connection to the X server.</param>
/// <param name="keys">Returns an array of bytes that identifies which keys are pressed down. Each bit represents one key of the keyboard.</param>
/// <remarks>Note that the logical state of a device (as seen by client applications) may lag the physical state if device event processing is frozen.</remarks>
/// The XQueryKeymap() function returns a bit vector for the logical state of the keyboard, where each bit set to 1 indicates that the corresponding key is currently pressed down. The vector is represented as 32 bytes. Byte N (from 0) contains the bits for keys 8N to 8N + 7 with the least-significant bit in the byte representing key 8N.
/// </summary>
/// <param name="display">Specifies the connection to the X server.</param>
/// <param name="keys">Returns an array of bytes that identifies which keys are pressed down. Each bit represents one key of the keyboard.</param>
/// <remarks>Note that the logical state of a device (as seen by client applications) may lag the physical state if device event processing is frozen.</remarks>
/// The XMaskEvent() function searches the event queue for the events associated with the specified mask. When it finds a match, XMaskEvent() removes that event and copies it into the specified XEvent structure. The other events stored in the queue are not discarded. If the event you requested is not in the queue, XMaskEvent() flushes the output buffer and blocks until one is received.
/// </summary>
/// <param name="display">Specifies the connection to the X server.</param>
/// <param name="event_mask">Specifies the event mask.</param>
/// <param name="e">Returns the matched event's associated structure.</param>
/// The XPutBackEvent() function pushes an event back onto the head of the display's event queue by copying the event into the queue. This can be useful if you read an event and then decide that you would rather deal with it later. There is no limit to the number of times in succession that you can call XPutBackEvent().
/// </summary>
/// <param name="display">Specifies the connection to the X server.</param>
/// <param name="event">Specifies the event.</param>