\r
void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY );\r
void Redisplay();\r
-void Reshape(int x, int y);\r
+void Reshape(int width, int height);\r
+void Position(int x, int y);\r
+void WindowStatus(int state);\r
\r
\r
\r
glEnd();\r
}\r
\r
+void UnhideTimer(int window)\r
+{\r
+ glutSetWindow(window);\r
+ glutShowWindow();\r
+}\r
+\r
void SampleKeyboard( unsigned char cChar, int nMouseX, int nMouseY )\r
{\r
switch (cChar)\r
glutKeyboardFunc( SampleKeyboard );\r
glutDisplayFunc( Redisplay );\r
glutReshapeFunc( Reshape );\r
+ glutPositionFunc( Position );\r
+ glutWindowStatusFunc( WindowStatus );\r
}\r
else\r
{\r
break;\r
\r
\r
+ case 'i':\r
+ case 'I':\r
+ glutIconifyWindow();\r
+ break;\r
+\r
+\r
+ case 'h':\r
+ case 'H':\r
+ if (nChildWindow!=-1 && cChar=='h') /* Capital H always hides the main window*/\r
+ {\r
+ glutSetWindow(nChildWindow);\r
+ glutTimerFunc(2000, UnhideTimer, nChildWindow);\r
+ }\r
+ else\r
+ {\r
+ glutSetWindow(nWindow);\r
+ glutTimerFunc(2000, UnhideTimer, nWindow);\r
+ }\r
+ glutHideWindow();\r
+\r
default:\r
break;\r
}\r
{\r
int win = glutGetWindow();\r
\r
- printf("position %s, %dx%d\n",win==nWindow?"main":"child",\r
+ printf("position, %s: (%d,%d)\n",win==nWindow?"top-left of main":"top-left of child relative to parent",\r
x, y);\r
}\r
\r
+void WindowStatus(int state)\r
+{\r
+ int win = glutGetWindow();\r
+ printf("windowstatus (win %i): %i\n",win,state);\r
+}\r
+\r
void Redisplay(void)\r
{\r
int win = glutGetWindow();\r
glutPostWindowRedisplay(win);\r
}\r
\r
-void Timer(int unused)
-{
- int win = glutGetWindow();
+void Timer(int unused)\r
+{\r
+ int win = glutGetWindow();\r
int border, caption;\r
\r
nPosX = glutGet(GLUT_WINDOW_X);\r
else\r
printf("child window %dx%d, top-left of client at: (%d,%d), relative to parent\n",\r
nWidth, nHeight,\r
- nPosX ,nPosY);
-
- /* (re)set the timer callback and ask glut to call it in 1 second */
- glutTimerFunc(300, Timer, 0);
+ nPosX ,nPosY);\r
+\r
+ /* (re)set the timer callback and ask glut to call it in 500 ms */\r
+ glutTimerFunc(500, Timer, 0);\r
}\r
\r
\r
glutDisplayFunc( Redisplay );\r
glutReshapeFunc( Reshape );\r
glutPositionFunc( Position );\r
+ glutWindowStatusFunc( WindowStatus );\r
\r
glutTimerFunc(300, Timer, 0);\r
\r