Make default background color transparent in wxOSX

This is needed for translucency effects, desktop background images
changing the toplevel window background tint.

Also don't erase background when no background color is specified.

Closes #26301.
This commit is contained in:
Stefan Csomor
2026-07-07 20:39:53 +02:00
committed by Vadim Zeitlin
parent 68cef639a5
commit 565553ee98
2 changed files with 21 additions and 1 deletions
+8
View File
@@ -133,6 +133,14 @@ public:
#endif
virtual wxVisualAttributes GetDefaultAttributes() const override
{
return GetClassDefaultAttributes(GetWindowVariant());
}
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
// implementation from now on
// --------------------------
+13 -1
View File
@@ -1538,6 +1538,17 @@ wxWindowMac::AlwaysShowScrollbars(bool hflag, bool vflag)
DoUpdateScrollbarVisibility();
}
/* static */ wxVisualAttributes
wxWindowMac::GetClassDefaultAttributes(wxWindowVariant variant)
{
// it is important to return valid values for all attributes from here,
// GetXXX() below rely on this
wxVisualAttributes attrs = wxWindowBase::GetClassDefaultAttributes(variant);
attrs.colBg = wxTransparentColour;
return attrs;
}
//
// we draw borders and grow boxes, are already set up and clipped in the current port / cgContextRef
// our own window origin is at leftOrigin/rightOrigin
@@ -2002,9 +2013,10 @@ bool wxWindowMac::MacDoRedraw( long time )
eevent.SetEventObject( this );
if ( ProcessWindowEvent( eevent ) )
break;
#ifdef __WXOSX_IPHONE__
if (!UseBgCol())
dc.Clear();
#endif
}
if ( UseBgCol() )