diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index 64a6b3b74f..b21d2d2e14 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -914,12 +914,7 @@ bool wxNonOwnedWindowCocoaImpl::SetTransparent(wxByte alpha) bool wxNonOwnedWindowCocoaImpl::SetBackgroundColour(const wxColour& col ) { - // 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()]; + [m_macWindow setBackgroundColor:col.OSXGetNSColor()]; return true; } diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index 3f46bca9e2..d43a4eba65 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -254,6 +254,13 @@ wxPoint wxNonOwnedWindow::GetClientAreaOrigin() const 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 ) return false ;