home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 5 / MA_Cover_5.iso / ppc / mesa / src-glut / glut_winmisc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-31  |  3.1 KB  |  122 lines

  1. /* Copyright (c) Mark J. Kilgard, 1994.  */
  2.  
  3. /* This program is freely distributable without licensing fees
  4.    and is provided without guarantee or warrantee expressed or
  5.    implied. This program is -not- in the public domain. */
  6.  
  7. #include <stdlib.h>
  8. #include <stdio.h>
  9. #include <string.h>
  10. #include <assert.h>
  11.  
  12. #if !defined(WIN32)
  13. #include <X11/Xlib.h>
  14. #include <X11/Xutil.h>
  15. #include <X11/Xatom.h>  /* for XA_STRING atom */
  16. #else
  17. extern int __glutMinWindowWidth;
  18. extern int __glutMinWindowHeight;
  19. #endif /* !WIN32 */
  20.  
  21. #include <GL/glut.h>
  22. #include "glutint.h"
  23.  
  24. /* CENTRY */
  25. void APIENTRY 
  26. glutSetWindowTitle(const char *title)
  27. {
  28.   XTextProperty textprop;
  29.  
  30.   assert(!__glutCurrentWindow->parent);
  31.   textprop.value = (unsigned char *) title;
  32.   textprop.encoding = XA_STRING;
  33.   textprop.format = 8;
  34.   textprop.nitems = strlen(title);
  35.   XSetWMName(__glutDisplay,
  36.     __glutCurrentWindow->win, &textprop);
  37.   XFlush(__glutDisplay);
  38. }
  39.  
  40. void APIENTRY 
  41. glutSetIconTitle(const char *title)
  42. {
  43.   XTextProperty textprop;
  44.  
  45.   assert(!__glutCurrentWindow->parent);
  46.   textprop.value = (unsigned char *) title;
  47.   textprop.encoding = XA_STRING;
  48.   textprop.format = 8;
  49.   textprop.nitems = strlen(title);
  50.   XSetWMIconName(__glutDisplay,
  51.     __glutCurrentWindow->win, &textprop);
  52.   XFlush(__glutDisplay);
  53. }
  54.  
  55. void APIENTRY 
  56. glutPositionWindow(int x, int y)
  57. {
  58.   __glutCurrentWindow->desiredX = x;
  59.   __glutCurrentWindow->desiredY = y;
  60.   __glutCurrentWindow->desiredConfMask |= CWX | CWY;
  61.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
  62. }
  63.  
  64. void APIENTRY 
  65. glutReshapeWindow(int w, int h)
  66. {
  67.   if (w <= 0 || h <= 0)
  68.     __glutWarning("glutReshapeWindow: non-positive width or height not allowed");
  69.  
  70. #if defined(WIN32)
  71.   if (w < __glutMinWindowWidth && !__glutCurrentWindow->parent)
  72.     __glutWarning("requested width is less than minimum allowed.");
  73.   if (h < __glutMinWindowHeight && !__glutCurrentWindow->parent)
  74.     __glutWarning("requested height is less than minimum allowed.");
  75. #endif /* WIN32 */
  76.  
  77.   __glutCurrentWindow->desiredWidth = w;
  78.   __glutCurrentWindow->desiredHeight = h;
  79.   __glutCurrentWindow->desiredConfMask |= CWWidth | CWHeight;
  80.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
  81. }
  82.  
  83. void APIENTRY 
  84. glutPopWindow(void)
  85. {
  86.   __glutCurrentWindow->desiredStack = Above;
  87.   __glutCurrentWindow->desiredConfMask |= CWStackMode;
  88.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
  89. }
  90.  
  91. void APIENTRY 
  92. glutPushWindow(void)
  93. {
  94.   __glutCurrentWindow->desiredStack = Below;
  95.   __glutCurrentWindow->desiredConfMask |= CWStackMode;
  96.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
  97. }
  98.  
  99. void APIENTRY 
  100. glutIconifyWindow(void)
  101. {
  102.   assert(!__glutCurrentWindow->parent);
  103.   __glutCurrentWindow->desiredMapState = IconicState;
  104.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
  105. }
  106.  
  107. void APIENTRY 
  108. glutShowWindow(void)
  109. {
  110.   __glutCurrentWindow->desiredMapState = NormalState;
  111.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
  112. }
  113.  
  114. void APIENTRY 
  115. glutHideWindow(void)
  116. {
  117.   __glutCurrentWindow->desiredMapState = WithdrawnState;
  118.   __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
  119. }
  120.  
  121. /* ENDCENTRY */
  122.