Fix background colour of combo boxes in wxMSW dark mode This was recently broken by 3ada94efeb (Also use control background in wxMSW dark mode, 2025-07-05), resulting in white background being used for wxChoice and wxComboBox as they incorrectly returned white as their background colour. Fix this by returning the correct colour in dark mode from wxChoice::GetClassDefaultAttributes() which is used as the fallback if background colour is not explicitly specified. See #25600. Closes #25619.
... | ... | @@ -195,11 +195,19 @@ wxChoice::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) |
195 | 195 | // API: TMT_TEXTCOLOR doesn't work either for EDIT nor COMBOBOX
|
196 | 196 | attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
|
197 | 197 | |
198 | - // NB: use EDIT, not COMBOBOX (the latter works in XP but not Vista)
|
|
199 | - wxUxThemeHandle hTheme(wnd, L"EDIT");
|
|
200 | - attrs.colBg = hTheme.GetColour(EP_EDITTEXT, TMT_FILLCOLOR, ETS_NORMAL);
|
|
201 | - if ( !attrs.colBg.IsOk() )
|
|
202 | - attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
|
198 | + if ( wxMSWDarkMode::IsActive() )
|
|
199 | + {
|
|
200 | + // Theme colour would be light, so don't use it.
|
|
201 | + attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
|
|
202 | + }
|
|
203 | + else
|
|
204 | + {
|
|
205 | + // NB: use EDIT, not COMBOBOX (the latter works in XP but not Vista)
|
|
206 | + wxUxThemeHandle hTheme(wnd, L"EDIT");
|
|
207 | + attrs.colBg = hTheme.GetColour(EP_EDITTEXT, TMT_FILLCOLOR, ETS_NORMAL);
|
|
208 | + if ( !attrs.colBg.IsOk() )
|
|
209 | + attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
|
210 | + }
|
|
203 | 211 | |
204 | 212 | return attrs;
|
205 | 213 | }
|
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help