X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmswin%2Ffg_main_mswin.c;h=a7912225c7f7cf5318bab5008e6b44ac83cd722d;hb=a5b0c9c64f5c4a35b82af7156f90bbae59d9c405;hp=bed1eb8a7a8911b43d3e66cd63850b2b8ebd567f;hpb=42858958aa7357b40e7aa29068054a26c020642e;p=freeglut diff --git a/src/mswin/fg_main_mswin.c b/src/mswin/fg_main_mswin.c index bed1eb8..a791222 100644 --- a/src/mswin/fg_main_mswin.c +++ b/src/mswin/fg_main_mswin.c @@ -138,7 +138,7 @@ static void fghUpdateWindowStatus(SFG_Window *window, GLboolean visState) INVOKE_WCB( *window, WindowStatus, ( visState ? GLUT_FULLY_RETAINED:GLUT_HIDDEN ) ); } - /* Also notify children */ + /* Also set visibility state for children */ for( child = ( SFG_Window * )window->Children.First; child; child = ( SFG_Window * )child->Node.Next ) @@ -168,12 +168,13 @@ void fgPlatformMainLoopPreliminaryWork ( void ) /* * Processing before the main loop: If there is a window which is open and - * which has a visibility callback, call it. I know this is an ugly hack, - * but I'm not sure what else to do about it. Ideally we should leave - * something uninitialized in the create window code and initialize it in - * the main loop, and have that initialization create a "WM_ACTIVATE" - * message. Then we would put the visibility callback code in the - * "case WM_ACTIVATE" block below. - John Fay -- 10/24/02 + * which has a visibility/windowStatus callback, call it to inform the client + * code that the window is visible. I know this is an ugly hack, + * but I'm not sure what else to do about it. Depending on WM_ACTIVATE would + * not work as not all windows get this when you are opening multiple before + * the mainloop starts. WM_SHOWWINDOW looked like an interesting candidate, but + * it is generated and processed before glutCreate(Sub)Window returns, so no + * callback can yet be set on the window. */ while( window ) { @@ -535,6 +536,11 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR /* Check window visible, we don't want to call the position callback when the user minimized the window */ if (window->State.Visible) { + /* Get top-left of non-client area of window, matching coordinates of + * glutInitPosition and glutPositionWindow, but not those of + * glutGet(GLUT_WINDOW_X) and glutGet(GLUT_WINDOW_Y), which return + * top-left of client area. + */ GetWindowRect( window->Window.Handle, &windowRect ); if (window->Parent)