From: Vadim Zeitlin Date: Fri, 22 Jul 2011 16:53:56 +0000 (+0000) Subject: Set wxDidCreatePaintDC to true even if we reused a cached wxPaintDC. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4877e9bf9097d6c815fb2264afad9fdd6e8eb3ff Set wxDidCreatePaintDC to true even if we reused a cached wxPaintDC. Reusing a cached wxPaintDC should count as painting the window, otherwise we could call DefWindowProc(WM_PAINT) if WM_PAINT was generated from inside EVT_PAINT handler (e.g. by calling wxWindow::Update()) and this validated the entire window and no painting was really done. In particular this fixes redrawing of wxStyledTextCtrl which does call Update() (completely unnecessarily AFAICS) from its EVT_PAINT handler when it wants to fully refresh itself. Closes #13345. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68337 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp index bad81c1e72..4564a189d1 100644 --- a/src/msw/dcclient.cpp +++ b/src/msw/dcclient.cpp @@ -225,6 +225,12 @@ wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) : } #endif // wxHAS_PAINT_DEBUG + // see comments in src/msw/window.cpp where this is defined + extern bool wxDidCreatePaintDC; + + wxDidCreatePaintDC = true; + + m_window = window; // do we have a DC for this window in the cache? @@ -236,11 +242,6 @@ wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) : } else // not in cache, create a new one { - // see comments in src/msw/window.cpp where this is defined - extern bool wxDidCreatePaintDC; - - wxDidCreatePaintDC = true; - m_hDC = (WXHDC)::BeginPaint(GetHwndOf(m_window), &g_paintStruct); if (m_hDC) ms_cache.Add(new wxPaintDCInfo(m_window, this));