From a94325a76abe24a96ca0223f684b0ef3ca939c1f Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 23 Oct 2018 21:01:31 +0200 Subject: [PATCH] fix transparency problems on macOS under mojave any backgroundColor destroys transparency --- src/osx/cocoa/nonownedwnd.mm | 7 ++++++- src/osx/nonownedwnd_osx.cpp | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index b21d2d2e14..64a6b3b74f 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -914,7 +914,12 @@ bool wxNonOwnedWindowCocoaImpl::SetTransparent(wxByte alpha) 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; } diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index d8883120ac..3f46bca9e2 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -152,8 +152,7 @@ bool wxNonOwnedWindow::Create(wxWindow *parent, wxWindowCreateEvent event(this); HandleWindowEvent(event); - if ( GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT ) - SetBackgroundColour(wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE )); + SetBackgroundColour(wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE )); if ( parent ) parent->AddChild(this);