force subview refresh on macOS 10.14
even on dark mode not all NSViews have their own layer, therefore don’t take that as a condition, because a child of such a view still might be layer-backed and need an explicit redraw. Avoid spurious redraws for not visible windows (especiall important for not-yet fully constructed views or views during destruction)
This commit is contained in:
@@ -2575,8 +2575,11 @@ void wxWidgetCocoaImpl::SetVisibility( bool visible )
|
||||
[m_osxView setHidden:(visible ? NO:YES)];
|
||||
|
||||
// trigger redraw upon shown for layer-backed views
|
||||
if( m_osxView.layer && !m_osxView.isHiddenOrHasHiddenAncestor )
|
||||
SetNeedsDisplay(NULL);
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
|
||||
if ( wxPlatformInfo::Get().CheckOSVersion(10, 14 ) )
|
||||
if( !m_osxView.isHiddenOrHasHiddenAncestor )
|
||||
SetNeedsDisplay(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
double wxWidgetCocoaImpl::GetContentScaleFactor() const
|
||||
@@ -3032,7 +3035,7 @@ static void SetSubviewsNeedDisplay( NSView *view )
|
||||
{
|
||||
for ( NSView *sub in view.subviews )
|
||||
{
|
||||
if ( sub.isHidden || !sub.layer )
|
||||
if ( sub.isHidden )
|
||||
continue;
|
||||
|
||||
[sub setNeedsDisplay:YES];
|
||||
@@ -3050,8 +3053,10 @@ void wxWidgetCocoaImpl::SetNeedsDisplay( const wxRect* where )
|
||||
// Layer-backed views (which are all in Mojave's Dark Mode) may not have
|
||||
// their children implicitly redrawn with the parent. For compatibility,
|
||||
// do it manually here:
|
||||
if ( m_osxView.layer )
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
|
||||
if ( wxPlatformInfo::Get().CheckOSVersion(10, 14 ) )
|
||||
SetSubviewsNeedDisplay(m_osxView);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool wxWidgetCocoaImpl::GetNeedsDisplay() const
|
||||
|
@@ -1919,6 +1919,8 @@ void wxWindowMac::MacUpdateClippedRects() const
|
||||
bool wxWindowMac::MacDoRedraw( long time )
|
||||
{
|
||||
bool handled = false ;
|
||||
if ( !IsShownOnScreen() )
|
||||
return handled;
|
||||
|
||||
wxRegion formerUpdateRgn = m_updateRegion;
|
||||
wxRegion clientUpdateRgn = formerUpdateRgn;
|
||||
|
Reference in New Issue
Block a user