From c07598dc395aa0d883e0cfa5943be93bed801150 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 6 Dec 2007 17:41:20 +0000 Subject: [PATCH] From Hautio Jari, "Current version of GraphicsWindowWin32 allows resize to zero height window. This breaks rendering in for example MFC SDI applications and in MFC MDI applications if user resizes the window so that client area has zero height. Current safeguard for minimized window: LRESULT GraphicsWindowWin32::handleNativeWindowingEvent( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) ... ///////////////// case WM_MOVE : case WM_SIZE : ///////////////// ... if (clientRect.bottom==0 && clientRect.right==0) ... does not cover this situation. In these situations clientRect.bottom = 0 and clientRect.right > 0. Quick fix to this is relax condition: if (clientRect.bottom==0 || clientRect.right==0) Modified file is attached. Tested with osgviewerMFC from 2.2.0 release (Windows XP sp2) Before fix: - execute from command line osgviewerMFC.exe cow.osg. - the cow is rendered nicely. - resize window to zero height by dragging from bottom border upwards. - resize window back to original height - just blue screen, no cow After fix: - execute from command line osgviewerMFC.exe cow.osg. - the cow is rendered nicely. - resize window to zero height by dragging from bottom border upwards. - resize window back to original height - the cow is where it is supposed to be. " --- src/osgViewer/GraphicsWindowWin32.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osgViewer/GraphicsWindowWin32.cpp b/src/osgViewer/GraphicsWindowWin32.cpp index aad5ad1c3..2b335f415 100644 --- a/src/osgViewer/GraphicsWindowWin32.cpp +++ b/src/osgViewer/GraphicsWindowWin32.cpp @@ -2137,10 +2137,10 @@ LRESULT GraphicsWindowWin32::handleNativeWindowingEvent( HWND hwnd, UINT uMsg, W int windowWidth; int windowHeight; - if (clientRect.bottom==0 && clientRect.right==0) + if (clientRect.bottom==0 || clientRect.right==0) { // - // Window has been minimized; keep window width & height to a minimum of 1 pixel + // Window has been minimized or has only toolbars visible; keep window width & height to a minimum of 1 pixel // windowWidth = 1;