Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

XParseGeometry(3X11)



XParseGeometry(3X11)                         XParseGeometry(3X11)



NAME
     XParseGeometry, XGeometry, 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;

     int XGeometry(display, screen, position, default_position,
     bwidth, fwidth, fheight,
              xadder, yadder, x_return, y_return, width_return,
     height_return)
           Display *display;
           int screen;
           char *position, *default_position;
           unsigned int bwidth;
           unsigned int fwidth, fheight;
           int xadder, yadder;
           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
     bwidth    Specifies the border width.

     colormap  Specifies the colormap.

     position
     default_position
               Specify the geometry specifications.

     display   Specifies the connection to the XWIN 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.



XWIN 3.0               Last change: 9/1/88                 .ie t





XParseGeometry(3X11)                         XParseGeometry(3X11)



     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.

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.

     You pass in the border width (bwidth), size of the incre-
     ments fwidth and fheight (typically font width and height),
     and any additional interior space (xadder and yadder) to
     make it easy to compute the resulting size.  The XGeometry
     function returns the position the window should be placed
     given a position and a default position.  XGeometry



XWIN 3.0               Last change: 9/1/88                 .ie t





XParseGeometry(3X11)                         XParseGeometry(3X11)



     determines the placement of a window using a geometry
     specification as specified by XParseGeometry and the addi-
     tional information about the window.  Given a fully quali-
     fied default geometry specification and an incomplete
     geometry specification, XParseGeometry returns a bitmask
     value as defined above in the XParseGeometry call, by using
     the position argument.

     The returned width and height will be the width and height
     specified by default_position as overridden by any user-
     specified position.  They are not affected by fwidth,
     fheight, xadder, or yadder.  The x and y coordinates are
     computed by using the border width, the screen width and
     height, padding as specified by xadder and yadder, and the
     fheight and fwidth times the width and height from the
     geometry specifications.

     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:

          #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 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.




XWIN 3.0               Last change: 9/1/88                 .ie t





XParseGeometry(3X11)                         XParseGeometry(3X11)



SEE ALSO
     Xlib - C Language X Interface





















































XWIN 3.0               Last change: 9/1/88                 .ie t





XParseGeometry(3X11)                         XParseGeometry(3X11)























































XWIN 3.0               Last change: 9/1/88                 .ie t






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