fixed DoSetClientSize() to use ::MoveWindow() instead of deferred sizing which never updated the client size we were checking here
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34806 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
7a19fb6e5f
commit
b0268dafc1
@ -1692,28 +1692,21 @@ void wxWindowMSW::DoSetClientSize(int width, int height)
|
|||||||
RECT rectClient;
|
RECT rectClient;
|
||||||
::GetClientRect(GetHwnd(), &rectClient);
|
::GetClientRect(GetHwnd(), &rectClient);
|
||||||
|
|
||||||
// if the size is already ok, stop here (rectClient.left = top = 0)
|
// if the size is already ok, stop here (NB: rectClient.left = top = 0)
|
||||||
if ( (rectClient.right == width || width == wxDefaultCoord) &&
|
if ( (rectClient.right == width || width == wxDefaultCoord) &&
|
||||||
(rectClient.bottom == height || height == wxDefaultCoord) )
|
(rectClient.bottom == height || height == wxDefaultCoord) )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int widthClient = width,
|
|
||||||
heightClient = height;
|
|
||||||
|
|
||||||
// Find the difference between the entire window (title bar and all)
|
// Find the difference between the entire window (title bar and all)
|
||||||
// and the client area; add this to the new client size to move the
|
// and the client area; add this to the new client size to move the
|
||||||
// window
|
// window
|
||||||
RECT rectWin;
|
RECT rectWin;
|
||||||
::GetWindowRect(GetHwnd(), &rectWin);
|
::GetWindowRect(GetHwnd(), &rectWin);
|
||||||
|
|
||||||
widthClient += rectWin.right - rectWin.left - rectClient.right;
|
const int widthWin = rectWin.right - rectWin.left,
|
||||||
heightClient += rectWin.bottom - rectWin.top - rectClient.bottom;
|
heightWin = rectWin.bottom - rectWin.top;
|
||||||
|
|
||||||
POINT point;
|
|
||||||
point.x = rectWin.left;
|
|
||||||
point.y = rectWin.top;
|
|
||||||
|
|
||||||
// MoveWindow positions the child windows relative to the parent, so
|
// MoveWindow positions the child windows relative to the parent, so
|
||||||
// adjust if necessary
|
// adjust if necessary
|
||||||
@ -1722,11 +1715,21 @@ void wxWindowMSW::DoSetClientSize(int width, int height)
|
|||||||
wxWindow *parent = GetParent();
|
wxWindow *parent = GetParent();
|
||||||
if ( parent )
|
if ( parent )
|
||||||
{
|
{
|
||||||
::ScreenToClient(GetHwndOf(parent), &point);
|
::ScreenToClient(GetHwndOf(parent), (POINT *)&rectWin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DoMoveWindow(point.x, point.y, widthClient, heightClient);
|
// don't call DoMoveWindow() because we want to move window immediately
|
||||||
|
// and not defer it here
|
||||||
|
if ( !::MoveWindow(GetHwnd(),
|
||||||
|
rectWin.left,
|
||||||
|
rectWin.top,
|
||||||
|
width + widthWin - rectClient.right,
|
||||||
|
height + heightWin - rectClient.bottom,
|
||||||
|
TRUE) )
|
||||||
|
{
|
||||||
|
wxLogLastError(_T("MoveWindow"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user