better to put code to check if menu should be deactivated in
[freeglut] / src / mswin / fg_state_mswin.c
index 07ffdb1..91256a3 100644 (file)
@@ -140,10 +140,10 @@ int fgPlatformGlutGet ( GLenum eWhat )
       return returnValue;
 
     case GLUT_WINDOW_BUFFER_SIZE:
-      returnValue = 1 ;                                      /* ????? */
+      returnValue = 1 ;                                      /* TODO????? */
       return returnValue;
     case GLUT_WINDOW_STENCIL_SIZE:
-      returnValue = 0 ;                                      /* ????? */
+      returnValue = 0 ;                                      /* TODO????? */
       return returnValue;
 
     case GLUT_WINDOW_X:
@@ -183,6 +183,19 @@ int fgPlatformGlutGet ( GLenum eWhat )
         GetWindowRect( fgStructure.CurrentWindow->Window.Handle, &winRect );
 #else
         winRect = fghGetClientArea(fgStructure.CurrentWindow, FALSE);
+        if (fgStructure.CurrentWindow->Parent && (eWhat==GLUT_WINDOW_X || eWhat==GLUT_WINDOW_Y))
+        {
+            /* For child window, we should return relative to upper-left
+             *  of parent's client area.
+             */
+            POINT topleft;
+            topleft.x = winRect.left;
+            topleft.y = winRect.top;
+
+            ScreenToClient(fgStructure.CurrentWindow->Parent->Window.Handle,&topleft);
+            winRect.left = topleft.x;
+            winRect.top  = topleft.y;
+        }
 #endif /* defined(_WIN32_WCE) */
 
         switch( eWhat )