From 708a408733bbfbca3d79042463f2882c0f40c6de Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 23 Oct 2018 21:12:48 +0200 Subject: [PATCH] move macOS transparency fix one level up --- src/osx/cocoa/nonownedwnd.mm | 7 +------ src/osx/nonownedwnd_osx.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 6 deletions(-) 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 ;