Annotation of researchv9/X11/src/X.V11R1/lib/X/XGeom.c, revision 1.1.1.1

1.1       root        1: #include "copyright.h"
                      2: 
                      3: /* $Header: XGeom.c,v 1.2 87/09/11 08:09:25 toddb Exp $/
                      4: /* Copyright Massachusetts Institute of Technology 1985 */
                      5: 
                      6: #include "Xlibint.h"
                      7: #include "Xutil.h"
                      8: 
                      9: /*
                     10:  * This routine given a user supplied positional argument and a default
                     11:  * argument (fully qualified) will return the position the window should take
                     12:  * returns 0 if there was some problem, else the position bitmask.
                     13:  */
                     14: 
                     15: int XGeometry (dpy, screen, pos, def, bwidth, fwidth, fheight, xadd, yadd, x, y, width, height)
                     16:      Display *dpy;                     /* user's display connection */
                     17:      int screen;                       /* screen on which to do computation */
                     18:      char *pos;                                /* user provided geometry spec */
                     19:      char *def;                                /* default geometry spec for window */
                     20:      unsigned int bwidth;              /* border width */
                     21:      unsigned int fwidth, fheight;     /* size of position units */
                     22:      int xadd, yadd;                   /* any additional interior space */
                     23:      register *x, *y, *width, *height; /* always set on successful RETURN */
                     24: {
                     25:        int px, py, pwidth, pheight;    /* returned values from parse */
                     26:        int dx, dy, dwidth, dheight;    /* default values from parse */
                     27:        int pmask, dmask;               /* values back from parse */
                     28: 
                     29:        pmask = XParseGeometry(pos, &px, &py, &pwidth, &pheight);
                     30:        dmask = XParseGeometry(def, &dx, &dy, &dwidth, &dheight);
                     31: 
                     32:        /* set default values */
                     33:        *x = (dmask & XNegative) ? 
                     34:            DisplayWidth(dpy, screen)  + dx - dwidth * fwidth - 
                     35:                2 * bwidth - xadd : dx;
                     36:        *y = (dmask & YNegative) ? 
                     37:            DisplayHeight(dpy, screen) + dy - dheight * fheight - 
                     38:                2 * bwidth - yadd : dy;
                     39:        *width  = dwidth;
                     40:        *height = dheight;
                     41: 
                     42:        if (pmask & WidthValue)  *width  = pwidth;
                     43:        if (pmask & HeightValue) *height = pheight;
                     44: 
                     45:        if (pmask & XValue)
                     46:            *x = (pmask & XNegative) ?
                     47:              DisplayWidth(dpy, screen) + px - *width * fwidth - 
                     48:                  2 * bwidth - xadd : px;
                     49:        if (pmask & YValue)
                     50:            *y = (pmask & YNegative) ?
                     51:              DisplayHeight(dpy, screen) + py - *height * fheight - 
                     52:                  2 * bwidth - yadd : py;
                     53:        return (pmask);
                     54: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.