From d6a97306678256aabada095b44631586862eb90e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 24 Dec 2001 16:26:47 +0000 Subject: [PATCH] DoSetClientSize() may take 4 iterations to set the right size sometimes, not 3 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13186 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/window.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 4fdf1856d8..3dd8c2240e 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1533,11 +1533,13 @@ void wxWindowMSW::DoSetClientSize(int width, int height) // will not be correct as the difference between the total and client size // changes - so we keep changing it until we get it right // - // normally this loop shouldn't take more than 2 iterations (usually 1 but - // if scrollbars [dis]appear as the result of the first call, then 2) but - // just to be on the safe side we check for it instead of making it an + // normally this loop shouldn't take more than 3 iterations (usually 1 but + // if scrollbars [dis]appear as the result of the first call, then 2 and it + // may become 3 if the window had 0 size originally and so we didn't + // calculate the scrollbar correction correctly during the first iteration) + // but just to be on the safe side we check for it instead of making it an // "infinite" loop (i.e. leaving break inside as the only way to get out) - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 4; i++ ) { RECT rectClient; ::GetClientRect(GetHwnd(), &rectClient); @@ -1548,7 +1550,7 @@ void wxWindowMSW::DoSetClientSize(int width, int height) break; } - if ( i == 2 ) + if ( i == 3 ) { // how did it happen? maybe OnSize() handler does something really // strange in this class? -- 2.45.2