Bug 2406 - Mac: (Catalina) No transparency in docking-icon.

Backported upstream fix for:

https://trac.wxwidgets.org/ticket/18257
This commit is contained in:
Leland Lucius 2020-04-29 08:48:16 -05:00
parent e24f7514be
commit 191f724631
3 changed files with 20 additions and 8 deletions

View File

@ -739,12 +739,6 @@ long style, long extraStyle, const wxString& WXUNUSED(name) )
[m_macWindow setDelegate:controller];
if ( ( style & wxFRAME_SHAPED) )
{
[m_macWindow setOpaque:NO];
[m_macWindow setAlphaValue:1.0];
}
if ( !(style & wxFRAME_TOOL_WINDOW) )
[m_macWindow setHidesOnDeactivate:NO];
}

View File

@ -4984,7 +4984,15 @@ void wxWidgetCocoaImpl::SetBackgroundColour( const wxColour &col )
if ( [targetView respondsToSelector:@selector(setBackgroundColor:) ] )
{
[targetView setBackgroundColor: col.OSXGetNSColor()];
wxWindow* peer = GetWXPeer();
if ( peer->GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT )
{
wxTopLevelWindow* toplevel = wxDynamicCast(peer,wxTopLevelWindow);
if ( toplevel == NULL || toplevel->GetShape().IsEmpty() )
[targetView setBackgroundColor:
col.IsOk() ? col.OSXGetNSColor() : nil];
}
}
}
@ -4995,6 +5003,9 @@ bool wxWidgetCocoaImpl::SetBackgroundStyle( wxBackgroundStyle style )
if ( [m_osxView respondsToSelector:@selector(setOpaque:) ] )
{
[m_osxView setOpaque: opaque];
if ( style == wxBG_STYLE_TRANSPARENT )
[m_osxView setBackgroundColor:[NSColor clearColor]];
}
return true ;

View File

@ -256,7 +256,10 @@ bool wxNonOwnedWindow::SetBackgroundColour(const wxColour& c )
if ( !wxWindow::SetBackgroundColour(c) && m_hasBgCol )
return false ;
if ( GetBackgroundStyle() != wxBG_STYLE_CUSTOM )
// only set the native background color if the toplevel window's
// background is not supposed to be transparent, otherwise the
// transparency is lost
if ( GetBackgroundStyle() != wxBG_STYLE_PAINT && GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT)
{
if ( m_nowpeer )
return m_nowpeer->SetBackgroundColour(c);
@ -511,6 +514,10 @@ bool wxNonOwnedWindow::DoSetRegionShape(const wxRegion& region)
{
m_shape = region;
// set the native content view to transparency, this is an implementation detail
// no reflected in the wx BackgroundStyle
GetPeer()->SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
return m_nowpeer->SetShape(region);
}