[wxMac] wxButton background on non-default background colour

23 views
Skip to first unread message

KT

unread,
Apr 4, 2026, 9:05:16 PM (5 days ago) Apr 4
to wx-dev
I'm not sure when this happened, but I'm pretty sure it hasn't always been the case:

Creating a standard wxButton on a non-default background colour leaves rectangular artifacts around the rounded button corners, as if it's expecting to be drawn against a different colour.

This is easily reproducible with samples/widgets, by adding to button.cpp:

void ButtonWidgetsPage::CreateContent()
{
SetBackgroundColour(wxColour(40, 40, 40));  // add this line
    wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);

When running on macOS in light mode (where the default dialog background is light) this creates a darker background for the button test. This is what the button looks like:

Screenshot 2026-04-04 at 6.06.26 PM.png

I can't figure out how to make the corners use the background colour, or be transparent.

I've looked back and seen some changes to both button.mm (d6d9b70...) and renderer.mm (58f8171...) that looked promising, but neither of those seems to be behind it, in testing.

I haven't yet bisected back to find when it broke (although I'm pretty sure it did): I have some custom patches that make rolling wx back beyond a certain point a little trickier. But I'll do that at some point.

Just wondering if this jumps out at anyone in a "Ah! I know what that is!" sort of way.

KT

Stefan Csomor

unread,
Apr 5, 2026, 8:07:05 AM (5 days ago) Apr 5
to wx-...@googlegroups.com
Hi

>Creating a standard wxButton on a non-default background colour leaves rectangular artifacts around the rounded button corners, as if it's expecting to be drawn against a >different colour.

>This is easily reproducible with samples/widgets, by adding to button.cpp:

>void ButtonWidgetsPage::CreateContent()
>{
>SetBackgroundColour(wxColour(40, 40, 40));  // add this line
>    wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);


>Just wondering if this jumps out at anyone in a "Ah! I know what that is!" sort of way.

Could you please test whether https://github.com/wxWidgets/wxWidgets/pull/26309 gives better results ?

Thanks,

Stefan


KT

unread,
Apr 5, 2026, 3:38:50 PM (5 days ago) Apr 5
to wx-dev
Thanks, Stefan. I just tested those changes and it didn't seem to make any difference.
Reply all
Reply to author
Forward
0 new messages