[Git][wxwidgets/wxwidgets][master] Make default background color transparent in wxOSX

2 views
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
Jul 7, 2026, 3:06:55 PM (14 days ago) Jul 7
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch master at wxWidgets / wxWidgets

Commits:

  • 565553ee
    by Stefan Csomor at 2026-07-07T20:39:53+02:00
    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.
    

2 changed files:

Changes:

  • include/wx/osx/window.h
    ... ... @@ -133,6 +133,14 @@ public:
    133 133
     
    
    134 134
     #endif
    
    135 135
     
    
    136
    +    virtual wxVisualAttributes GetDefaultAttributes() const override
    
    137
    +    {
    
    138
    +        return GetClassDefaultAttributes(GetWindowVariant());
    
    139
    +    }
    
    140
    +
    
    141
    +    static wxVisualAttributes
    
    142
    +    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
    
    143
    +
    
    136 144
         // implementation from now on
    
    137 145
         // --------------------------
    
    138 146
     
    

  • src/osx/window_osx.cpp
    ... ... @@ -1538,6 +1538,17 @@ wxWindowMac::AlwaysShowScrollbars(bool hflag, bool vflag)
    1538 1538
             DoUpdateScrollbarVisibility();
    
    1539 1539
     }
    
    1540 1540
     
    
    1541
    +/* static */ wxVisualAttributes
    
    1542
    +wxWindowMac::GetClassDefaultAttributes(wxWindowVariant variant)
    
    1543
    +{
    
    1544
    +    // it is important to return valid values for all attributes from here,
    
    1545
    +    // GetXXX() below rely on this
    
    1546
    +    wxVisualAttributes attrs = wxWindowBase::GetClassDefaultAttributes(variant);
    
    1547
    +    attrs.colBg = wxTransparentColour;
    
    1548
    +
    
    1549
    +    return attrs;
    
    1550
    +}
    
    1551
    +
    
    1541 1552
     //
    
    1542 1553
     // we draw borders and grow boxes, are already set up and clipped in the current port / cgContextRef
    
    1543 1554
     // our own window origin is at leftOrigin/rightOrigin
    
    ... ... @@ -2002,9 +2013,10 @@ bool wxWindowMac::MacDoRedraw( long time )
    2002 2013
                         eevent.SetEventObject( this );
    
    2003 2014
                         if ( ProcessWindowEvent( eevent ) )
    
    2004 2015
                             break;
    
    2005
    -
    
    2016
    +#ifdef __WXOSX_IPHONE__
    
    2006 2017
                         if (!UseBgCol())
    
    2007 2018
                             dc.Clear();
    
    2019
    +#endif
    
    2008 2020
                     }
    
    2009 2021
     
    
    2010 2022
                     if ( UseBgCol() )
    


View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help Notification message regarding https://gitlab.com/wxwidgets/wxwidgets/-/commit/565553ee980e925bbd8b3cdaeea0eb9f453d7dfd at 1783451212

Reply all
Reply to author
Forward
0 new messages