Fix background for children of windows with RTL layout in wxMSW

To correctly compute the brush origin offset for painting background of a
child in a window using RTL layout, we need to offset it by the child origin
i.e. its _right_ top corner in this case and not the left top corner as we did
before.

Conveniently, although not very explicitly, MapWindowPoints() already takes
care of this for us if we just pass it both the left and right points, but we
wrongly passed it only a single one, so it couldn't work its magic in this
case.

Change this to fix the drawing artefacts which appeared over wxNotebook
children with transparent background (e.g. wxStaticText) due to the use of
wrong origin before.
This commit is contained in:
Vadim Zeitlin
2016-04-08 22:15:56 +02:00
parent 79b60780fe
commit 169fb2c7f5

View File

@@ -4888,7 +4888,13 @@ wxWindowMSW::MSWGetBgBrushForChild(WXHDC hDC, wxWindowMSW *child)
RECT rc;
::GetWindowRect(GetHwndOf(child), &rc);
::MapWindowPoints(NULL, GetHwnd(), (POINT *)&rc, 1);
// It is important to pass both points to MapWindowPoints() as in
// addition to converting them to our coordinate system, this function
// will also exchange the left and right coordinates if this window
// uses RTL layout, which is exactly what we need here as the child
// window origin is its _right_ top corner in this case and not the
// left one.
::MapWindowPoints(NULL, GetHwnd(), (POINT *)&rc, 2);
int x = rc.left,
y = rc.top;