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