Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

XAllocColor(3X11)

XCreateColormap(3X11)

XGetDefault(3X11)

XSetWMProperties(3X11)

XStoreColors(3X11)

XParseGeometry(3X11)  —  UNIX Programmer’s Manual

NAME

XParseGeometry, XParseColor − parse window geometry and color

SYNTAX

int XParseGeometry(parsestring, x_return, y_return, width_return, height_return)
      char ∗parsestring;
      int ∗x_return, ∗y_return;
      int ∗width_return, ∗height_return;

Status XParseColor(display, colormap, spec, exact_def_return)
        Display ∗display;
        Colormap colormap;
        char ∗spec;
        XColor ∗exact_def_return;

ARGUMENTS

colormapSpecifies the colormap. 

position

default_position
Specify the geometry specifications.

displaySpecifies the connection to the X server. 

exact_def_return
Returns the exact color value for later use and sets the DoRed, DoGreen, and DoBlue flags.

fheight

fwidthSpecify the font height and width in pixels (increment size). 

parsestringSpecifies the string you want to parse. 

screenSpecifies the screen. 

specSpecifies the color name string; case is ignored. 

width_return

height_return
Return the width and height determined.

xadder

yadderSpecify additional interior padding needed in the window. 

x_return

y_returnReturn the x and y offsets. 

DESCRIPTION

By convention, X applications use a standard string to indicate window size and placement.  XParseGeometry makes it easier to conform to this standard because it allows you to parse the standard window geometry. Specifically, this function lets you parse strings of the form:

[=][<width>x<height>][{+-}<xoffset>{+-}<yoffset>]

The items in this form map into the arguments associated with this function.  (Items enclosed in <> are integers, items in [] are optional, and items enclosed in {} indicate “choose one of”. Note that the brackets should not appear in the actual string.)

The XParseGeometry function returns a bitmask that indicates which of the four values (width, height, xoffset, and yoffset) were actually found in the string and whether the x and y values are negative. By convention, −0 is not equal to +0, because the user needs to be able to say “position the window relative to the right or bottom edge.” For each value found, the corresponding argument is updated. For each value not found, the argument is left unchanged. The bits are represented by XValue, YValue, WidthValue, HeightValue, XNegative, or YNegative and are defined in <X11/Xutil.h>. They will be set whenever one of the values is defined or one of the signs is set.

If the function returns either the XValue or YValue flag, you should place the window at the requested position.

The XParseColor function provides a simple way to create a standard user interface to color. It takes a string specification of a color, typically from a command line or XGetDefault option, and returns the corresponding red, green, and blue values that are suitable for a subsequent call to XAllocColor or XStoreColor. The color can be specified either as a color name (as in XAllocNamedColor) or as an initial sharp sign character followed by a numeric specification, in one of the following formats:

#RGB(4 bits each)
#RRGGBB(8 bits each)
#RRRGGGBBB(12 bits each)
#RRRRGGGGBBBB(16 bits each)

The R, G, and B represent single hexadecimal digits (both uppercase and lowercase).  When fewer than 16 bits each are specified, they represent the most-significant bits of the value.  For example, #3a7 is the same as #3000a0007000.  The colormap is used only to determine which screen to look up the color on.  For example, you can use the screen’s default colormap. 

If the initial character is a sharp sign but the string otherwise fails to fit the above formats or if the initial character is not a sharp sign and the named color does not exist in the server’s database, XParseColor fails and returns zero.

XParseColor can generate a BadColor error.

DIAGNOSTICS

BadColor A value for a Colormap argument does not name a defined Colormap. 

SEE ALSO

XAllocColor(3X11), XCreateColormap(3X11), XGetDefault(3X11), XSetWMProperties(3X11), XStoreColors(3X11)
Xlib − C Language X Interface

X Version 11  —  Release 4

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026