XParseGeometry(3X11)RISC/os Reference Manual XParseGeometry(3X11)
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
colormap Specifies the colormap.
position
default_position
Specify the geometry specifications.
display Specifies 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
fwidth Specify the font height and width in pixels
(increment size).
parsestring
Specifies the string you want to parse.
screen Specifies the screen.
spec Specifies the color name string; case is ignored.
width_return
height_return
Return the width and height determined.
xadder
yadder Specify additional interior padding needed in the
window.
x_return
y_return Return the x and y offsets.
Printed 1/24/91 Release 4 Page 1
XParseGeometry(3X11)RISC/os Reference Manual XParseGeometry(3X11)
DESCRIPTION
By convention, X applications use a standard string to indi-
cate 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, Height-
Value, 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 specif-
ication of a color, typically from a command line or XGetDe-
fault option, and returns the corresponding red, green, and
blue values that are suitable for a subsequent call to XAl-
locColor 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:
(Reg.) #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
Release 4 Page 2 Printed 1/24/91
XParseGeometry(3X11)RISC/os Reference Manual XParseGeometry(3X11)
colormap.
If the initial character is a sharp sign but the string oth-
erwise 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
Printed 1/24/91 Release 4 Page 3