fix transparency problems on macOS

under mojave any backgroundColor destroys transparency
This commit is contained in:
Stefan Csomor
2018-10-23 21:01:31 +02:00
parent 651e1cd1b5
commit a94325a76a
2 changed files with 7 additions and 3 deletions

View File

@@ -914,7 +914,12 @@ bool wxNonOwnedWindowCocoaImpl::SetTransparent(wxByte alpha)
bool wxNonOwnedWindowCocoaImpl::SetBackgroundColour(const wxColour& col ) bool wxNonOwnedWindowCocoaImpl::SetBackgroundColour(const wxColour& col )
{ {
[m_macWindow setBackgroundColor:col.OSXGetNSColor()]; // only set the native background color if the toplevel window's
// background is not supposed to be transparent, otherwise the
// transparency is lost
if( GetWXPeer()->GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT &&
!(GetWXPeer()->GetWindowStyle() & wxFRAME_SHAPED) )
[m_macWindow setBackgroundColor:col.OSXGetNSColor()];
return true; return true;
} }

View File

@@ -152,8 +152,7 @@ bool wxNonOwnedWindow::Create(wxWindow *parent,
wxWindowCreateEvent event(this); wxWindowCreateEvent event(this);
HandleWindowEvent(event); HandleWindowEvent(event);
if ( GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT ) SetBackgroundColour(wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE ));
SetBackgroundColour(wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE ));
if ( parent ) if ( parent )
parent->AddChild(this); parent->AddChild(this);