Use wxWindow::GetClientAreaOrigin() instead of MSW functions.

::AdjustWindowRectEx() doesn't seem to work correctly for wxPopupWindow and
still offsets the coordinates by the title bar height even if these windows
don't have WS_CAPTION style. Rather than try to work around this, simply use
wxWindow method instead of the Windows function as shape wxRegion offset.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-10-18 21:56:34 +00:00
parent 63af513be3
commit 6a68fe84ba

View File

@@ -64,14 +64,9 @@ bool wxNonOwnedWindow::SetShape(const wxRegion& region)
delete[] (char*) rgnData;
// SetWindowRgn expects the region to be in coordinates
// relative to the window, not the client area. Figure
// out the offset, if any.
RECT rect;
DWORD dwStyle = ::GetWindowLong(GetHwnd(), GWL_STYLE);
DWORD dwExStyle = ::GetWindowLong(GetHwnd(), GWL_EXSTYLE);
::GetClientRect(GetHwnd(), &rect);
::AdjustWindowRectEx(&rect, dwStyle, ::GetMenu(GetHwnd()) != NULL, dwExStyle);
::OffsetRgn(hrgn, -rect.left, -rect.top);
// relative to the window, not the client area.
const wxPoint clientOrigin = GetClientAreaOrigin();
::OffsetRgn(hrgn, -clientOrigin.x, -clientOrigin.y);
// Now call the shape API with the new region.
if (::SetWindowRgn(GetHwnd(), hrgn, TRUE) == 0)