X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmswin%2Ffg_main_mswin.c;h=a74ee6dfeb0970d6f88e61b2a082ac371f1e023f;hb=b23128a3f3779555ea461278346d628a9b49fad0;hp=3ecde1f59c34bd392d23918cd6874c8597abbea6;hpb=45513505af6c7113e6d85d3ae0732d516d5f89c7;p=freeglut diff --git a/src/mswin/fg_main_mswin.c b/src/mswin/fg_main_mswin.c index 3ecde1f..a74ee6d 100644 --- a/src/mswin/fg_main_mswin.c +++ b/src/mswin/fg_main_mswin.c @@ -119,15 +119,21 @@ void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height ) SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING | SWP_NOZORDER ); + + /* Set new width and height so we can test for that in WM_SIZE message handler and don't do anything if not needed */ + window->State.Width = width; + window->State.Height = height; } void fgPlatformDisplayWindow ( SFG_Window *window ) { - RedrawWindow( + int success = RedrawWindow( window->Window.Handle, NULL, NULL, RDW_NOERASE | RDW_INTERNALPAINT | RDW_INVALIDATE | RDW_UPDATENOW ); + + printf("RedrawWindow (window %p): %i\n",window,success); } @@ -265,7 +271,7 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, if (hwnd) /* can be NULL if mouse outside parent by the time we get here */ { temp_window = fgWindowByHandle(hwnd); - if (temp_window->Parent) /* Verify we got a child window */ + if (temp_window && temp_window->Parent) /* Verify we got a child window */ child_window = temp_window; } } @@ -405,6 +411,9 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, } #endif /* defined(_WIN32_WCE) */ + + window->State.Redisplay = GL_TRUE; + printf("create set redisplay\n"); break; case WM_SIZE: @@ -415,7 +424,8 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, */ if( window->State.Visible ) { - window->State.NeedToResize = GL_TRUE; + /* get old values first to compare to below */ + int width = window->State.Width, height=window->State.Height; #if defined(_WIN32_WCE) window->State.Width = HIWORD(lParam); window->State.Height = LOWORD(lParam); @@ -423,6 +433,10 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, window->State.Width = LOWORD(lParam); window->State.Height = HIWORD(lParam); #endif /* defined(_WIN32_WCE) */ + + if (width!=window->State.Width || height!=window->State.Height) + /* Something changed, need to resize */ + window->State.NeedToResize = GL_TRUE; } break; @@ -514,6 +528,7 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, case WM_PAINT: /* Turn on the visibility in case it was turned off somehow */ + printf("WM_PAINT received\n"); window->State.Visible = GL_TRUE; InvalidateRect( hWnd, NULL, GL_FALSE ); /* Make sure whole window is repainted. Bit of a hack, but a safe one from what google turns up... */ BeginPaint( hWnd, &ps );