Fix window position calculation in wxMSW when using RTL.

Just use the native ::MapWindowPoints() to do the coordinate transformation
instead of doing it ourselves: we did it wrongly by inheriting the layout
direction from wxTheApp instead of from the parent window, so fix this in the
best possible way by not doing it at all and just relying on Windows to do it
for us.

In particular, this corrects the display of wxStatusBar in RTL frames.

Closes #15031.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76992 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-08-03 12:47:51 +00:00
parent d35c8954d6
commit bd2a350c42

View File

@ -1856,31 +1856,18 @@ void wxWindowMSW::DoGetPosition(int *x, int *y) const
{
RECT rect = wxGetWindowRect(GetHwnd());
POINT point;
point.x = rect.left;
point.y = rect.top;
// we do the adjustments with respect to the parent only for the "real"
// children, not for the dialogs/frames
if ( !IsTopLevel() )
{
if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft )
{
// In RTL mode, we want the logical left x-coordinate,
// which would be the physical right x-coordinate.
point.x = rect.right;
}
// Since we now have the absolute screen coords, if there's a
// parent we must subtract its top left corner
if ( parent )
{
::ScreenToClient(GetHwndOf(parent), &point);
}
// In RTL mode, we want the logical left x-coordinate,
// which would be the physical right x-coordinate.
::MapWindowPoints(NULL, parent ? GetHwndOf(parent) : HWND_DESKTOP,
(LPPOINT)&rect, 2);
}
pos.x = point.x;
pos.y = point.y;
pos.x = rect.left;
pos.y = rect.top;
}
// we also must adjust by the client area offset: a control which is just