Fix background of shaped frames under macOS

Don't set it to avoid overriding the "clear background" used for shaped
windows.

Closes #23286.

See #23296.
This commit is contained in:
Stefan Csomor 2023-02-25 13:10:15 +01:00 committed by Vadim Zeitlin
parent 1e98812a56
commit e49b791ca9
2 changed files with 4 additions and 2 deletions

View file

@ -3311,7 +3311,7 @@ void wxWidgetCocoaImpl::SetBackgroundColour( const wxColour &col )
wxWindow* peer = GetWXPeer();
if ( peer->GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT )
{
wxTopLevelWindow* toplevel = wxDynamicCast(peer,wxTopLevelWindow);
wxNonOwnedWindow* toplevel = dynamic_cast<wxNonOwnedWindow*>(peer);
if ( toplevel == nullptr || toplevel->GetShape().IsEmpty() )
[targetView setBackgroundColor:

View file

@ -258,7 +258,9 @@ 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_PAINT && GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT)
// we cannot set the background color on a shaped toplevel window
// otherwise we loose the shape and end up with a rectangular background
if ( GetBackgroundStyle() != wxBG_STYLE_PAINT && GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT && GetShape().IsEmpty() )
{
if ( m_nowpeer )
return m_nowpeer->SetBackgroundColour(c);