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