1.2.0 • Published 8 years ago

remote-xlib v1.2.0

Weekly downloads
2
License
Unlicense
Repository
-
Last release
8 years ago
This program and document is in public domain.

This documentation assumes that the module is imported as X. The square
brackets indicate that it is a class of object and indicates what object
it inherits (in the prototype chain). If a property is shown with . then
it is the property of the constructor; if shown with * then it is a
property of the instance object; if # then it is an event. Parameters
with {} means an object with properties of specified names.

Some functions return another function which expects a callback (the
callback is always called "cb" in this document). It won't execute
anything until the callback function is provided; it then executes
asynchronously and will call the provided callback function once it is
finished executing.

Each event emitter object (including X) also has "onG" and "onceG"
methods. These are similar to "on" and "once" but wraps with the "run"
function from the "genasync" package. It executes X.block() before the
event is executed, and X.unblock() after it returns.

Note: Other than text to draw on the screen, all text should contain only
ASCII characters. Text to draw on the screen is treated as 16-bit
characters using the encoding of the font (the standard fonts contain
ASCII characters and VT100 character graphics). If the font encoding is
Unicode, then the string is also interpreted as Unicode.


=== JavaScript Objects ===

X
  The global object for this module, and is an event emitter.

  #error(err)
    Called when an error occurs. The error object is an instance of
    X.Error; see X.Error for details.

  #exitx()
    Called when the remote X client program exits, possibly due to an
    error or something else.

  #resource()
    Another client has written a resource string to a window that does not
    watch "resource" events itself. There is no guarantee as to how many
    resources have been set (possibly even zero). When a SQL program puts
    a resource, it always calls this event on the X object instead of on
    any window.

  #sqlevent(data)
    Called when the SQL function X_SPECIALEVENT is called. The data is the
    string passed as the argument, and can contain 16-bit characters.

X.Arc
  Constant for X.Drawable.prototype.drawGeneralArc.

X.CapButt
  Constant for line styles. The endpoint of the line is square.

X.CapNotLast
  Constant for line styles. If the line width is zero, omits the endpoint,
  otherwise acts like X.CapButt.

X.CapProjecting
  Constant for line styles. Similar to X.CapButt but the end is further by
  half of the line width.

X.CapRound
  Constant for line styles. Specifies the end should be round.

X.Chord
  Constant for X.Drawable.prototype.drawGeneralArc.

X.DirHorizontal
  Constant for use with X.Drawable.prototype.drawPictureList. Pictures are
  drawn in a horizontal list with the first picture at the left side.

X.DirNone
  Constant for use with X.Drawable.prototype.drawPictureList. Pictures are
  stacked in the same place; later pictures may obscure previous ones.

X.DirVertical
  Constant for use with X.Drawable.prototype.drawPictureList. Pictures are
  drawn in a vertical list with the first picture at the top.

X.Drawable [EventEmitter]
  A base class for objects that you can draw on (windows and pictures).

  *clipBitmap(x,y,pic)
    Sets the clip bitmap to a given X.Picture object, with the specified
    origin. If the picture given is null, removes clipping.

  *clipChildren(bool)
    If true, clips children. If false, does not clip children.

  *clipRect(x,y,width,height)
    Define a clip rectangle. Anything drawn outside of the rectangle will
    not be drawn.

  *createPicture(width,height,depth,flag)(cb)
    Same as X.createPicture but uses the current drawable as the root.

  *depth
    Depth (the number of colour bits) of a picture/window. (You must call
    updateGeometry first)

  *drawArc(x,y,radius,start,size)
    Draw an arc of a circle with the specified center and radius. The
    start and size are the angles in counterclockwise degrees (fractions
    are also possible), starting from three o'clock.

  *drawBitmap(x,y,pic)
    Draw a bitmap using the current foreground colour. The pic parameter
    value must be a X.Picture object of depth 1.

  *drawBlock(x1,y1,x2,y2)
    Draw a filled rectangle.

  *drawCircle(x,y,radius)
    Draw a circle with specified center and radius.

  *drawChord(x,y,radius,start,size)
    Draw a filled arc, like drawArc but fills in the area of the chord.

  *drawDisc(x,y,radius)
    Draw a filled circle with specified center and radius.

  *drawDot(x,y)
    Draw a single pixel.

  *drawGeneralArc(cmd,x,y,width,height,angle1,angle2)
    A generalized function for drawing arcs, although given an ellipse
    with the specified corner and size, and angles are now in units of
    1/64 degrees. The cmd should X.Arc, X.Chord, or X.PieSlice.

  *drawLine(x1,y1,x2,y2,...)
    Draw one or more line segments. You can have any number of pairs of
    coordinates specified.

  *drawMacro(x,y,...)
    Draw on the picture by using a macro format. The ... can be any
    number of strings and numbers.

  *drawOpaqueText(x,y,str)
    Like drawText but the background is opaque and is drawn using the
    background colour.

  *drawPicture(x,y,src,[srcx,srcy,srcwidth,srcheight])
    Draw a picture or part of a picture with the top-left corner at the
    specified position. The src parameter should be a X.Picture object. If
    the optional parameters are given, only part of the picture is drawn.
    Note that the clip mask is ignored; it will use the transparency mask
    of the picture to draw instead.

  *drawPictureList(x,y,pic,dir,list)
    Draw multiple pictures, all taken from the same X.Picture object. The
    parameter dir is X.DirNone, X.DirHorizontal, or X.DirVertical. The
    list is either an array of 16-bit numbers or a string of 16-bit
    characters (which will be converted into the numbers). The clip mask
    is ignored; it will use the transparency mask instead. The pictures
    of the source X.Picture object are considered to be arranged in a
    grid, with picture 0 at the top-left, and the cellWidth and cellHeight
    properties giving the size of each individual icon.

  *drawPieSlice(x,y,radius,start,size)
    Draw a filled pie slice. Parameters are like drawArc.

  *drawPolygon(rule,x1,y1,x2,y2,x3,y3,...)
    Draw a filled polygon using the specified rule (which must be either
    X.EvenOddRule or X.WindingRule). Any number of pairs of coordinates is
    possible, and it is allowed for them to cross.

  *drawRect(x1,y1,x2,y2)
    Draw a rectangle.

  *drawText(x,y,str)
    Draw text at the specified position using the current font and the
    current foreground colour; the background is transparent.

  *height
    Height of a picture/window. (You must call updateGeometry first).

  *loadPicture(filename,flag)(cb)
    Same as X.loadPicture but uses the current drawable as the root.

  *popGC()
    Restore the graphics context pushed with pushGC(). It is an error if
    the OWNGC flag was not specified when creating it.

  *pushGC()
    Push the graphics context (the settings for how to draw stuff on this
    screen) onto a stack. It is an error if the OWNGC flag was not
    specified when creating this picture/window.

  *scroll(xd,yd,[edge])
    Scroll the picture/window. The picture is moved across the canvas by
    the amount and direction given by xd and yd, filling the remaining
    area with the background colour. The clip settings will be taken into
    account, so the parts clipped off are unchanged. If one of xd or yd is
    zero, then the edge position may be specified, which means the
    scrolling does not occur past that edge; it must be the edge you are
    scrolling away from in an orthogonal direction only.

  *setBackground(color)
    Set the background colour. (See X.makeColor for the colour format)

  *setFont(font)
    Set the font to a specified X.Font object.

  *setForeground(color)
    Set the foreground colour. (See X.makeColor for the colour format)

  *setFunction(value)
    Set the drawing function, as a multiplex code. The default value is 3.
    You can use bitwise operations with X.src and X.dst to configure this.

  *setLineStyle(width,dash,cap,join,[list])
    Set the line width, dash style (X.LineSolid, X.LineOnOffDash, or
    X.LineDoubleDash), end style (X.CapButt, X.CapNotLast, X.CapRound, or
    X.CapProjecting), and join style (X.JoinBevel, X.JoinMiter, or
    X.JoinRound). The list is a list of positive numbers used for
    programming the pattern of dashes to use when drawing lines, and can
    be omitted if the dash style is X.LineSolid.

  *setPlaneMask(mask)
    Set the plane mask, to draw on only some colour planes. The default is
    -1 which means to draw all colours.

  *setStipple(x,y,pic)
    Set the stippling of painted areas to a bitmap, and use the specified
    offset. If null, stippling is disabled. Only one of stipples and tiles
    can be specified at the same time.

  *setTile(x,y,pic)
    Set the tiling of painted areas to a picture, and use the specified
    offset. If null, tiling is disabled. Only one of stipples and tiles
    can be specified at the same time.

  *updateGeometry()(cb)
    Updates the properties: xpos, ypos, width, height, borderSize, depth.
    Must be called in order to be able to read any of these properties.

  *width
    Width of a picture/window. (You must call updateGeometry first).

X.Error [Error]
  An error with the X server.

  *XID
    Not always defined, but is the ID number of the object in the X system
    for which this error corresponds to.

  *message
    Text. The exact text may change in future versions of this software.

  *name
    Text; always "X.Error".

  *xError
    Error number.

  *xMajor
    Major error number.

  *xMinor
    Minor error number.

X.EvenOddRule
  Constant for polygon fill mode. A point is inside the shape if the line
  crosses it an odd number of times.

X.Font [Object]
  A font reference. Note that 16-bit character codes are possible, since
  JavaScript strings are 16-bits per character.

  *XID
    The font ID on the X server.

  *ascent
    Size of the extent above the baseline.

  *descent
    Size of the extent below the baseline.

  *lbearing
    Left bearing size.

  *rbearing
    Right bearing size.

  *textWidth(str)(cb)
    Calculates the text width of a given string, in pixels.

  *width
    Width of a character. (If not a fixpitch font, the width of character
    number 48, which is the ASCII code of "0".)

X.JoinBevel
  Constant for line styles. When segments are connected, the triangular
  notch of the connection is filled, and is otherwise like X.CapButt.

X.JoinMiter
  Constant for line styles. When segments are connected, the line is
  extended so that the corner is pointy.

X.JoinRound
  Constant for line styles. Indicates that connected segments should have
  round connections.

X.LineDoubleDash
  Constant for line styles. Indicates that the line is dashed; the odd
  dashes use the background color. However if a stipple is defined, then
  the background color is masked by the stipple.

X.LineOnOffDash
  Constant for line styles. Indicates that the line is dashed; the odd
  dashes are transparent.

X.LineSolid
  Constant for line styles. Indicates that it is not dashed.

X.Picture [X.Drawable]
  Represents a picture stored in the X server which can be drawn on, and
  displayed on windows or copied to other pictures. The picture optionally
  has a mask assigned. Any methods/properties of drawable can also used.

  *XID
    The ID number in the X server.

  *assignMask(data)
    Assign a mask to the picture, treating the data as a Buffer or
    Uint8Array containing the bitmap data. You must call updateGeometry()
    first before this can be used. Any bit in the mask which is zero will
    cause that part of the picture to be transparent.

  *baseline
    The baseline position for X.Drawable.prototype.drawPictureList. By
    default, this is zero, but can be overridden.

  *cellHeight
    The cell height for X.Drawable.prototype.drawPictureList. By default,
    this is eight, but can be overridden.

  *cellWidth
    The cell width for X.Drawable.prototype.drawPictureList. By default,
    this is eight, but can be overridden.

  *destroy()
    Destroys the picture. You should not touch this object afterward.

  *read(x,y,w,h,format)(cb)
    Read a part of a picture into a TypedArray, given by the format which
    must be a standard TypedArray constructor. The picture is read in
    native format instead of RGB format.

  *removeMask()
    Removes the mask from the picture (if any), making it opaque.

  *saveAs(filename)
    Save the picture into a PNG file asynchronously. The mask and cell
    sizes will not be saved.

  *write(x,y,w,h,data)
    Write a part of a picture from a TypedArray. The picture is written in
    native format instead of RGB format. Note that it does pay attention
    to the graphics context when writing to the picture.

X.PieSlice
  Constant for X.Drawable.prototype.drawGeneralArc.

X.Property(type,format,data) [Object]
  An object representing the value of a X property. The type is an atom,
  the format is how many bits per item (8, 16, or 32), and the data can be
  a string, number, Buffer, ArrayBuffer, or TypedArray (if it isn't a
  Buffer, it will be converted to a Buffer).

  .converter
    Contains properties which are a number, possibly followed by a letter
    which is either "W" or "L", and then a possible plus sign. It is used
    to convert properties of the specified type and format, where no
    letter means the format is 8, "W" means 16, and "L" means 32. If there
    is a plus sign, it is used to convert into a list of values. You can
    add your own and override existing converters.

  *data
    The data, stored in a Buffer instance.

  *format
    The format of the data (8, 16, or 32).

  *length
    Length of the data, in units corresponding to the format.

  *toValue()
    Converts the value using X.Property.converter.

  *toValueList()
    Converts the value using X.Property.converter.

  *type
    The data type (an atom).

X.Selection [EventEmitter]
  An object representing a selection owned by this program.

  *destroy()
    Disowns the selection.

  *request(target)
    Defined when the selection is created, but can be overridden later if
    wanted. The target is a target atom, and this function should return
    either null or a X.Property object.

  #clear()
    The selection has been disowned.

X.Statement [Object]
  Represents a prepared SQL statement.

  *bind(index,value)
    Bind a host parameter of the SQL statement. First it rewinds the
    statement if necessary. The index can be a number or the name of a
    host parameter, and the value can be null or undefined, or a string,
    or a 32-bit number, or a Buffer object, or a picture.

  *destroy()
    Destroys the prepared statement; it can no longer be used.

  *go(f)(cb)
    Execute the statement to completion. If the function f is specified
    then it is called for each row of the result.

  *reset()
    Same as rewind().

  *rewind()
    The statement is rewound. Next time the step will execute from the
    beginning again.

  *slot
    The slot number of this statement (read-only). If the statement has
    been implicitly or explicitly destroyed, it will be null.

  *step()(cb)
    Execute the statement until the next result row or until it is
    finished; it returns null if finished, otherwise an array of the
    data of the current result row. It will automatically rewind once it
    reaches the end.

X.Widget [X.Window]
  The object for a widget inside of a window. Also has the properties and
  events of X.Window and X.Drawable as well as these ones. Mouse events
  are automatically forwarded to a widget when the cursor points at it.

  *lower()
    Move to back, so that it may be obscured by other widgets.

  *raise()
    Move to front, so that it will be displayed instead of other widgets
    in the same position.

  *setBorderColor(color)
    Set the border colour. The change is visible immediately.

  *setGeometry(x,y,width,height)
    Resize and reposition the widget relative to its container.

  #mousein({detail})
    Mouse position enters the widget. The detail is a 8-bit number.

  #mouseout({detail})
    Mouse position exits the widget.

X.WindingRule
  Constant for polygon fill mode. A point is outside the shape if the line
  crosses the shape an equal number of clockwise and counterclockwise
  times (including zero); otherwise it is inside.

X.Window [X.Drawable]
  An object for a window. Any methods/properties of any drawable object
  are also usable.

  *XID
    The ID number in the X server.

  *children
    An array of child windows (widgets).

  *clear()
    Clear the window. The colour configured by setBackground is used.

  *createSelection(selection,function)
    Causes the window to own the selection given as an atom (normally this
    would be X.atom.PRIMARY, but it can be any atom), and returns a new
    X.Selection object, where the given function is the request method of
    that object.

  *createWidget(x,y,width,height,flag,border)(cb)
    Create a widget (subwindow) inside of this window, and returns the new
    X.Widget instance. You can specify the position, size, border size (0
    means there is no border), and flags. The same flags as X.createWindow
    can be used, but only BLACK, UNMAPPED, and OWNGC are supported for
    widgets. If the widget does not have its own graphics context, it will
    use the same graphics context as its parent.

  *destroy()
    Destroy this window; all child windows are also destroyed. You should
    not use this window anymore afterward.

  *getProperty(prop,del)(cb)
    Reads and returns a property on this window with the specified name
    (given as an atom). If del is true, deletes the property after reading
    it. Returns a X.Property object, or null if this window doesn't have
    the requested property.

  *getSelection(selection,target)(cb)
    Read the selection from whoever currently owns it; both selection and
    property should be atoms (normally, X.atom.PRIMARY and X.atom.STRING,
    respectively). Returns a X.Property object if the property has been
    successfully read, or null if it cannot.

  *hide()
    Makes the window unmapped, invisible, and non-interactable.

  *putProperty(property,type,data,format)
    Put the property on the window. The property and type are atoms; the
    format is 8 or 16 or 32; the data can be a string, array of numbers,
    Buffer, ArrayBuffer, or TypedArray. If the atom "UTF8_STRING" has been
    defined and is specified as the type and the data is a string, it is
    automatically converted from UTF-16 to UTF-8.

  *redraw(v)
    Clear and repaint the window, generating expose events on itself and
    on all of its children. If v is specified, it is passed as the "user"
    property of the event object.

  *selections
    An object with properties numbered by atoms, which holds the
    selections that this window owns.

  *setCursor(shape)
    Set the mouse cursor shape; should be something from X.cursor.

  *setTitle(name,[icon_name])
    Set the window title. If icon_name is omitted, it is same as name.

  *show()
    Makes the window mapped, allowing it to be visible on the screen and
    interactable (however it may be obscured by other windows).

  #command(str)
    Another client has sent a command to this window using _SEND_RESOURCE
    protocol.

  #destroy()
    When the window is about to be destroyed, this event is called first.
    If it throws anything, the destruction will fail; note that it will
    first attempt to destroy all children in the order of their creation
    before the window itself is destroyed.

  #expose({x,y,width,height,count})
    Called when window is exposed and needs to be repainted. The parameter
    tells what area needs to be repainted, and count is nonzero if more
    expose events will follow (a program that does not pay attention to
    what area and simply redraws everything, can skip the repaint unless
    the count is zero).

  #keydown({state,keyCode,keySym,text})
    When a key is pushed. The state tells if shift/control/alt is pushed,
    and text is a string containing the text corresponding to pushing the
    key (which may also consist of control characters or be empty).

  #keyup({state,keyCode})
    When a pushed key is released.

  #mousedown({state,button,x,y})
    The mouse button is pushed. The button tells which button (normally:
    1 for the left button, 2 for the middle button, and 3 for the right
    button).

  #mousemove({state,x,y})
    Mouse is moved within the window. Requires MOTION or DRAG flag.

  #mouseup({state,button,x,y})
    A pushed mouse button is released.

  #resize({border,width,height})
    The window has been resized; requires STRUCT flag. This may also be
    called if the window is moved or at other times; it hasn't necessarily
    actually changed to a different size.

  #resource()
    Another client has changed a resource on this window by using the
    _SEND_RESOURCE protocol. There is no guarantee as to the number of
    resources that have been set (possibly even zero).

X.atom
  An object containing properties with atom names. Functions that require
  atoms will use these atoms. If X.makeAtom is called, an atom will be
  added to this list. You should not write directly into this object.

  .PRIMARY
    The primary selection. When owning or requesting a selection, this is
    ordinarily the selection which should be used.

  .SECONDARY
    An alternate selection. (Normally PRIMARY is used instead.)

X.authorizeActions(n)
  If n is zero then all SQL statements are permitted. If n is nonzero,
  then only the bits set correspond to permitted SQL actions. See
  http://sqlite.org/c3ref/c_alter_table.html for the list of action codes;
  the n is a mask of the bitwise OR of (1<<(actioncode-1)).

X.authorizeFunctions(list)
  Create a whitelist of authorized SQL functions. If you pass null or an
  empty array, all functions are allowed. Otherwise it is an array of
  strings of the name of SQL functions to allow.

X.authorizePrefixes(prefix1,prefix2)
  If prefix1 is set, then SQL triggers and views with a name starting with
  that prefix will be able to bypass all restrictions specified by other
  authorize operations; however, no database object may be created,
  dropped, or altered that has that prefix. If prefix2 is set, then it is
  prohibited to do anything to database objects with names starting with
  that prefix.

X.black
  Colour code for the default "black" colour.

X.block()
  Blocks further events from being emitted to windows. Can be called
  multiple times; it will remember how many.

X.clear
  A constant with the value 0. Used in multiplex codes.

X.createBitmap(width,height,data)(cb)
  Create a new X.Picture object with depth 1. This picture can then be
  used with X.Drawable.prototype.clipBitmap.

X.createPicture(width,height,depth,flag)(cb)
  Creates a new X.Picture object of the given width, height, and depth.
  Any can be zero which means it will automatically determine. Flags are
  the bitwise OR of zero or more of the flags listed below.

  .OWNGC
    Create a graphics context for this picture.

X.createWindow(name,width,height,flag)(cb)
  Creates a new X.Window object with the given name, width, and height.
  The actual width and height may be different due to the window manager
  in use. The window is initially mapped, and uses X.cursor.arrow as the
  default mouse cursor shape. The title is initially the same as the name.
  The flags is the bitwise OR of zero or more of the flags listed below.

  .BLACK
    Makes the background black instead of white.

  .DRAG
    Asks for motion events while a button is held.

  .MOTION
    Asks for motion events always.

  .OWNGC
    Create a graphics context for this window.

  .STRUCT
    Asks for events when the window is resized. Also causes the width and
    height properties to automatically be updated.

  .UNMAPPED
    The window is initially hidden.

X.cursor
  An object containing properties with cursor names. Use them with the
  X.Window.prototype.setCursor method. All of the standard cursor shapes
  are included, but the "XC_" prefix is omitted; there are also many
  nonstandard cursor shapes included with this program (including the
  kitchen sink). You should not write into this object.

X.dst
  A constant with the value 5. Used to indicate the old data in a
  multiplex code.

X.execute(str)(cb)
  Execute one or more SQL statements. The return value will be an array;
  each element of the array is one row of the result, which is an array of
  the values of columns as ASCII strings, or undefined for columns
  containing no value.

X.getColorResource(quarklist,[default])(cb)
  Similar to X.getResource but returns a colour instead of a string.

X.getResource(quarklist,[default])(cb)
  Reads the resource named by the quark list and returns the value (as a
  string). If there is no such resource, uses the default value. Each
  element of the list can be a quark, a string (which must correspond to a
  quark listed in X.quark), or an array of two quarks (the first quark is
  treated as the name and the second as the class).

X.getStatement(slot)
  Return a X.Statement object from the given slot number, or null if there
  is no such prepared statement.

X.initAudio(cb)
  Initialize audio.

X.initQuarks(list)(cb)
  The list should be a list of strings. Each string is converted to a
  quark and added to the X.quark object.

X.initResources(list)(cb)
  Initializes the resource manager from the given list. Each element of
  the list can be one of:

  - An empty string
    This must be the first element if this is the first time this function
    is being called. It initializes the resource manager and fills in the
    defaults from the root window. When calling X.initResources later, you
    can omit the empty string in order to modify the existing resource
    manager database.

  - A string starting with "@"
    After the at sign give a name. It then parses command-line options, as
    specified by the strings starting with "-", using the given name as
    the first component of the resource name. Note that unambiguous
    abbreviations of the option names are also treated as the full option.

  - A string "-" option space resource
    If this option is found on the command-line, expects the next argument
    to be the value of this resource. The resource name should start with
    a dot or asterisk.

  - A string "-" option space "!" resource
    Similar to above but the option is sticky; the value immediately
    follows instead of the next argument.

  - A string "-" option space resource ":" value
    Similar to above but the value is built-in to the program, rather than
    specified on command-line.

  - A string "-" option space "#SKIP"
    If this option is seen, the next argument is ignored.

  - A string "-" option space "#XRM"
    If this option is seen, the next argument is expected to be a resource
    string, which is then added to the resource database.

  - A string "-" option space "#END"
    If this option is seen, all remaining arguments are ignored.

  - Anything else
    Treated as a line in the resource manager format, and is then added to
    the resource manager database.

X.key
  An object containing properties with keysym names. Not all keysym names
  are included, although many common ones are. Printable ASCII characters
  are not included since they are easily by the ASCII code, and codes for
  3270 terminal keys start by "IBM3270" instead of just "3270".

X.loadDatabase(filename)(cb)
  Load a SQL database. The filename can be a relative or absolute path, a
  file: URI, the string ":memory:", or an empty string. Recursive triggers
  will be enabled. Only one database can be loaded at a time.

X.loadExtension(name)(cb)
  Load a SQLite extension. Each time a database is loaded, no extensions
  will remain loaded and must be reloaded if wanted.

X.loadFont(name)(cb)
  Create a new X.Font object from the X core font with the specified name.
  Common font names are "fixed", "5x7", "5x8", "6x9", "6x10", "6x12",
  "6x13", "6x13bold", "8x16", "9x15", "9x15bold", "10x20", and "12x24". If
  the system has additional fonts installed, those may be used too, but
  the fonts listed here are recommended for most purposes.

X.loadPicture(filename,flag)(cb)
  Create a new X.Picture object from a PNG file (does not have its own
  graphics context). Transparency is supported, but only boolean and not
  full alpha transparency (only the high bit of the alpha channel will be
  in use). Flags can be bitwise OR of zero or more of the below flags. It
  is legal for the filename to be a X.Statement object instead of the name
  of a file; in such a case, the first column of the result of that
  statement is expected to contain a blob with the data in PNG format. The
  farbfeld format is also supported.

  .WITHMASK
    Causes a mask to be created from the alpha channel. If not specified,
    the alpha channel of the picture is ignored entirely.

X.makeAtom(name,[flag])(cb)
  Asks the X server for the atom with the given name. If the flag is true,
  it will not create it if does not already exist, and will return zero.
  The atom number is returned and stored in X.atom.

X.makeColor(red,green,blue)
  Returns a colour code for the given RGB values. These RGB values must be
  in range 0.0 to 1.0 in order to be valid. Alternatively you can use the
  number directly, which is 8-bit red, 8-bit green, 8-bit blue, where the
  blue is the low bits and red is higher bits.

X.onecolor
  Colour code that is guaranteed to have a pixel value of exactly one.

X.prepare(slot,text)(cb)
  Prepare a SQL statement and return a X.Statement object if acceptable.
  The slot number must be 0 to 255 and specifies which slot to load it
  into; it will invalidate any previous statement stored in that slot.
  Reloading the database invalidates all prepared statements. The SQL
  code may include host parameters (see SQLite documentation for details).
  Note that only a single SQL statement can be prepared in this way; if
  the text contains further SQL statements they are ignored. You can
  specify null as the slot which means it automatically selects one.

X.quark
  An initially empty object. Quark values for the resource manager will
  be listed here when X.initQuarks is called. You should not write into
  this object directly.

X.ringBell()
  Ring the bell. (Unfortunately on some computers it does not work.)

X.set
  A constant with the value 15. Used in multiplex codes.

X.src
  A constant with the value 3. Used to indicate the new data in a
  multiplex code.

X.sync(cb)
  Forces all X protocol requests to go through, and waits until it has
  successfully done so.

X.termAudio()
  Terminate audio.

X.unblock([e])
  Unblocks events blocked by X.block(). If this reduces the block count
  to zero, any events that were queued while blocking will now be emitted.
  The e parameter is optional, if not undefined or null, raises an error
  event after unblocking.

X.updateCurrentDirectory()
  Not normally needed by user code; other functions will automatically do
  this if a filename needs to be passed. This function will set the
  working directory of the C code to match that of the JavaScript code.

X.white
  Colour code for the default "white" colour.

X.xorcolor
  Colour code so that if you set XOR drawing function, it will switch
  between black and white.

X.zerocolor
  Colour code that is guaranteed to have a pixel value of exactly zero.


=== SQL Functions ===

X_GETRESOURCE/1
  Get a resource, given a fully qualified name. If there is none, the
  return is null.

X_GETRESOURCE/2
  Similar to above but both the name and class are specified.

X_PUTRESOURCE/1
  Put a resource, using the resource line format. Will generate a
  "resource" event.

X_SPECIALEVENT/1
  Queues a "sqlevent" event and returns null.

X_XLIB_DATA/0
  Returns a blob containing a C structure for use with extensions. The
  version of the set of members provided should be determined by the
  length of the data.


=== Cursor Shapes ===

The following cursor names are available:
  X_cursor
  arrow
  arrow_cross
  arrow_ellipsis
  arrow_minus
  arrow_plus
  based_arrow_down
  based_arrow_up
  boat
  bogosity
  bottom_left_corner
  bottom_right_corner
  bottom_side
  bottom_tee
  box_spiral
  center_ptr
  chaos
  circle
  clock
  coffee_mug
  cross
  cross_reverse
  crosshair
  diamond_cross
  diamond_medium
  diamond_outline
  diamond_small
  dot
  dot_box_mask
  double_arrow
  draft_fillsquare
  draft_head
  draft_large
  draft_small
  draft_square
  draped_box
  exchange
  fleur
  gobbler
  gumby
  hand1
  hand2
  heart
  icon
  invisible
  iron_cross
  kitchen_sink
  left_ptr
  left_right_side
  left_side
  left_tee
  leftbutton
  ll_angle
  lr_angle
  magnify
  magnify_minus
  magnify_plus
  man
  middlebutton
  mouse
  pencil
  pirate
  plus
  question_arrow
  right_ptr
  right_side
  right_tee
  rightbutton
  rtl_logo
  sailboat
  sb_down_arrow
  sb_h_double_arrow
  sb_left_arrow
  sb_right_arrow
  sb_up_arrow
  sb_v_double_arrow
  shuttle
  sizing
  spider
  spraycan
  star
  stopsign
  target
  tcross
  top_bottom_side
  top_left_arrow
  top_left_corner
  top_right_corner
  top_side
  top_tee
  trek
  tri_down
  tri_down_left
  tri_down_right
  tri_left
  tri_right
  tri_up
  tri_up_left
  tri_up_right
  ul_angle
  umbrella
  ur_angle
  watch
  xterm
  xterm_sideways
1.2.0

8 years ago

1.1.0

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago