[Git][wxwidgets/wxwidgets][master] Fix dark mode selection in list controls in latest Windows 11

1 view
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
May 31, 2026, 6:23:46 PM (6 days ago) May 31
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch master at wxWidgets / wxWidgets

Commits:

  • 5bd892f7
    by Fefedu973 at 2026-05-31T23:57:49+02:00
    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.
    

3 changed files:

Changes:

  • include/wx/msw/listbox.h
    ... ... @@ -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
    

  • src/msw/choice.cpp
    ... ... @@ -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;
    

  • src/msw/listbox.cpp
    ... ... @@ -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 Notification message regarding https://gitlab.com/wxwidgets/wxwidgets/-/commit/5bd892f7ac21eb007e1ebb0e5e00c492c17580f8 at 1780266223

Reply all
Reply to author
Forward
0 new messages