NXlib programming and reference manual
Overview NX11 or libNX11 is a compatibility library which provides X11 compatibility for Nano-X. Before this library was developed, many programs written for the X11 interface had to be converted from that to the Nano-X API. This was very time consuming for large programs and the maintenance for newer versions of these programs was a constraint. Therefore the NX11 library was developed which provides an X11 API and translates that to Nano-X API calls. This way, you can compile X11 programs using the Nano-X and NX11 libraries instead of the X11 libraries or, since libNX11 is a binary compatible subset to Xlib, you can run programs compiled for X11 on platforms that do not have X11 available. The primary target for NX11 was to provide sufficient X11 support for the FLTK GUI library. Details how to compile the FLTK library with NX11 are provided in the faq2.html file. In previous Nano-X versions you needed to link programs both with libnano-X and libNX11. Now there is the libPX11 library available which combines both libraries. Many X11 programs link with the Xext library usually without using the included routines in there. To help porting these program, an NXext library is provided that contains stubs of the functions in the Xext library. All these libraries are compiled if you compile the Nano-X package with „make“.
Compiling X11 programs with libNX11 You can compile
a program written for the standard X11 libraries with NX11
instead. Here is an example: You can check
the libraries the application program is linked with using the
„ldd“ command. E.g. „ldd test/testarc“ Please do not expect that it does work out of the box. It takes some time and sometimes code changes may be required.
Using NX11 as a binary compatible library Since
libNX11 implements the X11 functions just as Xlib does, the
compiled libNX11 library is binary compatible to Xlib. So you can
make a symbolic link from libX11.so.6 to libNX11.so to provide X11
functions on platforms without the standard libX11.so. This way
many X11 programs will work with libNX11 instead of the standard
libX11. An alternative
is „objdump -p ./xservervendor“ which shows additional
information we may not need. Further „ldd ./xservervendor“
will show the required libraries, however, it works in recursive
mode, so it shows the libraries too, which libX11.so needs again.
This can be confusing, since we do not have to provide these with
libNX11.so. This instructs
the program loader to first look into the „microwindows/src/lib“
for required shared libraries and if these cannot be found there,
continue with the default search path. The loader will then find
the X11 libraries in „/usr/X11“.
X11 links Adrian Nye, Xlib Programming Manual for Version 11 of the X Window System Adrian Nye, Xlib Programming Manual for Version 11 of the X Window System - HTML version Basic Graphics Programming With The Xlib Library Hammond, A Brief intro to X11 Programming Ross Maloney, Fundamentals of Xlib Programming by Examples
October 2018, Georg Potthast |
Alphabetical Listing of implemented routines
This is a list of the 287 X11 compatible functions implemented in libNX11. These often do not provide the full
functionality of the corresponding X11 functions. For many other X11 functions there are just stubs implemented
which can be found in the stub.c file in the nxlib directory.
The name of each function is a link to a detailed description of the X11 function. So if click on these you will
get additional information.
Xlib function (links) |
NXlib implementation in source code file |
Short description |
Extension.c |
Allocates the XExtCodes structure. |
|
Extension.c |
Adds an extension to attach arbitrary data to any of the structures of types contained in XEDataObject. |
|
ChSaveSet.c |
Add a window's children to the client's save-set. |
|
ClassHint.c |
Allocates and returns a pointer to a XClassHint structure. |
|
AllocColor.c |
Allocate a read-only colormap cell with closest hardware-supported color. |
|
Colorname.c |
Allocate a read-only colorcell from color name. |
|
SetWMProps.c |
Allocates and returns a pointer to a XSizeHints structure |
|
Colormap.c |
Allocates and returns a pointer to a XStandardColormap structure. |
|
SetWMProps.c |
Allocates and returns a pointer to a XWMHints structure. |
|
Bell.c |
Ring the bell (Control G). |
|
OpenDis.c |
Returns the black pixel value in a screen's default colormap. |
|
CrGC.c |
Change the components of a given graphics context. |
|
ChProperty.c |
Change a property associated with a window. |
|
ChSaveSet.c |
Add or remove a subwindow from the client's save-set. |
|
SetAttributes.c |
Set window attributes. |
|
NextEvent.c |
Check the event queue for a matching event. |
|
NextEvent.c |
Remove the next event that matches mask; don't wait. |
|
NextEvent.c |
Return the next event in queue that matches event type; don't wait. |
|
NextEvent.c |
Return the next event in queue matching type and window. |
|
NextEvent.c |
Remove the next event matching both passed window and passed mask; don't wait. |
|
ClearArea.c |
Clear a rectangular area in a window. |
|
Clear.c |
Clear an entire window. |
|
Region.c |
Generate the smallest rectangle enclosing a region. |
|
ClDisplay.c |
Disconnect a client program from an X server and display. |
|
IM.c |
Closes the specified input method. |
|
ChWindow.c |
Change the window position, size, border width, or stacking order. |
|
OpenDis.c |
Returns the connection number for the specified display |
|
StrKeysym.c |
Returns the uppercase and lowercase forms of the specified Keysym |
|
Selection.c |
Use the value of a selection. |
|
Copy.c |
Copy an area of a drawable. |
|
Copy.c |
Copy a single plane of a drawable into a drawable with depth, applying pixel values. |
|
CrBFData.c |
Create a bitmap from X11 bitmap format data. |
|
Colormap.c |
Create a colormap. |
|
FontCursor.c |
Create a cursor from the standard cursor font. |
|
font-find.c |
Creates a font set for the specified display |
|
CrGC.c |
Create a new graphics context for a given screen with the depth of the specified drawable. |
|
FontCursor.c |
Create a cursor from font glyphs. |
|
IM.c |
Creates a context within the specified input method. |
|
Image.c |
Allocate memory for an XImage structure. |
|
CrPixmap.c |
Create a pixmap. |
|
CrCursor.c |
Create a cursor from two bitmaps. |
|
CrPFBData.c |
Create a pixmap with depth from bitmap data. |
|
Region.c |
Create a new empty region. |
|
CrWindow.c |
Create an unmapped InputOutput window. |
|
Window.c |
Create a window and set attributes. |
|
OpenDis.c |
Return the default colormap ID on the specified screen |
|
OpenDis.c |
Return the default colormap ID on the specified screen |
|
OpenDis.c |
Returns the depth (number of planes) of the root window. |
|
OpenDis.c |
Returns the depth (number of planes) of the root window. |
|
OpenDis.c |
Returns the root window of the default screen. |
|
OpenDis.c |
Returns the default screen number referenced by XOpenDisplay() |
|
OpenDis.c |
Returns a pointer to the Screen structure of the default screen. |
|
OpenDis.c |
Return the default visual of the specified screen. |
|
DefCursor.c |
Assign a cursor to a window. |
|
Context.c |
Delete a context entry for a given window and type. |
|
ChProperty.c |
Delete a window property. |
|
Region.c |
Deallocate storage associated with a region. |
|
DestWindow.c |
Unmap and destroy a window and all subwindows. |
|
Screen.c |
Returns an integer that describes the height of the screen in pixels. |
|
GetPntMap.c |
Returns the min- and max-keycodes supported by the specified display |
|
OpenDis.c |
Report the display name when connection to a display fails. |
|
IM.c |
Returns the display associated with the specified input method. |
|
XMisc.c |
Returns the string that was passed to XOpenDisplay() when the current display was opened. |
|
Screen.c |
Return the width of the screen in pixels. |
|
DrArc.c |
Draw an arc fitting inside a rectangle. |
|
DrArc.c |
Draw multiple arcs. |
|
Text.c |
Draw 8-bit image text characters. |
|
Text16.c |
Draw 16-bit image text characters. |
|
DrLine.c |
Draw a line between two points. |
|
DrLines.c |
Draw multiple connected lines. |
|
DrPoint.c |
Draw a point. |
|
DrPoint.c |
Draw multiple points. |
|
DrRect.c |
Draw an outline of a rectangle. |
|
DrRect.c |
Draw the outlines of multiple rectangles. |
|
DrLines.c |
Draw multiple disjoint lines. |
|
Text.c |
Draw an 8-bit text string, foreground only. |
|
Text16.c |
Draw two-byte text strings. |
|
Text16.c |
Draw 16-bit polytext strings. |
|
Extension.c |
Returns a pointer to the list of extension structures attached to the specified object (XEDataObject). |
|
Region.c |
Determine if a region is empty. |
|
Region.c |
Determine if two regions have the same size, offset, and shape. |
|
NextEvent.c |
Check the number of events in the event queue. |
|
FontInfo.c |
Returns an XFontSetExtents structure. |
|
DrArc.c |
Fill an arc. |
|
DrArc.c |
Fill multiple arcs. |
|
FillPolygon.c |
Fill a polygon. |
|
Fillrect.c |
Fill a rectangular area. |
|
Fillrect.c |
Fill multiple rectangular areas. |
|
Context.c |
Get data from the context manager (not graphics context). |
|
Extension.c |
Returns the first extension data structure for the extension numbered number. |
|
Flush.c |
Flush the output buffer (display all queued requests). |
|
GrGC.c |
Force any cached changes to the GC to be flushed to the server. |
|
Free.c |
Free specified in-memory data created by an Xlib function. |
|
Colormap.c |
Delete a colormap and install the default colormap. |
|
AllocColor.c |
Free colormap cells or planes. |
|
CrCursor.c |
Destroy a cursor. |
|
QueryFont.c |
Unload a font and free storage for the font structure. |
|
FontInfo.c |
Free multiple font information arrays. |
|
find-font.c |
Free the memory allocated by XGetFontPath. |
|
FreeGC.c |
Free a graphics context. |
|
GetPntMap.c |
Destroy and free a keyboard modifier mapping structure. |
|
CrPixmap.c |
Free a pixmap ID. |
|
TextToStr.c |
Releases memory allocated by XmbTextPropertyToTextList() and XTextPropertyToStringList() and the missing charset list by XCreateFontSet(). |
|
CrGC.c |
Obtain the GContext (resource ID) associated with the specified graphics context. |
|
Atom.c |
Get a name for a given atom. |
|
Atom.c |
Returns the names associated with the specified atoms in the names_return array. |
|
ClassHint.c |
Get the XA_WM_CLASS property of a window. |
|
GetWMProps.c |
Reads the WM_COMMAND property from the specified window. |
|
font-find.c |
Get the current font search path. |
|
font-find.c |
Get a font property given its atom. |
|
GetGCVals.c |
Returns the components specified by valuemask for the specified GC. |
|
GetGeom.c |
Obtain the current geometry of drawable. |
|
Image.c |
Place contents of a rectangle from drawable into an image. |
|
SetIFocus.c |
Return the current keyboard focus window. |
|
GetPntMap.c |
Return symbols for keycodes. |
|
GetPntMap.c |
Obtain a mapping of modifier keys (Shift, Control, etc.) |
|
GetPntMap.c |
Get the pointer button mapping. |
|
Colormap.c |
Returns the RGB colormap definitions stored in the specified property on the named window. |
|
Selection.c |
Return the owner of a selection. |
|
Image.c |
Copy a rectangle in drawable to a location within the preexisting image. |
|
GetWMProps.c |
Reads the specified property from the window and stores the data in the returned XTextProperty structure. |
|
ClassHint.c |
Get the XA_WM_TRANSIENT_FOR property of a window. |
|
Visual.c |
Find a visual information structure that matches the specified template. |
|
WindowProperty.c |
Obtain the current attributes of window. |
|
ChProperty.c |
Obtain the atom type and property format for a window. |
|
GetWMProps.c |
Calls XGetTextProperty() to return the WM_CLIENT_MACHINE property. |
|
GetWMProps.c |
Reads the window manager hints and returns a pointer to a XWMHints structure. |
|
GetWMProps.c |
Calls XGetTextProperty() to obtain the WM_ICON_NAME property. |
|
GetWMProps.c |
Calls XGetTextProperty() to obtain the WM_NAME property. |
|
SetWMProto.c |
Returns the list of atoms stored in the WM_PROTOCOLS property on the specified window. |
|
NextEvent.c |
Wait for matching event. |
|
Extension.c |
Allocates storage for the information about the extension on the connection. |
|
Image.c |
Initializes the internal image manipulation routines of an image structure. |
|
Atom.c |
Return an atom for a given name string. |
|
Atom.c |
Returns the atom identifiers associated with the specified names. |
|
Region.c |
Compute the intersection of two regions. |
|
XKB.c |
Find the string and symbol associated with a keysym for a given keyboard state |
|
StrKeysym.c |
Convert a keycode to a keysym. |
|
StrKeysym.c |
Convert a keysym to the appropriate keycode. |
|
StrKeysym.c |
Convert a keysym symbol to a string. |
|
Screen.c |
Returns the array of depths that are available on the specified screen. |
|
font-find.c |
Return a list of the available font names. |
|
ListPix.c |
Returns an array of XPixmapFormatValues structures that describe the types of Z format images supported. |
|
font-find.c |
Load a font if not already loaded; get font ID. |
|
QueryFont.c |
Load a font and fill information structure. |
|
IM.c |
Returns the locale associated with the specified input method. |
|
Threads.c |
Locks out all other threads from using the specified display. |
|
ParseColor.c |
Get database RGB values and closest hardware-supported RGB values from color name. |
|
StrKeysym.c |
Get the keysym corresponding to a keycode in structure. |
|
StrKeysym.c |
Map a key event to ASCII string, keysym, and ComposeStatus. |
|
LowerWin.c |
Lower a window in the stacking order. |
|
MapRaised.c |
Map a window on top of its siblings. |
|
MapWindow.c |
Map all subwindows. |
|
MapWindow.c |
Map a window. |
|
NextEvent.c |
Remove the next event that matches mask. |
|
Visual.c |
Obtain the visual information that matches the desired depth and class. |
|
IM.c |
Returns the string from the input method specified |
|
MoveWin.c |
Change the size and position of a window. |
|
MoveWin.c |
Move a window. |
|
NextEvent.c |
Get the next event of any type or window. |
|
Request.c |
Extracts the full serial number that is to be used for the next request. |
|
Sync.c |
Send a NoOp to exercise connection with the server. |
|
Region.c |
Change offset of a region. |
|
Opendis.c |
Connect a client program to an X server. |
|
IM.c |
Opens an input method, matching the current locale and modifiers specification. |
|
ParseColor.c |
Look up or translate RGB values from ASCII color name or hexadecimal value. |
|
NextEvent.c |
Get an event without removing it from the queue. |
|
NextEvent.c |
Flush the output buffer and return the number of pending input events. |
|
Region.c |
Determine if a point is inside a region. |
|
Region.c |
Generate a region from points. |
|
NextEvent.c |
Push an event back on the input queue. |
|
Image.c |
Draw a rectangular image on a window or pixmap. |
|
NextEvent.c |
Return the length of the event queue for the connected display. |
|
QueryBest.c |
Obtain the “best” supported cursor, tile, or stipple size. |
|
QueryColor.c |
Obtain the RGB values and flags for a specified pixel value. |
|
QueryColor.c |
Obtain RGB values for an array of pixel values. |
|
Extension.c |
Get extension information. |
|
QueryFont.c |
Return information about a loaded font. |
|
QueryPointer.c |
Get the current pointer location. |
|
QueryTree.c |
Return a list of children, parent, and root. |
|
RaiseWin.c |
Raise a window to the top of the stacking order. |
|
XMisc.c |
Read a bitmap from disk. |
|
XMisc.c |
Reads in a file containing a bitmap returning the data directly without creating a pixmap in the server. |
|
Region.c |
Determine if a rectangle resides in a region. |
|
StrKeysym.c |
Update the stored modifier and keymap information. |
|
ChSaveSet.c |
Remove a window's children from the client's save-set. |
|
RepWindow.c |
Change a window's parent. |
|
ChWindow.c |
Change a window's size. |
|
OpenDis.c |
Returns the root window. |
|
OpenDis.c |
Returns the root window. |
|
Context.c |
Save a data value corresponding to a window and context type (not graphics). |
|
OpenDis.c |
Returns a screen number given a pointer to a Screen structure. |
|
SelInput.c |
Select the event types to be sent to a window. |
|
OpenDis.c |
Returns the vendor of connected server. |
|
ClassHint.c |
Set the XA_WM_CLASS property of a window. |
|
Locale.c |
Sets the X modifiers for the current locale setting. |
|
ClassHint.c |
Set the size hints property of a window in normal state (not zoomed or iconified). |
|
SetWMProps.c |
Replaces the existing specified property for the named window. |
|
ClassHint.c |
Set the XA_WM_TRANSIENT_FOR property of a window. |
|
SetWMProps.c |
Calls XSetTextProperty() to set the WM_CLIENT_MACHINE property. |
|
SetWMProto.c |
replaces the WM_PROTOCOLS property on the specified window. |
|
SetWMProps.c |
Replaces the size hints for the specified property on the named window. |
|
CrGC.c |
Set the background pixel value in a graphics context. |
|
SetClip.c |
Set clip_mask pixmap in a graphics context. |
|
SetClip.c |
Set the clip origin in a graphics context. |
|
SetClip.c |
Change clip_mask in a graphics context to the list of rectangles. |
|
CrGC.c |
Set dash_offset and dashes (for lines) in a graphics context. |
|
CrGC.c |
Set the fill style in a graphics context. |
|
CrGC.c |
Set the current font in a graphics context. |
|
font-find. |
Set the font search path. |
|
CrGC.c |
Set the foreground pixel value in a graphics context. |
|
CrGC.c |
Set graphics_exposures in a graphics context. |
|
ErrorHandler.c |
Sets the fatal I/O error handler. |
|
StName.c |
Set the name to be displayed in a window's icon. |
|
SetIFocus.c |
Set the keyboard focus window. |
|
SetAttributes.c |
Set the line drawing components in a graphics context. |
|
Region.c |
Set clip_mask of the graphics context to the specified region. |
|
Selection.c |
Set the owner of a selection. |
|
CrGC.c |
Set the stipple in a graphics context. |
|
CrGC.c |
Set the subwindow mode in a graphics context. |
|
CrGC.c |
Sets the tile/stipple origin in the specified GC |
|
CrGC.c |
Set the fill tile in a graphics context. |
|
SetWMProps.c |
Set the XA_WM_TRANSIENT_FOR property of a window. |
|
SetWMProps.c |
Sets the window manager hints. |
|
SetWMProps.c |
Sets the WM_ICON_NAME property. |
|
SetWMProps.c |
Sets the WM_NAME property. |
|
SetWMProps.c |
Replaces the size hints for the WM_NORMAL_HINTS property on the specified window. |
|
SetWMProps.c |
Sets the window properties for communicating with other clients, e.g. window and session managers. |
|
Backgnd.c |
Set the background pixel attribute of a window. |
|
PmapBgnd.c |
Change the background tile attribute of a window. |
|
Border.c |
Change a window border attribute to the specified pixel value and repaint the border. |
|
BdrWidth.c |
Change the border width of a window. |
|
Shape.c |
Returns True if the specified display supports the SHAPE extension else False. |
|
Shape.c |
The major and minor version numbers of the extension supported by the display are set. |
|
XMisc.c |
Store data in a cut buffer. |
|
XMisc.c |
Store data in cut buffer 0. |
|
StName.c |
Assign a name to a window for the window manager. |
|
StrToText.c |
Set the specified list of strings to an XtextProperty structure. |
|
StrKeysym.c |
Convert a keysym name string to a keysym. |
|
Region.c |
Subtract one region from another. |
|
Sync.c |
Flush the output buffer and wait for all events and errors to be processed by the server. |
|
TextExt.c |
Get string and font metrics. |
|
TextExt.c |
Get string and font metrics of a 16-bit character string. |
|
TextToStr.c |
Returns a list of strings representing the null-separated elements of the specified XTextProperty structure. |
|
TextExt.c |
Get the width in pixels of an 8-bit character string. |
|
TextExt.c |
Get the width in pixels of a 16-bit character string. |
|
QueryPointer.c |
Change the coordinate system from one window to another. |
|
UndefCurs.c |
Disassociate a cursor from a window. |
|
Region.c |
Add a rectangle to a region. |
|
Region.c |
Compute the union of two regions. |
|
UnloadFont.c |
Unload a font. |
|
Threads.c |
Allows other threads to use the specified display again. |
|
UnmapWindow.c |
Unmap a window. |
|
OpenDis.c |
Returns the visual ID for the specified visual type. |
|
OpenDis.c |
Returns the white pixel value in a screen's default colormap. |
|
NextEvent.c |
Remove the next event matching mask and window. |
|
UnmapWindow.c |
Unmap a window. |
|
Region.c |
Calculate the difference between the union and intersection of two regions. |
|
SetWMProps.c |
Sets the window properties for communicating with other clients, e.g. window and session managers. |
|
StrToText.c |
Convert an internationalized multi-byte text list to a text property structure. |
|
Xrm.c |
Merges the contents of one database into another. |
|
Xrm.c |
Merges the contents of a resource file into a database. |
|
Xrm.c |
Destroy a resource database and free its allocated memory. |
|
Xrm.c |
Enumerate the entries of a database. |
|
Xrm.c |
Retrieve a database from disk. |
|
Xrm.c |
Retrieves a resource from the specified database. |
|
Xrm.c |
Create a database from a string. |
|
Xrm.c |
Initialize the resource manager. |
|
Xrm.c |
Obtains the locale name of a database. |
|
Xrm.c |
Merges the contents of one database into another; overrides. |
|
ParseCmd.c |
Loads a resource database from a C command line |
|
Xrm.c |
Store a copy of a database to disk. |
|
Xrm.c |
Adds a single resource entry to the specified database. |
|
Xrm.c |
Store resources into the database. |
|
Xrm.c |
Adds a resource with the specified value to the specified database. |
|
Xrm.c |
Retrieves a resource from a resource database. |
|
Xrm.c |
Obtains a list of database levels. |
|
Xrm.c |
Search resource database levels for a given resource. |
|
Xrm.c |
If a resource entry with the identical bindings and quarks already exists in the database, the previous type and value are replaced. |
|
Xrm.c |
Add a string resource using quarks as a specification. |
|
Xrm.c |
Associates a resource database with a display. |
|
Xrm.c |
Convert a string with one or more components to a binding list and a quark list. |
|
Xrm.c |
Convert a string with one or more components to a quark list. |
|
SetWMProps.c |
Sets the window properties for communicating with other clients, e.g. window and session managers. |
|
StrToText.c |
Free the in-memory data associated with the specified wide character string list. |
|
StrToText.c |
Convert a list of text strings to an XTextProperty structure. |
|
StrToText.c |
Obtain a list of text strings from an XTextProperty structure. |