From 6a68fe84ba063c4ac6dadb422a89b7497e13f36c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 18 Oct 2011 21:56:34 +0000 Subject: [PATCH] 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 --- src/msw/nonownedwnd.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/msw/nonownedwnd.cpp b/src/msw/nonownedwnd.cpp index 48dd03e24d..66e4c69668 100644 --- a/src/msw/nonownedwnd.cpp +++ b/src/msw/nonownedwnd.cpp @@ -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) -- 2.47.2