diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 2f277ca50f..5fcccad382 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -554,8 +554,8 @@ public: virtual bool IsDoubleBuffered() const override; // Ensure that neither this window itself nor any of its parents use - // WS_EX_COMPOSITED: this is used by the native wxListCtrl which is - // incompatible with this style. + // WS_EX_COMPOSITED: this may only be necessary after calling + // SetDoubleBuffered() which sets this style. void MSWDisableComposited(); // synthesize a wxEVT_LEAVE_WINDOW event and set m_mouseInWindow to false diff --git a/interface/wx/statbox.h b/interface/wx/statbox.h index 548917ee93..64390072ab 100644 --- a/interface/wx/statbox.h +++ b/interface/wx/statbox.h @@ -20,13 +20,8 @@ wxWidgets 2.9.1 it is strongly recommended to create them as children of wxStaticBox itself, as doing this avoids problems with repainting that could happen when creating the other windows as siblings of the box. - Notably, in wxMSW, siblings of the static box are not drawn at all inside - it when compositing is used, which is the case by default, and - wxWindow::MSWDisableComposited() must be explicitly called to fix this. - Creating windows located inside the static box as its children avoids this - problem and works well whether compositing is used or not. - To summarize, the correct way to create static box and the controls inside + To be clear, the correct way to create static box and the controls inside it is: @code void MyFrame::CreateControls() diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index fd937a2a38..17957c94d9 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -2757,17 +2757,6 @@ bool wxStaticBoxSizer::CheckIfNonBoxChild(wxWindow* win) const wxDumpWindow(win), wxDumpWindow(win->GetParent())); -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - // Additionally, under MSW the windows inside a static box are not - // drawn at all when compositing is used, so we have to disable it. - // - // An alternative could be to Reparent() the window to the static - // box, but it might break the existing code and as we only allow - // this for compatibility in the first place, it seems better not - // to risk it. - win->MSWDisableComposited(); -#endif // __WXMSW__ && !__WXUNIVERSAL__ - return true; } diff --git a/src/common/webview_chromium.cpp b/src/common/webview_chromium.cpp index bb7b5bc898..f1f6d764ce 100644 --- a/src/common/webview_chromium.cpp +++ b/src/common/webview_chromium.cpp @@ -810,10 +810,6 @@ bool wxWebViewChromium::Create(wxWindow* parent, if ( !InitCEF(m_implData->m_config) ) return false; -#ifdef __WXMSW__ - MSWDisableComposited(); -#endif // __WXMSW__ - m_clientHandler = new ClientHandler{*this}; m_clientHandler->AddRef(); diff --git a/src/msw/glcanvas.cpp b/src/msw/glcanvas.cpp index 96d49c8228..21fb453622 100644 --- a/src/msw/glcanvas.cpp +++ b/src/msw/glcanvas.cpp @@ -735,8 +735,6 @@ bool wxGLCanvas::Create(wxWindow *parent, if ( !CreateWindow(parent, id, pos, size, style, name) ) return false; - MSWDisableComposited(); - // Choose a matching pixel format. // Need a PIXELFORMATDESCRIPTOR for SetPixelFormat() PIXELFORMATDESCRIPTOR pfd; diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 2b9e0d7f7e..0511836bf6 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -257,11 +257,6 @@ bool wxListCtrl::Create(wxWindow *parent, if ( !MSWCreateControl(WC_LISTVIEW, wxEmptyString, pos, size) ) return false; - // LISTVIEW generates and endless stream of LVN_ODCACHEHINT event for a - // virtual wxListCtrl, so disable WS_EX_COMPOSITED. - if ( IsVirtual() ) - MSWDisableComposited(); - const wxVisualAttributes& defAttrs = GetDefaultAttributes(); if ( wxMSWDarkMode::IsActive() ) diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 87efd5a357..e607c6a002 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -106,18 +106,13 @@ bool wxStaticBox::MSWGetDarkModeSupport(MSWDarkModeSupport& support) const bool wxStaticBox::ShouldUseCustomPaint() const { - // We currently always custom paint the box because we can't rely on double - // buffering remaining on even if it is on now, i.e. IsDoubleBuffered() - // could return true right but WS_EX_COMPOSITED could get turned off later - // because MSWDisableComposited() is called and this would make default - // WM_PAINT not work correctly any longer. A probably better solution would - // be to notify all windows from MSWDisableComposited() when the double - // buffered status changes. - // - // Still allow be disabling this by setting a system option which can be - // useful if the application paints on the box itself (which should be - // avoided, but some existing code does it). - return !wxSystemOptions::IsFalse(wxT("msw.staticbox.optimized-paint")); + // When not using double buffering, we paint the box ourselves by default + // because using the standard control default WM_PAINT handler results in + // awful flicker. However this can be disabled by setting a system option + // which can be useful if the application paints on the box itself (which + // should be avoided, but some existing code does it). + return !IsDoubleBuffered() && + !wxSystemOptions::IsFalse(wxT("msw.staticbox.optimized-paint")); } void wxStaticBox::UseCustomPaint() diff --git a/src/msw/webview_edge.cpp b/src/msw/webview_edge.cpp index 36fdcfc04c..1cdbfa4efb 100644 --- a/src/msw/webview_edge.cpp +++ b/src/msw/webview_edge.cpp @@ -1078,8 +1078,6 @@ bool wxWebViewEdge::Create(wxWindow* parent, return false; } - MSWDisableComposited(); - if (!m_impl->Create()) return false; Bind(wxEVT_SIZE, &wxWebViewEdge::OnSize, this);