Fix dark mode selection in list controls in latest Windows 11 This limits the dark-mode theme applied to native list HWNDs to the ScrollBar class instead of applying a full list/control theme which made the text of the selected items unreadable in Windows 26300.8553 (Windows 11 Insider). The main combobox control still keeps the existing CFD theme, preserving the dark drop button/trigger. The popup list HWND for wxChoice and wxComboBox and standalone wxListBox now use Explorer with the ScrollBar sub-id so scrollbars remain dark without applying the list item theme that makes selected rows unreadable. Fixes #26535. Closes #26538.
| ... | ... | @@ -134,6 +134,7 @@ public: |
| 134 | 134 | // Windows callbacks
|
| 135 | 135 | bool MSWCommand(WXUINT param, WXWORD id) override;
|
| 136 | 136 | WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
|
| 137 | + bool MSWGetDarkModeSupport(MSWDarkModeSupport& support) const override;
|
|
| 137 | 138 | |
| 138 | 139 | // under XP when using "transition effect for menus and tooltips" if we
|
| 139 | 140 | // return true for WM_PRINTCLIENT here then it causes noticeable slowdown
|
| ... | ... | @@ -223,7 +223,7 @@ bool wxChoice::MSWGetDarkModeSupport(MSWDarkModeSupport& support) const |
| 223 | 223 | WinStruct<COMBOBOXINFO> info;
|
| 224 | 224 | if ( ::GetComboBoxInfo(GetHwnd(), &info) && info.hwndList )
|
| 225 | 225 | {
|
| 226 | - wxMSWDarkMode::AllowForWindow(info.hwndList);
|
|
| 226 | + wxMSWDarkMode::AllowForWindow(info.hwndList, L"Explorer", L"ScrollBar");
|
|
| 227 | 227 | }
|
| 228 | 228 | |
| 229 | 229 | return true;
|
| ... | ... | @@ -173,6 +173,14 @@ WXDWORD wxListBox::MSWGetStyle(long style, WXDWORD *exstyle) const |
| 173 | 173 | return msStyle;
|
| 174 | 174 | }
|
| 175 | 175 | |
| 176 | +bool wxListBox::MSWGetDarkModeSupport(MSWDarkModeSupport& support) const
|
|
| 177 | +{
|
|
| 178 | + support.themeName = L"Explorer";
|
|
| 179 | + support.themeId = L"ScrollBar";
|
|
| 180 | + |
|
| 181 | + return true;
|
|
| 182 | +}
|
|
| 183 | + |
|
| 176 | 184 | void wxListBox::MSWUpdateFontOnDPIChange(const wxSize& newDPI)
|
| 177 | 185 | {
|
| 178 | 186 | wxListBoxBase::MSWUpdateFontOnDPIChange(newDPI);
|
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help