home *** CD-ROM | disk | FTP | other *** search
/ PC Shareware 1999 March / PCShareware-3-99.iso / IMPLE / DJGPP.RAR / DJGPP2 / XLIB-SR0.ZIP / SRC / XLIBEMU / GETGEOM.C < prev    next >
C/C++ Source or Header  |  1994-02-20  |  1KB  |  47 lines

  1. /* $Id: getgeom.c 1.1 1994/02/20 17:24:11 ulrich Exp $ */
  2. /*
  3.  * X library function XGetGeometry.
  4.  */
  5. #include "Xlibemu.h"
  6.  
  7. Status
  8. XGetGeometry (Display*        dpy,
  9.           Drawable        d,
  10.           Window*        root_return,
  11.           int*        x_return,
  12.           int*        y_return,
  13.           unsigned int*    width_return,
  14.           unsigned int*    height_return,
  15.           unsigned int*    border_width_return,
  16.           unsigned int*    depth_return)
  17. {
  18.   Window w;
  19.  
  20.   switch (d->type) {
  21.   case 2:
  22.     w = (Window) d;
  23.     if (0 == _WCheckWindow (dpy, w, X_GetGeometry))
  24.       return 0;
  25.     *root_return = DefaultRootWindow (dpy);
  26.     *x_return = w->x;
  27.     *y_return = w->y;
  28.     *width_return = w->width;
  29.     *height_return = w->height;
  30.     *border_width_return = w->border_width;
  31.     *depth_return = w->depth;
  32.     return 1;
  33.   case 0:
  34.   case 1:
  35.   case 3:
  36.     *root_return = DefaultRootWindow (dpy);
  37.     *x_return = 0;
  38.     *y_return = 0;
  39.     *width_return = ((Pixmap) d)->width;
  40.     *height_return = ((Pixmap) d)->height;
  41.     *border_width_return = 0;
  42.     *depth_return = (d->type == 0) ? 1 : DefaultDepth (dpy, DefaultScreen (dpy));
  43.     return 1;
  44.   }
  45.   return 0;
  46. }
  47.