Ensure that we never return negative client size.

wxMSW could return negative client size for tiny windows with borders, this
was unexpected and shouldn't happen so explicitly ensure it does not.

Also add a unit test to check that this problem doesn't exist in other ports.

Closes #13184.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67754 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-05-16 14:07:40 +00:00
parent 5f081e28fa
commit 352a7d6c46
2 changed files with 23 additions and 0 deletions

View File

@@ -1787,6 +1787,15 @@ void wxWindowMSW::DoGetClientSize(int *x, int *y) const
if ( y )
*y = rect.bottom;
}
// The size of the client window can't be negative but ::GetClientRect()
// can return negative size for an extremely small (1x1) window with
// borders so ensure that we correct it here as having negative sizes is
// completely unexpected.
if ( x && *x < 0 )
*x = 0;
if ( y && *y < 0 )
*y = 0;
}
void wxWindowMSW::DoGetPosition(int *x, int *y) const