home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / voglw.zip / pref.c < prev    next >
C/C++ Source or Header  |  1997-02-13  |  1KB  |  70 lines

  1.  
  2. #include "vogl.h"
  3.  
  4. static    long    px = -1, py = -1, pxs = -1, pys = -1;
  5.  
  6. /*
  7.  * prefposition
  8.  *
  9.  *    Specify a prefered position for a window that is
  10.  *    under control of a window manager.
  11.  *    Position is the location of the upper left corner.
  12.  *    Should be called before ginit.
  13.  */
  14. void
  15. prefposition(x1, x2, y1, y2) 
  16.     long    x1, x2, y1, y2;
  17. {
  18.     if (x1 < 0 || x2 < 0)
  19.         verror("prefposition: bad x value");
  20.  
  21.     if (y1 < 0 || y2 < 0)
  22.         verror("prefposition: bad y value");
  23.  
  24.  
  25.     px = x1;
  26.     py = y1;
  27.     pxs = x2 - x1;
  28.     pys = y2 - y1;
  29.     if (pxs <= 0 || pys <= 0)
  30.         verror("prefposition: bad window size");
  31. }
  32.  
  33. /*
  34.  * prefsize
  35.  *
  36.  *    Specify the prefered size for a window under control of
  37.  *    a window manager.
  38.  *    Should be called before ginit.
  39.  */
  40. void
  41. prefsize(x, y)
  42.     long    x, y;
  43. {
  44.     if (x < 0)
  45.         verror("prefsize: bad x value");
  46.  
  47.     if (y < 0)
  48.         verror("prefsize: bad y value");
  49.  
  50.     pxs = x;
  51.     pys = y;
  52. }
  53.  
  54. /*
  55.  * getprefposandsize
  56.  *
  57.  *    Returns the prefered position and size of a window under
  58.  *    control of a window manager. (-1 for unset parameters)
  59.  */
  60. void
  61. getprefposandsize(x, y, xs, ys)
  62.     int    *x, *y, *xs, *ys;
  63. {
  64.     *x = px;
  65.     *y = py;
  66.     *xs = pxs;
  67.     *ys = pys;
  68. }
  69.  
  70.