summaryrefslogtreecommitdiffstats
path: root/src/glut/os2/glut_winmisc.cpp
blob: 7cd6699924f7206eabb7374be0a69c9cdc3612d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

/* Copyright (c) Mark J. Kilgard, 1994.  */

/* This program is freely distributable without licensing fees
   and is provided without guarantee or warrantee expressed or
   implied. This program is -not- in the public domain. */


#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>


#include "glutint.h"

/* CENTRY */
void GLUTAPIENTRY
glutSetWindowTitle(const char *title)
{
#if defined(__OS2PM__)
   __glutSetWindowText(__glutCurrentWindow->win, (char *)title);

#else
  XTextProperty textprop;

  assert(!__glutCurrentWindow->parent);
  IGNORE_IN_GAME_MODE();
  textprop.value = (unsigned char *) title;
  textprop.encoding = XA_STRING;
  textprop.format = 8;
  textprop.nitems = strlen(title);
  XSetWMName(__glutDisplay,
    __glutCurrentWindow->win, &textprop);
  XFlush(__glutDisplay);
#endif
}

void GLUTAPIENTRY
glutSetIconTitle(const char *title)
{
#if defined(__OS2PM__)
//todo ?
#else

  XTextProperty textprop;

  assert(!__glutCurrentWindow->parent);
  IGNORE_IN_GAME_MODE();
  textprop.value = (unsigned char *) title;
  textprop.encoding = XA_STRING;
  textprop.format = 8;
  textprop.nitems = strlen(title);
  XSetWMIconName(__glutDisplay,
    __glutCurrentWindow->win, &textprop);
  XFlush(__glutDisplay);
#endif
}

void GLUTAPIENTRY
glutPositionWindow(int x, int y)
{
  IGNORE_IN_GAME_MODE();
  __glutCurrentWindow->desiredX = x;
  __glutCurrentWindow->desiredY = y;
  __glutCurrentWindow->desiredConfMask |= CWX | CWY;
  __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
}

void GLUTAPIENTRY
glutReshapeWindow(int w, int h)
{
  IGNORE_IN_GAME_MODE();
  if (w <= 0 || h <= 0)
    __glutWarning("glutReshapeWindow: non-positive width or height not allowed");

  __glutCurrentWindow->desiredWidth = w;
  __glutCurrentWindow->desiredHeight = h;
  __glutCurrentWindow->desiredConfMask |= CWWidth | CWHeight;
  __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
}

void GLUTAPIENTRY
glutPopWindow(void)
{
  IGNORE_IN_GAME_MODE();
  __glutCurrentWindow->desiredStack = Above;
  __glutCurrentWindow->desiredConfMask |= CWStackMode;
  __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
}

void GLUTAPIENTRY
glutPushWindow(void)
{
  IGNORE_IN_GAME_MODE();
  __glutCurrentWindow->desiredStack = Below;
  __glutCurrentWindow->desiredConfMask |= CWStackMode;
  __glutPutOnWorkList(__glutCurrentWindow, GLUT_CONFIGURE_WORK);
}

void GLUTAPIENTRY
glutIconifyWindow(void)
{
  IGNORE_IN_GAME_MODE();
  assert(!__glutCurrentWindow->parent);
  __glutCurrentWindow->desiredMapState = IconicState;
  __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
}

void GLUTAPIENTRY
glutShowWindow(void)
{
  IGNORE_IN_GAME_MODE();
  __glutCurrentWindow->desiredMapState = NormalState;
  __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
}

void GLUTAPIENTRY
glutHideWindow(void)
{
  IGNORE_IN_GAME_MODE();
  __glutCurrentWindow->desiredMapState = WithdrawnState;
  __glutPutOnWorkList(__glutCurrentWindow, GLUT_MAP_WORK);
}

/* ENDCENTRY */