move macOS transparency fix one level up

This commit is contained in:
Stefan Csomor
2018-10-23 21:12:48 +02:00
parent a94325a76a
commit 708a408733
2 changed files with 8 additions and 6 deletions

View File

@@ -914,12 +914,7 @@ bool wxNonOwnedWindowCocoaImpl::SetTransparent(wxByte alpha)
bool wxNonOwnedWindowCocoaImpl::SetBackgroundColour(const wxColour& col ) bool wxNonOwnedWindowCocoaImpl::SetBackgroundColour(const wxColour& col )
{ {
// only set the native background color if the toplevel window's [m_macWindow setBackgroundColor:col.OSXGetNSColor()];
// 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

@@ -254,6 +254,13 @@ wxPoint wxNonOwnedWindow::GetClientAreaOrigin() const
bool wxNonOwnedWindow::SetBackgroundColour(const wxColour& c ) bool wxNonOwnedWindow::SetBackgroundColour(const wxColour& c )
{ {
// 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_TRANSPARENT ||
(GetWindowStyle() & wxFRAME_SHAPED) )
return false;
if ( !wxWindow::SetBackgroundColour(c) && m_hasBgCol ) if ( !wxWindow::SetBackgroundColour(c) && m_hasBgCol )
return false ; return false ;