glutPostRedisplay();\r
}\r
\r
-void Reshape(int x, int y)\r
+void Reshape(int width, int height)\r
{\r
int win = glutGetWindow();\r
\r
- nWidth = glutGet(GLUT_WINDOW_WIDTH);\r
- nHeight = glutGet(GLUT_WINDOW_HEIGHT);\r
printf("reshape %s, %dx%d\n",win==nWindow?"main":"child",\r
- nWidth, nHeight);\r
+ width, height);\r
\r
- glViewport(0,0,nWidth,nHeight);\r
+ glViewport(0,0,width,height);\r
glMatrixMode(GL_PROJECTION);\r
glLoadIdentity();\r
- gluOrtho2D(0,nWidth,0,nHeight);\r
+ gluOrtho2D(0,width,0,height);\r
\r
if (win==nWindow && nChildWindow!=-1)\r
{\r
glutSetWindow(nChildWindow);\r
- glutPositionWindow((int)(nWidth*.35),(int)(nHeight*.35));\r
- glutReshapeWindow((int)(nWidth*.3),(int)(nHeight*.3));\r
+ glutPositionWindow((int)(width*.35),(int)(height*.35));\r
+ glutReshapeWindow((int)(width*.3),(int)(height*.3));\r
glutSetWindow(nWindow);\r
}\r
}\r
\r
+void Position(int x, int y)\r
+{\r
+ int win = glutGetWindow();\r
+\r
+ printf("position %s, %dx%d\n",win==nWindow?"main":"child",\r
+ x, y);\r
+}\r
+\r
void Redisplay(void)\r
{\r
int win = glutGetWindow();\r
* when the window is on a monitor to the left of the primary monitor\r
* or simply when maximized--try pressing the maximize button).\r
* the returned size is the size of the client area\r
+ * Note that the top-left of a child window is relative to the\r
+ * top-left of the client area of the parent.\r
*/\r
+ /* printf("window border: %dpx, caption: %dpx\n",border,caption); */\r
if (win==nWindow)\r
printf("main window %dx%d, top-left of client at: (%d,%d), of window at: (%d,%d)\n",\r
nWidth, nHeight,\r
glutKeyboardFunc( SampleKeyboard );\r
glutDisplayFunc( Redisplay );\r
glutReshapeFunc( Reshape );\r
+ glutPositionFunc( Position );\r
\r
glutMainLoop();\r
printf("glutMainLoop returned\n");\r