+void Timer(int unused)\r
+{\r
+ int win = glutGetWindow();\r
+ int x, y;\r
+ int width, height;\r
+ int border, caption;\r
+\r
+ x = glutGet(GLUT_WINDOW_X);\r
+ y = glutGet(GLUT_WINDOW_Y);\r
+ width = glutGet(GLUT_WINDOW_WIDTH);\r
+ height = glutGet(GLUT_WINDOW_HEIGHT);\r
+ border = glutGet(GLUT_WINDOW_BORDER_WIDTH);\r
+ caption = glutGet(GLUT_WINDOW_HEADER_HEIGHT);\r
+ /* returned position is top-left of client area, to get top-left of\r
+ * of window you'll need to add the size of the border and caption\r
+ * of the current window (can be 0).\r
+ * Note that the window position is not necessarily positive (e.g.\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
+ width, height,\r
+ x ,y,\r
+ x-border,\r
+ y-caption);\r
+ else\r
+ printf("child window %dx%d, top-left of client at: (%d,%d), relative to parent\n",\r
+ width, height,\r
+ x ,y);\r
+\r
+ /* (re)set the timer callback and ask glut to call it in 500 ms */\r
+ glutTimerFunc(500, Timer, 0);\r
+}\r
+\r