diff --git a/docs/changes.txt b/docs/changes.txt index f682d2c833..cf98b6a78f 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -108,6 +108,11 @@ Changes in behaviour not resulting in compilation errors platforms with RTF support. If you need to save/load plain text even for the files with the .rtf extension, specify wxTEXT_TYPE_PLAIN explicitly. +- wxClientDC and wxPaintDC now correctly offset their origin by wxFrame + toolbar, if any. This is consistent with the behaviour of the other ports + but may require removing any compensation for not doing this before that may + be present in the application code. + Changes in behaviour which may result in build errors ----------------------------------------------------- diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp index cc2549ca7c..5818562618 100644 --- a/src/msw/dcclient.cpp +++ b/src/msw/dcclient.cpp @@ -188,9 +188,8 @@ void wxClientDCImpl::InitDC() { wxWindowDCImpl::InitDC(); - // in wxUniv build we must manually do some DC adjustments usually - // performed by Windows for us -#if defined(__WXUNIVERSAL__) + // Account for the origin of the client area which is non-zero only for + // TLWs with (left or top) toolbar: we shouldn't draw over the toolbar. wxPoint ptOrigin = m_window->GetClientAreaOrigin(); if ( ptOrigin.x || ptOrigin.y ) { @@ -198,6 +197,9 @@ void wxClientDCImpl::InitDC() SetDeviceOrigin(ptOrigin.x, ptOrigin.y); } + // in wxUniv build we must manually do some DC adjustments usually + // performed by Windows for us +#if defined(__WXUNIVERSAL__) // clip the DC to avoid overwriting the non client area wxSize size = m_window->GetClientSize(); DoSetClippingRegion(0, 0, size.x, size.y); diff --git a/src/msw/overlay.cpp b/src/msw/overlay.cpp index 9d8240efa3..1fbdb383be 100644 --- a/src/msw/overlay.cpp +++ b/src/msw/overlay.cpp @@ -161,9 +161,15 @@ void wxOverlayImpl::Init(wxDC* dc, int , int , int , int ) m_window = dc->GetWindow(); // The rectangle must be in screen coordinates - m_rect = m_window->GetClientRect(); + m_rect = m_window->GetClientSize(); m_window->ClientToScreen(&m_rect.x, &m_rect.y); + // Because wxClientDC adjusts the origin of the device context to the + // origin of the client area of the window, we need to compensate for it + // here, to make sure that (0, 0) of the rectangle corresponds to the point + // (0, 0) of the window client area. + m_rect.Offset(-m_window->GetClientAreaOrigin()); + if ( IsUsingConstantOpacity() ) { m_bitmap.CreateWithDIPSize(m_rect.GetSize(), m_window->GetDPIScaleFactor());