[Git][wxwidgets/wxwidgets][master] 3 commits: Tweak wxSYS_COLOUR_INFOBK value in dark mode under Windows 11

1 view
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
Apr 30, 2026, 1:22:32 PMApr 30
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch master at wxWidgets / wxWidgets

Commits:

  • dbce2cf0
    by Steve Cornett at 2026-04-30T19:09:26+02:00
    Tweak wxSYS_COLOUR_INFOBK value in dark mode under Windows 11
    
    Use the average of the colours in the dithered background actually used.
    
    See #26412.
    
  • bbdbf45d
    by Václav Slavík at 2026-04-30T19:10:50+02:00
    Don't crash on unexpected CTFontDescription content
    
    Don't crash in wxNativeFontInfo::InitFromDescriptor() in wxOSX when the
    provided descriptor doesn't contain kCTFontTraitsAttribute.
    
    This can happen e.g. when the descriptor was deserialized from a plist
    dictionary and the corresponding font is not present on the system.
    
    Closes #26411.
    
  • 52f9219b
    by Vadim Zeitlin at 2026-04-30T19:14:08+02:00
    Improve wxFont::SetNativeFontInfo() documentation
    
    Explain that it returns true even if the font was not matched exactly.
    
    See #26411.
    

3 changed files:

Changes:

  • interface/wx/font.h
    ... ... @@ -1054,11 +1054,18 @@ public:
    1054 1054
             Creates the font corresponding to the given native font description string
    
    1055 1055
             which must have been previously returned by GetNativeFontInfoDesc().
    
    1056 1056
     
    
    1057
    -        If the string is invalid, font is unchanged.
    
    1057
    +        If the string is syntactically invalid, the functions returns @false
    
    1058
    +        and the font is unchanged. Otherwise the function returns @true even if
    
    1059
    +        the created font doesn't exactly match the description (e.g. because
    
    1060
    +        some of the attributes in it are not supported or the font name is not
    
    1061
    +        available on the end-user's system and so a closest match is created
    
    1062
    +        instead).
    
    1063
    +
    
    1058 1064
             This function is typically used for de-serializing a wxFont object
    
    1059 1065
             previously saved in a string-form.
    
    1060 1066
     
    
    1061
    -        @return @true if the creation was successful.
    
    1067
    +        @return @true if the font was initialized from the given string, @false
    
    1068
    +            if the string was invalid and the font was not changed.
    
    1062 1069
     
    
    1063 1070
             @see SetNativeFontInfoUserDesc()
    
    1064 1071
         */
    
    ... ... @@ -1423,7 +1430,7 @@ wxFontList* wxTheFontList;
    1423 1430
         Converts string to a wxFont best represented by the given string. Returns
    
    1424 1431
         @true on success.
    
    1425 1432
     
    
    1426
    -    @see wxToString(const wxFont&)
    
    1433
    +    @see wxToString(const wxFont&), wxFont::SetNativeFontInfo()
    
    1427 1434
     
    
    1428 1435
         @header{wx/font.h}
    
    1429 1436
     */
    
    ... ... @@ -1432,7 +1439,7 @@ bool wxFromString(const wxString& string, wxFont* font);
    1432 1439
     /**
    
    1433 1440
         Converts the given wxFont into a string.
    
    1434 1441
     
    
    1435
    -    @see wxFromString(const wxString&, wxFont*)
    
    1442
    +    @see wxFromString(const wxString&, wxFont*), wxFont::GetNativeFontInfoDesc()
    
    1436 1443
     
    
    1437 1444
         @header{wx/font.h}
    
    1438 1445
     */
    

  • src/msw/darkmode.cpp
    ... ... @@ -321,7 +321,7 @@ wxColour wxDarkModeSettings::GetColour(wxSystemColour index)
    321 321
                 return wxColour(isWindows10 ? 0x202020 : 0x191919);
    
    322 322
     
    
    323 323
             case wxSYS_COLOUR_INFOBK:
    
    324
    -            return wxColour(isWindows10 ? 0x2b2b2b : 0x2a2a2a);
    
    324
    +            return wxColour(isWindows10 ? 0x2b2b2b : 0x2e2e2e);
    
    325 325
     
    
    326 326
             case wxSYS_COLOUR_BTNTEXT:
    
    327 327
             case wxSYS_COLOUR_CAPTIONTEXT:
    

  • src/osx/carbon/font.cpp
    ... ... @@ -887,9 +887,10 @@ void wxNativeFontInfo::InitFromFontDescriptor(CTFontDescriptorRef desc)
    887 887
     
    
    888 888
         // determine approximate family
    
    889 889
     
    
    890
    -    CTFontSymbolicTraits symbolicTraits;
    
    890
    +    CTFontSymbolicTraits symbolicTraits = 0;
    
    891 891
         wxCFDictionaryRef traits((CFDictionaryRef)CTFontDescriptorCopyAttribute(desc, kCTFontTraitsAttribute));
    
    892
    -    traits.GetValue(kCTFontSymbolicTrait).GetValue((int32_t*)&symbolicTraits, 0);
    
    892
    +    if (traits)
    
    893
    +        traits.GetValue(kCTFontSymbolicTrait).GetValue((int32_t*)&symbolicTraits, 0);
    
    893 894
     
    
    894 895
         if (symbolicTraits & kCTFontMonoSpaceTrait)
    
    895 896
             m_family = wxFONTFAMILY_TELETYPE;
    
    ... ... @@ -1026,6 +1027,8 @@ CGFloat wxNativeFontInfo::GetCTWeight(CTFontDescriptorRef descr)
    1026 1027
     {
    
    1027 1028
         CGFloat weight;
    
    1028 1029
         CFTypeRef fonttraitstype = CTFontDescriptorCopyAttribute(descr, kCTFontTraitsAttribute);
    
    1030
    +    if (!fonttraitstype)
    
    1031
    +        return CGFloat(0.0);
    
    1029 1032
         wxCFDictionaryRef traits((CFDictionaryRef)fonttraitstype);
    
    1030 1033
         traits.GetValue(kCTFontWeightTrait).GetValue(&weight, CGFloat(0.0));
    
    1031 1034
         return weight;
    
    ... ... @@ -1035,6 +1038,8 @@ CGFloat wxNativeFontInfo::GetCTwidth(CTFontDescriptorRef descr)
    1035 1038
     {
    
    1036 1039
         CGFloat weight;
    
    1037 1040
         CFTypeRef fonttraitstype = CTFontDescriptorCopyAttribute(descr, kCTFontTraitsAttribute);
    
    1041
    +    if (!fonttraitstype)
    
    1042
    +        return CGFloat(0.0);
    
    1038 1043
         wxCFDictionaryRef traits((CFDictionaryRef)fonttraitstype);
    
    1039 1044
         traits.GetValue(kCTFontWidthTrait).GetValue(&weight, CGFloat(0.0));
    
    1040 1045
         return weight;
    
    ... ... @@ -1044,6 +1049,8 @@ CGFloat wxNativeFontInfo::GetCTSlant(CTFontDescriptorRef descr)
    1044 1049
     {
    
    1045 1050
         CGFloat slant;
    
    1046 1051
         CFTypeRef fonttraitstype = CTFontDescriptorCopyAttribute(descr, kCTFontTraitsAttribute);
    
    1052
    +    if (!fonttraitstype)
    
    1053
    +        return CGFloat(0.0);
    
    1047 1054
         wxCFDictionaryRef traits((CFDictionaryRef)fonttraitstype);
    
    1048 1055
         traits.GetValue(kCTFontSlantTrait).GetValue(&slant, CGFloat(0.0));
    
    1049 1056
         return slant;
    

Reply all
Reply to author
Forward
0 new messages