Rely on native double buffering by default in wxPropertyGrid

If the platform has native double-buffering, instruct wxPropertyGrid
to rely on it by default.

Closes #16978.
This commit is contained in:
Artur Wieczorek
2017-10-17 21:13:45 +02:00
parent cd669aea71
commit aaf1d505c6
2 changed files with 13 additions and 18 deletions

View File

@@ -37,6 +37,8 @@
#include "wx/intl.h"
#endif
#include "wx/dcbuffer.h" // for wxALWAYS_NATIVE_DOUBLE_BUFFER
// This define is necessary to prevent macro clearing
#define __wxPG_SOURCE_FILE__
@@ -587,7 +589,12 @@ void wxPropertyGridManager::Init2( int style )
m_pState = m_pPropGrid->m_pState;
// Rely on native double-buffering by default.
#if wxALWAYS_NATIVE_DOUBLE_BUFFER
m_pPropGrid->SetExtraStyle(wxPG_EX_INIT_NOCAT | wxPG_EX_NATIVE_DOUBLE_BUFFERING);
#else
m_pPropGrid->SetExtraStyle(wxPG_EX_INIT_NOCAT);
#endif // wxALWAYS_NATIVE_DOUBLE_BUFFER/!wxALWAYS_NATIVE_DOUBLE_BUFFER
// Connect to property grid onselect event.
// NB: Even if wxID_ANY is used, this doesn't connect properly in wxPython

View File

@@ -484,6 +484,11 @@ void wxPropertyGrid::Init2()
// This helps with flicker
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
// Rely on native double-buffering by default.
#if wxALWAYS_NATIVE_DOUBLE_BUFFER
SetExtraStyle(GetExtraStyle() | wxPG_EX_NATIVE_DOUBLE_BUFFERING);
#endif // wxALWAYS_NATIVE_DOUBLE_BUFFER
// Hook the top-level parent
m_tlpClosed = NULL;
m_tlpClosedTime = 0;
@@ -1153,26 +1158,9 @@ void wxPropertyGrid::SetExtraStyle( long exStyle )
if ( exStyle & wxPG_EX_NATIVE_DOUBLE_BUFFERING )
{
#if defined(__WXMSW__)
/*
// Don't use WS_EX_COMPOSITED just now.
HWND hWnd;
if ( m_iFlags & wxPG_FL_IN_MANAGER )
hWnd = (HWND)GetParent()->GetHWND();
else
hWnd = (HWND)GetHWND();
::SetWindowLong( hWnd, GWL_EXSTYLE,
::GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_COMPOSITED );
*/
//#elif defined(__WXGTK20__)
#endif
// Only apply wxPG_EX_NATIVE_DOUBLE_BUFFERING if the window
// truly was double-buffered.
if ( !this->IsDoubleBuffered() )
if ( !IsDoubleBuffered() )
{
exStyle &= ~(wxPG_EX_NATIVE_DOUBLE_BUFFERING);
}