WM_PAINT more conform to docs

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1546 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2013-03-01 18:28:55 +00:00
parent c8177024db
commit bab8eb3423

View File

@ -648,15 +648,22 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
case WM_PAINT: case WM_PAINT:
{ {
RECT rect;
if (GetUpdateRect(hWnd,&rect,FALSE))
{
/* As per docs, upon receiving WM_PAINT, first check if the update region is not empty before you call BeginPaint */
PAINTSTRUCT ps; PAINTSTRUCT ps;
/* Turn on the visibility in case it was turned off somehow */ /* Turn on the visibility in case it was turned off somehow */
window->State.Visible = GL_TRUE; 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... */ InvalidateRect( hWnd, NULL, GL_FALSE );
BeginPaint( hWnd, &ps ); BeginPaint( hWnd, &ps );
fghRedrawWindow( window ); fghRedrawWindow( window );
EndPaint( hWnd, &ps ); EndPaint( hWnd, &ps );
} }
}
break; break;
case WM_CLOSE: case WM_CLOSE: