04.04.2013 Views

Volume One: Xlib Programming Manual - Niksula

Volume One: Xlib Programming Manual - Niksula

Volume One: Xlib Programming Manual - Niksula

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figure 13−2. R4 Procedure for processing resource specifications with resource manager functions<br />

Routines that use these functions are shown and described in Chapter 14, "A Complete Application."<br />

13.3 Standard Geometry<br />

<strong>One</strong> of the preferences that must be handled by clients is the preferred size and placement of a window or icon. By<br />

convention, rather than having the user specify various elements of the size and placement with separate options, clients<br />

accept a single standard geometry string, which has the following format:<br />

x{+−}{+−}<br />

Items enclosed in are integers, and items enclosed in {} are a set from which one item is allowed. The xoffset and<br />

yoffset values are optional. They determine the position of the window or icon−−for the top−level window, they are,<br />

by convention, interpreted relative to the origin of the root window. The convention is that if the sign of xoffset or<br />

yoffset is positive, they specify that the offset is measured from the top or left edge of the application window to the top<br />

or left edge of the screen. If the sign of xoffset or yoffset is negative, they specify that the offset is measured from<br />

the bottom or right edge of the application window to the bottom or right edge of the screen.<br />

After being read in from the command line or from a preference file, this string can be separated into separate x, y,<br />

width, and height values with XParseGeometry(). See Chapter 14, "A Complete Application "for an example<br />

that uses XParseGeometry().<br />

In addition, there is a function called XWMGeometry() that can be used to parse a partial geometry specification from the<br />

user. XWMGeometry() takes a geometry string specified (presumably) by the user, which might not be complete, and the<br />

set of size hints that define the programs desired geometry. If the user−specified string specifies an element of the<br />

geometry, that value is used; otherwise, the corresponding value from program’s default geometry string is used. The

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!