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:
@@ -64,14 +64,9 @@ bool wxNonOwnedWindow::SetShape(const wxRegion& region)
|
|||||||
delete[] (char*) rgnData;
|
delete[] (char*) rgnData;
|
||||||
|
|
||||||
// SetWindowRgn expects the region to be in coordinates
|
// SetWindowRgn expects the region to be in coordinates
|
||||||
// relative to the window, not the client area. Figure
|
// relative to the window, not the client area.
|
||||||
// out the offset, if any.
|
const wxPoint clientOrigin = GetClientAreaOrigin();
|
||||||
RECT rect;
|
::OffsetRgn(hrgn, -clientOrigin.x, -clientOrigin.y);
|
||||||
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);
|
|
||||||
|
|
||||||
// Now call the shape API with the new region.
|
// Now call the shape API with the new region.
|
||||||
if (::SetWindowRgn(GetHwnd(), hrgn, TRUE) == 0)
|
if (::SetWindowRgn(GetHwnd(), hrgn, TRUE) == 0)
|
||||||
|
Reference in New Issue
Block a user