Shuffle code a bit to make it easier to skip deferring window position
This commit is contained in:
@@ -1935,10 +1935,31 @@ void wxWindowMSW::DoClientToScreen(int *x, int *y) const
|
|||||||
bool
|
bool
|
||||||
wxWindowMSW::DoMoveSibling(WXHWND hwnd, int x, int y, int width, int height)
|
wxWindowMSW::DoMoveSibling(WXHWND hwnd, int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
|
// toplevel window's coordinates are mirrored if the TLW is a child of another
|
||||||
|
// RTL window and changing width without moving the position would enlarge the
|
||||||
|
// window in the wrong direction, so we need to adjust for it
|
||||||
|
if ( IsTopLevel() )
|
||||||
|
{
|
||||||
|
// note that this may be different from GetParent() for wxDialogs
|
||||||
|
HWND tlwParent = ::GetParent((HWND)hwnd);
|
||||||
|
if ( tlwParent && (::GetWindowLong(tlwParent, GWL_EXSTYLE) & WS_EX_LAYOUTRTL) != 0 )
|
||||||
|
{
|
||||||
|
RECT old;
|
||||||
|
::GetWindowRect((HWND) hwnd, &old);
|
||||||
|
if ( old.left == x && old.right - old.left != width )
|
||||||
|
{
|
||||||
|
x -= width - (old.right - old.left);
|
||||||
|
}
|
||||||
|
// else: not a simple resize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if wxUSE_DEFERRED_SIZING
|
#if wxUSE_DEFERRED_SIZING
|
||||||
|
else
|
||||||
|
{
|
||||||
// if our parent had prepared a defer window handle for us, use it (unless
|
// if our parent had prepared a defer window handle for us, use it (unless
|
||||||
// we are a top level window)
|
// we are a top level window)
|
||||||
wxWindowMSW * const parent = IsTopLevel() ? NULL : GetParent();
|
wxWindowMSW * const parent = GetParent();
|
||||||
|
|
||||||
HDWP hdwp = parent ? (HDWP)parent->m_hDWP : NULL;
|
HDWP hdwp = parent ? (HDWP)parent->m_hDWP : NULL;
|
||||||
if ( hdwp )
|
if ( hdwp )
|
||||||
@@ -1965,27 +1986,9 @@ wxWindowMSW::DoMoveSibling(WXHWND hwnd, int x, int y, int width, int height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// otherwise (or if deferring failed) move the window in place immediately
|
// otherwise (or if deferring failed) move the window in place immediately
|
||||||
|
}
|
||||||
#endif // wxUSE_DEFERRED_SIZING
|
#endif // wxUSE_DEFERRED_SIZING
|
||||||
|
|
||||||
// toplevel window's coordinates are mirrored if the TLW is a child of another
|
|
||||||
// RTL window and changing width without moving the position would enlarge the
|
|
||||||
// window in the wrong direction, so we need to adjust for it
|
|
||||||
if ( IsTopLevel() )
|
|
||||||
{
|
|
||||||
// note that this may be different from GetParent() for wxDialogs
|
|
||||||
HWND tlwParent = ::GetParent((HWND)hwnd);
|
|
||||||
if ( tlwParent && (::GetWindowLong(tlwParent, GWL_EXSTYLE) & WS_EX_LAYOUTRTL) != 0 )
|
|
||||||
{
|
|
||||||
RECT old;
|
|
||||||
::GetWindowRect((HWND) hwnd, &old);
|
|
||||||
if ( old.left == x && old.right - old.left != width )
|
|
||||||
{
|
|
||||||
x -= width - (old.right - old.left);
|
|
||||||
}
|
|
||||||
// else: not a simple resize
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !::MoveWindow((HWND)hwnd, x, y, width, height, IsShown()) )
|
if ( !::MoveWindow((HWND)hwnd, x, y, width, height, IsShown()) )
|
||||||
{
|
{
|
||||||
wxLogLastError(wxT("MoveWindow"));
|
wxLogLastError(wxT("MoveWindow"));
|
||||||
|
Reference in New Issue
Block a user