Appendix I


© 1995 , 1996 Gregg M. Townsend, Ralph E. Griswold, and Clinton L. Jeffery

The X Window System

This appendix discusses issues that are specific to implementations of Icon running under the X Window System.

Under X, an Icon program is a client that performs graphical I/O on a server. The client and server can be the same machine, as when a program runs and displays locally on a workstation, or on different machines. A remote server can be specified by using the display attribute when opening a window.

There are many implementations of X, and different systems provide different features, so this appendix can't say precisely how things will work in all situations.

Color Specifications

Color specifications that are not recognized by Icon are passed to X for interpretation. X servers typically offer large sets of color names, including unusual ones such as orchid and papayawhip.

Color correction is controlled by the gamma attribute. The default value of gamma is based on the color returned by X for the device-independent X color specification RGBi:.5/.5/.5. On older X systems that do not recognize this specification, a configuration default value is used.

The interpretation of RGBi:.5/.5/.5 depends on properties associated with the root window. These properties are set by the xcmsdb utility. The library program xgamma can be used to set the properties to approximate a particular gamma value.

Font Specifications

In interpreting a font specification, Icon recognizes the following font characteristics and tries to match them as well as possible against the available X fonts:
   condensed, narrow, normal, wide, extended
   light, medium, demi, bold, demibold
   roman, italic, oblique
   mono, proportional
   sans, serif
The same specification can produce fonts of different appearance on different servers.

If a font specification is not understood or matched by Icon's font naming system, it is passed verbatim to X as a font name. This allows the use of native X font specifications, including wild cards. As a special case, a font specification of "fixed" (without any size or other characteristics) is passed to X as a font name without interpretation.

Drawing Operations

In addition to the special reverse value, the drawop attribute can be set to any of the sixteen standard X logical functions. These are listed in the following table. The value of each destination pixel is set by combining the source value (foreground pixel code) with the existing destination pixel code using the bitwise operations indicated below:

drawop= result
and source AND dest andInverted COMPL(source) AND dest andReverse source AND COMPL(dest) clear all bits 0 copy source copyInverted COMPL(source) equiv COMPL(source) XOR dest invert COMPL(dest) nand COMPL(source) OR COMPL(dest) noop dest nor COMPL(source) AND COMPL(dest) or source OR dest orInverted COMPL(source) OR dest orReverse source OR COMPL(dest) set all bits 1 xor source XOR dest
Note that the foreground pixel value cannot be set to an arbitrary bit pattern, but only to the code of an assigned color. The one exception is drawop=reverse, where the XOR of the foreground and background values is used with an XOR logical function.

Images

In ReadImage(), if an image file is not a valid GIF file, an attempt is made to read it as an X Bitmap or X Pixmap file.

In WriteImage(), if the file name ends in .xbm or .XBM, an X Bitmap file written. If the file name ends in .xpm or .XPM, an X Pixmap file is written. If the file name ends in .xpm.Z, a compressed X Pixmap file is written. In all other cases a GIF image is written.

X Resources

Default() returns values registered with the X Resource Manager. These values often are set by an .Xresources or .Xdefaults file.

Keyboard Event Codes

Icon uses X keysym codes as event codes. The actual code returned for a particular key depends on the configuration of the X server; this can be altered dynamically by the xmodmap utility. For example, the Sun keypad has one key labeled "3", "PgDn", and "R15". Whether this key produces an Icon event "3", Key_PgDn, Key_R15, or even something else depends on the X configuration.

Appendix D lists codes for keys that are found on many keyboards. A larger set is listed in the library file keysyms.icn.

Cursors and Pointers

The text cursor is an underscore character. It is visible only when the cursor attribute is on and the program is awaiting input in WRead() or WReads(). The cursor does not blink and may be hard to locate in a window containing a large amount of text.

The mouse location indicator, set by the pointer attribute, is selected from the X cursor font. The following values are accepted:



The default mouse location indicator is "left ptr".



Back to Contents