mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-17 17:02:51 +08:00
Remove now unnecessary calls to MSWDisableComposited()
Still keep the function itself for compatibility and because it might conceivably be still helpful e.g. after calling SetDoubleBuffered().
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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() )
|
||||
|
||||
+7
-12
@@ -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()
|
||||
|
||||
@@ -1078,8 +1078,6 @@ bool wxWebViewEdge::Create(wxWindow* parent,
|
||||
return false;
|
||||
}
|
||||
|
||||
MSWDisableComposited();
|
||||
|
||||
if (!m_impl->Create())
|
||||
return false;
|
||||
Bind(wxEVT_SIZE, &wxWebViewEdge::OnSize, this);
|
||||
|
||||
Reference in New Issue
Block a user