|
|
1.1 root 1: #include <X/mit-copyright.h>
2:
3: /* $Header: XGeom.c,v 10.5 86/02/01 15:34:27 tony Rel $/
4: /* Copyright Massachusetts Institute of Technology 1985 */
5:
6: #include "XlibInternal.h"
7:
8: /*
9: * This routine given a user supplied positional argument and a default
10: * argument (fully qualified) will return the position the window should take
11: * returns 0 if there was some problem, else the position bitmask.
12: */
13:
14: int XGeometry (pos, def, bwidth, fwidth, fheight, xadd, yadd, x, y, width, height)
15: char *pos; /* user provided geometry spec */
16: char *def; /* default geometry spec for window */
17: int bwidth; /* border width */
18: int fwidth, fheight; /* size of position units */
19: int xadd, yadd; /* any additional interior space */
20: register *x, *y, *width, *height; /* always set on successful RETURN */
21: {
22: int px, py, pwidth, pheight; /* returned values from parse */
23: int dx, dy, dwidth, dheight; /* default values from parse */
24: int pmask, dmask; /* values back from parse */
25:
26: pmask = XParseGeometry(pos, &px, &py, &pwidth, &pheight);
27: dmask = XParseGeometry(def, &dx, &dy, &dwidth, &dheight);
28:
29: /* set default values */
30: *x = (dmask & XNegative) ?
31: DisplayWidth() + dx - dwidth * fwidth - 2 * bwidth - xadd : dx;
32: *y = (dmask & YNegative) ?
33: DisplayHeight() + dy - dheight * fheight - 2 * bwidth - yadd : dy;
34: *width = dwidth;
35: *height = dheight;
36:
37: if (pmask & WidthValue) *width = pwidth;
38: if (pmask & HeightValue) *height = pheight;
39:
40: if (pmask & XValue)
41: *x = (pmask & XNegative) ?
42: DisplayWidth() + px - *width * fwidth - 2 * bwidth - xadd : px;
43: if (pmask & YValue)
44: *y = (pmask & YNegative) ?
45: DisplayHeight() + py - *height * fheight - 2 * bwidth - xadd: py;
46:
47: return (pmask);
48: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.