From a668db8b64323a31bddb96adc7641a379e294b68 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 11 Oct 2019 15:34:49 +0200 Subject: [PATCH] Do nothing in wxListCtrl::SetDoubleBuffered() in wxMSW Setting WS_EX_COMPOSITED, as the base class version does, just results in visual artefacts and is useless, as we turn on LVS_EX_DOUBLEBUFFER already, if it's supported, anyhow. So don't break the display if people call SetDoubleBuffered() in the mistaken belief that it does something useful in this case. --- include/wx/msw/listctrl.h | 5 +++++ src/msw/listctrl.cpp | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 59794184af..68c5c65f23 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -360,6 +360,11 @@ public: // Necessary for drawing hrules and vrules, if specified void OnPaint(wxPaintEvent& event); + // Override SetDoubleBuffered() to do nothing, its implementation in the + // base class is incompatible with the double buffering done by this native + // control. + virtual bool IsDoubleBuffered() const; + virtual void SetDoubleBuffered(bool on); virtual bool ShouldInheritColours() const wxOVERRIDE { return false; } diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index c3de6a8bfa..5f6f922854 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -466,6 +466,17 @@ void wxListCtrl::OnDPIChanged(wxDPIChangedEvent &event) } } +bool wxListCtrl::IsDoubleBuffered() const +{ + // LVS_EX_DOUBLEBUFFER is turned on for comctl32 v6+. + return wxApp::GetComCtl32Version() >= 600; +} + +void wxListCtrl::SetDoubleBuffered(bool WXUNUSED(on)) +{ + // Nothing to do, it's always enabled if supported. +} + #if WXWIN_COMPATIBILITY_3_0 // Deprecated void wxListCtrl::UpdateStyle()